# PORT 161/udp - SNMP

## Introduction

SNMP is not well-understood by many network administrators. This often results in SNMP misconfigurations, which can result in significant information leakage.

## Scanning the network

To scan for open SNMP ports we can use nmap:

```
sudo nmap -sU --open -P 161 <ip-addr>/<mask> -oG open-snmp.nmap
```

### Bruteforce attack

We can use tools such as `onesixtyone`, which will attempt to brute force attack against a list of IP addresses. First we need to create a file containing community strings:

```
echo public > community.txt
echo private >> community.txt
echo manager >> community.txt

for ip in $(seq 1 254); do echo 10.0.0.$ip; done > ips.txt
```

And run the tool:

```
onesixtyone -c community.txt -i ips.txt
```

## Enumeration

### Entire MIB Tree

```
snmpwalk -c public -v1 -t 10 <ip-addr>
```

### Windows Users

```
snmpwalk -c public -v1 -t <ip-addr> 1.3.6.1.4.1.77.1.2.25
```

### Running Windows Processes

```
snmpwalk -c public -v1 <ip-addr> 1.3.6.1.2.1.25.4.2.1.2
```

### Open TCP Ports

```
snmpwalk -c public -v1 <ip-addr> 1.3.6.1.2.1.6.13.1.3
```

### Installed Software

```
snmpwalk -c public -v1 <ip-addr> 1.3.6.1.2.1.25.6.3.1.2
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mvc1009.gitbook.io/hackingnotes/services/service-snmp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
