scapy.layers.dhcp

DHCP (Dynamic Host Configuration Protocol) and BOOTP

class scapy.layers.dhcp.BOOTP

Bases: scapy.packet.Packet

aliastypes
answers(other)
extract_padding(s)
fields_desc
BOOTP fields

op

ByteEnumField

1

htype

ByteField

1

hlen

ByteField

6

hops

ByteField

0

xid

IntField

0

secs

ShortField

0

flags

FlagsField (16 bits)

<Flag 0 ()>

ciaddr

IPField

'0.0.0.0'

yiaddr

IPField

'0.0.0.0'

siaddr

IPField

'0.0.0.0'

giaddr

IPField

'0.0.0.0'

chaddr

Field

b''

sname

Field

b''

file

Field

b''

options

StrField

b''

guess_payload_class(payload)
hashret()
payload_guess

Possible sublayers: DHCP

class scapy.layers.dhcp.BOOTP_am(**kargs)

Bases: scapy.ansmachine.AnsweringMachine

filter = 'udp and port 68 and port 67'
function_name = 'bootpd'
is_request(req)
make_reply(req)
parse_options(pool=Net('192.168.1.128/25'), network='192.168.1.0/24', gw='192.168.1.1', domain='localnet', renewal_time=60, lease_time=1800)
print_reply(req, reply)
static send_function(x, inter=0, loop=0, iface=None, iface_hint=None, count=None, verbose=None, realtime=None, return_packets=False, socket=None, *args, **kargs)

Send packets at layer 2

Parameters
  • x – the packets

  • inter – time (in s) between two packets (default 0)

  • loop – send packet indefinetly (default 0)

  • count – number of packets to send (default None=1)

  • verbose – verbose mode (default None=conf.verbose)

  • realtime – check that a packet was sent before sending the next one

  • return_packets – return the sent packets

  • socket – the socket to use (default is conf.L3socket(kargs))

  • iface – the interface to send the packets on

  • monitor – (not on linux) send in monitor mode

Returns

None

class scapy.layers.dhcp.DHCP

Bases: scapy.packet.Packet

aliastypes
fields_desc
DHCP fields

options

DHCPOptionsField

b''

class scapy.layers.dhcp.DHCPOptionsField(name, default, fmt='H', remain=0)

Bases: scapy.fields.StrField

getfield(pkt, s)
i2m(pkt, x)
i2repr(pkt, x)
islist = 1
m2i(pkt, x)
class scapy.layers.dhcp.DHCP_am(**kargs)

Bases: scapy.layers.dhcp.BOOTP_am

function_name = 'dhcpd'
make_reply(req)
class scapy.layers.dhcp.RandDHCPOptions(size=None, rndstr=None)

Bases: scapy.volatile.RandField

scapy.layers.dhcp.dhcp_request(iface=None, **kargs)

Send a DHCP discover request and return the answer