mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-08-04 06:50:14 +00:00
Adding support for multi-threading in (testing) vulnserver
This commit is contained in:
parent
4e938ea4fd
commit
07e6a0a079
3 changed files with 12 additions and 6 deletions
|
|
@ -12,6 +12,7 @@ from __future__ import print_function
|
|||
import re
|
||||
import sqlite3
|
||||
import sys
|
||||
import threading
|
||||
import traceback
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
|
|
@ -53,14 +54,17 @@ LISTEN_PORT = 8440
|
|||
|
||||
_conn = None
|
||||
_cursor = None
|
||||
_lock = None
|
||||
_server = None
|
||||
|
||||
def init(quiet=False):
|
||||
global _conn
|
||||
global _cursor
|
||||
global _lock
|
||||
|
||||
_conn = sqlite3.connect(":memory:", isolation_level=None, check_same_thread=False)
|
||||
_cursor = _conn.cursor()
|
||||
_lock = threading.Lock()
|
||||
|
||||
_cursor.executescript(SCHEMA)
|
||||
|
||||
|
|
@ -116,11 +120,13 @@ class ReqHandler(BaseHTTPRequestHandler):
|
|||
self.end_headers()
|
||||
|
||||
try:
|
||||
_cursor.execute("SELECT * FROM users WHERE id=%s LIMIT 0, 1" % self.params.get("id", ""))
|
||||
with _lock:
|
||||
_cursor.execute("SELECT * FROM users WHERE id=%s LIMIT 0, 1" % self.params.get("id", ""))
|
||||
results = _cursor.fetchall()
|
||||
|
||||
output = "<b>SQL results:</b>\n"
|
||||
output += "<table border=\"1\">\n"
|
||||
for row in _cursor.fetchall():
|
||||
for row in results:
|
||||
output += "<tr>"
|
||||
for value in row:
|
||||
output += "<td>%s</td>" % value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue