Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

SNMP request returning weird output

$
0
0

Sorry for posting this here, the other board is being spam by some jerk so I'm posting this here temporarily

 

I'm trying to retrieve a snmp output from my router, I can do it using "snmpwalk 5.7.0" and "MIB Browser", so is not a problem with router configuration. 

AutoIt         
#include "snmp_UDF-v1.7.4.au3" Global $Port = 161 ; UDP 161 = SNMP port Global $SNMP_Version = 2 ; SNMP v2c (1 for SNMP v1) Global $SNMP_Community = "public" ; SNMPString(Community) (change it) Global $SNMP_ReqID = 1 Global $SNMP_Command Global $Start = 1 Global $result Global $Timeout_msec = 2500 UDPStartup() $Socket = UDPOpen('192.168.1.1', $Port) $SNMP_Command = _SNMPBuildPacket('.1.3.6.1.2.1.1.5', $SNMP_Community, $SNMP_Version, $SNMP_ReqID, "A0") UDPSend($Socket, $SNMP_Command) _StartListener() Sleep(200) UDPCloseSocket($Socket) UDPShutdown() Sleep(200) Exit Func _StartListener()     If $Start = 1 Then         $Timeout = TimerInit()         While (1)             $srcv = UDPRecv($Socket, 1200)             If ($srcv <> "") Then                 $result = _ShowSNMPReceived($srcv)                 ConsoleWrite("received: " & $srcv &@LF)                 ;_ArrayDisplay($result)                 ExitLoop             EndIf             Sleep(100)             If TimerDiff($Timeout) > $Timeout_msec Then                 ExitLoop             EndIf         WEnd     EndIf EndFunc   ;==>_StartListener Func OnAutoItExit()     UDPCloseSocket($Socket)     UDPShutdown() EndFunc   ;==>OnAutoItExit

Request oid: .1.3.6.1.2.1.1.5

Expected result: TP-LINK

Received: 0x3082002E02010104067075626C6963A282001F020101020100020100308200123082000E060A2B0001030601020101058000 [ascii: 0‚.public¢‚0‚0‚ +€]

 

what am I doing wrong here? There's other cleaner way of doing this, like _snmpGet(server,comunity, oid)?

thanks for your time :)

 

EDIT: So, there's an output when I use "A1" parameter (but not the correct one), but with A0 I returns 0 or something like that


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>