mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-26 13:49:35 -05:00
fragattack: only start after receiving DHCP request
This commit is contained in:
parent
92d08ce6a8
commit
1af41d333e
@ -57,6 +57,9 @@ class Station():
|
|||||||
self.options = daemon.options
|
self.options = daemon.options
|
||||||
self.state = Station.INIT
|
self.state = Station.INIT
|
||||||
self.tk = None
|
self.tk = None
|
||||||
|
# TODO: Get the current PN from the kernel, increment by 0x99,
|
||||||
|
# and use that to inject packets. Causes less interference.
|
||||||
|
# Though perhaps causing interference might be good...
|
||||||
self.pn = 0x99
|
self.pn = 0x99
|
||||||
|
|
||||||
# Contains either the "to-DS" or "from-DS" flag.
|
# Contains either the "to-DS" or "from-DS" flag.
|
||||||
@ -344,11 +347,14 @@ class Authenticator(Daemon):
|
|||||||
|
|
||||||
# Raise event when client is assigned an IP address
|
# Raise event when client is assigned an IP address
|
||||||
station = self.stations[clientmac]
|
station = self.stations[clientmac]
|
||||||
if not station.is_connected() and clientmac in self.dhcp.leases:
|
if DHCP in p and not station.is_connected() and clientmac in self.dhcp.leases:
|
||||||
# TODO: We should wait a bit until the peer received the DHCP Ack ...
|
req_type = next(opt[1] for opt in p[DHCP].options if isinstance(opt, tuple) and opt[0] == 'message-type')
|
||||||
peerip = self.dhcp.leases[clientmac]
|
# This assures we only mark it was connected after receiving a DHCP Request
|
||||||
log(STATUS, "Client %s with IP %s has connected" % (clientmac, peerip))
|
if req_type == 3:
|
||||||
station.handle_connected(self.arp_sender_ip, peerip)
|
# TODO: We should wait a bit until the peer received the DHCP Ack ...
|
||||||
|
peerip = self.dhcp.leases[clientmac]
|
||||||
|
log(STATUS, "Client %s with IP %s has connected" % (clientmac, peerip))
|
||||||
|
station.handle_connected(self.arp_sender_ip, peerip)
|
||||||
|
|
||||||
station.handle_eth_rx(p)
|
station.handle_eth_rx(p)
|
||||||
|
|
||||||
@ -396,7 +402,7 @@ class Authenticator(Daemon):
|
|||||||
# Use a dedicated IP address for our ARP ping and replies
|
# Use a dedicated IP address for our ARP ping and replies
|
||||||
self.arp_sender_ip = self.dhcp.pool.pop()
|
self.arp_sender_ip = self.dhcp.pool.pop()
|
||||||
self.arp_sock = ARP_sock(sock=self.sock_eth, IP_addr=self.arp_sender_ip, ARP_addr=self.apmac)
|
self.arp_sock = ARP_sock(sock=self.sock_eth, IP_addr=self.arp_sender_ip, ARP_addr=self.apmac)
|
||||||
log(STATUS, "Injecting ARP packets with sender IP of %s" % self.arp_sender_ip)
|
log(STATUS, "Will inject ARP packets using sender IP %s" % self.arp_sender_ip)
|
||||||
|
|
||||||
|
|
||||||
class Supplicant(Daemon):
|
class Supplicant(Daemon):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user