Skip to content

Commit 29a0ce7

Browse files
committed
Worked a bit on the client discovery function, it runs, but doesn't pick up anything at the moment. This is most likely due to an issue with not correctly channel hopping nor have I focused down on a specific channel. So the next goal is to go back to the disc() function and fix the issue with getting the correct channel. After we fix that we're going to build a default function to channel hop and start off with that in order to find clients. Once that is complete will hone the function for selecting a specific channel from argument and really drive home the information we can gather with --client-discover
1 parent e143ecf commit 29a0ce7

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

discover.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def disc(interface):
2626
disc_net = set() # set to store unique network names - set is used to avoid duplicates
2727

2828
print("\nScanning for networks, press CTRL+C to stop\n")
29-
print(f"{'BSSID':<20}{'SSID'.center(20)}{'Channel'.center(10)}{'Frequency Band'.center(16)}{'Signal Strength'.center(20)}{'MFP Required'.center(12)}{'MFP Enabled'.rjust(14)}")
30-
print("-" * 112)
29+
print(f"{'BSSID':<20}{'SSID'.center(35)}{'Channel'.center(10)}{'Frequency Band'.center(16)}{'Signal Strength'.center(20)}{'MFP Required'.center(12)}{'MFP Enabled'.rjust(14)}")
30+
print("-" * 127)
3131
while True:
3232
try:
3333
p = s.recvfrom(2048)[0] # recieves packet from socket, up to 2048 bytes, extracts raw packet data
@@ -102,7 +102,7 @@ def disc(interface):
102102
ssid = "".join(chr(x) if chr(x) in string.printable else "" for x in ssid_raw) # convert ssid bytes to string
103103

104104
if (bssid, ssid) not in disc_net: # check if network has already been discovered
105-
print(f"{bssid:<20}{ssid.center(20)}{str(channel).center(10)}{freq_band.center(16)}{(str(sigstr) + ' dBm').center(20)}{mfp_required.center(12)}{mfp_enabled.rjust(14)}") # print network info
105+
print(f"{bssid:<20}{ssid.center(35)}{str(channel).center(10)}{freq_band.center(16)}{(str(sigstr) + ' dBm').center(20)}{mfp_required.center(12)}{mfp_enabled.rjust(14)}") # print network info
106106
disc_net.add((bssid, ssid)) # if not discovered, add to set
107107

108108
# used to handle network interuptions - typically caused by additional network services such as NetworkManager
@@ -126,18 +126,36 @@ def disc(interface):
126126

127127

128128
def client_disc(bssid, interface):
129+
pass
129130
try:
130131
s = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(0x0003))
131132
s.bind((interface, 0))
132133

133134
client_disc = set()
134135

135136
print("\nScanning for networks, press CTRL+C to stop\n")
137+
print(f"{'Client':<20}{'Source':<20}{'BSSID':<20}")
136138
while True:
137139
try:
138140
p = s.recvfrom(2048)[0]
139141

140-
# Enter code here
142+
frame_control = p[0:2]
143+
frame_type = (frame_control[0] & 0b00001100) >> 2
144+
frame_subtype = (frame_control[0] & 0b11110000) >> 4
145+
146+
if frame_type in (0, 2):
147+
to_ds = (frame_control[1] & 0b00000001) >> 0
148+
from_ds = (frame_control[1] & 0b00000010) >> 1
149+
150+
if to_ds in (0, 1) and from_ds in (0, 1):
151+
dest_mac = p[4:10]
152+
src_mac = p[10:16]
153+
bssid_mac = p[16:22]
154+
else:
155+
continue
156+
157+
if bssid_mac == bssid:
158+
print(f"{dest_mac:<20}{src_mac.center(20)}{bssid_mac.center(20)}")
141159

142160
except OSError as e:
143161
if e.errno == 100:
@@ -159,4 +177,4 @@ def client_disc(bssid, interface):
159177

160178
if __name__ == "__main__":
161179
disc()
162-
client_disc()
180+
client_disc()

okeus

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def main():
8888
print("Error: target input required") # requires target input for most operations
8989
exit(1)
9090
if (power_level or broadcast_attack or timedelay or frame_flood or num_frames or
91-
frag_size or sequence_number or reason or durof_attack) and not network_bssid:
91+
frag_size or sequence_number or reason or dur_of_attack) and not network_bssid:
9292
print("Error: network BSSID required") # requires network BSSID for most operations
9393
exit(1)
9494

okeusstrike.1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,30 +70,30 @@ OPTIONS
7070
Specifies that the deauthentication frames should be fragmented and will be fragmented based on a user supplied size in bytes. This option will automatically
7171
add padding for fragment sizes that are odd in number to the frame size or are larger than the frame size.
7272
Example: if the frame size is 50 bytes, the user inputs 26 bytes for the fragment size, OkeusStrike will send (2) 26 byte fragmented frames, with each frame
73-
having an extra byte of padding to make up for the odd numbered total.
73+
having an extra byte of padding to make up for the odd numbered total.
7474

7575
This is also true for input fragment sizes larger than the frame size, in which case the frame will be padded and fragmented based on the specified
7676
fragment size.
7777
Example: if the frame size is 50 bytes, the user inputs 60 bytes for the fragment size, OkeusStrike will send (2) 60 byte fragmented frames, with each
78-
frame having 25 bytes of the original frame and 35 bytes of padding.
78+
frame having 25 bytes of the original frame and 35 bytes of padding.
7979

8080
For fragment sizes are a less than half the size of the original frame size, the frame will be
8181
divided into fragments of the specified size and sent in as many fragments as needed to send the entire frame with padding for equal sized fragments.
82-
Example: if the frame size is 50 bytes, the user inputs 20 bytes for the fragment size, OkeusStrike will send (3) 20 byte fragmented frames, with each frame
83-
an equal amount of padding to make up for the odd numbered total.
82+
Example: if the frame size is 50 bytes, the user inputs 24 bytes for the fragment size, OkeusStrike will send (2) 24 byte fragmented frames, followed by (1)
83+
2 byte fragmented frame, for a total of (3) fragmented frames.
8484

8585
This option can be combined with --sequence (described below) for increased control over the fragmentation of the deauthentication frame.
8686

8787
--sequence <sequence_number>
8888
Specifies the total number of fragmented frames to send from user input. The option will automatically provide padding for odd numbered totals.
8989

9090
Example: if the frame size is 50 bytes, the user inputs (4) for the sequence number, OkeusStrike will send (4) frames of 13 bytes each, with each frame sending
91-
a portion of the origial frame and padded to account for the odd numbered total.
91+
a portion of the origial frame and padded to account for the odd numbered total.
9292

93-
If the user inputs a sequence number greater than the size of the frame, then OkeusStrike will send as many fragmented frames as possible with the original frame
94-
data and then send the remaining frames with padding to make up the total number of frames specified.
93+
If the user inputs a sequence number greater than the size of the frame, then OkeusStrike will send as many fragmented frames as possible with the original frame
94+
data and then send the remaining frames with padding to make up the total number of frames specified.
9595
Example: if the frame size is 50 bytes, the user inputs (60) for the sequence number, OkeusStrike will send the first 50 frames with 1 byte each of the original
96-
data, and the remaining 10 frames will be sent with 1 byte of padding each.
96+
data, and the remaining 10 frames will be sent with 1 byte of padding each.
9797

9898
This option can be combined with --fragment (described above) for increased control over the fragmentation of the deauthentication frame.
9999

0 commit comments

Comments
 (0)