The following subsections show a graphical representation of the main protocol packets and how to generate them.
First we need to perform some setup to import the packet classes:
In [1]:
from pysap.SAPRouter import *
from IPython.display import display
In [2]:
for command in router_adm_commands:
p = SAPRouter(type=SAPRouter.SAPROUTER_ADMIN, adm_command=command)
print(router_adm_commands[command])
display(p.canvas_dump())
In [3]:
for opcode in router_control_opcodes:
p = SAPRouter(type=SAPRouter.SAPROUTER_CONTROL, opcode=opcode)
if opcode in [70, 71]:
p.snc_frame = ""
print(router_control_opcodes[opcode])
display(p.canvas_dump())
In [4]:
router_string = [SAPRouterRouteHop(hostname="8.8.8.8", port=3299),
SAPRouterRouteHop(hostname="10.0.0.1", port=3200, password="S3cr3t")]
router_string_lens = map(len, map(str, router_string))
p = SAPRouter(type=SAPRouter.SAPROUTER_ROUTE,
route_entries=len(router_string),
route_talk_mode=1,
route_rest_nodes=1,
route_length=sum(router_string_lens),
route_offset=router_string_lens[0],
route_string=router_string)
display(p.canvas_dump())
for x in router_string:
display(x.canvas_dump())
In [5]:
p = SAPRouter(type=SAPRouter.SAPROUTER_PONG)
p.canvas_dump()
Out[5]: