zxtnt09 Posted October 19, 2015 Posted October 19, 2015 Hi,How can i use a external function in TCPSend / TCPRecv ,It's meant : TCPSend ( $main, function1 ) func function1 () msgbox (0,0,0) endfuncQ : Why i need to use that ? A : I need when a connection was true ( connected ) , server could send some functions and client receive that,Me => <= YouThanks
zxtnt09 Posted October 21, 2015 Author Posted October 21, 2015 Bump======================Something like that : Server : TCPSend ( $main, function1 ) func function1 () msgbox (0,0,0) endfuncClient :TCPRecv ; recive the msgbox (function1) sended from server
spudw2k Posted October 21, 2015 Posted October 21, 2015 You can't do it that simply. You cannot simply feed source code across a tcpsend and have the receiving side execute that function. Yes, can you send data to a machine and have it act on that data, but you have to define those actions and validate the data. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
zxtnt09 Posted October 22, 2015 Author Posted October 22, 2015 You can't do it that simply. You cannot simply feed source code across a tcpsend and have the receiving side execute that function. Yes, can you send data to a machine and have it act on that data, but you have to define those actions and validate the data.Hhmmm, thanks, can you make for me an simply example ?
Jefrey Posted December 4, 2015 Posted December 4, 2015 You must get the server's command on the client side and execute it.Example (actually I'm using my TCPClient UDF, get the download link on my signature but do not confuse with TCPServer UDF):#include 'tcpclient.au3' _TCPClient_OnReceive("onreceive") _TCPClient_Connect("ip", "port") ; ??????? Func onreceive($iSocket, $sIP, $sData, $sPar) Execute($sData) ; read below before using this code EndFuncSo the server will send the code to execute, like this:TCPSend($socket, "MsgBox(0, '', 'hey')")And it will run on the client side.However, it's too dangerous to open a port to receive codes to your computer, as a hacker may discover it and execute AutoIt functions that may harm your system completely. Instead of Execute()-ing, like I did above on the example, you could have a predefined list of allowed commands, and run them only. Also, find out some way to make sure the server is authorized to run commands on your machine. Passwords would be nice, but I don't know exactly what you are doing... My stuff Spoiler My UDFs _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) · RC4 RC4 encryption compatible with PHP and JS · storage.au3 localStorage and sessionStorage for AutoIt Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path GUICtrlStaticMarquee static text scrolling Random stuff Super Mario beep sound your ears will hurt
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