forked from dylanjwolff/competition-fuzzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_2.py
38 lines (33 loc) · 1.08 KB
/
example_2.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
def get_initial_corpus():
return ["fuzz"]
i = 0
def entrypoint(s):
global i
i += 1
print(f'trial {i}')
j = 0
k = 1
while j < 5:
a = 0 ## placeholder to simulate presence of some code
b = 0 ## placeholder to simulate presence of some code
if len(s) > j * 5 + 2:
a = 1 ## placeholder to simulate presence of some code
b = 1 ## placeholder to simulate presence of some code
while k < 10:
if (k > 5):
if len(s) > k * 2:
if s[k+1] == 'f':
if s[k*2 - 1] == 's':
print(f'bug found after {i} trials')
exit(219)
k += 1
else:
if len(s) > 2:
if len(s) < 10:
if s[-1] == 'b':
print(f'bug found in else branch after {i} trials')
exit(219)
j += 1
if __name__ == "__main__":
for p in range(0, 110):
entrypoint(get_initial_corpus()[0])