Advertisement
xe1phix

Xe1phix-[SNMP]-Enumeration-Cheatsheet-[v5.4.92].sh

Oct 6th, 2022 (edited)
771
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.99 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ##-=====================================================-##
  4. ##-<!>~<!>~<!>~<!>~<!>-<!>-<!>-<!>-<!>-<!>-<!>-<!>-<!>-<-##
  5. ##-=====================================================-##
  6. ##   [+] SNMP - Discovery + Enumeration + Pentesting
  7. ##-=====================================================-##
  8. ##-<!>~<!>~<!>~<!>~<!>-<!>-<!>-<!>-<!>-<!>-<!>-<!>-<!>-<-##
  9. ##-=====================================================-##
  10.  
  11.  
  12.  
  13. ##  [+] Examples
  14. snmpwalk -c public -v1 $TARGET 1.3.6.1.2.1.25.4.2.1.2
  15. onesixtyone -c community -I $TARGET
  16. snmpcheck -t $TARGET
  17. snmpenum -t $TARGET
  18.  
  19.  
  20. onesixtyone -i $line -o ../dir${domain}/snmponesixtyone_output.txt
  21. onesixtyone -c /usr/share/sparta/wordlists/snmp-default.txt -o snmp_one_sixtyone${2}.txt
  22.  
  23.  
  24. ##  [+] Version3
  25. nmap -sV -p 161 --script=snmp-info 192.168.1.0/24
  26.  
  27. ##  [+] Wordlists
  28. /usr/share/metasploit-framework/data/wordlists/snmp_default_pass.txt
  29.  
  30.  
  31. ##  [+] SNMP ENumeration:
  32.  
  33. snmpget -v 1 -c public IP version
  34. snmpwalk -v 1 -c public IP
  35. snmpbulkwalk -v 2 -c public IP
  36.  
  37. SNMP
  38. ----
  39. onesixtyone -c /usr/share/doc/onesixtyone/dict.txt
  40. Metasploit Module snmp_enum
  41. snmpcheck -t snmpservice
  42.  
  43.  
  44. snmpcheck -t $IP -c public
  45.  
  46. snmpenum -t $IP
  47.  
  48.  
  49. ##-============================-##
  50. ##  [+] SNMPv3 Enumeration
  51. ##-============================-##
  52. nmap -sV -p 161 --script=snmp-info $IP/24
  53.  
  54.  
  55. ## ---------------------------------------------------------- ##
  56. ## [+]  Enumerate MIB:
  57. ## ---------------------------------------------------------- ##
  58. ## [•]  1.3.6.1.2.1.25.1.6.0      ## System Processes
  59. ## [•]  1.3.6.1.2.1.25.4.2.1.2        ## Running Programs
  60. ## [•]  1.3.6.1.2.1.25.4.2.1.4        ## Processes Path
  61. ## [•]  1.3.6.1.2.1.25.2.3.1.4        ## Storage Units
  62. ## [•]  1.3.6.1.2.1.25.6.3.1.2        ## Software Name
  63. ## [•]  1.3.6.1.4.1.77.1.2.25     ## User Accounts
  64. ## [•]  1.3.6.1.2.1.6.13.1.3      ## TCP Local Ports
  65.  
  66.  
  67.  
  68. snmpwalk -c public -v1 $IP 1
  69.  
  70. Snmpwalk -c <community string> -v<version> $IP 1.3.6.1.2.1.25.4.2.1.2
  71.  
  72. onesixtyone -c names -i hosts
  73.  
  74. onesixtyone -d $IP
  75.  
  76.  
  77.  
  78. nmap -sU --open -p 161 $1
  79. nmap -n -Pn -sV $IP -p $IP --script=snmp-netstat,snmp-processes -oN $OUTPUT/$IP:$PORT_snmp.nmap
  80. onesixtyone -c public $IP | tee $OUTPUT/161_$IP-$PORT
  81. onesixtyone -c /usr/share/seclists/Discovery/SNMP/common-snmp-community-strings-onesixtyone.txt -dd $1 2>&1 | tee "snmp_onesixtyone_$1.txt"
  82.  
  83.  
  84. snmpwalk -c public -v1 $IP | tee $OUTPUT/snmpwalk_$IP-$PORT
  85. snmpwalk -c public -v1 $IP 1.3.6.1.4.1.77.1.2.25 | tee $OUTPUT/snmp_users_$IP-$PORT
  86. snmpwalk -c public -v1 $IP 1.3.6.1.2.1.6.13.1.3 | tee $OUTPUT/snmp_ports_$IP-$PORT
  87. snmpwalk -c public -v1 $IP 1.3.6.1.2.1.25.4.2.1.2 | tee $OUTPUT/snmp_process_$IP-$PORT
  88. snmpwalk -c public -v1 $IP 1.3.6.1.2.1.25.6.3.1.2 | tee $OUTPUT/snmp_software_$IP-$PORT
  89.  
  90.  
  91. snmpwalk -c public -v 1 $1 2>&1 | tee "snmpwalk.txt"
  92. snmpwalk -c public -v 1 $1 1.3.6.1.2.1.25.1.6.0 2>&1 | tee "snmpwalk_system_processes.txt"
  93. snmpwalk -c public -v 1 $1 1.3.6.1.2.1.25.4.2.1.2 2>&1 | tee "snmpwalk_running_processes.txt"
  94. snmpwalk -c public -v 1 $1 1.3.6.1.2.1.25.4.2.1.4 2>&1 | tee "snmpwalk_process_paths.txt"
  95. snmpwalk -c public -v 1 $1 1.3.6.1.2.1.25.2.3.1.4 2>&1 | tee "snmpwalk_storage_units.txt"
  96. snmpwalk -c public -v 1 $1 1.3.6.1.2.1.25.6.3.1.2 2>&1 | tee "snmpwalk_software_names.txt"
  97. snmpwalk -c public -v 1 $1 1.3.6.1.4.1.77.1.2.25 2>&1 | tee "snmpwalk_user_accounts.txt"
  98. snmpwalk -c public -v 1 $1 1.3.6.1.2.1.6.13.1.3 2>&1 | tee "snmpwalk_tcp_ports.txt"
  99.  
  100.  
  101.  
  102.  
  103.  
  104. ##-===========================================================-##
  105. ##  [+] SnmpWalk - start browsing through the
  106. ##                 MIB (management information base) tree.
  107. ##-===========================================================-##
  108. snmpwalk -c public -v1 $IP
  109.  
  110.  
  111. ## ---------------------------------------------------------------------- ##
  112. ##  [+] extract only system users use this value 1.3.6.1.4.1.77.1.2.25
  113. ## ---------------------------------------------------------------------- ##
  114. snmpwalk public -v1 $IP 1 |grep 77.1.2.25 |cut -d” “ -f4
  115.  
  116.  
  117. ## --------------------------------- ##
  118. ##  [+] Enumerating Windows Users:
  119. ## --------------------------------- ##
  120. snmpwalk -c public -v1 $IP 1.3 |grep 77.1.2.25 |cut -d" " -f4
  121.  
  122.  
  123. ## ------------------------------------- ##
  124. ##  [+] Enumerating Running Services
  125. ## ------------------------------------- ##
  126. snmpwalk -c public -v1 $IP 1 |grep hrSWRunName|cut -d" " -f4
  127.  
  128.  
  129. ## -------------------------------------- ##
  130. ##  [+] Enumerating installed software
  131. ## -------------------------------------- ##
  132. snmpwalk -c public -v1 $IP 1 |grep hrSWInstalledName
  133.  
  134.  
  135. ## ----------------------------------- ##
  136. ##  [+] Enumerating open TCP ports
  137. ## ----------------------------------- ##
  138. snmpwalk -c public -v1 $IP 1 |grep tcpConnState |cut -d"." -f6 |sort -nu
  139.  
  140.  
  141.  
  142.  
  143. ##  [+] Enmerate users from SNMP
  144. snmpwalk public -v1 192.168.X.XXX 1 | grep 77.1.2.25 | cut -d” “ -f4
  145. python /usr/share/doc/python-impacket-doc/examples/samrdump.py SNMP $TARGET
  146.  
  147.  
  148. ##  [+] Search SNMP with nmap
  149. nmap -sT -p 161 192.168.1.0/24 -oG snmp_results.txt
  150.  
Tags: osint snmp recon
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement