Esempio n. 1
0
import monkey
import os

if monkey.init(None, 0, 0, None) == False:
    os._exit(1)
if monkey.start() == False:
    os._exit(1)
if monkey.start() == False:
    os._exit(1)
Esempio n. 2
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()
Esempio n. 3
0
import monkey

f = open('/tmp/index.html', 'w')
f.write("<html><body><h2>Hello Monkey</h2></body></html>")
f.close()

monkey.init(None, 0, 0, '/tmp/')
monkey.configure(indexfile='index.html')

monkey.start()
raw_input("Press enter to stop the server...")
monkey.stop()
Esempio n. 4
0
import monkey
import os

monkey.init(None, 0, 0, None)
monkey.start()

n1 = len(monkey.mimetype_list())

monkey.mimetype_add("name1", "1")
monkey.mimetype_add("name2", "2")

n2 = len(monkey.mimetype_list())

if n2 - n1 != 2:
    os._exit(1)

monkey.stop()
Esempio n. 5
0
import monkey
import os

if not monkey.init(None, 0, 0, None):
    os._exit(1)
if not monkey.stop():
    os._exit(1)
Esempio n. 6
0
import monkey
import os

if not monkey.init('lol', 0, 0, None):
    os._exit(1)
Esempio n. 7
0
import monkey
import os

if not monkey.init(None, -1, 0, None):
    os._exit(1)
Esempio n. 8
0
import monkey

with open('outputs/a', 'w') as f:
    f.write('a\n')
print('a')

monkey.init({'p1': 5, 'p2': 6})

with open('outputs/b', 'w') as f:
    f.write('b\n')
print('b')

while True:
    pass