I wrote a program that received and executed commands send via IRC, which is how some botnets work. I wrote it in Python because working with IRC in Python is incredibly easy. It got to the stage where I could kill processes, change settings and download files via IRC (that's not strictly true, I had the Python script send me an e-mail with the file attached, so I used SMTP as well)· I don't have an IRC server running on my PC so I used a channel on Freenode. Commands were only executed if they were prefixed with a password and sent as a PRIVMSG because other people use the bots channel on Freenode.
It would have been a botnet if I had put the bot client on other computers, but I neither want or know how to do that.
Another thing I did recently was write a PHP script to try and root my own computer (I set up Apache and PHP on Linux for this) but it didn't work. I could run some commands (like 'ls') but the script didn't know about anything outside of the chroot jail into which Apache put it so it was basically useless.
I'm gonna play with the IRC stuff again, that was alot of fun.
Edit: Can't be asked with IRC, I'm just going to have it send commands as strings via TCP.
Edit 2: Done:
http://codepad.org/lYKvhShg
There's still a few bugs. The sendfile function will only work if you have a local SMTP server running, the shell function should be fine but I don't know if it works on non-UNIX systems, the update function hasn't been implemented because I've never done anything with FTP before.
You run the script with an address and port (I use localhost and 9000) and then telnet to the same address and port. Then you can type commands and see the output. Like I said, the shell command pretty much works, but not for commands that take input. I'll work on that at some point.