-
Notifications
You must be signed in to change notification settings - Fork 13
/
wp-check.py
885 lines (808 loc) · 42.3 KB
/
wp-check.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
#!/usr/bin/python
import os
import sys
import time
import proxy
import optparse
from output import *
import requests as req
from time import strftime
from wplyzer import WPlyzer
from threading import Thread, Event
try:
from queue import Queue
except ImportError:
from queue import Queue
http_headers = { 'User-agent' : 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/47.0 (Chrome)' }
def banner():
ban = '''-------------------------------------------------------------------------
_ __ ______
| | / /___ _________/ / __ \________ __________
| | /| / / __ \/ ___/ __ / /_/ / ___/ _ \/ ___/ ___/
| |/ |/ / /_/ / / / /_/ / ____/ / / __(__ |__ )
|__/|__/\____/_/ \__,_/_/ /_/ \___/____/____/
____ __ _ ________ __
/ __ \/ /_ ______ _(_)___ _____ / ____/ /_ ___ _____/ /_____ _____
/ /_/ / / / / / __ `/ / __ \/ ___/ / / / __ \/ _ \/ ___/ //_/ _ \/ ___/
/ ____/ / /_/ / /_/ / / / / (__ ) / /___/ / / / __/ /__/ ,< / __/ /
/_/ /_/\__,_/\__, /_/_/ /_/____/ \____/_/ /_/\___/\___/_/|_|\___/_/
/____/
:- by Nasir Khan (r0ot h3x49)
-------------------------------------------------------------------------\n'''
sys.stdout.write(sb + fg + str(ban))
class WordPress:
def __init__(self):
self._plugin_name = None
self._plugin_url = None
self._plugin_split_url = None
def Plugin_Check(self, url, out, queue, total, run_event, outfile=None):
while run_event.is_set():
tgt = url.get()
progress = queue.get()
try:
r = req.get(tgt, headers = http_headers)
except req.exceptions.MissingSchema:
time.sleep(5)
except req.exceptions.Timeout:
time.sleep(5)
except req.exceptions.RequestException:
time.sleep(5)
except req.exceptions.TooManyRedirects:
time.sleep(5)
else:
result = r.status_code
code, self._plugin_url = r.status_code, r.url
if code == 200:
self._plugin_split_url = self._plugin_url.split('/')
self._plugin_name = self._plugin_split_url[-2]
if outfile:
sys.stdout.write('{}{}[+] {}{:<25} : {}{}{}{}{} \n'.format(sb, fy, fg ,self._plugin_name, sd,fm, self._plugin_url, sb, fg))
self._file = (self._plugin_split_url[2]).replace('.','-') + '.txt'
fd = open(str(self._file),"a")
fd.write('[+] {:<20} : {}\n'.format(self._plugin_name, self._plugin_url))
fd.close()
else:
sys.stdout.write('{}{}[+] {}{:<25} : {}{}{}{}{} \n'.format(sb, fy, fg ,self._plugin_name, sd,fm, self._plugin_url, sb, fg))
else:
pass
out.put(result)
url.task_done()
def Progress(self, curr, total):
per = format(100.00 * (int(curr) / float(total)), '.2f')
filledLength = int(round(40 * int(curr) / float(total)))
bar = '=' * filledLength + ' ' * (40 - filledLength)
sys.stdout.write(sb + fr + '['+ sd + fm + str(bar) + sb + fr +'] '+ sb + fg + '( ' + str(int(curr)) +'/'+str(int(total))+' ) '+ str(per) +'% \r')
def main():
banner()
Wp = WordPress()
queue = Queue(1)
run_event = Event()
run_event.set()
us = "%prog [OPTIONS] URL"
version = "%prog version 1.0"
parser = optparse.OptionParser(usage=us,version=version,conflict_handler="resolve")
general = optparse.OptionGroup(parser, 'General')
general.add_option(
'-h', '--help',
action='help',
help='Print this help text and exit')
general.add_option(
'-v', '--version',
action='version',
help='Print program version and exit')
target = optparse.OptionGroup(parser, "Target")
target.add_option(
"-u", "--url",
type="string",
dest='url',\
help="Provide target url (e.g:- http://www.abc.com)")
enum = optparse.OptionGroup(parser, "Enumeration")
enum.add_option(
"-d", "--default",
action='store_true',
dest='default',\
help="Analyzes plugins from source code")
enum.add_option(
"-b", "--bruteforce",
action='store_true',
dest='brute',\
help="Analyzes plugins using bruteforce")
out = optparse.OptionGroup(parser, "Output")
out.add_option(
"-s", "--save",
action='store_true',
dest='outfile',\
help="Stores plugins in file with target url name.")
other = optparse.OptionGroup(parser, "Custom")
other.add_option(
"-w", "--wordlist",
action='store_true',
default = 'plugins.txt',
dest='list',\
help="Provide plugin wordlist else it will use default.")
other.add_option(
"-t", "--threads",
action='store_true',
default = 2,
dest='threads',\
help="Provide threads default threads = 2")
tor = optparse.OptionGroup(parser, "Proxy")
tor.add_option(
"--tor",
action='store_true',
dest='tor',\
help="Uses tor proxy network to send traffic through")
tor.add_option(
"--new-identity",
action='store_true',
dest='new_identity',\
help="Automated request for new identity on ip blocked")
parser.add_option_group(general)
parser.add_option_group(target)
parser.add_option_group(out)
parser.add_option_group(other)
parser.add_option_group(tor)
parser.add_option_group(enum)
(options, args) = parser.parse_args()
if not options.url:
parser.print_help()
elif options.url and not options.default and options.brute and options.threads is not True and options.list is not True:
tor = options.tor
newip = options.new_identity
Proxy = proxy.Proxy()
outf = options.outfile
if tor is True and newip is None:
Proxy.SetDefaultProxy
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
default_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
print('\n' + sb + fg + '[+]' + sb + fy + ' TOR: configuring tor proxy...')
Proxy.ConfigureProxy
try:
r = req.get('http://my-ip.herokuapp.com/')
except:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy connection error, make sure tor services are running...')
Proxy.SetDefaultProxy
resp = r.text
sp = resp.replace('\n','')
proxy_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
if default_ip != proxy_ip:
print(sb + fg + '[+]' + sb + fy + ' TOR: proxy configured successfully.')
print(sb + fg + '[+]' + sb + fy + ' TOR: network traffic will go through : (%s)' % (proxy_ip))
print(sb + fy + '\n-------------------------------------------------------------------------')
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy configuration is failed')
print(sb + fy + '\n-------------------------------------------------------------------------')
elif tor is True and newip is True:
Proxy.SetDefaultProxy
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
default_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
print('\n' + sb + fg + '[+]' + sb + fy + ' TOR: configuring tor proxy...')
time.sleep(1)
print(sb + fg + '[+]' + sb + fy + ' TOR: requesting new identity...')
time.sleep(1)
_resp = Proxy.NewIdentity
time.sleep(1)
if '250 OK' in _resp:
print(sb + fg + '[+]' + sb + fy + ' TOR: request was successfull.')
Proxy.ConfigureProxy
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: request was unsuccessfull.')
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
proxy_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
if default_ip != proxy_ip:
print(sb + fg + '[+]' + sb + fy + ' TOR: proxy configured successfully.')
print(sb + fg + '[+]' + sb + fy + ' TOR: network traffic will go through : (%s)' % (proxy_ip))
print(sb + fy + '\n-------------------------------------------------------------------------')
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy configuration is failed')
print(sb + fy + '\n-------------------------------------------------------------------------')
tgt = options.url
threads = options.threads
wordlist = options.list
if 'http://' in tgt:
tgt = tgt
elif 'https://' in tgt:
tgt = tgt
else:
tgt = 'http://%s' % (tgt)
print('\n' + sb + fg + '[+]' + sb + fy + ' URL: ' + str(tgt))
print(sb + fg + '[+]' + sb + fy + ' Started: '+str(strftime('%a %b %d %I:%M:%S %Y')))
print(sb + fg + '[+]' + sb + fy + " Wordlist: using default wordlist '" +str(wordlist)+ "'")
print(sb + fy + '\n-------------------------------------------------------------------------')
try:
f_in = open(wordlist)
except (OSError, WindowsError, IOError, Exception):
if os.name == 'posix':
sys.stdout.write("\n{}{}[-]{}{} Failed to open default wordlist {}{}'{}'\n{}{}[-]{}{} Wordlist '{}' does not exists in a default path '{}/{}'\n".format(sb, fy, sb, fr, sb, fw, wordlist, sb, fy, sd, fg, wordlist, os.getcwd(), wordlist))
else:
sys.stdout.write("\n{}{}[-]{}{} Failed to open default wordlist {}{}'{}'\n{}{}[-]{}{} Wordlist '{}' does not exists in a default path '{}\{}'\n".format(sb, fy, sb, fr, sb, fw, wordlist, sb, fy, sd, fg, wordlist, os.getcwd(), wordlist))
sys.exit(0)
plugins = set(list(line for line in (l.strip() for l in f_in) if line))
url = Queue()
out = Queue()
total = len(plugins)
td = int(threads)
for i in range(1, td+1):
try:
if outf:
t = Thread(target=Wp.Plugin_Check, args=(url, out, queue, total, run_event, outf))
t.daemon = True
t.start()
else:
t = Thread(target=Wp.Plugin_Check, args=(url, out, queue, total, run_event, outf))
t.daemon = True
t.start()
except KeyboardInterrupt:
Proxy.SetDefaultProxy
sys.stdout.write('\n{}{}[-]{}{} User Interrupted attempting to terminate threads..\n'.format(sb, fy, sd, fr))
time.sleep(2)
run_event.clear()
#url.join()
sys.stdout.write('{}{}[+]{}{} Threads successfully terminated.... \r\n'.format(sb, fy, sd, fg))
sys.exit(0)
except:
pass
for plugin in plugins:
try:
u = '%s/wp-content/plugins/%s' % (tgt, plugin)
url.put(u)
except KeyboardInterrupt:
Proxy.SetDefaultProxy
sys.stdout.write('\n{}{}[-]{}{} User Interrupted attempting to terminate threads..\n'.format(sb, fy, sd, fr))
time.sleep(2)
run_event.clear()
#url.join()
sys.stdout.write('{}{}[+]{}{} Threads successfully terminated.... \r\n'.format(sb, fy, sd, fg))
sys.exit(0)
except:
pass
for curr in range(total+1):
try:
Wp.Progress(curr, total)
if curr == total:
if outf:
print(sb + fy + '-------------------------------------------------------------------------')
print(sb + fg + '[+]' + sb + fy + ' Scan completed for target : (' + sd + fw + str(tgt) + sb + fy + ')')
print(sb + fg + '[+]' + sb + fy + ' Output is saved to : (' + sd + fw + str((tgt.split('/')[2]).replace('.','-')+'.txt') + sb + fy + ')')
else:
print(sb + fy + '-------------------------------------------------------------------------')
print(sb + fg + '[+]' + sb + fy + ' Scan completed for target : (' + sd + fw + str(tgt) + sb + fy + ')')
else:
queue.put(curr)
except KeyboardInterrupt:
Proxy.SetDefaultProxy
sys.stdout.write('\n{}{}[-]{}{} User Interrupted attempting to terminate threads..\n'.format(sb, fy, sd, fr))
time.sleep(2)
run_event.clear()
#url.join()
sys.stdout.write('{}{}[+]{}{} Threads successfully terminated.... \r\n'.format(sb, fy, sd, fg))
sys.exit(0)
except:
pass
elif options.url and not options.default and options.brute and options.list is True and options.threads is not True:
tor = options.tor
newip = options.new_identity
Proxy = proxy.Proxy()
outf = options.outfile
if tor is True and newip is None:
Proxy.SetDefaultProxy
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
default_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
print('\n' + sb + fg + '[+]' + sb + fy + ' TOR: configuring tor proxy...')
Proxy.ConfigureProxy
try:
r = req.get('http://my-ip.herokuapp.com/')
except:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy connection error, make sure tor services are running...')
Proxy.SetDefaultProxy
resp = r.text
sp = resp.replace('\n','')
proxy_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
if default_ip != proxy_ip:
print(sb + fg + '[+]' + sb + fy + ' TOR: proxy configured successfully.')
print(sb + fg + '[+]' + sb + fy + ' TOR: network traffic will go through : (%s)' % (proxy_ip))
print(sb + fy + '\n-------------------------------------------------------------------------')
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy configuration is failed')
print(sb + fy + '\n-------------------------------------------------------------------------')
elif tor is True and newip is True:
Proxy.SetDefaultProxy
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
default_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
print('\n' + sb + fg + '[+]' + sb + fy + ' TOR: configuring tor proxy...')
time.sleep(1)
print(sb + fg + '[+]' + sb + fy + ' TOR: requesting new identity...')
time.sleep(1)
_resp = Proxy.NewIdentity
time.sleep(1)
if '250 OK' in _resp:
print(sb + fg + '[+]' + sb + fy + ' TOR: request was successfull.')
Proxy.ConfigureProxy
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: request was unsuccessfull.')
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
proxy_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
if default_ip != proxy_ip:
print(sb + fg + '[+]' + sb + fy + ' TOR: proxy configured successfully.')
print(sb + fg + '[+]' + sb + fy + ' TOR: network traffic will go through : (%s)' % (proxy_ip))
print(sb + fy + '\n-------------------------------------------------------------------------')
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy configuration is failed')
print(sb + fy + '\n-------------------------------------------------------------------------')
tgt = options.url
wordlist = args[0]
threads = options.threads
if 'http://' in tgt:
tgt = tgt
elif 'https://' in tgt:
tgt = tgt
else:
tgt = 'http://%s' % (tgt)
if os.name == 'posix':
wlname = wordlist.split('/')[-1] if '/' in wordlist else wordlist
else:
wlname = wordlist.split('\\')[-1] if '\\' in wordlist else wordlist
print('\n' + sb + fg + '[+]' + sb + fy + ' URL: ' + str(tgt))
print(sb + fg + '[+]' + sb + fy + ' Started: '+str(strftime('%a %b %d %I:%M:%S %Y')))
print(sb + fg + '[+]' + sb + fy + " Wordlist: using provided wordlist '" +str(wlname)+ "'")
print(sb + fy + '\n-------------------------------------------------------------------------')
try:
f_in = open(wordlist)
except (OSError, WindowsError, IOError, Exception, IndexError):
Proxy.SetDefaultProxy
if os.name == 'posix':
sys.stdout.write("\n{}{}[-]{}{} Failed to open default wordlist {}{}'{}'\n{}{}[-]{}{} Wordlist '{}' does not exists in a given path '{}'\n".format(sb, fy, sb, fr, sb, fw, wlname, sb, fy, sd, fg, wlname, wordlist))
else:
sys.stdout.write("\n{}{}[-]{}{} Failed to open default wordlist {}{}'{}'\n{}{}[-]{}{} Wordlist '{}' does not exists in a given path '{}'\n".format(sb, fy, sb, fr, sb, fw, wlname, sb, fy, sd, fg, wlname, wordlist))
sys.exit(0)
plugins = set(list(line for line in (l.strip() for l in f_in) if line))
url = Queue()
out = Queue()
total = len(plugins)
td = int(threads)
for i in range(1, td+1):
try:
if outf:
t = Thread(target=Wp.Plugin_Check, args=(url, out, queue, total, run_event, outf))
t.daemon = True
t.start()
else:
t = Thread(target=Wp.Plugin_Check, args=(url, out, queue, total, run_event))
t.daemon = True
t.start()
except KeyboardInterrupt:
Proxy.SetDefaultProxy
sys.stdout.write('\n{}{}[-]{}{} User Interrupted attempting to terminate threads..\n'.format(sb, fy, sd, fr))
time.sleep(2)
run_event.clear()
#url.join()
sys.stdout.write('{}{}[+]{}{} Threads successfully terminated.... \r\n'.format(sb, fy, sd, fg))
sys.exit(0)
except:
pass
for plugin in plugins:
try:
u = '%s/wp-content/plugins/%s' % (tgt, plugin)
url.put(u)
except KeyboardInterrupt:
Proxy.SetDefaultProxy
sys.stdout.write('\n{}{}[-]{}{} User Interrupted attempting to terminate threads..\n'.format(sb, fy, sd, fr))
time.sleep(2)
run_event.clear()
#url.join()
sys.stdout.write('{}{}[+]{}{} Threads successfully terminated.... \r\n'.format(sb, fy, sd, fg))
sys.exit(0)
except:
pass
for curr in range(total+1):
try:
Wp.Progress(curr, total)
if curr == total:
if outf:
print(sb + fy + '-------------------------------------------------------------------------')
print(sb + fg + '[+]' + sb + fy + ' Scan completed for target : (' + sd + fw + str(tgt) + sb + fy + ')')
print(sb + fg + '[+]' + sb + fy + ' Output is saved to : (' + sd + fw + str((tgt.split('/')[2]).replace('.','-')+'.txt') + sb + fy + ')')
else:
print(sb + fy + '-------------------------------------------------------------------------')
print(sb + fg + '[+]' + sb + fy + ' Scan completed for target : (' + sd + fw + str(tgt) + sb + fy + ')')
else:
queue.put(curr)
except KeyboardInterrupt:
Proxy.SetDefaultProxy
sys.stdout.write('\n{}{}[-]{}{} User Interrupted attempting to terminate threads..\n'.format(sb, fy, sd, fr))
time.sleep(2)
run_event.clear()
#url.join()
sys.stdout.write('{}{}[+]{}{} Threads successfully terminated.... \r\n'.format(sb, fy, sd, fg))
sys.exit(0)
except:
pass
elif options.url and not options.default and options.brute and options.list is not True and options.threads is True:
tor = options.tor
newip = options.new_identity
Proxy = proxy.Proxy()
outf = options.outfile
if tor is True and newip is None:
Proxy.SetDefaultProxy
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
default_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
print('\n' + sb + fg + '[+]' + sb + fy + ' TOR: configuring tor proxy...')
Proxy.ConfigureProxy
try:
r = req.get('http://my-ip.herokuapp.com/')
except:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy connection error, make sure tor services are running...')
Proxy.SetDefaultProxy
resp = r.text
sp = resp.replace('\n','')
proxy_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
if default_ip != proxy_ip:
print(sb + fg + '[+]' + sb + fy + ' TOR: proxy configured successfully.')
print(sb + fg + '[+]' + sb + fy + ' TOR: network traffic will go through : (%s)' % (proxy_ip))
print(sb + fy + '\n-------------------------------------------------------------------------')
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy configuration is failed')
print(sb + fy + '\n-------------------------------------------------------------------------')
elif tor is True and newip is True:
Proxy.SetDefaultProxy
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
default_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
print('\n' + sb + fg + '[+]' + sb + fy + ' TOR: configuring tor proxy...')
time.sleep(1)
print(sb + fg + '[+]' + sb + fy + ' TOR: requesting new identity...')
time.sleep(1)
_resp = Proxy.NewIdentity
time.sleep(1)
if '250 OK' in _resp:
print(sb + fg + '[+]' + sb + fy + ' TOR: request was successfull.')
Proxy.ConfigureProxy
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: request was unsuccessfull.')
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
proxy_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
if default_ip != proxy_ip:
print(sb + fg + '[+]' + sb + fy + ' TOR: proxy configured successfully.')
print(sb + fg + '[+]' + sb + fy + ' TOR: network traffic will go through : (%s)' % (proxy_ip))
print(sb + fy + '\n-------------------------------------------------------------------------')
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy configuration is failed')
print(sb + fy + '\n-------------------------------------------------------------------------')
tgt = options.url
threads = args[0]
wordlist = options.list
if 'http://' in tgt:
tgt = tgt
elif 'https://' in tgt:
tgt = tgt
else:
tgt = 'http://%s' % (tgt)
print('\n' + sb + fg + '[+]' + sb + fy + ' URL: ' + str(tgt))
print(sb + fg + '[+]' + sb + fy + ' Started: '+str(strftime('%a %b %d %I:%M:%S %Y')))
print(sb + fg + '[+]' + sb + fy + " Wordlist: using default wordlist '" +str(wordlist)+ "'")
print(sb + fy + '\n-------------------------------------------------------------------------')
try:
f_in = open(wordlist)
except (OSError, WindowsError, IOError, Exception):
if os.name == 'posix':
sys.stdout.write("\n{}{}[-]{}{} Failed to open default wordlist {}{}'{}'\n{}{}[-]{}{} Wordlist '{}' does not exists in a default path '{}/{}'\n".format(sb, fy, sb, fr, sb, fw, wordlist, sb, fy, sd, fg, wordlist, os.getcwd(), wordlist))
else:
sys.stdout.write("\n{}{}[-]{}{} Failed to open default wordlist {}{}'{}'\n{}{}[-]{}{} Wordlist '{}' does not exists in a default path '{}\{}'\n".format(sb, fy, sb, fr, sb, fw, wordlist, sb, fy, sd, fg, wordlist, os.getcwd(), wordlist))
sys.exit(0)
plugins = set(list(line for line in (l.strip() for l in f_in) if line))
url = Queue()
out = Queue()
total = len(plugins)
td = int(threads)
for i in range(1, td+1):
try:
if outf:
t = Thread(target=Wp.Plugin_Check, args=(url, out, queue, total, run_event, outf))
t.daemon = True
t.start()
else:
t = Thread(target=Wp.Plugin_Check, args=(url, out, queue, total, run_event, outf))
t.daemon = True
t.start()
except KeyboardInterrupt:
Proxy.SetDefaultProxy
sys.stdout.write('\n{}{}[-]{}{} User Interrupted attempting to terminate threads..\n'.format(sb, fy, sd, fr))
time.sleep(2)
run_event.clear()
#url.join()
sys.stdout.write('{}{}[+]{}{} Threads successfully terminated.... \r\n'.format(sb, fy, sd, fg))
sys.exit(0)
except:
pass
for plugin in plugins:
try:
u = '%s/wp-content/plugins/%s' % (tgt, plugin)
url.put(u)
except KeyboardInterrupt:
Proxy.SetDefaultProxy
sys.stdout.write('\n{}{}[-]{}{} User Interrupted attempting to terminate threads..\n'.format(sb, fy, sd, fr))
time.sleep(2)
run_event.clear()
#url.join()
sys.stdout.write('{}{}[+]{}{} Threads successfully terminated.... \r\n'.format(sb, fy, sd, fg))
sys.exit(0)
except:
pass
for curr in range(total+1):
try:
Wp.Progress(curr, total)
if curr == total:
if outf:
print(sb + fy + '-------------------------------------------------------------------------')
print(sb + fg + '[+]' + sb + fy + ' Scan completed for target : (' + sd + fw + str(tgt) + sb + fy + ')')
print(sb + fg + '[+]' + sb + fy + ' Output is saved to : (' + sd + fw + str((tgt.split('/')[2]).replace('.','-')+'.txt') + sb + fy + ')')
else:
print(sb + fy + '-------------------------------------------------------------------------')
print(sb + fg + '[+]' + sb + fy + ' Scan completed for target : (' + sd + fw + str(tgt) + sb + fy + ')')
else:
queue.put(curr)
except KeyboardInterrupt:
Proxy.SetDefaultProxy
sys.stdout.write('\n{}{}[-]{}{} User Interrupted attempting to terminate threads..\n'.format(sb, fy, sd, fr))
time.sleep(2)
run_event.clear()
#url.join()
sys.stdout.write('{}{}[+]{}{} Threads successfully terminated.... \r\n'.format(sb, fy, sd, fg))
sys.exit(0)
except:
pass
elif options.url and not options.default and options.brute and options.list is True and options.threads is True:
tor = options.tor
newip = options.new_identity
Proxy = proxy.Proxy()
outf = options.outfile
if tor is True and newip is None:
Proxy.SetDefaultProxy
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
default_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
print('\n' + sb + fg + '[+]' + sb + fy + ' TOR: configuring tor proxy...')
Proxy.ConfigureProxy
try:
r = req.get('http://my-ip.herokuapp.com/')
except:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy connection error, make sure tor services are running...')
Proxy.SetDefaultProxy
resp = r.text
sp = resp.replace('\n','')
proxy_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
if default_ip != proxy_ip:
print(sb + fg + '[+]' + sb + fy + ' TOR: proxy configured successfully.')
print(sb + fg + '[+]' + sb + fy + ' TOR: network traffic will go through : (%s)' % (proxy_ip))
print(sb + fy + '\n-------------------------------------------------------------------------')
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy configuration is failed')
print(sb + fy + '\n-------------------------------------------------------------------------')
elif tor is True and newip is True:
Proxy.SetDefaultProxy
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
default_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
print('\n' + sb + fg + '[+]' + sb + fy + ' TOR: configuring tor proxy...')
time.sleep(1)
print(sb + fg + '[+]' + sb + fy + ' TOR: requesting new identity...')
time.sleep(1)
_resp = Proxy.NewIdentity
time.sleep(1)
if '250 OK' in _resp:
print(sb + fg + '[+]' + sb + fy + ' TOR: request was successfull.')
Proxy.ConfigureProxy
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: request was unsuccessfull.')
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
proxy_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
if default_ip != proxy_ip:
print(sb + fg + '[+]' + sb + fy + ' TOR: proxy configured successfully.')
print(sb + fg + '[+]' + sb + fy + ' TOR: network traffic will go through : (%s)' % (proxy_ip))
print(sb + fy + '\n-------------------------------------------------------------------------')
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy configuration is failed')
print(sb + fy + '\n-------------------------------------------------------------------------')
if len(args[0]) > 2:
wordlist = args[0]
threads = args[1]
else:
wordlist = args[1]
threads = args[0]
tgt = options.url
if 'http://' in tgt:
tgt = tgt
elif 'https://' in tgt:
tgt = tgt
else:
tgt = 'http://%s' % (tgt)
if os.name == 'posix':
wlname = wordlist.split('/')[-1] if '/' in wordlist else wordlist
else:
wlname = wordlist.split('\\')[-1] if '\\' in wordlist else wordlist
print('\n' + sb + fg + '[+]' + sb + fy + ' URL: ' + str(tgt))
print(sb + fg + '[+]' + sb + fy + ' Started: '+str(strftime('%a %b %d %I:%M:%S %Y')))
print(sb + fg + '[+]' + sb + fy + " Wordlist: using provided wordlist '" +str(wlname)+ "'")
print(sb + fy + '\n-------------------------------------------------------------------------')
try:
f_in = open(wordlist)
except (OSError, WindowsError, IOError, Exception, IndexError):
if os.name == 'posix':
sys.stdout.write("\n{}{}[-]{}{} Failed to open default wordlist {}{}'{}'\n{}{}[-]{}{} Wordlist '{}' does not exists in a given path '{}'\n".format(sb, fy, sb, fr, sb, fw, wlname, sb, fy, sd, fg, wlname, wordlist))
else:
sys.stdout.write("\n{}{}[-]{}{} Failed to open default wordlist {}{}'{}'\n{}{}[-]{}{} Wordlist '{}' does not exists in a given path '{}'\n".format(sb, fy, sb, fr, sb, fw, wlname, sb, fy, sd, fg, wlname, wordlist))
sys.exit(0)
plugins = set(list(line for line in (l.strip() for l in f_in) if line))
url = Queue()
out = Queue()
total = len(plugins)
td = int(threads)
for i in range(1, td+1):
try:
if outf:
t = Thread(target=Wp.Plugin_Check, args=(url, out, queue, total, run_event, outf))
t.daemon = True
t.start()
else:
t = Thread(target=Wp.Plugin_Check, args=(url, out, queue, total, run_event, outf))
t.daemon = True
t.start()
except KeyboardInterrupt:
Proxy.SetDefaultProxy
sys.stdout.write('\n{}{}[-]{}{} User Interrupted attempting to terminate threads..\n'.format(sb, fy, sd, fr))
time.sleep(2)
run_event.clear()
#url.join()
sys.stdout.write('{}{}[+]{}{} Threads successfully terminated.... \r\n'.format(sb, fy, sd, fg))
sys.exit(0)
except:
pass
for plugin in plugins:
try:
u = '%s/wp-content/plugins/%s' % (tgt, plugin)
url.put(u)
except KeyboardInterrupt:
Proxy.SetDefaultProxy
sys.stdout.write('\n{}{}[-]{}{} User Interrupted attempting to terminate threads..\n'.format(sb, fy, sd, fr))
time.sleep(2)
run_event.clear()
#url.join()
sys.stdout.write('{}{}[+]{}{} Threads successfully terminated.... \r\n'.format(sb, fy, sd, fg))
sys.exit(0)
except:
pass
for curr in range(total+1):
try:
Wp.Progress(curr, total)
if curr == total:
if outf:
print(sb + fy + '-------------------------------------------------------------------------')
print(sb + fg + '[+]' + sb + fy + ' Scan completed for target : (' + sd + fw + str(tgt) + sb + fy + ')')
print(sb + fg + '[+]' + sb + fy + ' Output is saved to : (' + sd + fw + str((tgt.split('/')[2]).replace('.','-')+'.txt') + sb + fy + ')')
else:
print(sb + fy + '-------------------------------------------------------------------------')
print(sb + fg + '[+]' + sb + fy + ' Scan completed for target : (' + sd + fw + str(tgt) + sb + fy + ')')
else:
queue.put(curr)
except KeyboardInterrupt:
Proxy.SetDefaultProxy
sys.stdout.write('\n{}{}[-]{}{} User Interrupted attempting to terminate threads..\n'.format(sb, fy, sd, fr))
time.sleep(2)
run_event.clear()
#url.join()
sys.stdout.write('{}{}[+]{}{} Threads successfully terminated.... \r\n'.format(sb, fy, sd, fg))
sys.exit(0)
except:
pass
elif options.url and not options.brute and options.default and options.list is not True and options.threads is not True:
tor = options.tor
newip = options.new_identity
Proxy = proxy.Proxy()
outf = options.outfile
if tor is True and newip is None:
Proxy.SetDefaultProxy
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
default_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
print('\n' + sb + fg + '[+]' + sb + fy + ' TOR: configuring tor proxy...')
Proxy.ConfigureProxy
try:
r = req.get('http://my-ip.herokuapp.com/')
except:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy connection error, make sure tor services are running...')
Proxy.SetDefaultProxy
resp = r.text
sp = resp.replace('\n','')
proxy_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
if default_ip != proxy_ip:
print(sb + fg + '[+]' + sb + fy + ' TOR: proxy configured successfully.')
print(sb + fg + '[+]' + sb + fy + ' TOR: network traffic will go through : (%s)' % (proxy_ip))
print(sb + fy + '\n-------------------------------------------------------------------------')
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy configuration is failed')
print(sb + fy + '\n-------------------------------------------------------------------------')
elif tor is True and newip is True:
Proxy.SetDefaultProxy
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
default_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
print('\n' + sb + fg + '[+]' + sb + fy + ' TOR: configuring tor proxy...')
time.sleep(1)
print(sb + fg + '[+]' + sb + fy + ' TOR: requesting new identity...')
time.sleep(1)
_resp = Proxy.NewIdentity
time.sleep(1)
if '250 OK' in _resp:
print(sb + fg + '[+]' + sb + fy + ' TOR: request was successfull.')
Proxy.ConfigureProxy
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: request was unsuccessfull.')
r = req.get('http://my-ip.herokuapp.com/')
resp = r.text
sp = resp.replace('\n','')
proxy_ip = (((sp.split(':')[-1]).replace('}','')).replace('"','')).replace(' ','')
if default_ip != proxy_ip:
print(sb + fg + '[+]' + sb + fy + ' TOR: proxy configured successfully.')
print(sb + fg + '[+]' + sb + fy + ' TOR: network traffic will go through : (%s)' % (proxy_ip))
print(sb + fy + '\n-------------------------------------------------------------------------')
else:
print(sb + fg + '[-]' + sb + fr + ' TOR: proxy configuration is failed')
print(sb + fy + '\n-------------------------------------------------------------------------')
url = options.url
if 'http://' in url:
url = url
elif 'https://' in url:
url = url
else:
url = 'http://%s' % (url)
print('\n' + sb + fg + '[+]' + sb + fy + ' URL: ' + str(url))
print(sb + fg + '[+]' + sb + fy + ' Started: '+str(strftime('%a %b %d %I:%M:%S %Y')))
print(sb + fy + '\n-------------------------------------------------------------------------')
Wp = WPlyzer(url)
resp = Wp.Request()
plugins = Wp._parse_plugins(resp)
if len(plugins) < 1:
print(sb + fy + '[-]' + sd + fr + ' try bruteforcing for plugins...')
else:
for name,ver in plugins.items():
path = '%s/wp-content/plugins/%s/' % (url, name)
if outf:
print('{}[+] {}{}{:<40} : {}{:<8}{} --> {}{}{}{}{}'.format(fy, sb, fg ,name, fy, ver, fg, sd,fm, path, sb, fg))
fname = (url.split('/')[2]).replace('.','-') + '.txt'
fd = open(fname, "a")
fd.write('{:<40} : {:<8} --> {}\n'.format(name, ver, path))
fd.close()
else:
print('{}[+] {}{}{:<40} : {}{:<8}{} --> {}{}{}{}{}'.format(fy, sb, fg ,name, fy, ver, fg, sd,fm, path, sb, fg))
if outf:
print(sb + fy + '-------------------------------------------------------------------------')
print(sb + fg + '[+]' + sb + fy + ' Scan completed for target : (' + sd + fw + str(url) + sb + fy + ')')
print(sb + fg + '[+]' + sb + fy + ' Output is saved to : (' + sd + fw + str((url.split('/')[2]).replace('.','-') + '.txt') + sb + fy + ')')
else:
print(sb + fy + '-------------------------------------------------------------------------')
print(sb + fg + '[+]' + sb + fy + ' Scan completed for target : (' + sd + fw + str(url) + sb + fy + ')')
if __name__ == '__main__':
main()