layer567 Package

aim Module

AOL Instant Messenger.

class pypacker.layer567.aim.FLAP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('ast', 'B', 42), ('type', 'B', 0), ('seq', 'H', 0), ('len', 'H', 0))
class pypacker.layer567.aim.SNAC(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('family', 'H', 0), ('subtype', 'H', 0), ('flags', 'H', 0), ('reqid', 'I', 0))
pypacker.layer567.aim.tlv(buf)

bgp Module

Border Gateway Protocol.

class pypacker.layer567.bgp.BGP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('marker', '16s', b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'), ('len', 'H', 0), ('type', 'B', 1))
class pypacker.layer567.bgp.Route(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('len', 'B', 0),)

dhcp Module

Dynamic Host Configuration Protocol.

class pypacker.layer567.dhcp.DHCP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('op', 'B', 1), ('hrd', 'B', 1), ('hln', 'B', 6), ('hops', 'B', 0), ('xid', 'I', 3735928559), ('secs', 'H', 0), ('flags', 'H', 0), ('ciaddr', 'I', 0), ('yiaddr', 'I', 0), ('siaddr', 'I', 0), ('giaddr', 'I', 0), ('chaddr', '16s', b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'), ('sname', '64s', b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'), ('file', '128s', b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'), ('magic', 'I', 1669485411), ('opts', None, <class 'pypacker.layer567.dhcp.DHCPTriggerList'>))
class pypacker.layer567.dhcp.DHCPOptMulti(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('type', 'B', 0), ('len', 'B', 0))
class pypacker.layer567.dhcp.DHCPOptSingle(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('type', 'B', 0),)
class pypacker.layer567.dhcp.DHCPTriggerList(lst=[], clz=None)

Bases: pypacker.triggerlist.TriggerList

DHCP-TriggerList to enable “opts += [(DHCP_OPT_X, b”xyz”)], opts[x] = (DHCP_OPT_X, b”xyz”)”, length should be auto-calculated.

diameter Module

Diameter.

class pypacker.layer567.diameter.AVP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('code', 'I', 0), ('flags', 'B', 0), ('len', '3s', b''))
class pypacker.layer567.diameter.Diameter(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('v', 'B', 1), ('len', '3s', 0), ('flags', 'B', 0), ('cmd', '3s', 0), ('app_id', 'I', 0), ('hop_id', 'I', 0), ('end_id', 'I', 0), ('avps', None, <class 'pypacker.triggerlist.TriggerList'>))

dns Module

Domain Name System.

class pypacker.layer567.dns.DNS(*args, **kwargs)

Bases: pypacker.pypacker.Packet

class AddRecord(*args, **kwargs)

Bases: pypacker.pypacker.Packet

DNS additional records.

__hdr__ = (('name', None, <class 'pypacker.layer567.dns.DNSString'>), ('postfix', 'B', 0), ('type', 'H', 41), ('plen', 'H', 4096), ('rcode', 'B', 0), ('edns', 'B', 0), ('z', 'H', 0), ('dlen', 'H', 0))
class DNS.Answer(*args, **kwargs)

Bases: pypacker.pypacker.Packet

DNS resource record.

__hdr__ = (('name', 'H', 49164), ('type', 'H', 1), ('cls', 'H', 1), ('ttl', 'I', 180), ('dlen', 'H', 4), ('address', None, <class 'pypacker.triggerlist.TriggerList'>))
class DNS.Auth(*args, **kwargs)

Bases: pypacker.pypacker.Packet

Auth data.

__hdr__ = (('name', 'H', 0), ('type', 'H', 0), ('cls', 'H', 0), ('ttl', 'I', 0), ('dlen', 'H', 0), ('name', None, <class 'pypacker.layer567.dns.DNSString'>), ('postfix1', 'B', 0), ('mailbox', None, <class 'pypacker.layer567.dns.DNSString'>), ('postfix2', 'B', 0), ('pserver', 'H', 0), ('mbox', 'H', 0), ('serial', 'H', 0), ('refresh', 'H', 0), ('retry', 'H', 0), ('expire', 'H', 0), ('minttl', 'H', 0))
class DNS.Query(*args, **kwargs)

Bases: pypacker.pypacker.Packet

DNS question.

__hdr__ = (('name', None, <class 'pypacker.layer567.dns.DNSString'>), ('postfix', 'B', 0), ('type', 'H', 1), ('cls', 'H', 1))
DNS.__hdr__ = (('id', 'H', 4660), ('flags', 'H', 288), ('questions_amount', 'H', 0), ('answers_amount', 'H', 0), ('authrr_amount', 'H', 0), ('addrr_amount', 'H', 0), ('queries', None, <class 'pypacker.layer567.dns.DNSTriggerList'>), ('answers', None, <class 'pypacker.layer567.dns.DNSTriggerList'>), ('auths', None, <class 'pypacker.layer567.dns.DNSTriggerList'>), ('addrecords', None, <class 'pypacker.layer567.dns.DNSTriggerList'>))
class pypacker.layer567.dns.DNSString(lst=[], clz=None)

Bases: pypacker.triggerlist.TriggerList

class pypacker.layer567.dns.DNSTriggerList(lst=[], clz=None)

Bases: pypacker.triggerlist.TriggerList

hsrp Module

Cisco Hot Standby Router Protocol.

class pypacker.layer567.hsrp.HSRP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('version', 'B', 0), ('opcode', 'B', 0), ('state', 'B', 0), ('hello', 'B', 0), ('hold', 'B', 0), ('priority', 'B', 0), ('group', 'B', 0), ('rsvd', 'B', 0), ('auth', '8s', b'cisco'), ('vip', '4s', b''))

