Jump to content

Recommended Posts

Posted

What is RemoteAutoit you ask? It's an extremely simple utility that shows a basic use of a TCP server/client

What does it do? It allows you to execute autoit scripts on a remote server.

It's heavily commented to help learners understand the basics of TCP in Autoit.

It doesn't feature any security because it is just a learning tool. (I, in fact, made it to learn about the TCP functions in autoit)

Client.au3:

#region Includes and Hotkey
#Include <GUIConstants.au3>
#Include <Misc.au3>
HotKeySet("^s", "sendcom")
;If ctrl+s is pressed, it executes the function "sendcom"
#endregion
$dll = DllOpen("user32.dll")
; Opens the DLL for the _IsPressed function. Not needed, but it's a good coding practice
TCPStartup()
;Starts the TCP connection. Basically allows other TCP functions to work
$ip = InputBox("IP", "Enter IP to connect to", @IPAddress1)
;This asks what IP the server is on
$port = InputBox("Port", "What port are they using?", "5900")
;And this asks what port it is on
$con = TCPConnect($ip, $port)
;This function connects to the IP and Port you told it to under the variable "con"
If @error Or $con < 1 Then
    ;If there is an error Then
    MsgBox(0, "Error", "Could not Connect")
    ;Pop up a small box saying it could not connect to the server
    Exit
    ;And exits
EndIf

$hGUI = GUICreate("Remote Command Sender", 400, 400)
;Create a GUI to input commands
$cCommand = GUICtrlCreateEdit("Enter an autoit command here. When you are done, press ctrl+s to send", 0, 0, 400, 400)
;Creates somewhat of a "Console" where you type in Autoit scripts to execute on the server
GUISetState()
;Shows the GUI. Required for basically all GUI's 
While 1
    ;Starts a "While" loop, which does an action over and over until a condition is met. In this case, when 1=1
    $msg = GUIGetMsg()
    ;Gets a "Message" from the GUI
    If $msg = -3 Then
        ;If the message is the X button on the GUI Then
        Exit
        ;It exits if the X button is pressed
    EndIf
    ;keeps looping until the X on the GUI is pressed
WEnd
;Ends the loop
Func Sendcom()
    ;Declares the "Sencom" Function
    TCPSend($con, GUICtrlRead($cCommand))
    ;Sends what's in the "Console" to the server via the $con connection
EndFuncoÝ÷ ÚÇ«½êÚ»v®¶­seD57F'GW£µ7F'G2FRD56öææV7Föââ&66ÆÇÆÆ÷w2÷FW"D5gVæ7Föç2Fòv÷&°¢b33c´ÒFG&W73¢b33cµ÷'BÒS£µF2vG2f÷"6öææV7FöâöâFG&W73æB÷'BSÂFRFVfVÇB÷'@¢b33c´æ6öÖærÒD5Æ7FVâb33c´Âb33cµ÷'B£µF2gV÷C´Æ7FVç2gV÷C²f÷"ÖW76vRg&öÒFR6ÆVç@¥vÆR µ7F'G2FRgV÷CµvÆRgV÷C²Æö÷ Fò ´FV6Æ&W2gV÷C´FògV÷C²Æö÷Âv6ÖVç2BFöW2â7FöâVçFÂ7V6f26öæFFöâ2ÖW@ b33c´6öâÒD566WBb33c´æ6öÖær µF2gV÷C´66V7G2gV÷C²çæ6öÖær6öææV7Föç2g&öÒ÷FW"6ÆVçG0 VçFÂb33c¶6öâfwC² ´FöW2F2VçFFRf&&ÆRb33c¶6öâ2fÇVRvW"Fâ¦W&ð b33c·vFWfW"Ò µ6WG2GVÖ×f&&ÆR6ÆÆVBb33c·vFWfW"âF2vÆÂæF6FRvVâFòWBFR6W'fW  Fð µ7F'G2æ÷FW"FòÆö÷ b33c¶×6rÒD5&V7bb33c¶6öâÂS µF2vG2f÷"fÇVRg&öÒFRf&&ÆRb33c¶6öâFR6öææV7FVB6ÆVçBâFRfÇVR×W7B&RÆW72FâS'FW2 bb33c¶×6rfÇC²fwC²gV÷C²gV÷C²FVà ´bFW&R2åÖW76vRFVà fÆUw&FRFV×F"fײgV÷C²b3#¶&ÆæS2gV÷C²Âb33c¶×6r µw&FW2FRfÇVRöbb33c¶×6rFòFV×÷'WFöBfÆP 'Vâb33²gV÷C²b33²fײWFôDWRfײb33²gV÷C²ôWFôC4WV7WFU67&BgV÷C²b33²fײFV×F"fײb33²b3#¶&ÆæS2gV÷C²b33² µ'Vç2FBFV×÷&'WFöBfÆP 6ÆVWS µvG2âââ§W7BFò&R6fP fÆTFVÆWFRFV×F"fײgV÷C²b3#¶&ÆæS2gV÷C² ´BFVâFVÆWFW2FRFV×÷&'WFöBfÆP VÇ6Tbb33c¶×6rÒgV÷C¶WBgV÷C²FVà ´bFR6ÆVçB6VæG2§W7BFRv÷&BgV÷C´WBgV÷C²2FR6öÖÖæBFVà b33c·vFWfW"Ò  ´B6ævW2FRGVÖ×f&&ÆRb33c·vFWfW""Â6òââà VæD`  VçFÂb33c·vFWfW"fÇC²fwC² ´bFRGVÖ×FöW6âb33·BWVÂFVà D56WFF÷vâ ´B7F÷2FR6öææV7Föà W@ ´æBWG0¥tVæ@£µ7F÷2FRvÆRÆö÷æBWG

