Ubuntu Pastebin

Paste from jusss at Fri, 13 Feb 2015 13:19:59 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import socket
import os

"""
   on the irc client , it just needs to set the nick name same as the nick name in alist[1],
   it's not necessary to set auto join the channel name in the irc client.
"""

alist=[':jusss.org NOTICE * :Welcome :) \r\n',
       ':jusss!~jusss@127.0.0.1 JOIN #irc-ctrl-shell\r\n']

fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
fd.bind(('192.168.1.254',6667))
fd.listen(9)

fd1, address = fd.accept()

fd1.send(alist[0].encode('utf-8'))
fd1.send(alist[1].encode('utf-8'))


while True:
    recv_msg = fd1.recv(1024).decode('utf-8')

    if len(recv_msg) > 0:
        position=recv_msg.find('PRIVMSG #irc-ctrl-shell :')

        if position > -1:
            cmd = recv_msg[position + 25:-2]
            result=eval(cmd)
            print(result)
            
            str_result=':services. 328 jusss #irc-ctrl-shell :' + str(result) + '\r\n'
            
            fd1.send(str_result.encode('utf-8'))

        exit_msg=recv_msg[0:4].find('QUIT')

        if exit_msg > -1:
            print(recv_msg)
Download as text