Jump to content

Recommended Posts

Kyan

Hello!
Been working on this, SNMP UDF is a bit incomplete, but found a way to make it work as I wanted.
 

D4mfgMN.png

 
Features

  •  Restarts wan connection
  •  Retrieve connected devices (Local IP/MAC address/device name)
  •  Displays: router external ip | up time | brand & model

I made this for my home router, but probably works on others models and brands (except the restart function, that is a TP-LINK exclusive xD)
 
TP-Link Manager v0.7.1.zip (v0.7 - 38 downloads)
 
#Changelog


v0.7.1
  • Added error checking for when an OID doesn't exist or can't be read
  • Disables everything and show a message when nothing is retrieved (argumentum idea :))

Edited by Kyan
  • Like 2

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Share this post


Link to post
Share on other sites
argumentum

in my house it failed but I think the bounds are wrong

If UBound($aFill) < UBound($aOIDs) Then ReDim $aFill[UBound($aOIDs)][2] ;If something failed, nvm lel

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("TP-LINK Manager", 351, 211)
$Edit1 = GUICtrlCreateEdit("Ainda não sei por aqui os IPs ligados", 0, 48, 350, 137, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN,$ES_READONLY))
$Label1 = GUICtrlCreateEdit($aFill[2]&" "&$aFill[3], 16 - 10, 4, 176, 20 - 2, 0x0800,0x00000020) ;$ES_READONLY, $WS_EX_TRANSPARENT

but then again, if I fix that it fails again

If (StringMid($result[9][0],1,$oidLength) <> $_oid) Or (Int(StringRight($result[9][0],3)) = 255) Then ExitLoop ;checkin if you're out of your desired MIB SubTree

I hope this helps to make a non crashing code, i did not continue looking

Thanks for sharing.

Share this post


Link to post
Share on other sites
TheDcoder

Please provide "WinHttpConstants.au3"

TD :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
TheDcoder

Error:

 

"C:UsersTheDcoderDesktopTP-Link ManagerTP-LINK Manager.au3" (40) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$Label1 = GUICtrlCreateEdit($aFill[2]&" "&$aFill[3], 16 - 10, 4, 176, 20 - 2, 0x0800,0x00000020)
$Label1 = GUICtrlCreateEdit(^ ERROR

 

Thanks @mLipok :)

TD


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
Kyan

argumentum and TheDecoder
 
See if this fix it

If UBound($aFill) < UBound($aOIDs) Then ReDim $aFill[UBound($aOIDs)] ;If something failed, nvm lel

EDIT: _SNMP_GETsubtree fix

Func _SNMP_GETsubtree($_oid,$firstSufix = '')
    Local $SNMP_ReqID = 0, $result,$SNMP_Command, $Timeout_msec = 900, $oidLength = StringLen($_oid), $return[1][2], $_contET = 1
    $_reqOID = $_oid&$firstSufix
    While 1
        If $SNMP_ReqID > 0 Then $_reqOID = $result[9][0]
        $SNMP_ReqID +=1
        $SNMP_Command = _SNMPBuildPacket($_reqOID, $sSNMPcommunity, 2, $SNMP_ReqID, "A1")
        UDPSend($Socket, $SNMP_Command)
        $Timeout = TimerInit()
        While 1
            $srcv = UDPRecv($Socket, 100)
            If $srcv <> "" Then $result = _ShowSNMPReceived($srcv)
            If @error Or TimerDiff($Timeout) > $Timeout_msec Then ExitLoop
            ;_ArrayDisplay($result)
            ;ConsoleWrite($srcv&@LF)
            Sleep(10)
        WEnd
        If IsArray($result) Then
            If (StringMid($result[9][0],1,$oidLength) <> $_oid) Or (Int(StringRight($result[9][0],3)) = 255) Then ExitLoop ;checkin if you're out of your desired MIB SubTree 
                                                                                        ;// = 255 is for the case of .1.3.6.1.2.1.4.22.1.2.1.192.168.1.255;  FF-FF-FF-FF-FF-FF
            ReDim $return[$_contET][2]
            $return[$_contET-1][0] = $result[9][0]
            $return[$_contET-1][1] = $result[9][1]
            $_contET +=1
        Else
            If Not @Compiled Then ConsoleWrite("_SNMP_GETsubtree() ==> Failed to retrieve OID:"&$_reqOID&@LF)
            ; Failed to retrieve OID => This can happen by: Your router has SNMP disabled, you enter the a wrong SNMP community name OR your router simply doesn't support that OID
            ExitLoop ; Since failed to retrieve the last OID it can't walk to the next
        EndIf
    WEnd
    Return $return
EndFunc

Please, let me know if there's more errors :)

(my script lacks some error checking, thats why it was failing)

if there's a couple of people using this script I can add english language to everything (yeah, I'm that lazy ,that's why I use scripts :P)

Edited by Kyan
  • Like 1

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Share this post


