-
Notifications
You must be signed in to change notification settings - Fork 298
/
cli.py
941 lines (791 loc) · 40.5 KB
/
cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
import argparse
import os
import sys
from settings import settings
from cert_wizard import cert_utils
# Python3 FTW
from pathlib import Path
BASIC_OPTIONS = [
'cert_wizard',
'reap_creds',
'capture_wpa_handshakes',
'psk_capture_file',
'pmkid',
'hostile_portal',
'captive_portal',
'debug',
'interface',
'essid',
'bssid',
'pmf',
'owe_transition_bssid',
'owe_transition_ssid',
'channel',
'hw_mode',
'cloaking',
'auth',
'karma',
'loud',
'known_beacons',
'channel_width',
'auth_alg',
'wpa_version',
'wpa_passphrase',
'autocrack',
'remote_rig',
'wordlist',
'pivot',
'eap_spray',
'password',
'interface_pool',
'user_list',
'bootstrap',
'known_ssids_file',
]
ROGUE_AP_ATTACKS = [
'hostile_portal',
'captive_portal',
'reap_creds',
]
def set_options():
parser = argparse.ArgumentParser()
modes_group = parser.add_argument_group('Modes')
modes_group_ = modes_group.add_mutually_exclusive_group()
modes_group_.add_argument('--cert-wizard',
dest='cert_wizard',
choices=[
'create',
'import',
'interactive',
'list',
'dh',
],
default=False,
nargs='?',
const='interactive',
help='Use this flag to run in Cert Wizard mode. '
'Use "--cert-wizard create" to create '
'a new certificate. Use "--cert-wizard '
'interactive" or simply "--cert-wizard" '
'to run Cert Wizard in interactive mode. '
'Use "--cert-wizard import" to import '
'a set of certificates into eaphammer\'s '
'static configuration. Use "--cert-wizard '
'list" to list all previously imported '
'certs, as well as the active cert '
'configuration. Use "--cert-wizard dh" '
'to manually regenerate eaphammer\'s dh '
'parameters.')
modes_group_.add_argument('--bootstrap',
dest='bootstrap',
action='store_true',
help=('Shorthand for "--cert-wizard create '
'--self-signed"'))
modes_group_.add_argument('--creds', '--brad',
dest='reap_creds',
action='store_true',
help='Harvest EAP creds using evil twin attack')
modes_group_.add_argument('--pmkid',
dest='pmkid',
action='store_true',
help=('Perform clientless attack against PSK '
'network using ZerBea\'s hcxtools.'))
modes_group_.add_argument('--eap-spray',
dest='eap_spray',
action='store_true',
help='Check for password reuse by spraying a '
'single password across a series of '
'usernames against target ESSID.')
modes_group_.add_argument('--hostile-portal',
dest='hostile_portal',
action='store_true',
help='Force clients to connect '
'to hostile portal')
modes_group_.add_argument('--captive-portal',
dest='captive_portal',
action='store_true',
help='Force clients to connect '
'to a captive portal')
parser.add_argument('--manual-config',
dest='manual_config',
type=str,
default=None,
metavar='config_file',
help='Bypass eaphammer\'s hostapd '
'configuration manager and load '
'your own hostapd.conf file instead.')
parser.add_argument('--save-config',
dest='save_config',
action='store_true',
default=None,
help='Save hostapd config file on exist.')
parser.add_argument('--save-config-only',
dest='save_config_only',
action='store_true',
default=None,
help='Don\'t actually run anything. Instead, '
'just generate a hostapd config file using '
'user supplied parameters then exit.')
parser.add_argument('--debug',
dest='debug',
action='store_true',
help='Enable debug output.')
parser.add_argument('--advanced-help', '-hh',
dest='advanced_help',
action='store_true',
help='Show extended help options then exit.')
cert_wizard_group = parser.add_argument_group('Cert Wizard')
cert_wizard_group.add_argument('--server-cert',
dest='server_cert',
default=None,
type=str,
help='Specify path to server cert file. '
'Can be used with '
'"--cert-wizard import" to import '
'a cert or cert chain, or with '
'any attack to override eaphammer\'s '
'static configuration. '
'File must be in PEM format and may '
'contain full certificate chain '
'and/or private key. If file does '
'not contain private key, the '
'--private-key flag should be used. '
'Likewise, if the file does not '
'contain a CA certificate chain, '
'the --ca-cert flag should be used.')
cert_wizard_group.add_argument('--ca-cert',
dest='ca_cert',
default=None,
type=str,
help='Specify path to ca cert file.')
cert_wizard_group.add_argument('--private-key',
dest='private_key',
default=None,
type=str,
help='Specify path to private key file.')
cert_wizard_group.add_argument('--private-key-passwd',
dest='private_key_passwd',
default=None,
type=str,
help='Specify private key password.')
cert_wizard_group.add_argument('--self-signed',
dest='self_signed',
action='store_true',
default=False,
help=('Combine with "--cert-wizard create" '
'to create a self-signed cert.'))
cert_wizard_group.add_argument('--cn',
dest='cn',
default=None,
type=str,
help='Specify certificate CN when running '
'--bootstrap or '
'"--cert-wizard create".')
cert_wizard_group.add_argument('--country',
dest='country',
default=None,
type=str,
help='Specify certificate country when '
'running --bootstrap or '
'"--cert-wizard create".')
cert_wizard_group.add_argument('--state',
dest='state',
default=None,
type=str,
help='Specify certificate state or province '
'when running --bootstrap or '
'"--cert-wizard create".')
cert_wizard_group.add_argument('--locale',
dest='locale',
default=None,
type=str,
help='Specify certificate locale (city) '
'attribute when running --bootstrap or '
'"--cert-wizard create".')
cert_wizard_group.add_argument('--org',
dest='org',
default=None,
type=str,
help='Specify certificate organization when '
'running --bootstrap or '
'"--cert-wizard create".')
cert_wizard_group.add_argument('--org-unit',
dest='org_unit',
default=None,
type=str,
help='Specify certificate org unit when '
'running --bootstrap or '
'"--cert-wizard create".')
cert_wizard_group.add_argument('--email',
dest='email',
default=None,
type=str,
help='Specify certificate emailAddress '
'attribute when running --bootstrap or '
'"--cert-wizard create".')
cw_advanced_group = parser.add_argument_group('Cert Wizard '
'Advanced Options')
cw_advanced_group.add_argument('--not-before',
dest='not_before',
default=0,
type=int,
help='Specify datetime on which '
'cert should become active.')
cw_advanced_group.add_argument('--not-after',
dest='not_after',
default=cert_utils.DEFAULT_EXP,
type=int,
help='Specify datetime on which cert '
'should become active.')
cw_advanced_group.add_argument('--algorithm',
dest='algorithm',
default=cert_utils.DEFAULT_ALGORITHM,
type=str,
help='Specify algorithm with '
'which to sign cert.')
cw_advanced_group.add_argument('--key-length',
dest='key_length',
default=cert_utils.DEFAULT_KEY_LEN,
type=int,
help='Specify default certificate '
'key length.')
cw_advanced_group.add_argument('--dh-file',
dest='dh_file',
default=None,
type=str,
help='Manually specify path '
'to dh_file at runtime.')
cw_advanced_group.add_argument('--ca-key',
dest='ca_key',
default=None,
type=str,
help='Specify path to CA private key file.')
cw_advanced_group.add_argument('--ca-key-passwd',
dest='ca_key_passwd',
default=None,
type=str,
help='Specify CA key password.')
access_point_group = parser.add_argument_group('Access Point')
access_point_group.add_argument('-i', '--interface',
dest='interface',
default=None,
type=str,
help='The phy interface on which '
'to create the AP')
access_point_group.add_argument('-e', '--essid',
dest='essid',
default=None,
type=str,
help='Specify access point ESSID')
access_point_group.add_argument('-b', '--bssid',
dest='bssid',
default=None,
type=str,
help='Specify access point BSSID')
access_point_group.add_argument('-c', '--channel',
dest='channel',
type=int,
default=None,
help='Specify access point channel '
'(default: 1).')
access_point_group.add_argument('--hw-mode',
dest='hw_mode',
type=str,
default=None,
help='Specify access point hardware mode '
'(defaults: g for 2.4GHz channels, '
'a for 5GHz channels).')
access_point_group.add_argument('--cloaking',
dest='cloaking',
choices=['none', 'full', 'zeroes'],
default=None,
help='Send empty SSID in beacons and '
'ignore probe request '
'frames that do not specify '
'full SSID (i.e. require '
'stations to know SSID). '
'Choices: [1. none - do '
'not use SSID cloaking. ] '
'[2. full - Send empty string'
' in beacon and ignore probe '
'requests for broadcast '
'SSID ] [3. zeroes - Replace '
'all characters in SSID '
'with ASCII 0 and ignore '
'probe requests for '
'broadcast SSID.]')
access_point_group.add_argument('--auth',
dest='auth',
type=str,
choices=[
'open',
'wpa-psk',
'wpa-eap',
'owe',
'owe-transition',
'owe-psk',
],
default=None,
help='Specify authentication mechanism '
'(hostile and captive portal '
'default: open )'
'(creds default: wpa-eap).')
access_point_group.add_argument('--pmf',
dest='pmf',
type=str,
choices=['disable', 'enable', 'require'],
default=None,
help='Enable, disaable, or require the use of '
'Protected Management Frames (PMF) '
'(802.11w) (default: disable) '
'(OWE default: require).')
access_point_group.add_argument('--karma',
dest='karma',
action='store_true',
help='Enable karma.')
karma_group = parser.add_argument_group('Karma Options')
karma_group.add_argument('--loud', '--singe',
dest='loud',
action='store_true',
help='Enable loud karma mode.')
karma_group.add_argument('--known-beacons',
dest='known_beacons',
action='store_true',
help='Enable persistent known beacons attack.')
default_ssid_list = os.path.join(
settings.dict['paths']['directories']['wordlists'],
settings.dict['core']['eaphammer']['general']['default_ssid_list'],
)
karma_group.add_argument('--known-ssids-file',
dest='known_ssids_file',
default=None,
type=str,
help='Specify the wordlist to use with '
'the --known-beacons features.')
ap_advanced_subgroup = parser.add_argument_group('AP Advanced Options')
ap_advanced_subgroup.add_argument('--wmm',
dest='wmm',
action='store_true',
help='Enable wmm (further configuration '
'of wmm performed in hostapd.ini)')
ap_advanced_subgroup.add_argument('--driver',
dest='driver',
default=None,
type=str,
help='Specify driver.')
ap_advanced_subgroup.add_argument('--beacon-interval',
dest='beacon_interval',
default=None,
type=int,
metavar='TUs',
help='Send beacon packets every n '
'Time Units (TUs). '
'A single TU is equal to '
'1024 microseconds. '
'(default: 100)')
ap_advanced_subgroup.add_argument('--dtim-period',
dest='dtim_period',
default=None,
type=int,
metavar='n',
help='Transmit broadcast frames after '
'every n beacons, '
'where n is an integer between '
'1 and 255. (default: 1)')
ap_advanced_subgroup.add_argument('--max-num-stations',
dest='max_num_stations',
default=None,
type=int,
help='The maximum number of '
'stations that can '
'connect to the AP at '
'any one time. (default: 255)')
ap_advanced_subgroup.add_argument('--rts-threshold',
dest='rts_threshold',
default=None,
type=int,
metavar='OCTETS',
help='Sets the RTS threshold in '
'octets. (default: 2347)')
ap_advanced_subgroup.add_argument('--fragm-threshold',
dest='fragm_threshold',
default=None,
type=int,
metavar='OCTETS',
help='Sets the fragmentation '
'threshold in octets. '
'(default: 2346)')
hwm80211n_subgroup = parser.add_argument_group(
'802.11n Options',
'Used when --hw-mode is set to "n"',
)
hwm80211n_subgroup.add_argument('--channel-width',
dest='channel_width',
type=int,
choices=[20,40],
default=None,
metavar='MGhz',
help='Set the channel width '
'in MGHz (single 20 MGHz '
'spatial stream or two 20 '
'MGHz spatial streams '
'totalling 40 MGHz). (default: 20)')
hwm80211n_advanced_subgroup = parser.add_argument_group(
'802.11n Advanced Options',
)
hwm80211n_advanced_subgroup.add_argument('--smps',
dest='smps',
type=str,
choices=['off','dynamic','static'],
default=None,
help='Spatial Multiplexing '
'(SM) Power Save')
hwm80211n_advanced_subgroup.add_argument('--ht40',
dest='ht40',
type=str,
choices=['plus', 'minus', 'auto'],
default=None,
help='Specifies whether the '
'secondary channel should be '
'higher (plus) or lower '
'(minus) than the primary '
'channel. (default: auto)')
hwm80211n_advanced_subgroup.add_argument('--max-spatial-streams',
dest='max_spatial_streams',
type=str,
choices=[1,2,3],
default=None,
help='Specifies maximum '
'number of spatial streams. '
'(default: 2)')
hwm80211n_advanced_subgroup.add_argument('--obss-interval',
dest='obss_interval',
type=None,
default=None,
help='Look this up if you don\'t '
'know what it does. You '
'probably don\'t need '
'it. (default: 0)')
hwm80211n_advanced_subgroup.add_argument('--greenfield',
dest='greenfield',
action='store_true',
help='Enable greenfield mode.')
hwm80211n_advanced_subgroup.add_argument('--ht-delayed-block-ack',
dest='ht_delayed_block_ack',
action='store_true',
help='Use HT Delayed Block ACK.')
hwm80211n_advanced_subgroup.add_argument('--short-gi',
dest='short_gi',
action='store_true',
help='Enable short GI (20 or 40 '
'depending on channel width')
hwm80211n_advanced_subgroup.add_argument('--lsig-txop-prot',
dest='lsig_txop_prot',
action='store_true',
help='Enable L-SIG '
'TXOP Protection support.')
hwm80211n_advanced_subgroup.add_argument('--require-ht',
dest='require_ht',
action='store_true',
help='Reject associations from '
'clients that do '
'not support HT.')
hwm80211n_advanced_subgroup.add_argument('--dsss-cck-40',
dest='dsss_cck_40',
action='store_true',
help='Enable DSSS/CCK Mode in 40MHz.')
hwm80211n_advanced_subgroup.add_argument('--disable-tx-stbc',
dest='disable_tx_stbc',
action='store_true',
help='Disable TX-STBC.')
hwm80211n_advanced_subgroup.add_argument('--ldpc',
dest='ldpc',
action='store_true',
help='Enable LDPC Coding capability.')
hwm80211n_advanced_subgroup.add_argument('--use-max-a-msdu-length',
dest='use_max_a_msdu_length',
action='store_true',
help='Set A-MSDU length to '
'maximum allowable '
'value (7935 octets). '
'If not set, 3839 '
'octets are used.')
psk_group = parser.add_argument_group(
'WPA-PSK Options',
'Only applicable if --auth wpa-psk is used',
)
psk_group.add_argument('--wpa-passphrase',
dest='wpa_passphrase',
type=str,
default=None,
help='Set WPA Passphrase for AP.')
wpa_group = parser.add_argument_group(
'WPA Options',
'Only applicable if --auth wpa-psk or wpa-eap are used',
)
wpa_group.add_argument('--capture-wpa-handshakes',
dest='capture_wpa_handshakes',
type=str,
choices=['yes', 'no'],
default=None,
help='Capture 4-way WPA handshakes '
'(wpa-psk default: yes) '
'(wpa-eap and sae defaults: no)')
wpa_group.add_argument('--psk-capture-file',
dest='psk_capture_file',
type=str,
default=None,
help='Path to which to write WPA handshake'
'files (default: automatically generated '
'from nonce and current timestamp)')
wpa_group.add_argument('--auth-alg',
dest='auth_alg',
type=str,
choices=['shared', 'open', 'both'],
default=None,
help='Authentication type (open or shared key). '
'(default: shared)')
wpa_group.add_argument('--wpa-version',
dest='wpa_version',
type=str,
choices=['1', '2'],
default=None,
help='Set WPA version. (default: 2)')
owe_transition_group = parser.add_argument_group(
'OWE Transition Mode Options',
('Only applicable if --auth '
'owe-transition is used'),
)
owe_transition_group.add_argument('--transition-bssid',
dest='owe_transition_bssid',
type=str,
default=None,
help='Set BSSID for OPEN AP')
owe_transition_group.add_argument('--transition-ssid',
dest='owe_transition_ssid',
type=str,
default=None,
help='Set SSID for OPEN AP')
eap_group = parser.add_argument_group(
'EAP Options',
'Only applicable if --auth wpa is used',
)
eap_group.add_argument('--autocrack',
dest='autocrack',
action='store_true',
help='Enable autocrack \'n add.')
autocrack_group = parser.add_argument_group(
'Autocrack Options',
'Only applicable if --auth wpa '
'--autocrack is used',
)
autocrack_group.add_argument('--remote-cracking-rig',
dest='remote_rig',
type=str,
metavar='server:port',
help='Use remote cracking rig '
'for autocrack feature.')
default_wordlist = os.path.join(
settings.dict['paths']['directories']['wordlists'],
settings.dict['core']['eaphammer']['general']['default_wordlist'],
)
eap_group.add_argument('--wordlist',
dest='wordlist',
default=default_wordlist,
type=str,
help='Specify the wordlist to use with '
'the autocrack feature.')
hp_group = parser.add_argument_group('Hostile Portal Options',
'Only applicable if --hostile-portal is used')
hp_group.add_argument('--pivot',
dest='pivot',
action='store_true',
help='Runs responder without SMB server enabled.')
eap_spray_group = parser.add_argument_group('EAP Spray')
eap_spray_group.add_argument('-I', '--interface-pool',
dest='interface_pool',
metavar='iface_n',
type=str,
nargs='+',
default=None,
help='List of interfaces available '
'for password spray attack.')
eap_spray_group.add_argument('--user-list',
dest='user_list',
default=None,
type=str,
help='Like a wordlist, except contains '
'usernames instead of passwords. '
'Each username should be '
'placed on a separate line.')
eap_spray_group.add_argument('--password',
dest='password',
default=None,
type=str,
help='Specify password to be '
'sprayed across list of users.')
try:
if '-hh' not in sys.argv and '--advanced-help' not in sys.argv:
for a in parser._actions:
if a.dest != 'help' and a.dest not in BASIC_OPTIONS:
a.help = argparse.SUPPRESS
args = parser.parse_args()
options = args.__dict__
if options['advanced_help']:
parser.print_help()
sys.exit()
if (options['cert_wizard'] is False and
options['manual_config'] is None and
options['advanced_help'] is False and
options['eap_spray'] is False and
options['bootstrap'] is False and
options['interface'] is None):
parser.print_usage()
print()
print('[!] Please specify a valid PHY', end=' ')
print('interface using the --interface flag')
sys.exit()
cw_val = options['cert_wizard']
if cw_val is not None:
if (options['bootstrap'] or
cw_val == 'create' and
options['self_signed']):
if options['cn'] is None:
parser.print_usage()
print()
print('[!] Please specify a valid CN '
'in order to use --bootstrap mode.', end='')
sys.exit()
if cw_val == 'create' and not options['self_signed']:
if options['ca_cert'] is None:
parser.print_usage()
print()
print('[!] Please specify valid CA cert using the '
'--ca-cert flag. If CA private key is not '
'included in CA cert file, it must also be '
'specified using the --ca-key flag.', end='')
sys.exit()
if options['cn'] is None:
parser.print_usage()
print()
print('[!] Please specify a valid CN in order to use '
'--bootstrap mode.', end='')
sys.exit()
if cw_val == 'import':
if options['server_cert'] is None:
parser.print_usage()
print()
msg = ('[!] Please specify path a server '
'certificate using the --server-cert flag.')
print(msg, end='')
sys.exit()
if options['loud'] and not options['karma']:
parser.print_usage()
print()
msg = ('[!] Cannot use --loud flag without --karma flag.')
print(msg, end='')
sys.exit()
# sanity checks for known beacons attack
if options['known_beacons']:
if not options['karma']:
parser.print_usage()
print()
msg = ('[!] Cannot use --known-beacons flag without --karma flag.')
print(msg, end='')
sys.exit()
if options['known_ssids_file'] is None:
parser.print_usage()
print()
msg = ('[!] Cannot use --known-beacons without known SSIDS file. '
'Please specify path to known SSIDS file with --known-ssids flag.')
print(msg, end='')
sys.exit()
if not Path(options['known_ssids_file']).is_file():
parser.print_usage()
print()
msg = ('[!] Specified known SSID file not found: {}'.format(options['known_ssids_file']))
print(msg, end='')
sys.exit()
if any([ options[a] for a in ROGUE_AP_ATTACKS ]):
if options['server_cert'] is None:
if options['ca_cert']:
parser.print_usage()
print()
msg = ('[!] Cannot use --ca-cert flag at '
'attack runtime without using '
'--server-cert flag.')
print(msg, end='')
sys.exit()
if options['private_key']:
parser.print_usage()
print()
msg = ('[!] Cannot use --ca-cert flag at '
'attack runtime without using '
'--server-cert flag.')
print(msg, end='')
sys.exit()
if options['private_key_passwd']:
parser.print_usage()
print()
msg = ('[!] Cannot use --private-key flag at '
'attack runtime without using '
'--server-cert flag.')
print(msg, end='')
sys.exit()
if (options['pmkid'] and
options['bssid'] is None and
options['essid'] is None):
parser.print_usage()
print()
msg = ('[!] Please specify a valid target '
'using the --bssid or --essid flags.')
print(msg, end=' ')
sys.exit()
if options['eap_spray']:
invalid_args = False
if options['user_list'] is None:
print()
msg = ('[!] Please specify a valid user '
'list file using the --user-list flag.')
print(msg, end=' ')
invalid_args = True
if options['essid'] is None:
print()
msg = ('[!] Please specify a valid target '
'using the --essid flag.')
print(msg, end=' ')
invalid_args = True
if options['password'] is None:
print()
msg = ('[!] Please specify password to '
'spray using the --password flag.')
print(msg, end=' ')
invalid_args = True
if options['interface_pool'] is None:
print()
msg = ('[!] Please specify a list of wireless'
'interfaces using the --interface-pool flag.')
print(msg, end=' ')
invalid_args = True
if invalid_args:
sys.exit()
except SystemExit:
print()
print('[!] Use -h or --help to display a list of basic options.')
msg = ('[!] Use -hh or --advanced-help to '
'display full list of extended options.')
print(msg)
print()
raise
if options['manual_config'] is not None:
with open(options['manual_config']) as fd:
for line in fd:
if 'interface' in line:
options['interface'] = line.strip().split('=')[1]
if options['interface'] is None:
print()
msg = ('[!] Please specify a valid PHY '
'interface in your config file.')
print(msg)
sys.exit()
return options