# Path: lib/out.py
# def windows_out(color, msg):
# def good(msg):
# def warning(msg):
# def error(msg):
# def jump(url):
# def alert(content, url):
#     STD_OUTPUT_HANDLE = -11
# 
# Path: lib/config.py
# def load():
# def update(conf):
# def load_rule():
# def update_rule(rule):
# def rule_read(name, get_file_handle=None):
# def rule_write(name, rule):
# 
# Path: lib/redisopt.py
# def get_hash(host, uri, postdata):
# def content_deal(headers, host, method, postdata, uri, packet):


import re
import json
import time
import base64
import requests
import urlparse
import threading
from xml.dom import minidom
from base64 import decodestring as ds
from lib import out
from lib import config
from lib.redisopt import conn
    elif urlparse.urlparse(request['url']).query != "":
        url = request['url'].replace(param, param + payload)
        res, times = time_requests(request['method'], url, request['headers'], request['postdata'])
    elif time_check:
        return "Error", 0
    else:
        return "Error"
    if time_check:
        return res, times
    else:
        return res


def query_collect(query, url):
    url = urlparse.urlparse(url)
    return urlparse.urlunparse((url.scheme, url.netloc, url.path, url.params, query, url.fragment))


def requests_convert(request):
    url = urlparse.urlparse(request['url'])
    query = re.sub("=$", "=1", url.query.replace("=&", "=1&"))
    request['url'] = query_collect(query, request['url'])
    return request


def scan_start():
    while config.load()['scan_stat'].lower() == "true":
        try:
            while thread_filled():
                time.sleep(5)

# Path: lib/out.py
# def windows_out(color, msg):
# def good(msg):
# def warning(msg):
# def error(msg):
# def jump(url):
# def alert(content, url):
#     STD_OUTPUT_HANDLE = -11
# 
# Path: lib/config.py
# def load():
# def update(conf):
# def load_rule():
# def update_rule(rule):
# def rule_read(name, get_file_handle=None):
# def rule_write(name, rule):
# 
# Path: lib/redisopt.py
# def get_hash(host, uri, postdata):
# def content_deal(headers, host, method, postdata, uri, packet):


# Path: lib/scan.py
import re
import json
import time
import base64
import requests
import urlparse
import threading
from xml.dom import minidom
from base64 import decodestring as ds
from lib import out
from lib import config
from lib.redisopt import conn

    elif urlparse.urlparse(request['url']).query != "":
        url = request['url'].replace(param, param + payload)
        res, times = time_requests(request['method'], url, request['headers'], request['postdata'])
    elif time_check:
        return "Error", 0
    else:
        return "Error"
    if time_check:
        return res, times
    else:
        return res


def query_collect(query, url):
    url = urlparse.urlparse(url)
    return urlparse.urlunparse((url.scheme, url.netloc, url.path, url.params, query, url.fragment))


def requests_convert(request):
    url = urlparse.urlparse(request['url'])
    query = re.sub("=$", "=1", url.query.replace("=&", "=1&"))
    request['url'] = query_collect(query, request['url'])
    return request


def scan_start():
    while config.load()['scan_stat'].lower() == "true":
        try:
            while thread_filled():
                time.sleep(5)

            reqhash = conn.rpoplpush("waiting", "running")