예제 #1
0
import monkey
import os


def datacb(vhost, url, get, get_len, post, post_len, header):
    os._exit(1)


def urlch(string):
    return 0


monkey.init(None, 0, 0, None)
monkey.set_callback('data', datacb)
monkey.set_callback('url', urlch)
monkey.start()
os.system('wget -q -t2 -O /dev/null localhost:2001')
monkey.stop()
예제 #2
0
파일: quiz.py 프로젝트: AmesianX/monkey
    global content
    content = "<html><body><center><h2>I'm a sad puppy.</h2>\n</center></body></html>"

def listf(vhost, url, get, get_len, post, post_len, header):
    global content
    global image
    ret = {}
    if url == '/image.png':
        ret['content'] = image
        ret['content_len'] = len(ret['content'])
        ret['return'] = 1
        return ret
    if post is None:
        front()
    elif 'q1=who' in post or 'q1=yes' in post:
        points()
    else:
        wrong()

    ret['content'] = content
    ret['content_len'] = len(ret['content'])
    ret['return'] = 1

    return ret

monkey.init(None, 0, 0, None)
monkey.set_callback('data', listf)
monkey.start()
raw_input("Press enter to stop the server...")
monkey.stop()
예제 #3
0
    ret['return'] = 1
    ret['content'] = content
    ret['content_len'] = len(content)
    return ret

class WorkerThread(threading.Thread):
    def __init__(self, num_requests):
        super(WorkerThread, self).__init__()
        self.num_requests = num_requests
    def run(self):
        for r in range(self.num_requests):
            subprocess.call('curl localhost:2001 1> /dev/null 2> /dev/null', shell=True)

if __name__ == '__main__':
    monkey.init(None, 0, 0, None)
    monkey.set_callback('data', datacb)
    monkey.start()

    threads = []
    for t in range(NUM_THREADS):
        t = WorkerThread(REQ_PER_THREAD)
        threads.append(t)

    [t.start() for t in threads]
    [t.join() for t in threads]

    workers = monkey.scheduler_workers_info()
    for w in workers:
        w.print_info()

    monkey.stop()
예제 #4
0
import monkey
import os
import subprocess

content = "\0" * 50000


def datacb(vhost, url, get, get_len, post, post_len, header):
    ret = {}
    ret["return"] = 1
    ret["content"] = content
    ret["clen"] = len(ret["content"])
    return ret


monkey.init(None, 0, 0, None)
monkey.set_callback("data", datacb)
monkey.start()
subprocess.call("curl localhost:2001 >/tmp/tmpfile 2>/dev/null", shell=True)
if "a68b2482a6c645a9738329909861afb3" not in subprocess.check_output("md5sum /tmp/tmpfile", shell=True):
    os._exit(1)
monkey.stop()
예제 #5
0
파일: ip-ban.py 프로젝트: AmesianX/monkey
import monkey
import os

def datacb(vhost, url, get, get_len, post, post_len, header):
    os._exit(1)

def ipch(string):
    return 0

monkey.init(None, 0, 0, None)
monkey.set_callback('data', datacb)
monkey.set_callback('ip', ipch)
monkey.start()
os.system('wget -q -t2 -O /dev/null localhost:2001')
monkey.stop()
예제 #6
0
파일: ip-ban.py 프로젝트: KqSMea8/gueslang
import monkey
import os


def datacb(vhost, url, get, get_len, post, post_len, header):
    os._exit(1)


def ipch(string):
    return 0


monkey.init(None, 0, 0, None)
monkey.set_callback('data', datacb)
monkey.set_callback('ip', ipch)
monkey.start()
os.system('wget -q -t2 -O /dev/null localhost:2001')
monkey.stop()
예제 #7
0
파일: url-ban.py 프로젝트: AmesianX/monkey
import monkey
import os

def datacb(vhost, url, get, get_len, post, post_len, header):
    os._exit(1)

def urlch(string):
    return 0

monkey.init(None, 0, 0, None)
monkey.set_callback('data', datacb)
monkey.set_callback('url', urlch)
monkey.start()
os.system('wget -q -t2 -O /dev/null localhost:2001')
monkey.stop()
예제 #8
0

def listf(vhost, url, get, get_len, post, post_len, header):
    global content
    global image
    ret = {}
    if url == '/image.png':
        ret['content'] = image
        ret['content_len'] = len(ret['content'])
        ret['return'] = 1
        return ret
    if post is None:
        front()
    elif 'q1=who' in post or 'q1=yes' in post:
        points()
    else:
        wrong()

    ret['content'] = content
    ret['content_len'] = len(ret['content'])
    ret['return'] = 1

    return ret


monkey.init(None, 0, 0, None)
monkey.set_callback('data', listf)
monkey.start()
raw_input("Press enter to stop the server...")
monkey.stop()