http Module

Hypertext Transfer Protocol.

class pypacker.layer567.http.HTTP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('header', None, <class 'pypacker.layer567.http.HTTPTriggerList'>),)
class pypacker.layer567.http.HTTPTriggerList(lst=[], clz=None)

Bases: pypacker.triggerlist.TriggerList

pypacker.layer567.http.parse_body(buf, headers)

Return HTTP body parsed from a file object, given HTTP header dict.

netflow Module

Cisco Netflow.

class pypacker.layer567.netflow.Netflow1(*args, **kwargs)

Bases: pypacker.layer567.netflow.NetflowBase

Netflow Version 1.

class NetflowRecord(*args, **kwargs)

Bases: pypacker.layer567.netflow.NetflowRecordBase

Netflow v1 flow record.

__hdr__ = (('src_addr', 'I', 0), ('dst_addr', 'I', 0), ('next_hop', 'I', 0), ('input_iface', 'H', 0), ('output_iface', 'H', 0), ('pkts_sent', 'I', 0), ('bytes_sent', 'I', 0), ('start_time', 'I', 0), ('end_time', 'I', 0), ('src_port', 'H', 0), ('dst_port', 'H', 0), ('pad1', 'H', 0), ('ip_proto', 'B', 0), ('tos', 'B', 0), ('tcp_flags', 'B', 0), ('pad2', 'B', 0), ('pad3', 'H', 0), ('reserved', 'I', 0))
class pypacker.layer567.netflow.Netflow5(*args, **kwargs)

Bases: pypacker.layer567.netflow.NetflowBase

Netflow Version 5.

class NetflowRecord(*args, **kwargs)

Bases: pypacker.layer567.netflow.NetflowRecordBase

Netflow v5 flow record.

__hdr__ = (('src_addr', 'I', 0), ('dst_addr', 'I', 0), ('next_hop', 'I', 0), ('input_iface', 'H', 0), ('output_iface', 'H', 0), ('pkts_sent', 'I', 0), ('bytes_sent', 'I', 0), ('start_time', 'I', 0), ('end_time', 'I', 0), ('src_port', 'H', 0), ('dst_port', 'H', 0), ('pad1', 'B', 0), ('tcp_flags', 'B', 0), ('ip_proto', 'B', 0), ('tos', 'B', 0), ('src_as', 'H', 0), ('dst_as', 'H', 0), ('src_mask', 'B', 0), ('dst_mask', 'B', 0), ('pad2', 'H', 0))
Netflow5.__hdr__ = (('version', 'H', 1), ('count', 'H', 0), ('sys_uptime', 'I', 0), ('unix_sec', 'I', 0), ('unix_nsec', 'I', 0), ('flow_sequence', 'I', 0), ('engine_type', 'B', 0), ('engine_id', 'B', 0), ('reserved', 'H', 0))
class pypacker.layer567.netflow.Netflow6(*args, **kwargs)

Bases: pypacker.layer567.netflow.NetflowBase

Netflow Version 6. XXX - unsupported by Cisco, but may be found in the field.

class NetflowRecord(*args, **kwargs)

Bases: pypacker.layer567.netflow.NetflowRecordBase

Netflow v6 flow record.

