Created
March 8, 2012 23:07
-
-
Save daniel-garcia/2004030 to your computer and use it in GitHub Desktop.
Generate honeyd.conf for proxying localhost as monitoring target network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import random | |
#numnets = 253 | |
#numhosts = 253 | |
numnets = 128 | |
numhosts = 253 | |
#numnets = 3 | |
#numhosts = 5 | |
print """\ | |
route entry 10.183.0.1 | |
# create the default template | |
# drop/block all packets | |
create default | |
set default default tcp action block | |
set default default udp action block | |
set default default icmp action block | |
set default maxfds 50 | |
""" | |
i = 1; | |
SNMP_HOSTS = 950 | |
generated_hosts = 0 | |
profiles = set() | |
for network in range(numnets+1): | |
if network > 0: | |
print "" | |
print "route 10.183.0.1 add net 10.183.%s.0/24 10.183.%s.1" % (network, network) | |
print "route 10.183.%s.1 link 10.183.%s.0/24" % (network, network) | |
for host in range(2, numhosts+1): | |
if i > SNMP_HOSTS: | |
i = 1 | |
i += 1 | |
phost = i % 187 | |
pnetwork = i / 254 | |
args = { | |
'profile': 'host_10_181_%d_%d' % (pnetwork, phost), | |
'proxy': '10.181.%s.%s' % (pnetwork, phost), | |
'host': host, | |
'network': network, | |
'uptime': random.randint(300, 200000), | |
} | |
if args['profile'] not in profiles: | |
profiles.add(args['profile']) | |
print """ | |
create %(profile)s | |
set %(profile)s uptime %(uptime)d | |
set %(profile)s default icmp action open | |
add %(profile)s tcp port 22 proxy %(proxy)s:22 | |
add %(profile)s udp port 161 proxy %(proxy)s:9001 | |
add %(profile)s udp port 9001 proxy %(proxy)s:9001 | |
""" % args | |
print "bind 10.183.%(network)s.%(host)s %(profile)s" % args | |
generated_hosts += 1 | |
print "# generated hosts : %d " % generated_hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment