enaiman Posted January 10, 2009 Author Share Posted January 10, 2009 @dmollico That is happening if something in the packet is wrong. I can see that you are using "A0" (get request) with that OID. This is not working always because A0 expects an instance to be specified. In order to work you will have to add a 0 at the end of your OID (instance 0) Global $SNMP_OID = "1.3.6.1.2.1.43.10.2.1.4.1.1.0" If that doesn't work, you will need to use (the easiest way to get the info you need) "A1" (get next) with your current OID (Global $SNMP_OID = "1.3.6.1.2.1.43.10.2.1.4.1.1") Hope any of these solutions will work (I'll be back next week) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
enaiman Posted March 10, 2009 Author Share Posted March 10, 2009 Time for a new update Added GetBulk support. This works for SNMP v2 and up (if used with SNMP v1 will return an error). GetBulk is used to retrieve large amounts of OIDs in the same packet - a single querry is send with an OID (the start OID) and a number of OId to be returned. GetBulk can work with a generous amount of OId requested but using it with too many OIDs will make the udf to reach its (string and array) limits and the script will fail. I have successfully tested it for 80 OIDs but failed for 100 (I guess the arrays in the udf were too small) - as I said, it depends on OID's length - that's why I would recommend a value of 50 as being "safe". The return type of the function have been changed as well. The old return has an "educational" value, showing everything received in a not-so-easy to work with array. The new return is a 2D array having in pos [0][0] the error code and the next elements are pairs OID - ClearValue. The old return (array) is still built in the memory and can be accessed anytime - its name is $SNMP_Received. Also I have changed the example script to show 4 different request types. That's it for now Have fun. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
ptrex Posted March 11, 2009 Share Posted March 11, 2009 @enaiman Tested and approved. Works like a charm. This is a very nice and usefull UDF !! Thanks for your persistance in the SNMP UDF. regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
enaiman Posted March 11, 2009 Author Share Posted March 11, 2009 @ptrex The fact that you find this udf useful is enough reward for me; I haven't wasted the time working on it It still needs some work in its actual form (formatting the udf, coments and making the code more compact; a "tunning" job) and I still have SNMP v3 to look forward to. I don't know about SNMP v3 it is a big project and I'm afraid I won't have enough time to work on it. It has brought alot of changes and encryption and authentication might prove too much for me, plus I'm not sure I can find enough info on the Internet about SNMPv3 packet structure. As I said, I'm not sure atm if I would add support for SNMPv3 ... but .. who knows? maybe SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Sjee Posted March 26, 2009 Share Posted March 26, 2009 (edited) Thanks for the great UDF. I have some problems when I use for example this 1.3.6.1.4.1.26565.1.1.1.24.0 OID. The result also shows a different OID... (1.3.6.1.4.129.10113.207.69.1.1.1.24.0) any idea what is causing this problem? Edited March 26, 2009 by Sjee Link to comment Share on other sites More sharing options...
enaiman Posted March 30, 2009 Author Share Posted March 30, 2009 I have some problems when I use for example this 1.3.6.1.4.1.26565.1.1.1.24.0Wow - I haven't seen such a great number 26565 - obviously my UDF wasn't ready to handle it ... but it will.Issue fixed; it will work fine with such great numbers but not over 65535 I'll upload the changed version very soon - check first page.Thanks for testing and finding this error SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Sjee Posted March 30, 2009 Share Posted March 30, 2009 Thanks for your quick support. I might be doing something wrong but I still get an error on this OID, the OID returned is 1.3.6.1.4.1.16591.16591.69.1.1.1.24.0 Link to comment Share on other sites More sharing options...
enaiman Posted March 30, 2009 Author Share Posted March 30, 2009 (edited) Do you mean that the OID "returned" by the polled device is decoded wrong? Or this is the OID you are trying to poll? I have checked again the UDF and it works - are you sure you have downloaded the new version and replaced the old one? (it should have version 1.3) If this is correct - can you post here the packet you receive and it's badly decoded? (it is the variable passed to _ShowSNMPReceived function) Edited March 30, 2009 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Axel82 Posted April 1, 2009 Share Posted April 1, 2009 (edited) I have some problems too: The OID should look so - ".1.3.6.1.4.1.15.1143.1.1" - with point before 1. So it is written to instructions to a server. Snmpget.exe returns value "81" and it's correct. But script returns "1.3.6.1.4.1.15.132215.1.1 - 0" - another OID, and no value. If i try to use OID without point, return value looks the same. Edited April 1, 2009 by Axel82 Link to comment Share on other sites More sharing options...
enaiman Posted April 2, 2009 Author Share Posted April 2, 2009 Thank you for providing feedback Took me some time to find that there is an error somewhere - then tooke me some more time to isolate and correct it. I still can't believe that the error was in "_encode" function (it was there since the begining but it went undetected) I have corrected it and uploaded the new version (1.3.1) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Sjee Posted April 2, 2009 Share Posted April 2, 2009 Thanks, the problem is solved in version 1.3.1! Link to comment Share on other sites More sharing options...
Axel82 Posted April 14, 2009 Share Posted April 14, 2009 My case still doesn't work. If i use OID=1.3.6.1.2.1.15.1271.1 - answer is "1.3.6.1.2.1.15.1271.1.0 - 0", should be 81. If OID=.1.3.6.1.2.1.15.1271.1, answer is "1.3.0.1.3.6.1.2.1.15.1271.1 - 0". Link to comment Share on other sites More sharing options...
enaiman Posted April 14, 2009 Author Share Posted April 14, 2009 @Axel82What method are you using? "A0" (GetRequest) or "A1"(GetNext)?My guess is that you're using GetNext since the OID returned differs so much.I don't know what equipment are you trying to use my udf with; you can specify that and I might be able to dig around ...Anyway - try to use 1.3.6.1.2.1.15.1271.1.0 and "A0" - if 0 instance exists it will return a value then.Let me know what happens. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Axel82 Posted April 15, 2009 Share Posted April 15, 2009 (edited) I used A0, A1 and any another posible kinds of "A". Result the same.Here is some screenshots:Real state of serverScript, using with point before OUIDScripts without point.Using OID ".iso.org.dod..." instead numbers gives nothing Edited April 15, 2009 by Axel82 Link to comment Share on other sites More sharing options...
enaiman Posted April 15, 2009 Author Share Posted April 15, 2009 @Axel82I guess I found your mistake: you are using a wrong OID.From your SNMP browser I can read: .iso.org.dod.internet.private.enterprises and this will translate in:iso = 1org = 3dod = 6internet = 1private = 4enterprises = 1So the correct OID will be 1.3.6.1.4.1.15.1271.1.0 not 1.3.6.1.2.1.15.1271.1.0 which is the equivalent of .iso.org.dod.internet.mgmt.mib2.bgp.1271.1.0Try the OID above and all will be fine.Note: OIDs in "non-numeric" form are not supported at the moment (maybe a future project ... not sure yet). The only OID form supported is 1.3.6.x.y.... (no dot in front) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Axel82 Posted April 16, 2009 Share Posted April 16, 2009 It works! It's alive! Thank you so much! Link to comment Share on other sites More sharing options...
enaiman Posted April 17, 2009 Author Share Posted April 17, 2009 I'm glad it works for you. Everybody makes small mistakes - we're only humans after all SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Axel82 Posted April 19, 2009 Share Posted April 19, 2009 (edited) I have one more question.Here is screen of the folder structure in different computers. How can i get names of folders in array for each computer? Use "getnext" not the best idea, because the folders contain too much keys. Edited April 19, 2009 by Axel82 Link to comment Share on other sites More sharing options...
enaiman Posted April 20, 2009 Author Share Posted April 20, 2009 I'm not sure I understand exactly what do you want to get ... Do you want to get the list of all folders under iso.dod.internet.private.enterprise.15 ? Please give a more detailed explanation. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Axel82 Posted April 20, 2009 Share Posted April 20, 2009 (edited) Sorry, i use machine translator, my english not well. Yes, i need to get that list in array, but only names of folders, without contents. Edited April 20, 2009 by Axel82 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now