Skip to content

Commit 1e3a5ba

Browse files
committed
Multiple channel hopping fix PR derv82#145
1 parent bd3fc8f commit 1e3a5ba

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

wifite/args.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ def _add_global_args(self, glob):
5959
action='store',
6060
dest='channel',
6161
metavar='[channel]',
62-
type=int,
63-
help=Color.s('Wireless channel to scan (default: {G}all 2Ghz channels{W})'))
62+
help=Color.s('Wireless channel to scan e.g. {C}1,3-6{W} ' +
63+
'(default: {G}all 2Ghz channels{W})'))
6464
glob.add_argument('--channel', help=argparse.SUPPRESS, action='store',
65-
dest='channel', type=int)
65+
dest='channel')
6666

6767
glob.add_argument('-5',
6868
'--5ghz',

wifite/config.py

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
import os
5+
import re
56

67
from .util.color import Color
78
from .tools.macchanger import Macchanger
@@ -191,6 +192,10 @@ def parse_settings_args(cls, args):
191192
'when scanning & attacking')
192193

193194
if args.channel:
195+
chn_arg_re = re.compile("^[0-9]+((,[0-9]+)|(-[0-9]+,[0-9]+))*(-[0-9]+)?$")
196+
if not chn_arg_re.match(args.channel):
197+
raise ValueError("Invalid channel! The format must be 1,3-6,9")
198+
194199
cls.target_channel = args.channel
195200
Color.pl('{+} {C}option:{W} scanning for targets on channel ' +
196201
'{G}%s{W}' % args.channel)

0 commit comments

Comments
 (0)