Add a --conf option to eapol_test.py

The --conf option specifies a file containing a list of options
to configure the network used for running the test which will be
used in place of the defaults built into the script.

Signed-off-by: Nick Porter <nick@portercomputing.co.uk>
master
Nick Porter 3 years ago committed by Jouni Malinen
parent 99c1789ab1
commit f238610616

@ -72,7 +72,7 @@ class eapol_test:
break break
return None return None
def run(ifname, count, no_fast_reauth, res): def run(ifname, count, no_fast_reauth, res, conf):
et = eapol_test(ifname) et = eapol_test(ifname)
et.request("AP_SCAN 0") et.request("AP_SCAN 0")
@ -81,14 +81,20 @@ def run(ifname, count, no_fast_reauth, res):
else: else:
et.request("SET fast_reauth 1") et.request("SET fast_reauth 1")
id = et.add_network() id = et.add_network()
et.set_network(id, "key_mgmt", "IEEE8021X")
et.set_network(id, "eapol_flags", "0") if len(conf):
et.set_network(id, "eap", "TLS") for item in conf:
et.set_network_quoted(id, "identity", "user") et.set_network(id, item, conf[item])
et.set_network_quoted(id, "ca_cert", 'ca.pem') else:
et.set_network_quoted(id, "client_cert", 'client.pem') et.set_network(id, "key_mgmt", "IEEE8021X")
et.set_network_quoted(id, "private_key", 'client.key') et.set_network(id, "eapol_flags", "0")
et.set_network_quoted(id, "private_key_passwd", 'whatever') et.set_network(id, "eap", "TLS")
et.set_network_quoted(id, "identity", "user")
et.set_network_quoted(id, "ca_cert", 'ca.pem')
et.set_network_quoted(id, "client_cert", 'client.pem')
et.set_network_quoted(id, "private_key", 'client.key')
et.set_network_quoted(id, "private_key_passwd", 'whatever')
et.set_network(id, "disabled", "0") et.set_network(id, "disabled", "0")
fail = False fail = False
@ -114,6 +120,7 @@ def main():
parser.add_argument('--no-fast-reauth', action='store_true', parser.add_argument('--no-fast-reauth', action='store_true',
dest='no_fast_reauth', dest='no_fast_reauth',
help='disable TLS session resumption') help='disable TLS session resumption')
parser.add_argument('--conf', help='file of network conf items')
args = parser.parse_args() args = parser.parse_args()
num = int(args.num) num = int(args.num)
@ -122,12 +129,22 @@ def main():
global wpas_ctrl global wpas_ctrl
wpas_ctrl = args.ctrl wpas_ctrl = args.ctrl
conf = {}
if args.conf:
f = open(args.conf, "r")
for line in f:
confitem = line.split("=")
if len(confitem) == 2:
conf[confitem[0].strip()] = confitem[1].strip()
f.close()
t = {} t = {}
res = {} res = {}
for i in range(num): for i in range(num):
res[i] = Queue.Queue() res[i] = Queue.Queue()
t[i] = threading.Thread(target=run, args=(str(i), iter, t[i] = threading.Thread(target=run, args=(str(i), iter,
args.no_fast_reauth, res[i])) args.no_fast_reauth, res[i],
conf))
for i in range(num): for i in range(num):
t[i].start() t[i].start()
for i in range(num): for i in range(num):

Loading…
Cancel
Save