Sign in to follow this  
Followers 0
faustf

tcp send problem

10 posts in this topic

hi guy i have a little problem

i want reset my router in remote mode , usally use web but is so long , i want do a simple gui with one button over my desktop clik and reset immidiatly

i analyze the http header and i finded a string for reset

http://192.168.1.1/setup.cgi?todo=reboot&this_file=diag.htm&next_file=diag.htm

if insert this string in browser address atomatically router reset without press button

i think reuse this string and i created this little script , but not go :(

where is mistake ? ? ?

#include 


$Form1 = GUICreate("R&R", 137, 62, 1075, 503)
$Button1 = GUICtrlCreateButton("Reset Rutter", 24, 16, 91, 33, 0)
GUISetState(@SW_SHOW)
$szData=('http://192.168.1.1/setup.cgi?todo=reboot&this_file=diag.htm&next_file=diag.htm')
$szIPADDRESS="192.168.1.1"

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
TCPStartup()
If @error Then
MsgBox(16+262144, " Error", "Non posso aprire il socket!")
Exit -1
Else
$ConnectedSocket = TCPConnect($szIPADDRESS, 80)
If @error Then
MsgBox(16+262144, " Error", "Non posso Connettermi!")
;Exit -1
Else

$v=TCPSend($ConnectedSocket, $szData)
If @error Then
MsgBox(16+262144, " Error", "Non posso inviare i dati!")
Else
MsgBox(0+262144, " Info", "Reset inviato con successo attendi 30 sec!")
EndIf

EndIf



EndIf

EndSwitch
WEnd

thanks :)

Share this post


Link to post
Share on other sites



Hi,

Well I would be surprised if this worked, hopefully there are some security measures meaning that you need to login (so you need to send this request) before sending any request like this one.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

but why if open browser at 192.168.1.1 dont request login ??

Share this post


Link to post
Share on other sites

and the script dont give me nothing error

if router block me for login i must have error in this part of code

$ConnectedSocket = TCPConnect($szIPADDRESS, 80)
If @error Then
MsgBox(16+262144, " Error", "Non posso Connettermi!")
;Exit -1
Else

Share this post


Link to post
Share on other sites

$szData=ShellExecute('http://192.168.1.1/setup.cgi?todo=reboot&this_file=diag.htm&next_file=diag.htm')

Done


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

but in this mode ope also a browser???

i dont wanna open a browser

Share this post


Link to post
Share on other sites

Look at the help file for ShellExecute, you can set the process to be hidden using @SW_HIDE in the proper parameter in the command, then you can wait for a period of time, and then close the process. You might have to play around with the delay time a bit to figure out how long it takes. You can also use the _IE* functions to do this hidden as well, which would be a better method, but not so easy.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Find UDF called WinHttp.au3. Help file that comes with it has plenty of examples of how to use it, including example of what you want to do. There are no browsers included in that equation nor other mumbo jumbo.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

i try in this mode

ShellExecute('http://192.168.1.1/setup.cgi?todo=reboot&this_file=diag.htm&next_file=diag.htm','','','',@SW_HIDE)

or

szData=ShellExecute('http://192.168.1.1/setup.cgi?todo=reboot&this_file=diag.htm&next_file=diag.htm','',@SW_HIDE)

but dont go hide, open browser and lunch page

you have some example ?? thankz

Share this post


Link to post
Share on other sites

i resolve alll with this

$oIE = _IECreate("http://192.168.1.1/setup.cgi?todo=reboot&this_file=diag.htm&next_file=diag.htm", 0, 0)

but is possible have exmple also with shellexecute and with WinHttp.au3

thankz

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
Sign in to follow this  
Followers 0