Various utils¶
Utils¶
-
class
Utils
¶ Bases:
object
Various utilities provided by libtins.
-
static
channel_to_mhz
(channel)¶ Convert a channel to frequence
Parameters: channel (uint16_t) Returns: frequence (uint16_t)
-
static
ip_to_gateway
(ip)¶ Returns the gateway that will be used for the given IP address
Parameters: ip (bytes or IPv4Address
)Returns: gateway ( IPv4Address
)
-
static
list_network_interfaces
()¶ Returns the list of available network interfaces.
Returns: interfaces (list of NetworkInterface
)
-
static
list_route_entries
()¶ List the system route entries.
Returns: routes (list of RouteEntry
)
-
static
mhz_to_channel
(mhz)¶ Convert a frequence to channel
Parameters: mhz (uint16_t) Returns: channel (uint16_t)
-
static
pdutype_to_string
(int t)¶ Parameters: t (int) -- the pdu type as an integer Returns: the pdu type as a string
-
static
resolve_domain
(domain)¶ Resolve the given domain to IPv4 address
Parameters: domain (bytes) Returns: address ( IPv4Address
)
-
static
resolve_domain6
(domain)¶ Resolve the given domain to IPv6 address
Parameters: domain (bytes) Returns: address ( IPv6Address
)
-
static
Route entries¶
-
class
RouteEntry
(interface, destination, gateway, mask)¶ Bases:
object
Encapsulate a route entry.
RouteEntry supports equality testing, copying, reducing, and hashing.
Parameters: - interface (bytes)
- destination (IPv4Address)
- gateway (IPv4Address)
- mask (IPv4Address)
Constants¶
-
class
Constants
¶ Bases:
object
-
class
ARP
¶ Bases:
enum.IntEnum
ARP constants
Attributes:
NETROM
,ETHER
,EETHER
,AX25
,PRONET
,CHAOS
,IEEE802
,ARCNET
,APPLETLK
,DLCI
,ATM
,METRICOM
,IEEE1394
,EUI64
,INFINIBAND
,SLIP
,CSLIP
,SLIP6
,CSLIP6
,RSRVD
,ADAPT
,ROSE
,X25
,HWX25
,PPP
,HDLC
,CISCO
,LAPB
,DDCMP
,RAWHDLC
,TUNNEL
,TUNNEL6
,FRAD
,SKIP
,LOOPBACK
,LOCALTLK
,FDDI
,BIF
,SIT
,IPDDP
,IPGRE
,PIMREG
,HIPPI
,ASH
,ECONET
,IRDA
,FCPP
,FCAL
,FCPL
,FCFABRIC
,IEEE802_TR
,IEEE80211
,IEEE80211_PRISM
,IEEE80211_RADIOTAP
,IEEE802154
,IEEE802154_PHY
,NONE
,VOID_TYPE
-
class
Constants.
Ethernet
¶ Bases:
enum.IntEnum
Ethernet packet types
Attributes:
UNKNOWN
,SPRITE
,IP
,ARP
,REVARP
,AT
,AARP
,VLAN
,IPX
,IPV6
,PPPOED
,PPPOES
,EAPOL
,LOOPBACK
-
class
Constants.
Proto
¶ Bases:
enum.IntEnum
Protocols
Attributes:
PROTO_HOPOPTS
,PROTO_IP
,PROTO_ICMP
,PROTO_IGMP
,PROTO_IPIP
,PROTO_TCP
,PROTO_EGP
,PROTO_PUP
,PROTO_UDP
,PROTO_IDP
,PROTO_TP
,PROTO_DCCP
,PROTO_IPV6
,PROTO_ROUTING
,PROTO_FRAGMENT
,PROTO_RSVP
,PROTO_GRE
,PROTO_ESP
,PROTO_AH
,PROTO_ICMPV6
,PROTO_NONE
,PROTO_DSTOPTS
,PROTO_MTP
,PROTO_ENCAP
,PROTO_PIM
,PROTO_COMP
,PROTO_SCTP
,PROTO_UDPLITE
,PROTO_RAW
-
class