4got Posted July 9, 2008 Share Posted July 9, 2008 I have created this script in order to perform some action on a remote computer: now you can only open windows whit a message inside,for example warning window,start a new prompt window and shutdown the computer.Here is the code: Client: CODE ;Created by 4got #include <GUIConstants.au3> #include <INet.au3> #include <TCP Funcs.au3> ;-----------------------Creation of the window----------------------- GUICreate("Client",250,250,300,300) ;create a window GUISetState() ;window status visible ;-------------------------------------------------------------------- ;-----------------------Inside the window---------------------------- GUICtrlCreateLabel("Receiver:",10,10) ;new label $input=GUICtrlCreateInput ("0.0.0.0", 60,5) ;input for the ip of the receiver ;------------------------creation of a group of radio button--------- GuiCtrlCreateGroup("Windows", 10, 35,230,100) ;create the new group $normal=GuiCtrlCreateRadio("Normal", 20, 50, 80) ;and the various radio button for the different tipe of the window GuiCtrlSetState(-1, $GUI_CHECKED) ;set the first radio button checked $stop=GuiCtrlCreateRadio("Stop", 20, 70, 80) $question=GuiCtrlCreateRadio("?", 20, 90, 80) $exl=GuiCtrlCreateRadio("!", 20, 110, 80) $info=GuiCtrlCreateRadio("Information", 100, 50, 80) GUICtrlCreateGroup ("",-99,-99,1,1) ;end of the group ;-------------------------------------------------------------------- $n2 = GUICtrlCreateButton("Send", 10, 220, 60) ;send button $n3 = GUICtrlCreateEdit("write here the message",10, 140, 230, 70) ;space for the text to send $n4 = GUICtrlCreateMenu("Command") ;menu' $n5 = GuiCtrlCreateMenuItem("Start",$n4) $n6 = GuiCtrlCreateMenuItem("Shutdown",$n4) ;-------------------------begin-------------------------------------------------- GUICtrlSetState(-1, $GUI_FOCUS) while 1 $msg = GUIGetMsg() Select Case $msg=$n2 $ipselected = GUICtrlRead($input, 1) ; the value of the ip $mess=GUICtrlRead($n3,1) ;read the message $cont=ping($ipselected) ;ping the addres to determinate if it is online If $cont Then TCPStartup() $Socket=TCPConnect($ipselected,7000) ;connection with the selected ip ;-----control the check box selected Select Case BitAND(GUICtrlRead($normal), $GUI_CHECKED) = $GUI_CHECKED $win=0 Case BitAND(GUICtrlRead($stop), $GUI_CHECKED) = $GUI_CHECKED $win=16 Case BitAND(GUICtrlRead($question), $GUI_CHECKED) = $GUI_CHECKED $win=32 Case BitAND(GUICtrlRead($exl), $GUI_CHECKED) = $GUI_CHECKED $win=48 Case BitAND(GUICtrlRead($info), $GUI_CHECKED) = $GUI_CHECKED $win=64 EndSelect TCPSendMessage($Socket,$win & " " & $mess & @CRLF ) ;send the message TCPCloseSocket($Socket) ;close the connection TCPShutdown() Else MsgBox(48,"ERROR","Host is down") ;if the host is not connected EndIf Case $msg=$n5 $mess="start" $ipselected = GUICtrlRead($input, 1) ; the value of the ip $cont=ping($ipselected) ;ping the addres to determinate if it is online If $cont Then TCPStartup() $Socket=TCPConnect($ipselected,7000) TCPSendMessage($Socket,$mess & @CRLF) TCPCloseSocket($Socket) ;close the connection TCPShutdown() EndIf Case $msg=$n6 $mess="shutdown" $ipselected = GUICtrlRead($input, 1) ; the value of the ip $cont=ping($ipselected) ;ping the addres to determinate if it is online If $cont Then TCPStartup() $Socket=TCPConnect($ipselected,7000) TCPSendMessage($Socket,$mess & @CRLF) TCPCloseSocket($Socket) ;close the connection TCPShutdown() EndIf Case $msg= $GUI_EVENT_CLOSE ExitLoop EndSelect wend Server: CODE#include <Misc.au3> #include <TCP Funcs.au3> #NoTrayIcon Local $ConnectedSocket = -1 $MainSocket = TCPStartServer(7000) ;open the port 7000 While 1 $ConnectedSocket = TCPAccept( $MainSocket) ;accept entering connection If $ConnectedSocket > 0 Then $Data = TCPReceive($ConnectedSocket) ;take the message if $ConnectedSocket<>-1 Then Select Case StringInStr($Data,"start",0) > 0 run("cmd.exe") Case StringInStr($Data,"shutdown",0) > 0 Shutdown(9) Case StringInStr($Data,"0",0) > 0 $mess=StringTrimLeft($Data,1) $win=StringTrimRight($Data,stringlen($Data)-1) msgbox($win,"Finestra di Windows",$mess) Case StringInStr($Data,"16",0) > 0 $mess=StringTrimLeft($Data,2) $win=StringTrimRight($Data,stringlen($Data)-2) msgbox($win,"Warning",$mess) Case StringInStr($Data,"32",0) > 0 $mess=StringTrimLeft($Data,2) $win=StringTrimRight($Data,stringlen($Data)-2) msgbox($win,"Domanda",$mess) Case StringInStr($Data,"48",0) > 0 $mess=StringTrimLeft($Data,2) $win=StringTrimRight($Data,stringlen($Data)-2) msgbox($win,"Finestra di Windows",$mess) Case StringInStr($Data,"64",0) > 0 $mess=StringTrimLeft($Data,2) $win=StringTrimRight($Data,stringlen($Data)-2) msgbox($win,"Informazione",$mess) Case Else MsgBox(0, "Message Received", $Data) ;print the message EndSelect EndIf EndIf WEnd Could someone help me to improve this script?? THX a lot Link to comment Share on other sites More sharing options...
4got Posted July 13, 2008 Author Share Posted July 13, 2008 Nobody could help me???? Link to comment Share on other sites More sharing options...
xwinterx Posted July 13, 2008 Share Posted July 13, 2008 It kinda depends on what you want help with? i haven't tried this myself. you want help improving it as in adding more stuff? streamlining code? ??? Link to comment Share on other sites More sharing options...
4got Posted July 14, 2008 Author Share Posted July 14, 2008 yes I want to add more stuff...But I have no idea of what I could add... Link to comment Share on other sites More sharing options...
2words4uready Posted August 8, 2008 Share Posted August 8, 2008 yes I want to add more stuff...But I have no idea of what I could add...seems it has problems connecting through a router Link to comment Share on other sites More sharing options...
yehia Posted August 13, 2008 Share Posted August 13, 2008 good work man My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
SoulA Posted August 14, 2008 Share Posted August 14, 2008 Start process/program, kill process/program, file transfer capabilities, get a list of the system info of the remote computer, get a list of running processes, send keystrokes, get a screen shot of remote computer.... just a start of things you could add. Link to comment Share on other sites More sharing options...
4got Posted September 21, 2008 Author Share Posted September 21, 2008 seems it has problems connecting through a routerin my local network when I send messages it works correctly but when I try to send a command like the "shutdown" it doesn't works all the times... Link to comment Share on other sites More sharing options...
4got Posted September 21, 2008 Author Share Posted September 21, 2008 Start process/program, kill process/program, file transfer capabilities, get a list of the system info of the remote computer, get a list of running processes, send keystrokes, get a screen shot of remote computer.... just a start of things you could add.Thx (sorry if I answer now to the replies but I've some problems with internet connection) ...I'll try to add the new stuff.... thx again to all... Link to comment Share on other sites More sharing options...
torels Posted September 21, 2008 Share Posted September 21, 2008 msgbox au3 command cmd commands Ftp protocols to send files (basicly... all you can do with a computer) cheers Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org 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