etingof / snmpsim

SNMP Simulator
http://snmplabs.com/snmpsim/
BSD 2-Clause "Simplified" License
376 stars 119 forks source link

SNMP communication #152

Open jaimesaez97 opened 3 years ago

jaimesaez97 commented 3 years ago

Hello there.

I am trying to debug a simple SNMP agent and querying it.

I am raising the SNMP agent through this command: $ python snmpsim.commands.responder.py --data-dir=./data --agent-udpv4-endpoint=127.0.0.1:1024

And I receive the following info: Screenshot from 2020-09-28 12-02-58 Screenshot from 2020-09-28 12-03-10 be I am querying existing SNMP agent by the following command: $ pyton snmpsim.commands.cm2rec.py --agent-udpv4-endpoint=127.0.0.1:1024 --output-file=/home/jaime/Documents/snmpsim/data/public.snmprec

And I receive the following info: Screenshot from 2020-09-28 12-04-45

I am triying to debug the communication between two process but I am not able to discover where is the SNMP-agent communication function.

Where is the code point where MIBs are sent from SNMP agent side?

Thank you, Jaime.

gainskills commented 3 years ago

you are using --data-dir=./data as data source of SNMP agent, is there any data there in the folder?

jaimesaez97 commented 3 years ago

you are using --data-dir=./data as data source of SNMP agent, is there any data there in the folder?

This folder is the data folder inside SNMPSIM project (snmpsim/data).

gainskills commented 3 years ago

you are using --data-dir=./data as data source of SNMP agent, is there any data there in the folder?

This folder is the data folder inside SNMPSIM project (snmpsim/data).

Can you try without the parameter? from your screenshot, seemed it load nothing.

image

jaimesaez97 commented 3 years ago

Without this parameter I get back the same error. I think the problem is the SNMP agent can not fin any MIB to reply the query.

Screenshot from 2020-10-07 10-14-46 Screenshot from 2020-10-07 10-14-54

gainskills commented 3 years ago

Without this parameter I get back the same error. I think the problem is the SNMP agent can not fin any MIB to reply the query.

Screenshot from 2020-10-07 10-14-46 Screenshot from 2020-10-07 10-14-54

I would suggest you check the environment you are using and the step snmpsim you ran snmpsim. Log will be printed when the data is loaded: image

jaimesaez97 commented 3 years ago

Without this parameter I get back the same error. I think the problem is the SNMP agent can not fin any MIB to reply the query. Screenshot from 2020-10-07 10-14-46 Screenshot from 2020-10-07 10-14-54

I would suggest you check the environment you are using and the step snmpsim you ran snmpsim. Log will be printed when the data is loaded: image

Are you running server and client like this?

python snmpsim/snmpsim/commands/responder.py --agent-udpv4-endpoint=127.0.0.1:1024
python snmpsim/snmpsim/commands/cmd2rec.py --agent-udpv4-endpoint=127.0.0.1:1024 --output-file=/home/jaime/Documents/Projects/snmpsim/data/public.snmprec
gainskills commented 3 years ago

Without this parameter I get back the same error. I think the problem is the SNMP agent can not fin any MIB to reply the query. Screenshot from 2020-10-07 10-14-46 Screenshot from 2020-10-07 10-14-54

I would suggest you check the environment you are using and the step snmpsim you ran snmpsim. Log will be printed when the data is loaded: image

  1. cmd2rec unable to got data because responder failed to load data
  2. I'm not in your way to load the SNMP agent, I ran it as the document described: snmpsim-command-responder --agent-udpv4-endpoint=127.0.0.1:1024
  3. Please make sure #2 works 1st, then you can dig into the SNMPsim code to see how it load the data.
jaimesaez97 commented 3 years ago

I am trying to introduce some security into the project through ciphering and I need to launch it through python snmpsim/commands/responder.py. When I try to launch it from terminal, I get another output:

python snmpsim/commands/responder.py --agent-udpv4-endpoint=127.0.0.1:1024

The correct data_dir is /usr/local/lib/python2.7/dist-packages/snmpsim-1.0.0-py2.7.egg/snmpsim/data. Output: Screenshot from 2020-10-07 10-44-31

But the client does not return any OID:

python snmpsim/commands/cmd2rec.py --agent-udpv4-endpoint=127.0.0.1:1024 --output-file=/home/jaime/Documents/Projects/snmpsim/data/public.snmprec

Output: Screenshot from 2020-10-07 10-45-31

"OIDs dumped: 0"