Network
netstat
-p show pid
-t tcp
-u udp
-l listening
-i show network interface packet transactions
-r show kernel ip routing
-g show group membership information of IPV4 and IPV6
-a all
common usage
ss - socket statistics
ss is almost same as netstat but fater and has some specific usage
-n, --numeric don't resolve service names
ss -s #summary statistics
ss -antp src :80
ss -altp dst :80
ss -nt -o
ss -t4 state established
fuser
fuser 8080/tcp
fuser -k 8080/tcp
lsof
lsof -i:8080
kill -9 $(lsof -i:8080)
parameters
-t - show only process ID
-i - show only internet connections related process
nmap
parameter
nmap -sP IP ping only
nmap -sS 192.168.1.1 TCP SYN scan
nmap -sU 192.168.1.1 UDP scan
namp -sO 192.168.1.1 protocol scan
namp -p 1024-2048 192.168.1.1 port range scan
namp -p 80,25,443,110 192.168.1.1 port scan
tcpdump
parameters
-XX
: Same as-X
, but also shows the ethernet header.-D
: Show the list of available interfaces-l
: Line-readable output (for viewing as you save, or sending to other commands)-q
: Be less verbose (more quiet) with your output.-t
: Give human-readable timestamp output.-tttt
: Give maximally human-readable timestamp output.-i eth0
: Listen on the eth0 interface.-vv
: Verbose output (more v’s gives more output).-c
: Only get x number of packets and then stop.-s
: Define the snaplength (size) of the capture in bytes. Use-s0
to get everything, unless you are intentionally capturing less.-S
: Print absolute sequence numbers.-e
: Get the ethernet header as well.-q
: Show less protocol information.-E
: Decrypt IPSEC traffic by providing an encryption key.
examples:
tcpdump 'src 10.0.2.4 and (dst port 3389 or 22)'
tcpdump dst 192.168.0.2 and src net and not icmp
tcpdump net 1.2.3.0/24
tcpdump -c 1 -X icmp
tcpdump -nnvvS src 10.5.2.3 and dst port 3389
write to one PCAP file
tcpdump port 80 -w capture_file
Last updated
Was this helpful?