Jump to content

Recommended Posts

Posted

Hi,

How can i use a external function in TCPSend / TCPRecv ,

It's meant : 

TCPSend ( $main, function1 )

func function1 ()
msgbox (0,0,0)
endfunc

Q : 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 => :console:<= You

Thanks

 

 

Posted

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.

Posted
  On 10/21/2015 at 9:06 PM, spudw2k said:

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 ? :console:

 

  • 1 month later...
Posted

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
EndFunc

So 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

  Reveal hidden contents

 

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
×
×
  • Create New...