__hdr__ = (('src_addr', 'I', 0), ('dst_addr', 'I', 0), ('next_hop', 'I', 0), ('input_iface', 'H', 0), ('output_iface', 'H', 0), ('pkts_sent', 'I', 0), ('bytes_sent', 'I', 0), ('start_time', 'I', 0), ('end_time', 'I', 0), ('src_port', 'H', 0), ('dst_port', 'H', 0), ('pad1', 'B', 0), ('tcp_flags', 'B', 0), ('ip_proto', 'B', 0), ('tos', 'B', 0), ('src_as', 'H', 0), ('dst_as', 'H', 0), ('src_mask', 'B', 0), ('dst_mask', 'B', 0), ('in_encaps', 'B', 0), ('out_encaps', 'B', 0), ('peer_nexthop', 'I', 0))
Netflow6.__hdr__ = (('version', 'H', 1), ('count', 'H', 0), ('sys_uptime', 'I', 0), ('unix_sec', 'I', 0), ('unix_nsec', 'I', 0), ('flow_sequence', 'I', 0), ('engine_type', 'B', 0), ('engine_id', 'B', 0), ('reserved', 'H', 0))
class pypacker.layer567.netflow.Netflow7(*args, **kwargs)

Bases: pypacker.layer567.netflow.NetflowBase

Netflow Version 7.

class NetflowRecord(*args, **kwargs)

Bases: pypacker.layer567.netflow.NetflowRecordBase

Netflow v7 flow record.

__hdr__ = (('src_addr', 'I', 0), ('dst_addr', 'I', 0), ('next_hop', 'I', 0), ('input_iface', 'H', 0), ('output_iface', 'H', 0), ('pkts_sent', 'I', 0), ('bytes_sent', 'I', 0), ('start_time', 'I', 0), ('end_time', 'I', 0), ('src_port', 'H', 0), ('dst_port', 'H', 0), ('flags', 'B', 0), ('tcp_flags', 'B', 0), ('ip_proto', 'B', 0), ('tos', 'B', 0), ('src_as', 'H', 0), ('dst_as', 'H', 0), ('src_mask', 'B', 0), ('dst_mask', 'B', 0), ('pad2', 'H', 0), ('router_sc', 'I', 0))
Netflow7.__hdr__ = (('version', 'H', 1), ('count', 'H', 0), ('sys_uptime', 'I', 0), ('unix_sec', 'I', 0), ('unix_nsec', 'I', 0), ('flow_sequence', 'I', 0), ('reserved', 'I', 0))
class pypacker.layer567.netflow.NetflowBase(*args, **kwargs)

Bases: pypacker.pypacker.Packet

Base class for Cisco Netflow packets.

class NetflowRecordBase(*args, **kwargs)

Bases: pypacker.pypacker.Packet

Base class for netflow v1-v7 netflow records.

NetflowBase.__hdr__ = (('version', 'H', 1), ('count', 'H', 0), ('sys_uptime', 'I', 0), ('unix_sec', 'I', 0), ('unix_nsec', 'I', 0))

ntp Module

Network Time Protocol.

class pypacker.layer567.ntp.NTP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('flags', 'B', 28), ('stratum', 'B', 2), ('interval', 'B', 4), ('precision', 'B', 233), ('delay', 'I', 0), ('dispersion', 'I', 0), ('id', '4s', b'\x00\x01\x02\x03'), ('update_time', '8s', b'\x00\x00\x00\x00\x00\x00\x00\x00'), ('originate_time', '8s', b''), ('receive_time', '8s', b''), ('transmit_time', '8s', b''))

pmap Module

Portmap / rpcbind.

class pypacker.layer567.pmap.Pmap(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('prog', 'I', 0), ('vers', 'I', 0), ('prot', 'I', 0), ('port', 'I', 0))

radius Module

Remote Authentication Dial-In User Service.

class pypacker.layer567.radius.Radius(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('code', 'B', 0), ('id', 'B', 0), ('len', 'H', 4), ('auth', '16s', b''))
parse_attrs(buf)

Parse attributes buffer into a list of (type, data) tuples.

rfb Module

Remote Framebuffer Protocol.

class pypacker.layer567.rfb.CutText(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('pad', '3s', ''), ('length', 'I', 0))
class pypacker.layer567.rfb.FramebufferUpdate(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('pad', '1s', ''), ('num_rects', 'H', 0))
class pypacker.layer567.rfb.FramebufferUpdateRequest(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('incremental', 'B', 0), ('x_position', 'H', 0), ('y_position', 'H', 0), ('width', 'H', 0), ('height', 'H', 0))
class pypacker.layer567.rfb.KeyEvent(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('down_flag', 'B', 0), ('pad', '2s', ''), ('key', 'I', 0))
class pypacker.layer567.rfb.PointerEvent(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('button_mask', 'B', 0), ('x_position', 'H', 0), ('y_position', 'H', 0))
class pypacker.layer567.rfb.RFB(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('type', 'B', 0),)
class pypacker.layer567.rfb.SetColourMapEntries(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('pad', '1s', ''), ('first_colour', 'H', 0), ('num_colours', 'H', 0))
class pypacker.layer567.rfb.SetEncodings(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('pad', '1s', ''), ('num_encodings', 'H', 0))
class pypacker.layer567.rfb.SetPixelFormat(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('pad', '3s', ''), ('pixel_fmt', '16s', ''))

