Skip to content

Commit c62777a

Browse files
committed
linting
1 parent f425210 commit c62777a

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

tests/test_chall_resp.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import rex
1+
import os
2+
import logging
3+
24
import angr
35
import archr
4-
import flaky
56
from angr.state_plugins.trace_additions import FormatInfoIntToStr, FormatInfoStrToInt
7+
import rex
68

7-
import os
89
bin_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries'))
910
cache_location = str(os.path.join(bin_location, 'tests_data/rop_gadgets_cache'))
1011

11-
import logging
1212

1313
def _do_pov_test(pov, enable_randomness=True):
1414
""" Test a POV """
@@ -32,7 +32,8 @@ def break_chall_resp_atoi():
3232
f1 = FormatInfoIntToStr(addr=itoa_addr, func_name="itoa", int_arg_num=1, str_dst_num=0, base=10, base_arg=None)
3333
f2 = FormatInfoStrToInt(addr=atoi_addr, func_name="atoi", str_arg_num=0, base=10, base_arg=None,
3434
allows_negative=True)
35-
crash = rex.Crash(bin_path, crash=crash_input, format_infos=[f1, f2], rop_cache_path=os.path.join(cache_location, "chall_resp_atoi"))
35+
crash = rex.Crash(bin_path, crash=crash_input, format_infos=[f1, f2],
36+
rop_cache_path=os.path.join(cache_location, "chall_resp_atoi"))
3637
exploit_f = crash.exploit()
3738
for e in exploit_f.register_setters:
3839
assert _do_pov_test(e)
@@ -48,7 +49,8 @@ def test_chall_response():
4849
path = bin_location + "/tests/cgc/overflow_after_challenge_response2"
4950

5051
with archr.targets.LocalTarget([path], target_os='cgc') as target:
51-
crash = rex.Crash(target, crash=inp, rop_cache_path=os.path.join(cache_location, "overflow_after_challenge_response2"))
52+
crash = rex.Crash(target, crash=inp,
53+
rop_cache_path=os.path.join(cache_location, "overflow_after_challenge_response2"))
5254
exploit_f = crash.exploit()
5355
crash.project.loader.close()
5456

@@ -65,7 +67,8 @@ def test_chall_resp_rand():
6567
path = bin_location + "/tests/cgc/overflow_after_chall_resp_rand"
6668

6769
with archr.targets.LocalTarget([path], target_os='cgc') as target:
68-
crash = rex.Crash(target, crash=inp, rop_cache_path=os.path.join(cache_location, "overflow_after_chall_resp_rand"))
70+
crash = rex.Crash(target, crash=inp,
71+
rop_cache_path=os.path.join(cache_location, "overflow_after_chall_resp_rand"))
6972
exploit_f = crash.exploit()
7073
crash.project.loader.close()
7174

@@ -77,7 +80,7 @@ def test_chall_resp_rand():
7780

7881
def run_all():
7982
functions = globals()
80-
all_functions = dict(filter((lambda kv: kv[0].startswith('test_')), functions.items()))
83+
all_functions = {k:v for k,v in functions.items() if k.startswith("test_")}
8184
for f in sorted(all_functions.keys()):
8285
print(f)
8386
if hasattr(all_functions[f], '__call__'):

0 commit comments

Comments
 (0)