Text grabber to execute commands into the terminal. reddit / irc ---------------------------------------------------------------------- lukewarm20 · 2017-11-16 01:28 Does anyone know how to make an IRC bot grab what a user says and paste into a terminal and execute it? I saw this post of making a twitch bot and I tried to get some kind of command like os.system("shutdown") to work. Referred code: https://github.com/BadNidalee/ChatBot ---------------------------------------------------------------------- atblakely · 2017-11-16 03:29 Giving any user access to running terminal commands is a really bad idea. Unless you got some kinda authentication for it. ---------------------------------------------------------------------- lukewarm20 · 2017-11-16 03:31 Yeah good point, the script is on a server just for me and that is it. Edit: words ---------------------------------------------------------------------- anarchyisthekey · 2017-11-16 10:25 One option that comes to mind is using python twisted. Connect to the server, send channel join and auth commands. Twisted includes a simple irc message parser. Parse each line, use subprocess module to run the command, send the command output as a message. If you want to write in a different language, IRC is a real simple protocol, you only need to know how to operate a TCP-IP socket and do some basic string manipulation to start. But beware! IRC is not a secure protocol, you should use SSH. If you have a server, use ssh. If you need a server to act as a middle man (e.g. firewall issues), you do not need to connect to an irc server and pass commands through it. You can use an existing free service localtunnel. (localtunnel.me) If you have other darker purposes in mind like operating a botnet, this is not the place to ask. Maybe netsecstudents subreddit will help. ---------------------------------------------------------------------- lukewarm20 · 2017-11-16 10:44 Awesome! Thank you so much! And no, I'm not making an evil dark irc botnet. This is just for some basic parsing. ---------------------------------------------------------------------- atblakely · 2017-11-16 13:01 http://github.com/ablakely/shadow My bot has a .eval command that evaluates perl code. Perl has 2 ways of running commands system “uptime”; which will return true or false based on the commands exit status and `uptime` (enclosed with `) which will run the command and pipe its output to a variable or array. To do like a dir listing with my bot u could do .eval my @dirlist = `ls`; foreach my $f (@dirlist) { $bot->say($chan, $f); }