Jump to content

http relay check for next command easy way to do it? Remote administration


vailixi
 Share

Recommended Posts

I've been fooling around with writing a remote administration tool.

The server has a MySQL database that stores commands.

The client will query the server by the auto incremented primary key for the database entry and will compare it to the id stored from the latest command it executed. I thought doing this by downloading the php file with the id output and grabbing the value with a streamreader and then compare them. If it's a id number is higher the number of the latest command the client will execute the latest command. Then store the latest id in the text file for comparison against future commands.

Thus far I've been downloading the file and comparing the integer value to the value stored in another the other stored file.

Is there an easier way an easy way to read a remote file? Just get the id number as a stored value. It basically just needs to read the first line of the file.

I got the idea from how some software automatically updates. It will query a remote server for something like version.txt and if the version number in the remote file is higher it will download and install the latest version of the software. Easy enough. So I thought hmmm. I could issue commands like that. I also thought I could issue commands through a web interface to all of the connected in a botnet sort of way or legitimately getting clients to install updates or perform other tasks.

Any thoughts?

Link to comment
Share on other sites

Sounds a lot like a Command & Control thing. Slave machine asks a Master machine for work, Master responds with the command to run, Slave then runs it.

In terms of protocol, I'd let the Slave do an HTTP(s) POST request to a fixed path on the Master with the current ID in the request data. The master responds with a full command to run which can be just a line. Set the mime type of the result to text/plain and you can return the result as-is from the Master which is most easily processed by the Slave.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

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