xe1phix

Xe1phix-[TCPDump]-Cheatsheet-[v5.7.92].sh

Sep 21st, 2022 (edited)
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 24.67 KB | None | 0 0
  1. #!/bin/sh
  2. ##-=============================================-##
  3. ##   [+] Create An Alias For HTTP GET Traffic:
  4. ##-=============================================-##
  5. alias httpdump="tcpdump -i eth0 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
  6.  
  7.  
  8. ##-========================================-##
  9. ##   [+] TCPDUMP all the data on port $1
  10. ##       into rotated files /tmp/results
  11. ##-========================================-##
  12. tcpdump -i any -s0 tcp port "$1" -A -w /tmp/$File -C 100
  13.  
  14.  
  15. ##-==========================-##
  16. ##  [+] Display a pcap file:
  17. ##-==========================-##
  18. tcpdump -r $File.pcap
  19.  
  20.  
  21. ##-=========================================-##
  22. ##   [+] Display ips and filter and sort:
  23. ##-=========================================-##
  24. tcpdump -n -r $File.pcap | awk -F" " '{print $3}' | sort -u | head
  25.  
  26.  
  27. ##-=========================================-##
  28. ##   [+] Grab a packet capture on port 80:
  29. ##-=========================================-##
  30. tcpdump tcp port 80 -w $File.pcap -i eth0
  31.  
  32.  
  33. ##-=====================================================-##
  34. ##   [+] Check for ACK or PSH flag set in a TCP packet:
  35. ##-=====================================================-##
  36. tcpdump -A -n 'tcp[13] = 24' -r $File.pcap
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. ##-=================================-##
  44. ##                  [?] TCP Connections
  45. ##-=================================-##
  46. ##
  47. ## ---------------------------------------------------------- ##
  48. ##              SYN -> SYN/ACK -> ACK
  49. ## ---------------------------------------------------------- ##
  50. ##      DATA -> DATA/ACK -> ACK -> ACK
  51. ## ---------------------------------------------------------- ##
  52. ##              FIN -> FIN/ACK -> ACK
  53. ## ---------------------------------------------------------- ##
  54.    
  55.  
  56.  
  57. ##-=====================-##
  58. ##   [+] Monitor TCP traffic:
  59. ##-=====================-##
  60. tcpdump -n -tttt -i eth0 tcp
  61.  
  62.  
  63. ##-=====================-##
  64. ##   [+] Monitor ftp traffic:
  65. ##-=====================-##
  66. tcpdump -A port ftp -v
  67.  
  68.  
  69. ##-============================================-##
  70. ##    [+] Save to pcap file and display data on screen:
  71. ##-============================================-##
  72. tcpdump -n -w - port 8080 |tee $File.pcap |tcpdump -A -r -
  73.  
  74.  
  75.  
  76. ##-=============================-##
  77. ##   [+] Capture Packets on Port 80:
  78. ##-=============================-##
  79. tcpdump -A -s0 port 80
  80.  
  81.  
  82. ##-======================-##
  83. ##   [+] Filter on UDP traffic:
  84. ##-======================-##
  85. tcpdump -i eth0 udp
  86. tcpdump -i eth0 proto 17
  87.  
  88.  
  89. ##-===================================-##
  90. ##  [+] Capture Hosts based on IP address:
  91. ##-===================================-##
  92. tcpdump -i eth0 host 10.10.1.1
  93.  
  94.  
  95. ##-=================================================-##
  96. ##  [+] Capture only packets going one way using src or dst:
  97. ##-=================================================-##
  98. tcpdump -i eth0 dst 10.10.1.20
  99.  
  100.  
  101. ##-=======================-##
  102. ##    [+] Write a capture file:
  103. ##-=======================-##
  104. tcpdump -i eth0 -s0 -w $File.pcap
  105.  
  106.  
  107. ##-======================-##
  108. ##    [+] Line Buffered Mode
  109. ##-======================-##
  110. ## ----------------------------------------------------------- ##
  111. ##  [?] buffered (or packet buffered -C) mode
  112. ## ----------------------------------------------------------- ##
  113. tcpdump -i eth0 -s0 -l port 80 | grep 'Server:'
  114.  
  115.  
  116. ##-=================================================-##
  117. ##   [+] Extract HTTP User Agent from HTTP request header:
  118. ##-=================================================-##
  119. tcpdump -nn -A -s1500 -l | grep "User-Agent:"
  120.  
  121.  
  122. ##-==========================================-##
  123. ##   [+]  Extract User Agent + Header From Packets:
  124. ##-==========================================-##
  125. ## ---------------------------------------------------------------------------------------------- ##
  126. ##   [?] use egrep and multiple matches we can get the User Agent
  127. ##        and the Host (or any other header) from the request.
  128. ## ---------------------------------------------------------------------------------------------- ##
  129. tcpdump -nn -A -s1500 -l | egrep -i 'User-Agent:|Host:'
  130.  
  131.  
  132. ##-==========================================-##
  133. ##    [+] Capture only HTTP GET and POST packets:
  134. ##-==========================================-##
  135. tcpdump -s 0 -A -vv 'tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420'
  136.  
  137.  
  138. ##-================================-##
  139. ##  [+] Select Only on POST Requests:
  140. ##-================================-##
  141. ## ----------------------------------------------------------------------------------------------------------- ##
  142. ##  [?] Match the hexadecimal GET and POST ascii Fingerprints in Packets
  143. ## ----------------------------------------------------------------------------------------------------------- ##
  144. tcpdump -s 0 -A -vv 'tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x504f5354'
  145.  
  146.  
  147. ##-==============================-##
  148. ##    [+] Extract HTTP Request URLs:
  149. ##-==============================-##
  150. ## ------------------------------------------------------------------------------------ ##
  151. ##    [?] Parse Host and HTTP Request location from traffic
  152. ## ------------------------------------------------------------------------------------ ##
  153. tcpdump -s 0 -v -n -l | egrep -i "POST /|GET /|Host:"
  154.  
  155.  
  156.  
  157. ##-==========================================-##
  158. ##  [+] Extract HTTP Passwords in POST Requests:
  159. ##-==========================================-##
  160. tcpdump -s 0 -A -n -l | egrep -i "POST /|pwd=|passwd=|password=|Host:"
  161.  
  162.  
  163. ##-===========================================-##
  164. ##  [+] Capture Cookies from Server and from Client:
  165. ##-===========================================-##
  166. tcpdump -nn -A -s0 -l | egrep -i 'Set-Cookie|Host:|Cookie:'
  167.  
  168.  
  169. ##-===========================-##
  170. ##  [+] Capture all ICMP packets:
  171. ##-===========================-##
  172. tcpdump -n icmp
  173.  
  174.  
  175. ##-=================================================================-##
  176. ##  [+] Show ICMP Packets that are not ECHO/REPLY (standard ping):
  177. ##-=================================================================-##
  178. tcpdump 'icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply'
  179.  
  180.  
  181. ##-==============================-##
  182. ##    [+] Capture SMTP / POP3 Email
  183. ##-==============================-##
  184. ## ----------------------------------------------------- ##
  185. ##    [?] Parse the email recipients
  186. ## ----------------------------------------------------- ##
  187. tcpdump -nn -l port 25 | grep -i 'MAIL FROM\|RCPT TO'
  188.  
  189.  
  190. ##-===================-##
  191. ##    [+] SMTP Analysis
  192. ##-===================-##
  193. tcpdump -l -s0 -w - tcp dst port 25 | strings | grep -i 'MAIL FROM\|RCPT TO'
  194.  
  195.  
  196. ##-===================================-##
  197. ##    [+] Extract NTP Query and Response
  198. ##-===================================-##
  199. tcpdump dst port 123
  200.  
  201.  
  202. ##-=====================================-##
  203. ##    [+] Capture SNMP Query and Response
  204. ##-=====================================-##
  205. tcpdump -n -s0  port 161 and udp
  206.  
  207.  
  208. ##-========================================-##
  209. ##    [+] Capture FTP Credentials and Commands
  210. ##-========================================-##
  211. ## ______________________________________________
  212. ## --------------------------------------------------------------------------- ##
  213. ##  [?] Capture FTP Connections (TCP port 20)
  214. ## --------------------------------------------------------------------------- ##
  215. ##  [?] FTP Commands: LIST, CWD and PASSIVE
  216. ## --------------------------------------------------------------------------- ##
  217. ## ______________________________________________
  218. ## --------------------------------------------------------------------------- ##
  219. ##  [?] After the authentication is established
  220. ##      an FTP session can be active or passive
  221. ## --------------------------------------------------------------------------- ##
  222. tcpdump -nn -v port ftp or ftp-data
  223.  
  224.  
  225. ##-=======================-##
  226. ##  [+] Rotate Capture Files:
  227. ##-=======================-##
  228. ## --------------------------------------------------------------------------------- ##
  229. ##  [?] The file capture-(hour).pcap
  230. ##        will be created every (-G) 3600 seconds (1 hour).
  231. ##        The files will be overwritten the following day.
  232. ##        So you should end up with capture-{1-24}.pcap
  233. ## --------------------------------------------------------------------------------- ##
  234. tcpdump  -w /tmp/$File-%H.pcap -G 3600 -C 200
  235.  
  236.  
  237. ##-======================================-##
  238. ##  [+] Capture IPv6 traffic using the ip6 filter:
  239. ##-======================================-##
  240. tcpdump -nn ip6 proto 6
  241.  
  242.  
  243. ##-======================================================-##
  244. ##  [+] Read IPv6 UDP Traffic from a previously saved capture file:
  245. ##-======================================================-##
  246. tcpdump -nr $File.pcap ip6 proto 17
  247.  
  248.  
  249. ##-=========================================-##
  250. ##  [+] Test Network For Someone Running Nmap:
  251. ##-=========================================-##
  252. ## --------------------------------------------------------------- ##
  253. ##    [?] Detect Port Scan in Network Traffic
  254. ## --------------------------------------------------------------- ##
  255. tcpdump -nn port 80 | grep "GET /"
  256.  
  257.  
  258. ##-===================================================-##
  259. ##  [+] Capture Start and End Packets of every non-local host
  260. ##-===================================================-##
  261. ## ------------------------------------------------------------------------------------------------ ##
  262. ##    [?] Show each established TCP conversation with timestamps
  263. ## ------------------------------------------------------------------------------------------------ ##
  264. tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net localnet'
  265.  
  266.  
  267. ##-=================================================-##
  268. ##  [+] Capture DNS Request and Response Packets:
  269. ##-=================================================-##
  270. ## -------------------------------------------------------------------------------------- ##
  271. ##  [?] Outbound DNS request to Google public DNS
  272. ##        and the A record (ip address) response
  273. ## -------------------------------------------------------------------------------------- ##
  274. tcpdump -i eth0 -s0 port 53
  275.  
  276.  
  277. ##-=============================-##
  278. ##  [+] Capture HTTP data packets:
  279. ##-=============================-##
  280. ## -------------------------------------------------------------------------------------------- ##
  281. ##  [?] Only capture on HTTP data packets on port 80.
  282. ## -------------------------------------------------------------------------------------------- ##
  283. ##  [?] Avoid capturing the TCP session setup (SYN / FIN / ACK)
  284. ## -------------------------------------------------------------------------------------------- ##
  285. tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
  286.  
  287.  
  288. ##-============================================-##
  289. ##    [+] Capture with tcpdump and view in Wireshark
  290. ##-============================================-##
  291. 'tcpdump -s0 -c 1000 -nn -w - not port 22' | wireshark -k -i -
  292.  
  293.  
  294. ##-================================-##
  295. ##    [+] Capture Top Hosts by Packets
  296. ##-================================-##
  297. ## -------------------------------------------------------- ##
  298. ##   [?] List the top number of packets
  299. ##   [?] Extract the IP address
  300. ##   [?] Sort and count the occurrances
  301. ## -------------------------------------------------------- ##
  302. tcpdump -nnn -t -c 200 | cut -f 1,2,3,4 -d '.' | sort | uniq -c | sort -nr | head -n 20
  303.  
  304.  
  305. ##-===================================-##
  306. ##  [+] Capture all the plaintext passwords
  307. ##-===================================-##
  308. ## -------------------------------------------------------------------------------------- ##
  309. ##     [?] capture passwords (hostname, ip address, system)
  310. ## -------------------------------------------------------------------------------------- ##
  311. tcpdump port http or port ftp or port smtp or port imap or port pop3 or port telnet -l -A | egrep -i -B5 'pass=|pwd=|log=|login=|user=|username=|pw=|passw=|passwd=|password=|pass:|user:|username:|password:|login:|pass |user '
  312.  
  313.  
  314. ##-====================================-##
  315. ##    [+] Capture DHCP Request And Replies:
  316. ##-====================================-##
  317. ## ----------------------------------------------------------------------------------------------- ##
  318. ##     [?] DHCP requests are seen on port 67 and the reply is on 68.
  319. ## ----------------------------------------------------------------------------------------------- ##
  320. tcpdump -v -n port 67 or 68
  321. tcpdump -i eth0 udp port 67 or port 68 -vvv
  322.  
  323.  
  324. ## -------------------------------------------------------------------------------- ##
  325. ##     [?] DHCPv6 uses UDP port number 546 for clients
  326. ##     [?] and port number 547 for servers.
  327. ## -------------------------------------------------------------------------------- ##
  328. tcpdump -i eth0 -n -vv '(udp port 546 or port 547)'
  329.  
  330.  
  331. ##-====================================-##
  332. ##    [+]  record the capture data to a file.
  333. ##-====================================-##
  334. tcpdump -i eth0 udp port 53 -w $File.pcap
  335.  
  336.  
  337.  
  338. ##-================================-##
  339. ##    [+] read the results of the capture
  340. ##-================================-##
  341. tcpdump -n -t -r $File.pcap port 53
  342.  
  343.  
  344.  
  345.  
  346. tcpdump -i any -s0 -w $File.pcap
  347. tcpdump -i eth0 -w $File -n -U -s 0 src not 192.168.1.X and dst not 192.168.1.X
  348. tcpdump -vv -i eth0 src not 192.168.1.X and dst not 192.168.1.X
  349.  
  350.  
  351.  
  352.  
  353. ##-===========================-##
  354. ##     [+] Cleartext GET Requests
  355. ##-===========================-##
  356. tcpdump -vvAls0 | grep 'GET'
  357. tcpdump -i wlan0 -vvv -A | grep "GET"
  358.  
  359. ##-===========================-##
  360. ##     [+] Find HTTP Host Headers
  361. ##-===========================-##
  362. tcpdump -vvAls0 | grep 'Host:'
  363.  
  364.  
  365. ##-=======================-##
  366. ##     [+] Find HTTP Cookies
  367. ##-=======================-##
  368. tcpdump -vvAls0 | grep 'Set-Cookie|Host:|Cookie:'
  369.  
  370.  
  371.  
  372.  
  373. ##-=======================================-##
  374. ##     [+] grep all GET from the wlan0 interface
  375. ##     [+] Do not get any SSL-encrypted traffic
  376. ##-=======================================-##
  377. tcpdump -i wlan0 src port 80 or dst port 80 -w $File.pcap
  378. tcpdump -i eth0 src port 80 or dst port 80 -w $File.pcap
  379.  
  380.  
  381. ##-==========================-##
  382. ##    [+] Find SSH Connections
  383. ##-==========================-##
  384. tcpdump 'tcp[(tcp[12]>>2):4] = 0x5353482D'
  385.  
  386.  
  387. ##-=====================-##
  388. ##    [+] Find DNS Traffic
  389. ##-=====================-##
  390. tcpdump -vvAs0 port 53
  391.  
  392.  
  393. ##-=========================================-##
  394. ##    [+] show only the successful SYN responses
  395. ##-=========================================-##
  396. tcpdump -nn -r $File 'src $IP and tcp[tcpflags] & tcp-syn != 0'
  397.  
  398.  
  399. ##-=========================================-##
  400. ##    [+] See which ICMP packets we received back
  401. ##    [?] Saying the port was unreachable:
  402. ##-=========================================-##
  403. tcpdump -nn -Q in -r $File "icmp" |  awk '{print $10,$11}' | grep unreachable | awk '{print $1}' | sort -u
  404.  
  405.  
  406.  
  407. ##-=============================================-##
  408. ##     [+] Print the traffic in hex with ascii interpretation
  409. ##-=============================================-##
  410. tcpdump -nX -r $File.pcap
  411.  
  412.  
  413. ##-==========================-##
  414. ##     [+] Only record tcp-traffic
  415. ##-==========================-##
  416. tcpdump tcp -w $File.pcap
  417.  
  418.  
  419. ##-===============================-##
  420. ##     [+] Dump Packets By Domain
  421. ##-===============================-##
  422. tcpdump -i eth0 -nt -s 500 port domain
  423.  
  424.  
  425. ##-======================================-##
  426. ##  [+] Filter By Domain Using Regex:
  427. ##-======================================-##
  428. tcpdump -i eth0 -nt port 53 | grep $DomainDNS
  429.  
  430.  
  431. ##-=====================================-##
  432. ##     [+] CAPTURE PACKETS ON ETH0
  433. ##           IN ASCII AND HEX AND WRITE TO FILE
  434. ##-=====================================-##
  435. tcpdump -i ethO -XX -w $File.pcap
  436.  
  437.  
  438. ##-===================================-##
  439. ##     [+] CAPTURE HTTP TRAFFIC TO 2.2.2.2
  440. ##-===================================-##
  441. tcpdump -i ethO port 80 dst 2.2.2.2
  442.  
  443.  
  444. ##-=============================-##
  445. ##     [+] Capture Ping Echo Requests:
  446. ##-=============================-##
  447. tcpdump -nni eth0 -e icmp[icmptype] == 8
  448.  
  449.  
  450. ##-===========================-##
  451. ##     [+] Capture Ping Responses:
  452. ##-===========================-##
  453. tcpdump -i ethO 'icmp[icmptype] == icmp-echoreply'      ## PRINT ALL PING RESPONSES
  454.  
  455.  
  456. ##-========================-##
  457. ##     [+] Capture SYN Packets:
  458. ##-========================-##
  459. tcpdump -nnr $File.pcap -c 3 'tcp[13] & 2 = 2' | grep -E '(S|S\.)'
  460.  
  461.  
  462. ##-========================-##
  463. ##     [+] Isolate TCP RST flags
  464. ##-========================-##
  465. tcpdump 'tcp[13] & 4!=0'
  466. tcpdump 'tcp[tcpflags] == tcp-rst'
  467.  
  468.  
  469. ##-========================-##
  470. ##     [+] Isolate TCP SYN flags
  471. ##-========================-##
  472. tcpdump 'tcp[13] & 2!=0'
  473. tcpdump 'tcp[tcpflags] == tcp-syn'
  474.  
  475.  
  476. ##-=======================================================-##
  477. ##     [+] Isolate packets that have both the SYN and ACK flags set:
  478. ##-=======================================================-##
  479. tcpdump 'tcp[13]=18'
  480.  
  481.  
  482. ##-=========================-##
  483. ##     [+] Isolate TCP URG flags
  484. ##-=========================-##
  485. tcpdump 'tcp[13] & 32!=0'
  486. tcpdump 'tcp[tcpflags] == tcp-urg'
  487.  
  488.  
  489. ##-=========================-##
  490. ##     [+] Isolate TCP ACK flags
  491. ##-=========================-##
  492. tcpdump 'tcp[13] & 16!=0'
  493. tcpdump 'tcp[tcpflags] == tcp-ack'
  494.  
  495.  
  496. ##-=========================-##
  497. ##     [+] Isolate TCP PSH flags
  498. ##-=========================-##
  499. tcpdump 'tcp[13] & 8!=0'
  500. tcpdump 'tcp[tcpflags] == tcp-push'
  501.  
  502. ##-=========================-##
  503. ##     [+] Isolate TCP FIN flags
  504. ##-=========================-##
  505. tcpdump 'tcp[13] & 1!=0'
  506. tcpdump 'tcp[tcpflags] == tcp-fin'
  507.  
  508.  
  509. ##-=========================-##
  510. ##     [+]
  511. ##-=========================-##
  512. tcpdump -i xl0 'tcp[13] & 2 == 2'
  513. tcpdump -i xl0 tcp[13] == 2
  514.  
  515.  
  516. ##-=========================-##
  517. ##     [+] Both SYN and RST Set
  518. ##-=========================-##
  519. tcpdump 'tcp[13] = 6'
  520.  
  521.  
  522. ##-==========================-##
  523. ##     [+] Find HTTP User Agents
  524. ##-==========================-##
  525. tcpdump -vvAls0 | grep 'User-Agent:'
  526.  
  527.  
  528. ##-=========================================-##
  529. ##     [+] Capture Packets Coming From $Domain
  530. ##-=========================================-##
  531. tcpdump -i any -w $File.pcap -n "host $(dig +short $Domain)"
  532.  
  533.  
  534. ##-========================-##
  535. ##     [+] Capture SYN Packets:
  536. ##-========================-##
  537. tcpdump -d 'tcp[13] & 2 = 2' >/dev/null | grep -B 1 -A 2 0x2
  538. tcpdump -nnr $File.pcap -c 3 'tcp[13] & 2 = 2' | grep -E '(S|S\.)'
  539.  
  540.  
  541. ##-================================================-##
  542. ##     [+] CAPTURE 50 DNS PACKETS AND PRINT TIMESTAMP
  543. ##-================================================-##
  544. tcpdump -i ethO -c 50 -tttt 'udp and port 53'
  545.  
  546.  
  547. ##-======================================-##
  548. ##     [+] CAPTURE TCP TRAFFIC ON PORT 22-23
  549. ##-======================================-##
  550. tcpdump portrange 21-23
  551. tcpdurnp -nvvX -sO -i ethO tcp portrange 22-23
  552.  
  553.  
  554. ##-===========================-##
  555. ##     [+]
  556. ##-===========================-##
  557. tcpdurnp -I ethO -tttt dst ip and not net 1.1.1.0/24    ##
  558.  
  559.  
  560. ##-===============================-##
  561. ##     [+] Get Cisco network information:
  562. ##-===============================-##
  563. tcpdump -nn -v -i eth0 -s 1500 -c 1 'ether[20:2] == 0x2000'
  564.  
  565.  
  566. ##-======================================-##
  567. ##     [+] SHOW CONNECTIONS TO A SPECIFIC IP
  568. ##-======================================-##
  569. tcpdump -i ethO -tttt dst 192.168.1.22 and not net 192.168.1.0/24
  570.  
  571.  
  572. ##-========================================-##
  573. ##     [+] CAPTURE TRAFFIC FOR <SEC> SECONDS
  574. ##-========================================-##
  575. durnpcap -I ethO -a duration: sec -w file $File.pcap
  576.  
  577.  
  578. ##-===================-##
  579. ##     [+] REPLAY PCAP
  580. ##-===================-##
  581. file2cable -i ethO -f $File.pcap
  582.  
  583.  
  584.  
  585. tcpreplay --topspeed --loop=O --intf=ethO $PCAP -- mbps=10|100|1000
  586.  
  587.  
  588.  
  589.  
  590. ## ==================================================================================== ##
  591. tcpick -i eth0 -C                                           ## display the connection status:
  592. ## ==================================================================================== ##
  593. tcpick -i eth0 -C -yP -h -a                         ## display the payload and packet headers:
  594. ## ==================================================================================== ##
  595. tcpick -i eth0 -C -bCU -T1 "port 25"        ## display client data only of the first smtp connection:
  596. ## ==================================================================================== ##
  597. tcpick -i eth0 -wR "port ftp-data"          ## download a file passively:
  598. ## ==================================================================================== ##
  599. tcpick -a                                                       ## Displays host names instead of ip addresses.
  600. ## ==================================================================================== ##
  601. tcpick -v5                                                      ## Verbose Lvl 1-5
  602. ## ==================================================================================== ##
  603.  
  604.  
  605. ## ==================================================================================== ##
  606. tcpick   -i   eth0   --pipe  client  "port  80"  |  gzip  > $File.gz
  607. ## ==================================================================================== ##
  608. tcpick -i eth0 --pipe server "port 25" | nc foobar.net 25
  609. ## ==================================================================================== ##
  610.  
  611.  
  612. ##-===============================================-##
  613. ##     [+] Process all of the pcap files in the current directory:
  614. ##-===============================================-##
  615. tcpflow -o out -a -l *.pcap
  616.  
  617.  
  618. ##-===============================================-##
  619. ##     [+] Convert the hostname to an IPv4 address using DNS:
  620. ##-===============================================-##
  621. nmap --dns-servers 8.8.8.8,8.8.4.4 scanme.nmap.org
  622.  
  623.  
  624.  
  625. tcpdump -n -r $File.cap | awk '{print $3}'| sort -u
  626. tcpdump -n src host 145.254.160.237 -r $File.cap
  627. tcpdump -n dst host 145.254.160.237 -r $File.cap
  628. tcpdump -n port 53 -r $File.cap
  629. tcpdump -nX port 80 -r $File.cap
  630.  
  631.  
  632.  
  633.  
  634. ##-==================-##
  635. ##     [+] NFS Requests
  636. ##-==================-##
  637. tcpdump -n -i eth0 dst port nfs
  638. tcpdump -n -i any -c10000 dst port nfs | grep --line-buffered '"' | cut '-d"' -f2
  639.  
  640. ##-============================-##
  641. ##     [+] Print HTTP GET Requests
  642. ##-============================-##
  643. tcpdump -A -i eth0 -vvv -s 500 'tcp port 80 and ip[2:2] > 40 and tcp[tcpflags] & tcp-push != 0 and dst port 80' -f
  644.  
  645. ##-===============================-##
  646. ##     [+] Debugging Ganglia's gmetad
  647. ##-===============================-##
  648. tcpdump -w $File.pcap -s 0 -vxli lo src host localhost and dst host localhost and dst portrange 8660-8777
  649.  
  650. ##-===============================================-##
  651. ##     [+] Capturing Traffic For A Particular Source Subnet
  652. ##-===============================================-##
  653. tcpdump -i eth0 -w $File.pcap src net 50.115.209.0/24
  654.  
  655. ##-=======================================================-##
  656. ##     [+] Capturing Traffic For A Particular Host With A Particular Port
  657. ##-=======================================================-##
  658. tcpdump -i eth0 -w $File.pcap host 10.20.43.21 and port 22
  659.  
  660. ##-=================================-##
  661. ##     [+] Capture Multicast or Broadcast
  662. ##-=================================-##
  663. tcpdump -i eth0 -w $File.pcap -n "multicast or broadcast"
  664.  
  665. ##-==========================================-##
  666. ##   [+] Show Outbound TCP Traffic That is Not SSH
  667. ##-==========================================-##
  668. tcpdump -i eth0 tcp and src host `ip address show dev eth0 primary | sed -n 's,^    inet ,,p' | sed 's,/.*$,,'` and port not 22
  669.  
  670. ##-===================================================-##
  671. ##   [+] Rotating Output File Every 600 Secs, Retain only 18 files
  672. ##-===================================================-##
  673. tcpdump -w $File-%Y%m%d%H%M%S.dump -G 600 -W 18 -vv '(host avatax.avalara.net and port 443)'
  674.  
  675.  
  676. ##-====================================================-##
  677. ##   [+] Capture Packets With Port Ranges 31000-31100
  678. ##-====================================================-##
  679. tcpdump -i eth0 -w $File.pcap 'tcp port 8080 or tcp portrange 31000-31100'
  680.  
  681.  
  682.  
  683.  
  684. ##-==================================================-##
  685. ##   [+] Capture on interface eth0 - Write To File
  686. ##-==================================================-##
  687. tcpdump -nn -i eth0 -w $File.pcap
  688.  
  689.  
  690. ##-====================================================-##
  691. ##   [+] Capture only first 56 bytes of each frame
  692. ##-====================================================-##
  693. ## ---------------------------------------------------- ##
  694. ##   [?] Covers the IP header and typical TCP header.
  695. ##       (a.k.a.“snaplen of 56”.)
  696. ## ---------------------------------------------------- ##
  697. tcpdump -nn -i eth0 -w $File.pcap -s 56
  698.  
  699.  
  700. ##-==============================================-##
  701. ##   [+] Attempt to Capture Entire Contents of
  702. ##       Each packet (a.k.a “snaplen zero”.)
  703. ##-==============================================-##
  704. tcpdump -nn -i eth0 -w $File.pcap -s 0
  705.  
  706.  
  707.  
  708.  
Add Comment
Please, Sign In to add comment