-
Notifications
You must be signed in to change notification settings - Fork 0
/
.better_ifconfig
42 lines (38 loc) · 2.28 KB
/
.better_ifconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# ---------------------------------------------------------------------------
# Description: This file holds human readible networking utils.
# Motivation: Linux cmds <ifconfig> | ps aux | ipconfig | ipfw are confusing.
# ---------------------------------------------------------------------------
alias myip4='curl ifconfig.me' # myip4: Public facing IPV4 Addr
alias myip6='curl ifconfig.co' # myip6: Public facing IPV6 Addr
alias netCons='lsof -i' # netCons: Show all open TCP/IP sockets
alias flushDNS='dscacheutil -flushcache' # flushDNS: Flush out the DNS Cache
alias lsock='sudo /usr/sbin/lsof -i -P' # lsock: Display open sockets
alias lsockU='sudo /usr/sbin/lsof -nP | grep UDP' # lsockU: Display only open UDP sockets
alias lsockT='sudo /usr/sbin/lsof -nP | grep TCP' # lsockT: Display only open TCP sockets
alias ipInfo0='ipconfig getpacket en0' # ipInfo0: Get info on connections for en0
alias ipInfo1='ipconfig getpacket en1' # ipInfo1: Get info on connections for en1
alias openPorts='sudo lsof -i | grep LISTEN' # openPorts: All listening connections
alias showBlocked='sudo ipfw list' # showBlocked: All ipfw rules inc/ blocked IP
alias en0ipv6='ifconfig en0 | grep inet6 | awk -F " " '{print $2}' | sed 's/%en0//''
# ii: display useful host related informaton
# -------------------------------------------------------------------
ii() {
echo -e "\nYou are logged on ${red}$HOST"
echo -e "\nAdditionnal information:$nc] " ; uname -a
echo -e "\n${cyn}Users logged on:$nc " ; w -h
echo -e "\n${grn}Current date :$nc " ; date
echo -e "\n${grn}Machine stats :$nc " ; uptime
echo -e "\n${blu}Current network location :$nc " ; scselect
echo -e "\n${mag}Public facing IPV4 Address :$nc \c " ; myip4
echo -e "\n${mag}Public facing IPV6 Address :$nc \c " ; myip6
echo -e "\n${nc}"
}
export -f ii
# ip: display IPv4 and IPv6 public addresses
#-------------------------------------------------------------------
ip() {
echo -e "\n${mag}Public facing IPV4 Address :$nc \c " ; myip4
echo -e "\n${mag}Public facing IPV6 Address :$nc \c " ; myip6
echo -e "\n${nc}"
}
export -f ip