Link to post
Share on other sites
argumentum

argumentum and TheDecoder

cool, it does not show anything . I added that if nothing found, disable the buttons

If StringRegExp($aFill[2],'(?i)TP.LINK') Then $isTPlink = 1

If StringStripWS(GUICtrlRead( $IPext ),8) = "" Then
    GUICtrlSetState($btnReset,$GUI_DISABLE)
    GUICtrlSetState($btnRLD,$GUI_DISABLE)
    GUICtrlSetData($Label1,"nothing to see, carry on..")
EndIf
Edited by argumentum
  • Like 1

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • 31290
      By 31290
      Hi everyone, hope you are doing fine
      Well, I'm currently writing a small script that goes to a certain web page, finds the first link of a specified section and download the file associated to this link.
      Depending on the computer that the tool is launched, the script gets the computer model and search in the (provided here) ini file which link to follow.
      At first, Dell was kind enough to provide only one link but now, they provide two of them. The first one is now a .txt file (  ) whereas my script has been designed to download only the fist and latest link released for the BIOS Update.

      Here's the current code which is working with only the first and latest link of the BIOS category:
      So the question is: 
      In the case of double links like shown in the picture above, how it is possible to tell the script to download only the link containing an the .exe file?
      Of course, I could have changed the array result to [1] instead of [0] [which is working] but it seems that Dell does that randomly and that I deal with a lot of computer models.
      Thanks for the help you can provide, 
      -31290-
       
      SEE_BIOS_LINKS.ini
    • ripdad
      By ripdad
      I have had several people ask for this, so I decided to work the algorithm for it and this is the result.
      What is it?
      A Gateway Proxy Sends and Receives Data Unmodified.
      https://en.wikipedia.org/wiki/Proxy_server
      What is it used for?
      You can use it as a gateway, relay or router between two known static IP addresses.
      More information is in the header of the script.
      Download: LocalGatewayProxy.au3
      You will need WSA_NBTCP.au3 from here:
      https://www.autoitscript.com/forum/topic/191954-wsa_nbtcp-v100-udf/
      If you have any questions or problems, let me know.
       
    • nacerbaaziz
      By nacerbaaziz
      hello
      please i need to link a progress bar with a time can you help me?
      e.g
      i want to set a progress bar for 10 sec
      am waiting for your answers
      thank you.
    • leomoon
      By leomoon
      Hello,
      I'm trying to write a hotkey program and I know exactly how to do it but it will be hard coded and the user won't be able to edit it.
      HotKeySet("{ESC}", "HotKeyPressed") HotKeySet("^!d", "HotKeyPressed") HotKeySet("^+x", "HotKeyPressed") While 1 Sleep(500) WEnd Func HotKeyPressed() Switch @HotKeyPressed Case "{ESC}" Exit Case "^!d" ShellExecute("D:\Docs") Case "^+x" ShellExecute("D:\Docs\My Portables\Burner\AnyBurn\AnyBurn.exe") EndSwitch EndFunc I want the program to read a file that has hotkeys on odd lines and paths on even lines but I don't see how the program will load into itself.
      Is it even possible?
      Thanks.
    • robertcollier4
      By robertcollier4
      Choose a directory of link files to replace substring paths.
      LNKSubstringReplacer.au3
      _RecFileListToArray.au3

       
      #include <Array.au3> #include <_RecFileListToArray.au3> #include <File.au3> $modalSimulMode = MsgBox (3, "Simulated mode?" ,"Would you like to perform this substring replacement of link files in simulated mode? In simulated mode you will see what would have happened in a file named" & @CRLF & "LNKSubstringReplacer Results.txt" & @CRLF & @CRLF & "but no changes will be made" & @CRLF & @CRLF & "Yes - simulated mode, no changes will be made" & @CRLF & "No - resaving mode, changes will be made") If $modalSimulMode = 2 Then Exit ElseIf $modalSimulMode = 6 Then $saveAgain = False ElseIf $modalSimulMode = 7 Then $saveAgain = True ElseIf MsgBox(0, "ERROR", "Error with asking simulated mode, exiting") EndIf Local $dirToSearchDefault = @ProgramsCommonDir ; Local $dirToSearchDefault = "T:\testdir" Local $dirToSearch = InputBox("Select directory", "In which directory would you like to search for files to perform substring link replacement for?", $dirToSearchDefault, "", 520, 320) If $dirToSearch = "" Then Exit EndIf Local $StrToSearch = InputBox("Specify substring to search for", "What substring would you like to be replaced for link target and link working directory?", "", "", 520, 320) ; If $StrToSearch = "" Then ; allow empty input in case just want to resave and fix all links If @error = 1 Then Exit EndIf Local $StrToReplace = InputBox("Specify substring to replace with", "All occurrences of" & @CRLF & $StrToSearch & @CRLF & @CRLF & "Contained in links in the directory " & @CRLF & $dirToSearch & @CRLF & @CRLF & "Should be replaced with what?", $StrToSearch, "", 520, 320) ; If $StrToSearch = "" Then ; allow empty input in case just want to resave and fix all links If @error = 1 Then Exit EndIf Local $listFiles = _RecFileListToArray($dirToSearchDefault, "*", 1, 1, 0, 2) If (Not IsArray($listFiles)) and (@Error=1) Then MsgBox (0,"","No files found in search path, exiting") Exit EndIf ; _ArrayDisplay($listFiles, "$aFileList") ; Write simulated results to a text file $dateNow = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & @MIN & @SEC $fileLnkPath = @ScriptDir & "\" & $dateNow & " LNKSubstringReplacer Results.txt" FileDelete($fileLnkPath) Local $fileTextList = FileOpen($fileLnkPath, $FO_APPEND) If $fileTextList = -1 Then MsgBox(0, $fileLnkPath, "FileOpen Error, exiting") Exit EndIf FileWrite($fileTextList, "---------------------------------------" & @CRLF) FileWrite($fileTextList, "Link file to scan" & @CRLF) FileWrite($fileTextList, "Link target" & @CRLF) FileWrite($fileTextList, "Link working directory" & @CRLF) Local $thisExtension = "" Local $sDrive = "", $sDir = "", $sFileName = "" For $i = 1 To $listFiles[0] ; Only do LNK extension Local $listFilesPathSplit = _PathSplit($listFiles[$i], $sDrive, $sDir, $sFileName, $thisExtension) ; MsgBox(0, $i, $listFiles[$i] & " , " & $thisExtension) If(StringCompare(".lnk", $thisExtension, 2) == 0) Then ; If(NOT StringCompare(".lnk", $thisExtension, 2)) Then FileWrite($fileTextList, @CRLF & "---------------------------------------" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) Local $thislnkArray = FileGetShortcut($listFiles[$i]) If(NOT @error) Then If($thislnkArray[0] <> "") Then ; _ArrayDisplay($lnkArray) ; FileWrite($fileTextList, $thislnkArray[0] & @CRLF) ; FileWrite($fileTextList, $thislnkArray[2] & @CRLF) FileWrite($fileTextList, $thislnkArray[0] & $thislnkArray[2] & @CRLF) FileWrite($fileTextList, $thislnkArray[1] & @CRLF) ; Allow empty $StrToSearch or empty $strToReplace just to fix and resave all links If( ($StrToSearch = "") OR ($StrToReplace = "") ) Then $newLinkTarget = RemoveSurrQuotes($thislnkArray[0]) $newLinkTargetArgs = $thislnkArray[2] $newLinkWorkingDir = RemoveSurrQuotes($thislnkArray[1]) Else $newLinkTarget = RemoveSurrQuotes(StringReplace($thislnkArray[0], $StrToSearch, $StrToReplace)) $newLinkTargetArgs = StringReplace($thislnkArray[2], $StrToSearch, $StrToReplace) $newLinkWorkingDir = RemoveSurrQuotes(StringReplace($thislnkArray[1], $StrToSearch, $StrToReplace)) EndIf ; Remove ending backslash from working dir While (StringRight($newLinkWorkingDir, 1) = "\") $newLinkWorkingDir = StringTrimRight($newLinkWorkingDir, 1) WEnd If($saveAgain) Then FileWrite($fileTextList, @CRLF & "Resaved:" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) FileWrite($fileTextList, $newLinkTarget & " " & $newLinkTargetArgs & @CRLF) FileWrite($fileTextList, $newLinkWorkingDir & @CRLF) $saveResult = FileCreateShortcut( _ $newLinkTarget, _ $listFiles[$i], _ $newLinkWorkingDir, _ $newLinkTargetArgs, _ $thislnkArray[3], _ $thislnkArray[4], _ "", _ $thislnkArray[5], _ $thislnkArray[6] _ ) If(NOT $saveResult) Then FileWrite($fileTextList, "ERROR Unable to resave: " & $listFiles[$i] & @CRLF) EndIf Else FileWrite($fileTextList, @CRLF & "Simulated Resave:" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) FileWrite($fileTextList, $newLinkTarget & " " & $newLinkTargetArgs & @CRLF) FileWrite($fileTextList, $newLinkWorkingDir & @CRLF) EndIf Else FileWrite($fileTextList, "Found empty link target, skipping " & @CRLF) EndIf Else FileWrite($fileTextList, "FileGetShortcut Error, skipping " & @CRLF) Exit EndIf Else FileWrite($fileTextList, @CRLF & "---------------------------------------" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) FileWrite($fileTextList, "Skipping not a link file" & @CRLF) EndIf Next FileClose($fileTextList) ;--------------------------------------------------------------- Func RemoveSurrQuotes($myString) Return StringReplace($myString, '"', '') EndFunc ;---------------------------------------  
×