[unisog] getting the Arp Table from a router whit Java API or C application

Fuat Baran fuat at columbia.edu
Tue Apr 11 17:51:33 GMT 2006

You can't do a GetRequest on a table OID.  To get objects from a  
table you'll need to "walk" the table by doing a series of  
GetNextRequests on one or more columns of the table that you're  
interested in.

Do a google of "GetNextRequest" and read some of the hits you'll  
get.  They describe the concept.


On Apr 11, 2006, at 5:30 AM, stefano wrote:

> Hi, sorry for my bad english, i know this and i'm working for make  
> it better.. but here come the question: I've known this mailing  
> list reading the previous thread talking about this argument  
> (Getting ARP tables from Cisco switches via snmp -- slightly OT )  
> after a search on google..
> I've to develop an identical application (that insert in a DB the  
> MAC, the IP and if is possible the Switch port number..) but i've a  
> condiction, i've to develop this using a java server, not one linux  
> commands or application  (not , but max portability, because some  
> servers are Windows and some are Unix, therefore i can't use  
> smnpwalk or arptrace!! ) i must to realize this operation whit  
> JavaAPIs or whit portable a source code as a C code.
> I've downloaded the Adventnet java SNMP API package, and i can get  
> a variable from the MIB for example the OID  
> return to me the string value "Cisco Internetwork Operating System  
> Software \r\nIOS (tm) RSP Software (RSP-JSV-M), Version 12.0(9),  
> RELEASE SOFTWARE (fc1)\r\nCopyright (c) 1986-2000 by cisco Systems,  
> Inc.\r\nCompiled Mon 24-Jan-00 23:15 by bettyl" then i can deduce  
> that the APIs work fine. But if i try to get a table, i recive a  
> null pointer, and i don't know how i can do this operation correctly.
> anyone can help me?
> here there is the bad test code working only with a single MIB  
> variable:
> public static void openSNMPSession() throws Exception
>     {
>         System.out.println("ci2ao");
>         SnmpAPI api = new SnmpAPI();
>         SnmpSession session = new SnmpSession(api);
>         session.open();
>         SnmpPDU pdu = new SnmpPDU();
>         pdu.setRemoteHost("");
>         pdu.setCommand(SnmpAPI.GET_REQ_MSG);
>         pdu.addNull(new SnmpOID(".")); //doesn't work
>         //pdu.addNull(newSnmpOID(". ")); work
>         SnmpPDU response_pdu = session.syncSend(pdu);
>         if(response_pdu == null)
>         {
>             System.out.println("The Request has timed out.");
>         }
>         else
>         {
>             System.out.println(response_pdu.printVarBinds());
>             System.out.println("Errors: "+response_pdu.getError());
>             System.out.println("Account: "+response_pdu.getCommunity 
> ()+"\n Ver "+response_pdu.getVariable(10));
>         }
>     }
> _______________________________________________
> unisog mailing list
> unisog at lists.sans.org
> http://www.dshield.org/mailman/listinfo/unisog

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.dshield.org/pipermail/unisog/attachments/20060411/39b0933c/attachment.htm

More information about the unisog mailing list