rip Module

Routing Information Protocol.

class pypacker.layer567.rip.Auth(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('rsvd', 'H', 65535), ('type', 'H', 2), ('auth', '16s', 0))
class pypacker.layer567.rip.RIP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('cmd', 'B', 1), ('v', 'B', 2), ('rsvd', 'H', 0), ('rte_auth', None, <class 'pypacker.triggerlist.TriggerList'>))
class pypacker.layer567.rip.RTE(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('family', 'H', 2), ('route_tag', 'H', 0), ('addr', 'I', 0), ('subnet', 'I', 0), ('next_hop', 'I', 0), ('metric', 'I', 1))

rpc Module

Remote Procedure Call.

class pypacker.layer567.rpc.RPC(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('xid', 'I', 0), ('dir', 'I', 0))
pypacker.layer567.rpc.pack_xdrlist(*args)
pypacker.layer567.rpc.unpack_xdrlist(cls, buf)

rtp Module

Real-Time Transport Protocol

class pypacker.layer567.rtp.RTP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('type', 'H', 32768), ('seq', 'H', 0), ('ts', 'I', 0), ('ssrc', 'I', 0))

sip Module

Session Initiation Protocol.

class pypacker.layer567.sip.SIP(*args, **kwargs)

Bases: pypacker.layer567.http.HTTP

smb Module

Server Message Block.

class pypacker.layer567.smb.SMB(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = [('proto', '4s', b''), ('cmd', 'B', 0), ('err', 'I', 0), ('flags1', 'B', 0), ('flags2', 'B', 0), ('pad', '6s', ''), ('tid', 'H', 0), ('pid', 'H', 0), ('uid', 'H', 0), ('mid', 'H', 0)]

ssl Module

Secure Sockets Layer / Transport Layer Security.

class pypacker.layer567.ssl.SSL(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('records', None, <class 'pypacker.triggerlist.TriggerList'>),)
class pypacker.layer567.ssl.SSL2(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('len', 'H', 0), ('msg', 's', ''), ('pad', 's', ''))
class pypacker.layer567.ssl.TLSHello(*args, **kwargs)

Bases: pypacker.pypacker.Packet

Client and server hello.

__hdr__ = (('type', 'B', 0), ('len', '3s', 0), ('version', 'H', 769), ('random', '32s', b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'), ('sid_len', 'B', 32))
class pypacker.layer567.ssl.TLSRecord(*args, **kwargs)

Bases: pypacker.pypacker.Packet

SSLv3 or TLSv1+ packet.

In addition to the fields specified in the header, there are compressed and decrypted fields, indicating whether, in the language of the spec, this is a TLSPlaintext, TLSCompressed, or TLSCiphertext. The application will have to figure out when it’s appropriate to change these values.

__hdr__ = (('type', 'B', 0), ('version', 'H', 0), ('len', 'H', 0))
pypacker.layer567.ssl.parse_variable_array(buf, lenbytes)

Parse an array described using the “Type name<x..y>” syntax from the spec

Read a length at the start of buf, and returns that many bytes after, in a tuple with the TOTAL bytes consumed (including the size). This does not check that the array is the right length for any given datatype.

ssl_ciphersuites Module

Nicely formatted cipher suite definitions for TLS

A list of cipher suites in the form of CipherSuite objects. These are supposed to be immutable; don’t mess with them.

class pypacker.layer567.ssl_ciphersuites.CipherSuite(code, name, kx, auth, encoding, mac)

Bases: builtins.object

Encapsulates a cipher suite.

Members/args: * code: two-byte ID code, as int * name: as in ‘TLS_RSA_WITH_RC4_40_MD5’ * kx: key exchange algorithm, string * auth: authentication algorithm, string * encoding: encoding algorithm * mac: message authentication code algorithm

block_size

In bytes. Default to 1.

mac_size

In bytes. Default to 0.

telnet Module

Telnet.

class pypacker.layer567.telnet.Telnet(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('telnet_data', None, <class 'pypacker.triggerlist.TriggerList'>),)
pypacker.layer567.telnet.strip_options(buf)

Return a list of lines and dict of options from telnet data.

tftp Module

Trivial File Transfer Protocol.

class pypacker.layer567.tftp.TFTP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('opcode', 'H', 1),)

tpkt Module

ISO Transport Service on top of the TCP (TPKT).

class pypacker.layer567.tpkt.TPKT(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('v', 'B', 3), ('rsvd', 'B', 0), ('len', 'H', 0))