Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-w-du committed Jul 30, 2021
1 parent e2360f1 commit a7b6b8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions examples/B00-mini-internet/mini-internet.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,6 @@
emu.dump('base-component.bin')

# Uncomment the following if you want to generate the final emulation files
#emu.render()
#emu.compile(Docker(), './output')
emu.render()
emu.compile(Docker(), './output')

15 changes: 6 additions & 9 deletions examples/B05-botnet/botnet-basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,26 @@
###############################################################################
# Build a botnet

# Create services for botnet controller and client
# Create two service layers
bot = BotnetService()
botClient = BotnetClientService()

# Pick an IP for botnet controller
controllerIp = '10.150.0.66'

# Create a virtual node for bot controller,
# and add a file to this node
f = open("./ddos.py", "r")
bot.install('bot_controller').addFile(f.read(), "/tmp/ddos.py")

# Bind the virtual node to a physical node (create a new one)
emu.addBinding(Binding('bot_controller', filter = Filter(ip = controllerIp), action = Action.NEW))
emu.addBinding(Binding('bot_controller',
filter = Filter(ip='10.150.0.66'), action=Action.NEW))

for asn in [151, 152, 153, 154]:
vname = 'bot{}'.format(asn)

# Create a virtual node for each bot client
# Create a virtual node for each bot client,
# bind the virtual node to a physical node (new)
botClient.install(vname).setServer('bot_controller')

# Bind the virtual node to a physical node (new)
emu.addBinding(Binding(vname, filter = Filter(asn = asn), action = Action.NEW))
emu.addBinding(Binding(vname, filter = Filter(asn=asn), action=Action.NEW))

###############################################################################

Expand Down

0 comments on commit a7b6b8a

Please sign in to comment.