Home | Trees | Index | Help |
---|
Module dnet |
|
dumb networking library This module provides a simplified interface to several low-level networking routines, including network address manipulation, kernel arp(4) cache and route(4) table lookup and manipulation, network firewalling, network interface lookup and manipulation, IP tunnelling, and raw IP packet and Ethernet frame transmission.
Classes | |
---|---|
addr |
addr(addrtxt=None, type=ADDR_TYPE_NONE) -> network address object Create a network address object, optionally initialized from a human-readable Ethernet, IP, or IPv6 address string. |
arp |
arp() -> ARP table object Open a handle to the system ARP table. |
eth |
eth(device) -> Ethernet device object Open the specified Ethernet device for sending. |
fw |
fw() -> Firewall ruleset object Open a handle to the local network firewall configuration. |
intf |
intf() -> Interface table object Open a handle to the system network interface table. |
ip |
ip() -> Raw IP object Open a raw IP socket for sending. |
rand |
rand() -> Pseudo-random number generator Obtain a handle for fast, cryptographically strong pseudo-random number generation. |
route |
route() -> Routing table object Open a handle to the system routing table. |
tun |
tun(src, dst[, mtu]) -> Network tunnel interface handle Obtain a handle to a network tunnel interface, to which packets destined for dst are delivered (with source addresses rewritten to src), where they may be read by a userland process and processed as desired. |
Function Summary | |
---|---|
Return a packed binary string representing an Ethernet/IP ARP message. | |
Convert an Ethernet MAC address from a printable string to a packed binary string ('\x00\xde\xad\xbe\xef\x00'). | |
Convert an Ethernet MAC address from 6-byte packed binary string to a printable string ('00:de:ad:be:ef:00'). | |
Return a packed binary string representing an Ethernet header. | |
Return a packed binary string representing an ICMP header. | |
Convert an IPv6 address from a printable string to a packed binary string ('\x0a\x00\x00\x01'). | |
Return a packed binary string representing an IPv6 packet with the IPv6 and transport-layer checksums set. | |
Convert an IPv6 address from a 16-byte packed binary string to a printable string ('10.0.0.1'). | |
Return a packed binary string representing an IPv6 header. | |
Convert an IP address from a printable string to a packed binary string ('\x0a\x00\x00\x01'). | |
Return packed binary string representing an IP packet with the IP and transport-layer checksums set. | |
ip_cksum_add(...)
| |
ip_cksum_carry(...)
| |
Convert an IP address from a 4-byte packed binary string or integer to a printable string ('10.0.0.1'). | |
Return a packed binary string representing an IP header. | |
Return a packed binary string representing a TCP header. | |
Return a packed binary string representing a UDP header. |
Variable Summary | |
---|---|
str |
__author__ = 'Dug Song <dugsong@monkey.org>'
|
str |
__copyright__ = 'Copyright (c) 2003 Dug Song'
|
str |
__license__ = 'BSD'
|
str |
__url__ = 'http://libdnet.sourceforge.net/'
|
str |
__version__ = '1.11'
|
int |
ADDR_TYPE_ETH = 1 |
int |
ADDR_TYPE_IP = 2 |
int |
ADDR_TYPE_IP6 = 3 |
int |
ADDR_TYPE_NONE = 0 |
int |
ARP_ETHIP_LEN = 20 |
int |
ARP_HDR_LEN = 8 |
int |
ARP_HRD_ETH = 1 |
int |
ARP_HRD_IEEE802 = 6 |
int |
ARP_OP_REPLY = 2 |
int |
ARP_OP_REQUEST = 1 |
int |
ARP_OP_REVREPLY = 4 |
int |
ARP_OP_REVREQUEST = 3 |
int |
ARP_PRO_IP = 2048 |
int |
ETH_ADDR_BITS = 48 |
str |
ETH_ADDR_BROADCAST = '\xff\xff\xff\xff\xff\xff'
|
int |
ETH_ADDR_LEN = 6 |
str |
ETH_ADDR_UNSPEC = '\x00\x00\x00\x00\x00\x00'
|
int |
ETH_CRC_LEN = 4 |
int |
ETH_HDR_LEN = 14 |
int |
ETH_LEN_MAX = 1518 |
int |
ETH_LEN_MIN = 64 |
int |
ETH_MIN = 46 |
int |
ETH_MTU = 1500 |
int |
ETH_TYPE_8021Q = 33024 |
int |
ETH_TYPE_ARP = 2054 |
int |
ETH_TYPE_IP = 2048 |
int |
ETH_TYPE_IPV6 = 34525 |
int |
ETH_TYPE_LEN = 2 |
int |
ETH_TYPE_LOOPBACK = 36864 |
int |
ETH_TYPE_MPLS = 34887 |
int |
ETH_TYPE_MPLS_MCAST = 34888 |
int |
ETH_TYPE_PPPOE = 34916 |
int |
ETH_TYPE_PPPOEDISC = 34915 |
int |
ETH_TYPE_PUP = 512 |
int |
ETH_TYPE_REVARP = 32821 |
int |
FW_DIR_IN = 1 |
int |
FW_DIR_OUT = 2 |
int |
FW_OP_ALLOW = 1 |
int |
FW_OP_BLOCK = 2 |
int |
INTF_FLAG_BROADCAST = 16 |
int |
INTF_FLAG_LOOPBACK = 2 |
int |
INTF_FLAG_MULTICAST = 32 |
int |
INTF_FLAG_NOARP = 8 |
int |
INTF_FLAG_POINTOPOINT = 4 |
int |
INTF_FLAG_UP = 1 |
int |
INTF_TYPE_ETH = 6 |
int |
INTF_TYPE_LOOPBACK = 24 |
int |
INTF_TYPE_OTHER = 1 |
int |
INTF_TYPE_TUN = 53 |
int |
IP6_ADDR_BITS = 128 |
int |
IP6_ADDR_LEN = 16 |
str |
IP6_ADDR_LOOPBACK = '\x00\x00\x00\x00\x00\x00\x00\x00\x0...
|
str |
IP6_ADDR_UNSPEC = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\...
|
int |
IP6_HDR_LEN = 40 |
int |
IP6_HLIM_DEFAULT = 64 |
int |
IP6_HLIM_MAX = 255 |
int |
IP6_LEN_MAX = 65535 |
int |
IP6_LEN_MIN = 40 |
int |
IP6_MTU_MIN = 1280 |
str |
IP_ADDR_ANY = '\x00\x00\x00\x00'
|
int |
IP_ADDR_BITS = 32 |
str |
IP_ADDR_BROADCAST = '\xff\xff\xff\xff'
|
int |
IP_ADDR_LEN = 4 |
str |
IP_ADDR_LOOPBACK = '\x7f\x00\x00\x01'
|
str |
IP_ADDR_MCAST_ALL = '\xe0\x00\x00\x01'
|
str |
IP_ADDR_MCAST_LOCAL = '\xe0\x00\x00\xff'
|
int |
IP_DF = 16384 |
int |
IP_HDR_LEN = 20 |
int |
IP_HDR_LEN_MAX = 60 |
int |
IP_LEN_MAX = 65535 |
int |
IP_LEN_MIN = 20 |
int |
IP_MF = 8192 |
int |
IP_OFFMASK = 8191 |
int |
IP_OPT_LEN = 2 |
int |
IP_OPT_LEN_MAX = 40 |
int |
IP_PROTO_AH = 51 |
int |
IP_PROTO_ESP = 50 |
int |
IP_PROTO_GRE = 47 |
int |
IP_PROTO_ICMP = 1 |
int |
IP_PROTO_ICMPV6 = 58 |
int |
IP_PROTO_IGMP = 2 |
int |
IP_PROTO_IP = 0 |
int |
IP_PROTO_IPV6 = 41 |
int |
IP_PROTO_MAX = 255 |
int |
IP_PROTO_RAW = 255 |
int |
IP_PROTO_RESERVED = 255 |
int |
IP_PROTO_TCP = 6 |
int |
IP_PROTO_UDP = 17 |
int |
IP_RF = 32768 |
int |
IP_TOS_DEFAULT = 0 |
int |
IP_TTL_DEFAULT = 64 |
int |
IP_TTL_MAX = 255 |
int |
TCP_HDR_LEN = 20 |
int |
TCP_OPT_ALTSUM = 14 |
int |
TCP_OPT_ALTSUMDATA = 15 |
int |
TCP_OPT_BUBBA = 17 |
int |
TCP_OPT_CC = 11 |
int |
TCP_OPT_CCECHO = 13 |
int |
TCP_OPT_CCNEW = 12 |
int |
TCP_OPT_CORRUPT = 23 |
int |
TCP_OPT_ECHO = 6 |
int |
TCP_OPT_ECHOREPLY = 7 |
int |
TCP_OPT_EOL = 0 |
int |
TCP_OPT_MAX = 27 |
int |
TCP_OPT_MD5 = 19 |
int |
TCP_OPT_MSS = 2 |
int |
TCP_OPT_NOP = 1 |
int |
TCP_OPT_POCONN = 9 |
int |
TCP_OPT_POSVC = 10 |
int |
TCP_OPT_REC = 22 |
int |
TCP_OPT_SACK = 5 |
int |
TCP_OPT_SACKOK = 4 |
int |
TCP_OPT_SCPS = 20 |
int |
TCP_OPT_SKEETER = 16 |
int |
TCP_OPT_SNACK = 21 |
int |
TCP_OPT_SNAP = 24 |
int |
TCP_OPT_TCPCOMP = 26 |
int |
TCP_OPT_TIMESTAMP = 8 |
int |
TCP_OPT_TRAILSUM = 18 |
int |
TCP_OPT_WSCALE = 3 |
int |
TCP_PORT_MAX = 65535 |
int |
TCP_WIN_MAX = 65535 |
int |
TH_ACK = 16 |
int |
TH_CWR = 128 |
int |
TH_ECE = 64 |
int |
TH_FIN = 1 |
int |
TH_PUSH = 8 |
int |
TH_RST = 4 |
int |
TH_SYN = 2 |
int |
TH_URG = 32 |
int |
UDP_HDR_LEN = 8 |
int |
UDP_PORT_MAX = 65535 |
Function Details |
---|
arp_pack_hdr_ethip(...)Return a packed binary string representing an Ethernet/IP ARP message. Keyword arguments: op -- operation (ARP_OP_*) (16-bit integer) sha -- sender Ethernet address (6-byte binary string) spa -- sender IP address (4-byte binary string) dha -- destination Ethernet address (6-byte binary string) dpa -- destination IP address (4-byte binary string) |
eth_aton(...)Convert an Ethernet MAC address from a printable string to a packed binary string ('\x00\xde\xad\xbe\xef\x00'). |
eth_ntoa(...)Convert an Ethernet MAC address from 6-byte packed binary string to a printable string ('00:de:ad:be:ef:00'). |
eth_pack_hdr(...)Return a packed binary string representing an Ethernet header. Keyword arguments: dst -- destination address (6-byte binary string) src -- source address (6-byte binary string) type -- Ethernet payload type (ETH_TYPE_*) (16-bit integer) |
icmp_pack_hdr(...)Return a packed binary string representing an ICMP header. Keyword arguments: type -- ICMP type (8-bit integer) code -- ICMP code (8-bit integer) |
ip6_aton(...)Convert an IPv6 address from a printable string to a packed binary string ('\x0a\x00\x00\x01'). |
ip6_checksum(...)Return a packed binary string representing an IPv6 packet with the IPv6 and transport-layer checksums set. Arguments: pkt -- binary string representing an IPv6 packet |
ip6_ntoa(...)Convert an IPv6 address from a 16-byte packed binary string to a printable string ('10.0.0.1'). |
ip6_pack_hdr(...)Return a packed binary string representing an IPv6 header. Keyword arguments: fc -- flow class (8-bit integer) fl -- flow label (20-bit integer) plen -- payload length (16-bit integer) nxt -- next header (IP_PROTO_*) (8-bit integer) hlim -- hop limit (8-bit integer) src -- source address (16-byte binary string) dst -- destination address (16-byte binary string) |
ip_aton(...)Convert an IP address from a printable string to a packed binary string ('\x0a\x00\x00\x01'). |
ip_checksum(...)Return packed binary string representing an IP packet with the IP and transport-layer checksums set. Arguments: pkt -- binary string representing an IP packet |
ip_ntoa(...)Convert an IP address from a 4-byte packed binary string or integer to a printable string ('10.0.0.1'). |
ip_pack_hdr(...)Return a packed binary string representing an IP header. Keyword arguments: tos -- type of service (8-bit integer) len -- length (IP_HDR_LEN + payload) (16-bit integer) id -- packet ID (16-bit integer) off -- fragmentation offset (16-bit integer) ttl -- time-to-live (8-bit integer) p -- protocol (IP_PROTO_*) (8-bit integer) src -- source address (4-byte binary string) dst -- destination address (4-byte binary string) |
tcp_pack_hdr(...)Return a packed binary string representing a TCP header. Keyword arguments: sport -- source port (16-bit integer) dport -- destination port (16-bit integer) seq -- sequence number (32-bit integer) ack -- acknowledgment number (32-bit integer) flags -- control flags (TH_*) (8-bit integer bitmask) win -- window size (16-bit integer) urp -- urgent pointer (16-bit integer) |
udp_pack_hdr(...)Return a packed binary string representing a UDP header. Keyword arguments: sport -- source port (16-bit integer) dport -- destination port (16-bit integer) ulen -- UDP header + data length (16-bit integer) |
Variable Details |
---|
__author__
|
__copyright__
|
__license__
|
__url__
|
__version__
|
ADDR_TYPE_ETH
|
ADDR_TYPE_IP
|
ADDR_TYPE_IP6
|
ADDR_TYPE_NONE
|
ARP_ETHIP_LEN
|
ARP_HDR_LEN
|
ARP_HRD_ETH
|
ARP_HRD_IEEE802
|
ARP_OP_REPLY
|
ARP_OP_REQUEST
|
ARP_OP_REVREPLY
|
ARP_OP_REVREQUEST
|
ARP_PRO_IP
|
ETH_ADDR_BITS
|
ETH_ADDR_BROADCAST
|
ETH_ADDR_LEN
|
ETH_ADDR_UNSPEC
|
ETH_CRC_LEN
|
ETH_HDR_LEN
|
ETH_LEN_MAX
|
ETH_LEN_MIN
|
ETH_MIN
|
ETH_MTU
|
ETH_TYPE_8021Q
|
ETH_TYPE_ARP
|
ETH_TYPE_IP
|
ETH_TYPE_IPV6
|
ETH_TYPE_LEN
|
ETH_TYPE_LOOPBACK
|
ETH_TYPE_MPLS
|
ETH_TYPE_MPLS_MCAST
|
ETH_TYPE_PPPOE
|
ETH_TYPE_PPPOEDISC
|
ETH_TYPE_PUP
|
ETH_TYPE_REVARP
|
FW_DIR_IN
|
FW_DIR_OUT
|
FW_OP_ALLOW
|
FW_OP_BLOCK
|
INTF_FL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