-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathautofuck.py
106 lines (79 loc) · 2.49 KB
/
autofuck.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
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
__author__ = 'fengxuan'
import os
import sys
import json
import importlib
import threading
from multiprocessing import Process
from termcolor import cprint
from lib.gwhatweb import gwhatweb
from lib.log import logger
absolutepath = sys.path[0]
def LoadCmsFingerprint():
cmsfinger = []
cmsjson = "{0}{1}json/testcms.json".format(absolutepath, os.sep)
with open(cmsjson) as f:
cmsfinger = json.load(f)
return cmsfinger
def LoadPocPlugin():
cmspocs = []
cmsjson = "{0}{1}json/data.json".format(absolutepath, os.sep)
logger.info("Load Poc Plugin ! ------------------")
with open(cmsjson) as f:
cmspocs = json.load(f)
logger.info("Load Poc Plugin Done! ------------------")
return cmspocs
pocplugin = LoadPocPlugin()
class AutoFuck():
def __init__(self, url, cms):
self.url = url
self.cms = cms
def attack(self):
pass
def verify(self):
if self.cms not in pocplugin['cms']:
logger.error("we don't have this cms poc")
return False
process_list = []
for poc in pocplugin['cms'][self.cms]:
import_module = 'pocs.cms.{cms}.{filename}'.format(cms=self.cms, filename=poc['method'].replace('_BaseVerify', ''))
p = threading.Thread(target=self.run, args=(import_module,poc,))
process_list.append(p)
for p in process_list:
p.setDaemon(True)
p.start()
for pro in process_list:
pro.join()
def run(self, import_module, poc):
method = importlib.import_module(import_module)
command_run = "method.{classname}('{url}').run()".format(classname=poc['method'], url=self.url)
eval(command_run)
def loadtargetfile(filename):
targetlist = []
with open(filename) as f:
for line in f.readlines():
targetlist.append(line.strip())
return targetlist
def onedragon(url):
p = gwhatweb(url, cmsfinger)
cms = p.whatweb()
if cms:
at = AutoFuck(url, cms)
at.verify()
else:
cprint("Can't' Recognition this url {0}".format(url))
def main():
targetlist = loadtargetfile('target.txt')
process_list = []
for url in targetlist:
p = Process(target=onedragon, args=(url,))
process_list.append(p)
for p in process_list:
p.start()
for pro in process_list:
pro.join()
if __name__ == '__main__':
cmsfinger = LoadCmsFingerprint()
main()