tests: Explicit str/bytes conversion for key_lifetime_in_memory
This is needed for python3. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
a42ec6611c
commit
b3361e5dc9
4 changed files with 6 additions and 3 deletions
|
@ -5083,6 +5083,7 @@ def test_wpa2_eap_ttls_pap_key_lifetime_in_memory(dev, apdev, params):
|
|||
# eloop before reading process memory.
|
||||
time.sleep(1)
|
||||
dev[0].ping()
|
||||
password = password.encode()
|
||||
buf = read_process_memory(pid, password)
|
||||
|
||||
dev[0].request("DISCONNECT")
|
||||
|
|
|
@ -2329,7 +2329,7 @@ def read_process_memory(pid, key=None):
|
|||
buf = bytes()
|
||||
logger.info("Reading process memory (pid=%d)" % pid)
|
||||
with open('/proc/%d/maps' % pid, 'r') as maps, \
|
||||
open('/proc/%d/mem' % pid, 'r') as mem:
|
||||
open('/proc/%d/mem' % pid, 'rb') as mem:
|
||||
for l in maps.readlines():
|
||||
m = re.match(r'([0-9a-f]+)-([0-9a-f]+) ([-r][-w][-x][-p])', l)
|
||||
if not m:
|
||||
|
@ -2360,7 +2360,7 @@ def verify_not_present(buf, key, fname, keyname):
|
|||
return
|
||||
|
||||
prefix = 2048 if pos > 2048 else pos
|
||||
with open(fname + keyname, 'w') as f:
|
||||
with open(fname + keyname, 'wb') as f:
|
||||
f.write(buf[pos - prefix:pos + 2048])
|
||||
raise Exception(keyname + " found after disassociation")
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# EAP Re-authentication Protocol (ERP) tests
|
||||
# Copyright (c) 2014-2015, Jouni Malinen <j@w1.fi>
|
||||
# Copyright (c) 2014-2019, Jouni Malinen <j@w1.fi>
|
||||
#
|
||||
# This software may be distributed under the terms of the BSD license.
|
||||
# See README for more details.
|
||||
|
@ -275,6 +275,7 @@ def test_erp_key_lifetime_in_memory(dev, apdev, params):
|
|||
# eloop before reading process memory.
|
||||
time.sleep(1)
|
||||
dev[0].ping()
|
||||
password = password.encode()
|
||||
buf = read_process_memory(pid, password)
|
||||
|
||||
dev[0].request("DISCONNECT")
|
||||
|
|
|
@ -362,6 +362,7 @@ def test_sae_key_lifetime_in_memory(dev, apdev, params):
|
|||
# eloop before reading process memory.
|
||||
time.sleep(1)
|
||||
dev[0].ping()
|
||||
password = password.encode()
|
||||
buf = read_process_memory(pid, password)
|
||||
|
||||
dev[0].request("DISCONNECT")
|
||||
|
|
Loading…
Reference in a new issue