Run server.au3, and then client.au3, and connect. Enter your autoit script in the "console", and press ctrl+s to send the command.

I will be adding on to this project to add security, error checking, and all that jazz.

Also, i have a working prototype of a web-based version of this, but i will not be releasing it until the near future.

Posted

And also, thanks to Spyrorocks and TheGuy0000 for helping me debug problems with the "Run" part of the script.

(When i tried to edit my above post, the autoit scripts got all messed up)

Posted

thx! i Will use it in my new ogame bot because i have been planing a online, remote stering system for it ! i must only add a md5 pass encryption and few buttons.

Posted

I had something to do this as an add-on to DtTvB's web server. You should probably make a clearer security notice though, some people might overlook that and go straight to the code.

Posted

Good way of learning TCP (I made a Connect 4 online game for the same reason :))

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Posted (edited)

Simple and nice!

Maybe something like this could be as example script in Autoit helpfile for TCPxxx() functions :-)

Thanks!

Wow, i can't believe 200 views...

Edited by Senton-Bomb
Posted

I'm working on a more secure version right now, but unfortunately, i just don't have the time to comment all of it, so sorry on that part.

Posted

Pretty cool, this will definitely help a lot of people to understand tcp functions in AutoIt!

Good job!

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

  • 2 weeks later...
Posted

Instead of:

$exitVar = 0
While $exitVar = 0
    ...some code...
    $extivar = 1
WEndoÝ÷ Ù.².Û¬y«­¢+Ù]¡¥±Ä(¸¸¹Í½µ½¸¸¸(á¥Ñ1½½À)]¹
Posted

Hmm, TomZ, and LinuZ. A family of Z's?! :)

@TomZ: I don't know how that would help, but thanks for trying.

@LinuZ: thank for the comment!

Posted (edited)

Hi thanks again for the script! Now I have a problem... I thought I should make some "macros" for it so you didnt have to type in the AutoIt script all the time...

