forked from 5alt/autoSqlmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
myinjector.py
39 lines (34 loc) · 1005 Bytes
/
myinjector.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
# -*- coding: utf-8 -*-
from Queue import Empty
import multiprocessing
import time
import sys
from lib.sqlmapapiwrapper import SqlmapAPIWrapper
import config
def with_color(c, s):
return "\x1b[%dm%s\x1b[0m" % (c, s)
class myinjector():
def run(self):
while True:
try:
(fname,taskid,url,start_time) = config.queue.get(timeout=1)
injector = SqlmapAPIWrapper(fname)
injector.settaskid(taskid)
if not injector.terminal():
if time.time()-start_time>config.sqlmap_tasktimeout:
injector.clear()
continue
config.queue.put((fname,taskid,url,start_time))
time.sleep(3)
continue
if injector.vulnerable():
print with_color(32, "#%s [VulUrl] %s"%(time.strftime("%H:%M:%S"),url))
print with_color(32, "#%s [Exploit] sqlmap -r %s"%(time.strftime("%H:%M:%S"), config.save_path + '/' + fname))
sys.stdout.flush()
injector.delete()
else:
injector.clear()
except Empty:
time.sleep(3)
except KeyboardInterrupt:
return