Exemplo n.º 1
0
def test_fuzz():
    pwd = os.environ['PWD']
    for i in range(1,100):
        with open('{}/tests/fuzzdb/{}.dat'.format(pwd, i), 'wb') as fout:
            fout.write(os.urandom(random.randint(2,400))) # replace 1024 with size_kb if not unreasonably large
    # Now let's inspect the garbage.
    netdb.inspect(netdb_dir='{}/fuzzdb/'.format(pwd))
Exemplo n.º 2
0
def test_fuzz():
    pwd = os.environ['PWD']
    for i in range(1, 100):
        with open('{}/tests/fuzzdb/{}.dat'.format(pwd, i), 'wb') as fout:
            fout.write(os.urandom(random.randint(
                2,
                400)))  # replace 1024 with size_kb if not unreasonably large
    # Now let's inspect the garbage.
    netdb.inspect(netdb_dir='{}/fuzzdb/'.format(pwd))
Exemplo n.º 3
0
#!/usr/bin/python
import os,netdb,sys

def _print_hook(netdbe):
    print (netdbe['published'])

if len(sys.argv) != 2:
    print 'Usage: ripubd.py <dir>'
    sys.exit(-1)

netdb.inspect(_print_hook,sys.argv[1])
Exemplo n.º 4
0
	parser.add_argument('-s', '--server', help='where to send data',type=str, default='tuuql5avhexhn7oq4lhyfythxejgk4qpavxvtniu3u3hwfwkogmq.b32.i2p')
	parser.add_argument('-p', '--port', help='where to send data',type=int, default='80')
	parser.add_argument('-t', '--token', help='token to prove yourself',type=str, default='')
	args = parser.parse_args()

	if not args.token:
		print 'Use a token. See --help for usage.'
		raise SystemExit, 0

	rpc = i2pcontrol.pyjsonrpc.HttpClient(
		url = ''.join(['http://',args.server,':',str(args.port)]),
		gzipped = True
	)
	
	# NetDB Stuff
	netdb.inspect(hook=print_entry)

	# Local router stuff
	a = i2pcontrol.I2PController()
	vals = a.getRouterInfo()
	this_router = {
		'activepeers'          : vals['i2p.router.netdb.activepeers'],
		'fastpeers'            : vals['i2p.router.netdb.fastpeers'],
		'highcapacitypeers'    : vals['i2p.router.netdb.highcapacitypeers'],
		'tunnelsparticipating' : vals['i2p.router.net.tunnels.participating'],
	}

	try:
		rpc.collect(token=args.token, netdb=routers, local=this_router, version=VERSION)
	except i2pcontrol.pyjsonrpc.JsonRpcError, err:
		print 'Error code {}: {} -- {}'.format(err.code, err.message, err.data)
Exemplo n.º 5
0
import netdb
netdb.inspect()