Allow2010 Posted November 9, 2013 Author Posted November 9, 2013 (edited) Thanks for your questions. What you ask can be done with the UDF. Downloading a file is not yet implemented (want to add sth to up and download the phonebook as well)... I can not find the time to solve you questions...maybe someone else can...check back a few weeks later, maybe i will add something. Edited November 9, 2013 by Allow2010
Zoli1972 Posted December 17, 2013 Posted December 17, 2013 (edited) @Allow2010: Sorry, but I'm unable to get your script working. My Autoit says, global variables wouldn't be declared. I've already double-checked, if any function in the script uses variables before declaration, but found nothing wrong. I've also noticed your warning about the _FB_Init() function, which has the declaration of the gobal variables inside. I've even moved them all to the main script to be sure, that they're running before everything else, but that didn't help either. I'm using Windows XP SP3, Autoit 3 Wrapper v.2.0.1.24. Tried your script version 1.3 and 1.5. Please, help. I'm trying to write a script, that retreives ADSL/VDSL signal quality information from the Frintz!Box. Maybe a UDF that can be added in future releases? Edited December 17, 2013 by Zoli1972
Allow2010 Posted December 22, 2013 Author Posted December 22, 2013 Hmm, which version of udf and which autoit version? Can you test on a newer Windows (7 if possible?)
mickeyd Posted February 7, 2014 Posted February 7, 2014 (edited) Hi All, I found this API useful to build some functions for querying the VPN status and switching VPNs on and off. These functions will probably require FRITZ!OS 6.01 or newer and have only been tested on the FB 7390: expandcollapse popup#include-once ;======================================================================================================= ; Description ...: En-Disable VPN Connections by Name ; Parameters ....: Name of VPN-Connection, "on"/"off" ; Return values .: 0 on success, 1=Name not found ; Author ........: mickeyd ; Modified by....: ; Remarks .......: Tested with FB 7390, FRITZ!OS: 6.01 ; Related .......: ; Example(s).....: ;======================================================================================================== Func _FB_SwitchVPN($vpnname, $onoff = "on") Local $aVPNs = _FB_GetVPNs() Local $i Local $updates = 0 Local $found = 0 Dim $params[1][2] = [['getpage', '/internet/vpn.lua']] _FB_Logfile($vpnname & ":" & $onoff) For $i=0 To UBound($aVPNs)-1 If StringCompare($vpnname,$aVPNs[$i][0])=0 Then $found+=1 ;Changed? If StringCompare($onoff,$aVPNs[$i][1])<>0 Then $aVPNs[$i][1]=$onoff $updates+=1 ;_FB_Logfile("upd") EndIf EndIf If $aVPNs[$i][1]="on" Then $params = _FB_AddOrUpdateFieldIn2DArray($params, 'active_' & ($i+1), "1") Else ;no active_(n) param if vpn is disabled EndIf Next If $updates>0 Then $params = _FB_AddOrUpdateFieldIn2DArray($params, 'apply', "") _FB_Logfile("POST") _FB_PostForm($params) EndIf If $found=0 Then _FB_Logfile("VPN '" & $vpnname "' not found.") Return 1 Else Return 0 EndIf EndFunc ;======================================================================================================= ; Description ...: Get current VPN Status & Names ; Parameters ....: ; Return values .: Array of VPN Connections,[x][0]:Connection name, [x][1]:Active: on/off, ; [x][2]:Status 1/0,[x][3]:Internet-Ip, [x][4]:Src-Ip, [x][5]: Dst-Ip ; Author ........: mickeyd ; Modified by....: ; Remarks .......: Tested with FB 7390, FRITZ!OS: 6.01 ; Related .......: ; Example(s).....: ;======================================================================================================== ; Func _FB_GetVPNs() ;read all dect settings and return them in an array Dim $vpn[1][6] Dim $params[1][2] = [['getpage', '/internet/vpn.lua']] $result = _FB_GetRequest($params) ;_FB_Logfile($result & @CRLF) ;Expected Format (FB7390, OS 6.01) ; Multiple Rows: ;<tr> ;<td class="active"><input type="checkbox" name="active_1" value="1" id="ui_Active_1" checked="checked" ></td> ;<td class="name"><nobr><span title="FRITZBOX1">FRITZBOX1</span></nobr></td> ;<td class="remote_ip"><nobr><span title="87.1.2.3">87.1.2.3</span></nobr></td> ;<td class="src"><nobr><span title=""></span></nobr></td> ;<td class="dst"><nobr><span title=""></span></nobr></td> ;<td class="led_gray"></td> ;... ;</tr> Local $i=0 While $i<100 ;arbitrary upper limit Local $matches $matches = StringRegExp($result, '(?i)name="active_' & ($i+1) & _ '"([^>]*)>.*?td class="name".*?<span title="([^"]*)"(.*?)<\/tr>', 1) If @error<>0 Then ;_FB_Logfile("_FB_GetVPNs: match error: " & @error) If ($i=0) Then Return 0 ;no matches ExitLoop Else ReDim $vpn [$i+1][6] $vpn[$i][0]=$matches[1] If StringInStr($matches[0],'"checked"') Then $vpn[$i][1]="on" Else $vpn[$i][1]="off" EndIf ;parse optional parameters Local $matches2 ;Status $matches2 = StringRegExp($matches[2], '(?i)class="led_([^"]*)"', 1) If @error=0 Then If StringCompare($matches2[0],'green')=0 Then $vpn[$i][2]='1' ;connected Else $vpn[$i][2]='0' ;not connected EndIf Else $vpn[$i][2]='' EndIf ;remote_ip $matches2 = StringRegExp($matches[2], '(?i)class="remote_ip">(.*?)<\/td>', 1) If @error=0 Then $vpn[$i][3]=StringRegExpReplace($matches2[0],'<[^>]*>','') Else $vpn[$i][3]='' EndIf ;src $matches2 = StringRegExp($matches[2], '(?i)class="src">(.*?)<\/td>', 1) If @error=0 Then $vpn[$i][4]=StringRegExpReplace($matches2[0],'<[^>]*>','') Else $vpn[$i][4]='' EndIf ;dst $matches2 = StringRegExp($matches[2], '(?i)class="dst">(.*?)<\/td>', 1) If @error=0 Then $vpn[$i][5]=StringRegExpReplace($matches2[0],'<[^>]*>','') Else $vpn[$i][5]='' EndIf _FB_Logfile($i & ": " & $vpn[$i][0] & "," & $vpn[$i][1] & " Status:" & $vpn[$i][2] _ & " Remote-Ip:" & $vpn[$i][3] & " Src:" & $vpn[$i][4] & " Dst:" & $vpn[$i][5]) $i=$i+1 EndIf WEnd Return $vpn EndFunc ;==>_FB_GetVPNs Edited February 7, 2014 by mickeyd
Allow2010 Posted February 23, 2014 Author Posted February 23, 2014 (edited) Thank you for sharing...very nice!!! Edited February 23, 2014 by Allow2010
benlein Posted March 17, 2014 Posted March 17, 2014 Thanx for this nice api. I'm using _FB_DIAL with FB 7270 os 5.54 on Fon1 which works great. But I'm not able to use it on DECT attached device. Calls go out from Fon1 even i changed i.e. to 613 (internal nr of device). In the log there is 613 shown but not used. Maybe its an FB issue. Any Ideas? _FB_Dial($PhoneNr, "1") ; Call from Fon1 (TAE attached wired device) _FB_Dial($PhoneNr, "613") ; Call from Fon1 (TAE attached wired device) but should be wireless DECT phone
Canni Posted March 27, 2014 Posted March 27, 2014 (edited) Ist it possible to get the temperature information? http://www.wehavemorefun.de/fritzbox/Cpu_(ui) http://devrandom.de/postshtml/2013-03-10_fbox_temp.md.html Thanks ! Edited March 27, 2014 by Canni
Bluesmaster Posted August 3, 2014 Posted August 3, 2014 Thank you very much My UDF: [topic='156155']_shellExecuteHidden[/topic]
JustMe2014 Posted August 16, 2014 Posted August 16, 2014 (edited) Hello, at first big thanks for this great tool! I have tested now all versions, but i have some troubles. I try to reboot my FritzBoxes, v1.5 can do a reboot for Firmware 29.04.89 and 39.04.77 but with the version 58.04.85 it doesn't work. Maybe i do something wrong. Here is th Log File: 16.08.2014-21:18:23: Init OK 16.08.2014-21:18:23: Executing GetRequest 16.08.2014-21:18:23: This is no LUA page: /cgi-bin/webcm? 16.08.2014-21:18:23: Executing _FB_Request 16.08.2014-21:18:23: 1 fields found, adding query to request 16.08.2014-21:18:23: Query was built: getpage=../html/login_sid.xml 16.08.2014-21:18:24: Challenge found: 4eb57a45 16.08.2014-21:18:24: Response calculated: 4eb57a45-0b1e3218eca6efc3d255d3ef1a984bd4 16.08.2014-21:18:24: Executing PostForm 16.08.2014-21:18:24: This is no LUA page: /cgi-bin/webcm 16.08.2014-21:18:24: Executing _FB_Request 16.08.2014-21:18:24: 2 fields found, adding query to request 16.08.2014-21:18:24: Query was built: getpage=../html/login_sid.xml&login:command/response=4eb57a45-0b1e3218eca6efc3d255d3ef1a984bd4 16.08.2014-21:18:24: SID found: 696fc378be4b1fab 16.08.2014-21:18:24: Login OK. Current SID is 696fc378be4b1fab 16.08.2014-21:18:24: Executing PostForm 16.08.2014-21:18:24: Field sid is already uptodate 16.08.2014-21:18:24: This is no LUA page: /cgi-bin/webcm 16.08.2014-21:18:24: Executing _FB_Request 16.08.2014-21:18:24: 2 fields found, adding query to request 16.08.2014-21:18:24: Query was built: getpage=../html/login_sid.xml&sid=696fc378be4b1fab 16.08.2014-21:18:25: SID found: 696fc378be4b1fab 16.08.2014-21:18:25: Login OK, running examples 16.08.2014-21:18:25: Executing Reboot Step1 16.08.2014-21:18:25: Executing _FB_Request 16.08.2014-21:18:25: 2 fields found, adding query to request 16.08.2014-21:18:25: Query was built: sid=696fc378be4b1fab&reboot= 16.08.2014-21:18:25: Executing Reboot Step2 16.08.2014-21:18:25: Executing _FB_Request 16.08.2014-21:18:25: 1 fields found, adding query to request 16.08.2014-21:18:25: Query was built: = 16.08.2014-21:18:25: Error: _WinHttpReceiveResponse failed And i want to know also if it is possible to enable and disable the SIP account? Best Regards, Sabri Edited August 16, 2014 by JustMe2014
Allow2010 Posted October 7, 2015 Author Posted October 7, 2015 updated to version 1.61 for latest labor FritzOS
Allow2010 Posted October 19, 2015 Author Posted October 19, 2015 updated to version 1.636 for latest labor FOS and many changes and new functions
Allow2010 Posted October 23, 2015 Author Posted October 23, 2015 update for lates labor version 06.36-31629 BETA
Allow2010 Posted October 24, 2015 Author Posted October 24, 2015 (edited) update and fixes forFRITZ!OS:06.36-31656 BETA goodbye for now... Edited October 24, 2015 by Allow2010
informatik_wsl Posted November 30, 2015 Posted November 30, 2015 Hello i have a little problem with my Fb Script im a newbie and trying to Upload a Xml Phonebook to my Fritzbox.So here is my problem . i trying to login my FritzBox but with my Script i cant find. Forms on the User Interface from my Fritzbox. Here is LoginScript Thank you Guys ;-) #include<ie.au3>$url = "http://fritz.box"$passwort = "password"$oIE = _IECreate($url)$oForm = _IEGetObjById($oIE, "uiMainForm") ;uiLogin;$oNummer = _IEFormElementGetObjByName($oForm, "nummer");_IEFormElementSetValue($oNummer, $nummer)$oPW = _IEFormElementGetObjByName($oForm, "uiPass")_IEFormElementSetValue($oPW, $passwort)$oButton = _IEGetObjByName ( $oIE, "uiSubmitLogin")_IEAction($oButton,"click")
Allow2010 Posted December 21, 2015 Author Posted December 21, 2015 @informatik_wslthis is the wrong thread for your question. My UDF uses a different approach.
Allow2010 Posted December 21, 2015 Author Posted December 21, 2015 UDF works fine with current Firmware 6.50 for FritzBox 7490
nobbitry Posted September 17, 2016 Posted September 17, 2016 (edited) I searched for something, to let my smartphone ring, when I couldn't find it at home. I had to laugh, when I saw your example "dialtool.au3". Almost nothing left to do for me Great work. Thank you really much. Edited September 17, 2016 by nobbitry
Canni Posted October 2, 2016 Posted October 2, 2016 Great work! Can you please tell me how to get status info like CPU temperature from statistics-page? Thank you :-)
nobbitry Posted May 24, 2017 Posted May 24, 2017 (edited) Hi @Allow2010, I love your UDF, but I have a problem and I hope you or someone else can help me. I want to let my phone ring. It works. But my Script tells "Login failed". Script: Spoiler expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** OnAutoItExitRegister("FBTT_shutdown") #include "includes\_FB_Tools_api.au3" #include "includes\_FB_Tools.au3" $number = "**620" If _FB_Init() = 0 Then _FB_Logfile("Init failed") Exit -1 Else _FB_Logfile("Init OK") EndIf If _FB_LogIn() = 0 Then;log in to the fritzbox and generate a new sid _FB_Logfile("Login failed") MsgBox(0, "Login", "Login failed") Exit -1 Else _FB_Logfile("Login OK. Current SID is " & _FB_getSID()) EndIf If _FB_Dial($number)=1 Then ;MsgBox(0, "Dialing", "Dialing " & $number & " OK") Sleep(5000) _FB_Dial_Hangup() Exit 0 Else MsgBox(0, "Dialing", "Dialing " & $number & " failed") Exit 1 EndIf Func FBTT_shutdown() _FB_Logfile("Shuting down") _FB_Logout() _FB_shutdown() EndFunc ;==>FBTT_shutdown I inserted some ConsoleWrite-Lines into the Fuction _FB_LogIn (_FB_Tools_api.au3) and it says the Return comes from line 532: Spoiler ;this always works If $sessioninfo[1][0] <> "0000000000000000" Then;we have a sid _FB_Logfile("SID found: " & $sessioninfo[1][0], 2) _FB_SetSID($sessioninfo[1][0]) ConsoleWrite(@ScriptLineNumber & @CRLF) ; from nobbitry Return 1 ; <--- Line 532! Else _FB_Logfile("Existing SID was not found", 1) ConsoleWrite(@ScriptLineNumber & @CRLF) ; from nobbitry Return 0 EndIf The Return value is 1. Where comes the error from? Edited May 24, 2017 by nobbitry
Allow2010 Posted June 4, 2017 Author Posted June 4, 2017 can you please post or PM the complete logfile and tell me the FB Model and FOS version, thank you!
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