blunderbuss-wctf / wacker

A WPA3 dictionary cracker
BSD 2-Clause "Simplified" License
284 stars 56 forks source link

Channel option #2

Closed jeremysolt closed 1 year ago

jeremysolt commented 3 years ago

Allow the user to supply the channel and convert it to the correct frequency

rpcraig commented 3 years ago

Depends on how pedantic we need to be with this. There are overlapping channel numbers in 5GHz and 2.4GHz bands. There are also overlapping channels if dealing with 60GHz. If concerned about these scenarios we would need the user to supply yet another option in the form of the band as well. If not concerned then we can just loosely take 1-14 and the other channels that airodump-ng uses {36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 132, 134, 136, 138, 140, 142, 144, 149, 151, 153, 155, 157, 159, 161, 165, 169, 173}. The idea of just having --freq is that the onus is passed to the user in those overlapping cases.

If you still prefer the later than a patch like the following would suffice I assume:

diff --git a/wacker.py b/wacker.py
 index bae44bb..6af2b67 100755
 --- a/wacker.py 
 +++ b/wacker.py
 @@ -186,12 +186,35 @@ def check_interface(interface):
     return interface

 +channels = list(range(1,15)) + \
 +    [36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 100, 102, 104,
 +     106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 132, 134, 136,
 +     138, 140, 142, 144, 149, 151, 153, 155, 157, 159, 161, 165, 169, 173]
 +
 +
 +def convert_channel(chan):
 +    chan = int(chan)
 +    if chan not in channels:
 +        raise argparse.ArgumentTypeError(f'{chan} is not supported')
 +
 +    # 2.4 GHZ band
 +    if chan == 14:
 +        return 2484
 +    if chan < 14:
 +        return 2407 + chan * 5
 +
 +    # 5 GHZ band
 +    return 5000 + chan * 5
 +
 +
  parser = argparse.ArgumentParser(description='A WPA3 dictionary cracker. Must run as root!')
  parser.add_argument('--wordlist', type=argparse.FileType('r'), required=True, help='wordlist to use', dest='wordlist')
  parser.add_argument('--interface', type=check_interface, dest='interface', required=True, help='interface to use')
  parser.add_argument('--bssid', type=check_bssid, dest='bssid', required=True, help='bssid of the target')
  parser.add_argument('--ssid', type=str, dest='ssid', required=True, help='the ssid of the WPA3 AP')
 -parser.add_argument('--freq', type=int, dest='freq', required=True, help='frequency of the ap')
 +group = parser.add_mutually_exclusive_group(required=True)
 +group.add_argument('--freq', type=int, dest='freq', help='frequency of the ap')
 +group.add_argument('--channel', type=convert_channel, dest='freq', help='channel of the ap')
  parser.add_argument('--start', type=str, dest='start_word', help='word to start with in the wordlist')
  parser.add_argument('--debug', action='store_true', help='increase logging output')