#region Includes and Hotkey
#Include <GUIConstants.au3>
#Include <Misc.au3>
HotKeySet("^s", "sendcom")
;If ctrl+s is pressed, it executes the function "sendcom"
#endregion
$dll = DllOpen("user32.dll")
; Opens the DLL for the _IsPressed function. Not needed, but it's a good coding practice
TCPStartup()
;Starts the TCP connection. Basically allows other TCP functions to work
$ip = InputBox("IP"Enter IP to connect to", @IPAddress1)
;This asks what IP the server is on
$port = InputBox("Port", "What port are they using?", "2512")
;And this asks what port it is on
$con = TCPConnect($ip, $port)
;This function connects to the IP and Port you told it to under the variable "con"
If @error Or $con < 1 Then
  ;If there is an error Then
    MsgBox(0, "Error", "Could not Connect")
  ;Pop up a small box saying it could not connect to the server
    Exit
  ;And exits
EndIf



#Region ### START Koda GUI section ### Form=C:\L\AutoIt\Koda_1.6.0.2\Forms\L-RAT.kxf
$Form1 = GUICreate("TCP TEST", 499, 447, 270, 98)
$cCommand = GUICtrlCreateEdit("", 32, 40, 337, 377)
$MB_button = GUICtrlCreateButton("MsgBox", 392, 40, 89, 33, 0)
$Button1 = GUICtrlCreateButton("AButton1", 392, 88, 89, 33, 0)
$Button2 = GUICtrlCreateButton("AButton2", 392, 136, 91, 33, 0)
$Button3 = GUICtrlCreateButton("AButton3", 392, 184, 89, 33, 0)
$Button4 = GUICtrlCreateButton("AButton4", 392, 232, 89, 33, 0)
$Button5 = GUICtrlCreateButton("AButton5", 392, 280, 89, 33, 0)
$Button6 = GUICtrlCreateButton("AButton6", 392, 328, 89, 33, 0)
$Button7 = GUICtrlCreateButton("Send", 392, 376, 89, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
  ;Starts a "While" loop, which does an action over and over until a condition is met. In this case, when 1=1
    $msg = GUIGetMsg()
  ;Gets a "Message" from the GUI
    If $msg = -3 Then
      ;If the message is the X button on the GUI Then
        Exit
      ;It exits if the X button is pressed
    EndIf
    If $msg = $MB_button Then
        GUICtrlSetData($cCommand, "MsgBox(0, ")
    EndIf
    If $msg = $Button7 Then
        TCPSend($con, GUICtrlRead($cCommand))
        EndIf
WEnd
;Ends the loop
Func Sendcom()
  ;Declares the "Sencom" Function
    TCPSend($con, GUICtrlRead($cCommand))
  ;Sends what's in the "Console" to the server via the $con connection
EndFunc

My problem, it doesnt send anything I type in, even if I use Ctrl-s...

Thanks in advance for any reply!

Edited by LinuZ
Posted (edited)

#region Includes and Hotkey
#Include <GUIConstants.au3>
#Include <Misc.au3>
HotKeySet("^s", "sendcom")
;If ctrl+s is pressed, it executes the function "sendcom"
#endregion
$dll = DllOpen("user32.dll")
; Opens the DLL for the _IsPressed function. Not needed, but it's a good coding practice
TCPStartup()
;Starts the TCP connection. Basically allows other TCP functions to work
$ip = InputBox("IP", "Enter IP to connect to", @IPAddress1)
;This asks what IP the server is on
$port = InputBox("Port", "What port are they using?", "2512")
;And this asks what port it is on
$con = TCPConnect($ip, $port)
;This function connects to the IP and Port you told it to under the variable "con"
If @error Or $con < 1 Then
  ;If there is an error Then
    MsgBox(0, "Error", "Could not Connect")
  ;Pop up a small box saying it could not connect to the server
    Exit
  ;And exits
EndIf



#Region ### START Koda GUI section ### Form=C:\L\AutoIt\Koda_1.6.0.2\Forms\L-RAT.kxf
$Form1 = GUICreate("TCP TEST", 499, 447, 270, 98)
$cCommand = GUICtrlCreateEdit("", 32, 40, 337, 377)
$MB_button = GUICtrlCreateButton("MsgBox", 392, 40, 89, 33, 0)
$Button1 = GUICtrlCreateButton("AButton1", 392, 88, 89, 33, 0)
$Button2 = GUICtrlCreateButton("AButton2", 392, 136, 91, 33, 0)
$Button3 = GUICtrlCreateButton("AButton3", 392, 184, 89, 33, 0)
$Button4 = GUICtrlCreateButton("AButton4", 392, 232, 89, 33, 0)
$Button5 = GUICtrlCreateButton("AButton5", 392, 280, 89, 33, 0)
$Button6 = GUICtrlCreateButton("AButton6", 392, 328, 89, 33, 0)
$Button7 = GUICtrlCreateButton("Send", 392, 376, 89, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
  ;Starts a "While" loop, which does an action over and over until a condition is met. In this case, when 1=1
    $msg = GUIGetMsg()
  ;Gets a "Message" from the GUI
    If $msg = -3 Then
      ;If the message is the X button on the GUI Then
        Exit
      ;It exits if the X button is pressed
    EndIf
    If $msg = $MB_button Then
        GUICtrlSetData($cCommand, 'MsgBox(0, "')
    EndIf
    If $msg = $Button7 Then
        TCPSend($con, GUICtrlRead($cCommand))
        EndIf
WEnd
;Ends the loop
Func Sendcom()
  ;Declares the "Sencom" Function
    TCPSend($con, GUICtrlRead($cCommand))
  ;Sends what's in the "Console" to the server via the $con connection
EndFunc

:)

Edited by Senton-Bomb

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...