Yeik Posted April 9, 2009 Share Posted April 9, 2009 This is a client/server code i have been working on. you have to download the TCP UDF, put it in your includes directory.You will have to create your server client and loop, but the client it set to run as itself. I called it elevate so that it can install programs, or run tests as a simple user. Lots of options that you can configure and change. Most of the defaults are set as Globals.messages that begin with the following do as they seem/autoitrunwait ; Will send paramaters to a runwait()/autoitrun ; will send paramaters to run()/autoiteline ; will execute an autoitline (be careful about quotations)/autoitescript ; will execute indicated autoitscript/autoitcmd ; run command line options, isn't set up to send you the output/autoitcall ; call a function. You can create a list of functions to call with paramaters. The code for this in elevate.au3 runs through all of your paramters and can send declared variables to the function, supports multiple paramaters.Im still developing it little bits at a time but it works and is a good base setup. I am interested to here in peoples experience in using it.If I left anything incriminating in there, please let me know, I went over it but it has been long in the making. Of course if I left anything out, or if you have any questions.Thanks to Kip for his TCP UDF as well!example server: (remember client can be used on its own without needing more coding)#include <GUIConstants.au3> #include <array.au3> #include <GUIConstants.au3> #include <string.au3> #include <Misc.au3> #include <file.au3> #include "tcpserver.au3" Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 1) TrayCreateItem("List Clients") TrayItemSetOnEvent(-1, "_listclient") TrayCreateItem("Send") TrayItemSetOnEvent(-1, "_Sendmsggui") TrayCreateItem("Gui") TrayItemSetOnEvent(-1, "_CreateGui") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "ExitScript") TraySetState() Global $user = "" Global $pswd = "" Global $domain = "" _servercreate(); this should manage the server side of things. for the gui run _creuteGui, also as a tray option Run(@AutoItExe & ' /autoit3executescript ' & '"' & 'g:\examples\elevate.au3" ' &$user & ' ' & $domain & ' ' & _StringEncrypt(1, 'userpass', 'mypsswd', 3) & '127.0.0.1') while 1 sleep(5000) wendtcpserver.au3elevate.au3 func get_quote() local $quote switch random(1, 3, 1) case 1 $quote = '"' & "A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, " & _ "design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give " & _ "orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, " & _ "fight efficiently, die gallantly. Specialization is for insects." & '"' & " Robert A. Heinlein" case 2 $quote = '"' & "Within each of us lies the power of our consent to health and sickness, to riches and poverty, to freedom " & _ "and to slavery. It is we who control these, and not another." & '"' & " Richard Bach (Illusions)" case 3 $quote ='"' & "Don't handicap your children by making their lives easy." & '"' & " Robert A. Heinlein" EndSwitch MsgBox(0, "Quote for the moment", $quote & @CRLF) EndFunc get_quote() Link to comment Share on other sites More sharing options...
ZeR0 Posted April 12, 2009 Share Posted April 12, 2009 Nice ;D i go to check Link to comment Share on other sites More sharing options...
Yeik Posted April 12, 2009 Author Share Posted April 12, 2009 up to 20 downloads, hopefully people are liking it, modifying it, and twisting it for their own pleasure. I am interested in hearing how people end up using this, or if they are just getting it to look at the code for their own projects. I will be updating it again soon. There are a few more things I want to code in, and then there is a small project I am working on that if it works, and I get it completed I will integrate into this, and possibly post seperately if there is lots of interest in it. func get_quote() local $quote switch random(1, 3, 1) case 1 $quote = '"' & "A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, " & _ "design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give " & _ "orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, " & _ "fight efficiently, die gallantly. Specialization is for insects." & '"' & " Robert A. Heinlein" case 2 $quote = '"' & "Within each of us lies the power of our consent to health and sickness, to riches and poverty, to freedom " & _ "and to slavery. It is we who control these, and not another." & '"' & " Richard Bach (Illusions)" case 3 $quote ='"' & "Don't handicap your children by making their lives easy." & '"' & " Robert A. Heinlein" EndSwitch MsgBox(0, "Quote for the moment", $quote & @CRLF) EndFunc get_quote() Link to comment Share on other sites More sharing options...
l4tran Posted April 29, 2009 Share Posted April 29, 2009 up to 20 downloads, hopefully people are liking it, modifying it, and twisting it for their own pleasure. I am interested in hearing how people end up using this, or if they are just getting it to look at the code for their own projects.I will be updating it again soon. There are a few more things I want to code in, and then there is a small project I am working on that if it works, and I get it completed I will integrate into this, and possibly post seperately if there is lots of interest in it.Hello,I am a newbie and dont quite fully understand your code.Could you give me a few examples how you would use it.I am also in the process of writing something similar, however I can't get my client to send more than one command to the server. Hope your examples can help me debug your code. Thanks. Link to comment Share on other sites More sharing options...
Yeik Posted May 7, 2009 Author Share Posted May 7, 2009 Hello, I am a newbie and dont quite fully understand your code. Could you give me a few examples how you would use it. I am also in the process of writing something similar, however I can't get my client to send more than one command to the server. Hope your examples can help me debug your code. Thanks. Sorry for the long wait, I get busy and go out of town a lot. So the server, as you can see, is pretty simple since most everything else is already created in my au3 file. TrayItemSetOnEvent(-1, "_listclient")oÝ÷ Øâ.¥¡"Ú,zwZ²)àé²Æ zÚ-éZ²×%éírçyË^u«¢+ÙQÉå%ѵMÑ=¹Ù¹Ð ´Ä°ÅÕ½Ðí} ÉÑÕ¤ÅÕ½Ðì¤ Brings up a GUI i threw together that lists all the events you receive (ones that the client sends back after finishing a command you send will say Finished:>) there currently isn't a box for history of commands you send, i may add that later. The box below that is where you type what your sending. Then you have a list of checkboxes that show you all the clients (by ip address) that you have connected. Checking them will send the message to that client. The dropdown menu just adds string into the from of the command you are sending, ie run will add '/autoitrun;' to the front of your string so you type in "notepad" and you would get '/autoitrun;notepad' the client receives this and sees the /autoitrun and knows that it is going to run() the command after ; so it would call run(notepad) the client then respondes saying I finished running notepad ('Finished:>/autoitrun;notepad') so right now it is just a basic setup that can comminucate back and forth, with the ability to call a few specific autoit functions. I set it up as a base so that it can be expanded upon heavily, and also for remote installation of silent exe/msi files. I hope this helps you understand my side of the code, if your curious about the tcpudf that i am using, the example scripts have kiffs event driven tcp UDF and should be able to help with that. func get_quote() local $quote switch random(1, 3, 1) case 1 $quote = '"' & "A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, " & _ "design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give " & _ "orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, " & _ "fight efficiently, die gallantly. Specialization is for insects." & '"' & " Robert A. Heinlein" case 2 $quote = '"' & "Within each of us lies the power of our consent to health and sickness, to riches and poverty, to freedom " & _ "and to slavery. It is we who control these, and not another." & '"' & " Richard Bach (Illusions)" case 3 $quote ='"' & "Don't handicap your children by making their lives easy." & '"' & " Robert A. Heinlein" EndSwitch MsgBox(0, "Quote for the moment", $quote & @CRLF) EndFunc get_quote() Link to comment Share on other sites More sharing options...
kenneal Posted June 10, 2009 Share Posted June 10, 2009 >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\sit\Desktop\CMPB\elevate.au3" C:\Program Files\AutoIt3\Include\TCP.au3 (291) : used without being declared.: $uBound = UBound($__TCP_SOCKETS) ^ ERROR >Exit code: 1 Time: 0.305 Have you any idea how I can fix this? I am on Vista Home Premium SP1 and AutoIt v3.3.0.0. Link to comment Share on other sites More sharing options...
Yeik Posted June 19, 2009 Author Share Posted June 19, 2009 (edited) TCP udf>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\sit\Desktop\CMPB\elevate.au3" C:\Program Files\AutoIt3\Include\TCP.au3 (291) : used without being declared.: $uBound = UBound($__TCP_SOCKETS) ^ ERROR >Exit code: 1 Time: 0.305 Have you any idea how I can fix this? I am on Vista Home Premium SP1 and AutoIt v3.3.0.0. You didn't download the TCP UDF from Kip, it should be in this Example scripts forum. Put this in your include directory. Nevermind. i downlaoded the latest tcp udf and it is doing this. looks like Kip forgot to declare $uBound anywhere in the tcp udf, and i have the Must Declare Variables, 'opt("MustDeclareVars", 1)', set so that is causing the error. in elevate.au3 you can remove that line, or you can add local $uBound in each function that has it in Kip's tcp client. Edited June 19, 2009 by Yeik func get_quote() local $quote switch random(1, 3, 1) case 1 $quote = '"' & "A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, " & _ "design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give " & _ "orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, " & _ "fight efficiently, die gallantly. Specialization is for insects." & '"' & " Robert A. Heinlein" case 2 $quote = '"' & "Within each of us lies the power of our consent to health and sickness, to riches and poverty, to freedom " & _ "and to slavery. It is we who control these, and not another." & '"' & " Richard Bach (Illusions)" case 3 $quote ='"' & "Don't handicap your children by making their lives easy." & '"' & " Robert A. Heinlein" EndSwitch MsgBox(0, "Quote for the moment", $quote & @CRLF) EndFunc get_quote() 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