Kyan

TP-LINK Manager v0.7.1

7 posts in this topic

#1 ·  Posted (edited)

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
2 people like this

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



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

Please provide "WinHttpConstants.au3"

TD :)


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

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

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

Share this post


Link to post
Share on other sites

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 - BETA * 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 * Best coding practices * 

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: 2017-06-04

Share this post


Link to post
Share on other sites

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

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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
1 person likes this

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

#7 ·  Posted (edited)

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
1 person likes this

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

    • 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 ;---------------------------------------  
    • 31290
      By 31290
      Hi everyone, 
      Following this page:
      http://downloads.dell.com/published/pages/latitude-e5450-laptop.html
      I have to download the BIOS for the E5440 model. As I don't know in which order Dell will place the description and the link to download the file (also because the 5440 can be put in first) I'd like to make  the following piece of code to search only first the link that deals with the E5440:
      (The only thing I'm sure is that the string E5440 will be either in the first or the second position and I need to download the corresponding link)
      Local $sRead = InetRead('http://downloads.dell.com/published/pages/latitude-e5450-laptop.html', 1) ConsoleWrite(BinaryToString($sRead) & @CRLF) Local $aData = _StringBetween(BinaryToString($sRead), 'Type: BIOS', 'Category:') TrayTip("", "Downloading latest BIOS Version, please wait...", 10, 3) Local $aLinks = _StringBetween($aData[0], '<A HREF="/', '"><IMG') For $i = 0 To UBound($aLinks) - 1 $aLinks[$i] = 'http://downloads.dell.com/' & $aLinks[$i] Next Local $hDownload = InetGet($aLinks[0], @DesktopDir & "\BIOSE5450.exe", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD) Local $iFileSize = Round(FileGetSize(@DesktopDir & "\BIOSE5450.exe") / 1048576) InetClose($hDownload) MsgBox(0, "", "The latest E5450 BIOS (" & $iFileSize & " MB) have been downloaded")
      I was thinking of an string search in the array but all my attempts failed for now.
      Can someone could give me a hand over here.
       
    • Kanashius
      By Kanashius
      This Epubmanager is good for short loadingtime and Detailed Information about the Books. With the manager it comes an full-reader with readout-function (TTS), using installed voices.
      This Program is used to Manage e-books/epubs. You can import directorys. A lot of information is read from the epub and saved in a database.
      Most important is the speed of loading books, because the management should be used for lots of epubs.
      All chargings are displayed. There is also an Sql-Console, if you want to edit a lot of entry, otherwise you can do a rightclick and edit every Element in another window.
      Also there is a Epub-Reader to read the epubs just with a doubleclick at any entry.

      Information saved in the database (if they can be read in the epub):
      identifier, author, description, title, genre, creationdate, path, speach
      Information about Epub-Reader:
      The Epub-Reader opens Epubs and they can be read chapter by chapter.
      At the left side there is a Listbox, where you can select the chapters
      There is also a read out function, reading your epub. (You can change Voice and Audiooutput, but you need to have installed a TTS-Speach).
      Also you can edit the font-size.
    • ur
      By ur
      I wrote below code to delete a file.
      But when I am trying to delete a shortcut, it it deleting target file instead of shortcut when I created a context menu entry for this executable.
      The executable is working fine if we use it normally instead of context menu.But with COntext menu it is taking the target instead of shortcut.
       
      By using the below registries.
      Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\Delete Permanently\command] @="\"C:\\Program Files\\Permanent Delete\\Delete Permanently.exe\" \"%1\"" And compiled the below code to executable.
       
      DeleteFile($CmdLine[$i]) ; Adding the path through CMD line argument. Func DeleteFile($sFilePath) Local $iDelete = FileDelete($sFilePath) ; Display a message of whether the file was deleted. If $iDelete Then MsgBox($MB_ICONINFORMATION, "Deleting ...", "The file was successfuly deleted: " & $sFilePath,10) Else MsgBox($MB_ICONERROR, "Deleting ...", "An error occurred while deleting the file: " & $sFilePath & @CRLF & "Please check whether it is in use by any process",10) EndIf EndFunc  
    • CaptainSparky
      By CaptainSparky
      Hello.
      I have designed and created a simple Clipboard manager in AutoIt. The project is open for any ideas, I hope you found it useful (and if you did please like my post so I can continue making software).
      Features
      [Done] Can store data in up to 5 slots.
      [Done] Options form.
      [Done] System Tray menu.
      [Done] Supports Hot-keys when pasting/copying data.
      [Done] Ability to copy and store text.
      [Done] Clipper theme.
      [Coming soon] Ability to copy and store files and folders.
      [Coming soon] Clipboard history form. ( currently logs history into a text file )
      And Much Much More!
      Source
      Conclusion
      If you find any bugs or you have any ideas you are free to leave them here.
      Please give this script a try because it took time. If you enjoyed this script PLEASE smash the like button, Thanks!
      ALSO: Have any script ideas? Please share them with me because I will make them!
       
      Clipper.au3