How to capture and forward SNMP messages using WinSNMP? - sockets

I'm fairly new to SNMP/WinSNMP and I'm trying to access what it would take to accept SNMP traffic on ports 161/162 and forward it to another device. I would like to be able to examine messages and possibly modify them before passing them to the device.
Would WinSNMP agent APIs be suitable for it? Are there any examples out there how to accomplish this in C++?
I'd appreciate any pointers.
Thanks.

Sounds like you want to make a Proxy Agent. There are already a great number of such implemented, so in order to avoid reinventing the wheel, do a web search for "windows snmp proxy" and see if you could use one of those products instead.

Related

Cisco Switchport mode by SNMP

Do it have a way to access and add/change/remove the switchport mode option from a port by SNMP ?
I found no any information about it and seems to be not possible...
I'm curently searching a way to autoconfig ports using perl scripts and SNMP.
If anyone have a solution or even another way to do this, I'll be grateful.
Thanks.
What I understand from your post is, that you want to configure the vlans and trunks (or something else?) on multiple switches/routers . If thats true you better look on "VLAN Trunking Protocol". One of the best guides and explanation I found is that one- https://www.youtube.com/watch?v=jHw7OUqcg-g
The best way would probably be to prepare individual configuration and extract it via Console.
Otherwise I am still confuse what you really want to achieve. If they have IP assigned to a vlan/interface you can burst configuration via Telnet with a script. - But that looks like an overkill for this purpose.

Connecting/Tunneling through a proxy so you appear to be connecting from another country(iOS)?

I'm interested in trying to make a connection from within my app to a proxy somewhere in the UK so I can listen to radio streams there that are blocked from the UK.
What would it take technically to implement this?
Is this even possible with the API available within iOS?
Many Thanks,
-Code
I think you need to use a VPN for this kind of thing. I have (of course) never done this myself but you could use OpenVPN in theory. I don't know how useful this is and there is a writeup here to explain why I say this. You need to jailbreak your phone.

What is the preferred way to find all other clients on local network?

Writing an iPhone app in which I want to save the user the grief of typing in IP addresses by finding other clients on the local network.
Is this possible?
If so, what is the preferred way of doing this?
Yes, use Bonjour. See NSNetService.
This class is used to advertise information about the service you're running using multicast DNS. Use NSNetServiceBrowser to find published services of the type you're interested in.
The clients need some way to register with the server. Or you can use portknocking. Long time back there was a protocol from Novell SLP. There is a OpenSLP now. Found a interesting link, I hope this helps
http://www.opendoor.com/shareway/slp.html

What's the best way to handle multiple outgoing connections in Perl?

I have three TCP servers I need to connect to, each with different protocols, but all in nonblocking mode. Right now my plan is essentially opening a new IO::Socket per each one and adding them to IO::Select, then looping through can_read(). The idea is based on how servers are usually written in Perl, but it seems like it could work for clients.
I'm wondering if this is the best way to do it, furthermore I'm also wondering how I can probe each connection for disconnection, and initiate a reconnection to it without disrupting the other sockets. Any code examples would be a great help, or at least some points in the right direction on how best to do this.
You may want to use AnyEvent, or POE. Just look through the documentation, it has some nice examples to help you learn your way around.

Is there a way to discover what different types of switches am I connected to?

I wanted to know if we could find out what type of switch our machine is directly connected to ..
For instance if I am connected to a Cisco,Brocade,foundry and Force10 switch .
Is it possible to write a perl script to find out the management address of the switch [without logging in]
Is it possible to write a perl script to find out the switch vendor and model number ...
Thanks for your suggestions.
EDIT: Wanted to add that I am directly connected to the switch .. I can disable the firewall on my machine ...
nmap is what you want. If that doesn't do it, the answer is probably "no". If you need the IP address of the switch, run traceroute/tracert to see what the next hop is.
There is no guaranteed way of being able to achieve this. It depends very much on how your switch has been configured and how open your network admins have made it.
If everything is completely open then the best way of finding out the type of switch is to use snmp. The net-snmp library for perl (see docs here) is a good place to start.
But that assumes that the management interface is exposed to your box.
There is no guarantee that it will be.
If it is then nmap (as suggested by others) may work. At least it might tell you if the management interface is accessible at which point you can use snmp to tell you the rest.
Traceroute might yield some more information, but only if the address used for it's routing is the same as the management address. (and assuming that your "switch" is really a "router". If not then this won't yield any useful information.)
ping might yield some information about the manufacturer, but only if it hasn't been configured to proxy-arp.
On Cisco switchs if CDP is activated you should be able to see CDP traffic on your wire which will indicate switch model, name and switch port you are connected to.
Don't know for other brands.
Not really. In the modern world of firewalled, packet-modifying, NATed subnetworks, you really can't do anything reliably to inspect a network from a client machine.
That said, trying nmap on your router might tell you something interesting. Or it might not. The results are entirely up to the admins of your network.
follow the wire
You can ping it to get its Ethernet address, and then look it up in one of the vendor code lists.