Advertisement
xe1phix

Xe1phix-[NGrep]-Cheatsheet-[v4.8.24].sh

Sep 21st, 2022 (edited)
976
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.31 KB | None | 0 0
  1. #!/bin/sh
  2. ##-====================================-##
  3. ##   [+] Xe1phix-NGrep-[v*.*.**].sh
  4. ##-====================================-##
  5.  
  6.  
  7. ##-=============================================-##
  8. ##   [+] Listen to TCP traffic on eth0 device
  9. ##-=============================================-##
  10. ngrep -d 'eth0' -W byline -t -q '^(GET|POST|PUT|HEAD|CONNECT) '
  11.  
  12.  
  13.  
  14. ngrep -q 'HTTP' 'tcp'                   ## Filter Out TCP Packets
  15. ngrep -q 'HTTP' 'udp'                   ## Filter Out UDP Packets
  16. ngrep -q 'HTTP' 'icmp'                  ## Filter Out ICMP Packets
  17. ngrep -q 'HTTP' 'host 192.168'          ## matches all headers containing the string 'HTTP' sent to or from the ip address starting with 192.168
  18. ngrep -q 'HTTP' 'dst host 192.168'      ## match a destination host
  19. ngrep -q 'HTTP' 'src host 192.168'      ## match a source host
  20. ngrep -q 'HTTP' 'port 80'               ## match a port
  21.  
  22.  
  23.  
  24.  
  25. ##-=======================================-##
  26. ##     [+] Sniff packets with live verbose output
  27. ##     [+] Timestamps
  28. ##     [+] Hexadecimal values
  29. ##     [+] ASCII strings
  30. ##-=======================================-##
  31. ngrep -t -x 'USER|PASS|RETR|STOR' tcp port ftp and host $Domain
  32. ngrep -wi -d any 'user|pass' port 21
  33.  
  34.  
  35. ##-==================================-##
  36. ##  [+] Match packets with the following:
  37. ##-==================================-##
  38. ##      -------------------------------
  39. ##                POST (^*)                             ## at the start of the line
  40. ##      ------------- or --------------
  41. ##            HTTP POST requests
  42. ##      -------------------------------
  43. ##      in a simple text output format.
  44. ##-=================================-##
  45. ngrep -d wlan0 '^POST'
  46.  
  47.  
  48. ## -------------------------------------------------------------------- ##
  49. ##  [?] String 'pwd' has shown the HTTP POST
  50. ##         request with my login and password
  51. ## -------------------------------------------------------------------- ##
  52. ngrep -t -d wlan0 'pwd'
  53.  
  54.  
  55. ##-======================================-##
  56. ##  [+]
  57. ##-======================================-##
  58. ngrep -q -W byline "GET|POST HTTP"
  59. ngrep -l -q -d eth0 "^GET |^POST " tcp and port 80
  60.  
  61.  
  62.  
  63.  
  64. ##-==========================================================-##
  65. ##   [+] Search network traffic for string "User-Agent: "
  66. ##-==========================================================-##
  67. ngrep -d eth0 "User-Agent: " tcp and port 80
  68.  
  69.  
  70. ##-==========================================================-##
  71. ##   [+] Monitor all activity (src or dest) port 25 (SMTP).
  72. ##-==========================================================-##
  73. ngrep -d any port 25
  74.  
  75.  
  76.  
  77. ##-=======================================-##
  78. ##     [+]
  79. ##-=======================================-##
  80. ngrep -I $File.pcap -q -W single -t "GET" ip src 192.168.1.1 | awk '{ print $2, $3, $11, $9}' | sed 's/\.\{1,3\}User-Agent//' | grep -v -E '(ad|cache|analytics|wxdata|voicefive|imwx|weather.com|counterpath|cloudfront|2mdn.net|click|api|acuity|tribal|pixel|touchofclass|flickr|ytimg|pulse|twitter|facebook|graphic|revsci|digi|rss|cdn|brightcove|atdmt|btrll|metric|content|trend|serv|content|global|fwmrm|typekit|[az]*-[a-z]*\.com|pinit|cisco|tumblr)' | sed '/ [ \t]*$/d' > $File.txt
  81.  
  82.  
  83.  
  84. ##-========================================-##
  85. ##   [+] Discover the url of media files
  86. ##-========================================-##
  87. ngrep -lqi -p -W none ^get\|^post tcp dst port 80 -d eth0 | egrep '(flv|mp4|m4v|mov|mp3|wmv)'
  88.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement