Skip to content

Commit

Permalink
tested new hashmap mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
esohel30 committed Jul 22, 2024
1 parent 047234c commit 7c3b5b9
Showing 1 changed file with 33 additions and 20 deletions.
53 changes: 33 additions & 20 deletions scripts/pysa_fuzzer/code_generator2.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ def generate(self) -> str:



generator.add_function_8()

generator.add_function_1()
generator.add_function_6()
generator.add_function_8()
generator.add_function_8()

Expand All @@ -251,45 +253,48 @@ def generate(self) -> str:


import random
def f0():
if random.randint(1, 3) == 1:
return input()
else:
return f0()


def f0(x):
hashmap = {char: ord(char) for char in x}
if (value := hashmap.get('a')) is not None:
return chr(value + 1) + x
def f2(x):
if (y := random.randint(1, 3)) == 1:
return x + str(y)
else:
return f0(x + 'a')
return f2(x)


def f2(x):
def f4(x):
hashmap = {char: ord(char) for char in x}
if (value := hashmap.get('a')) is not None:
return chr(value + 1) + x
else:
return f2(x + 'a')
return f4(x + 'a')


def f4(x):
def f6(x):
hashmap = {char: ord(char) for char in x}
if (value := hashmap.get('a')) is not None:
return chr(value + 1) + x
else:
return f4(x + 'a')
return f6(x + 'a')


def f1(x):
hashmap = {char: ord(char) for char in x}
if (value := hashmap.get('z')) is not None:
return print(chr(value - 1) + x)
if random.randint(1, 3) == 1:
return print(x)
else:
return f1(x + 'z')

return f1(x)

def f3(x):
hashmap = {char: ord(char) for char in x}
if (value := hashmap.get('z')) is not None:
return f1(chr(value - 1) + x)
if (y := random.randint(1, 3)) == 1:
return f1(x + str(y))
else:
return f3(x + 'z')
return f3(x)


def f5(x):
Expand All @@ -299,4 +304,12 @@ def f5(x):
else:
return f5(x + 'z')

f5(f4(f2(f0(input()))))

def f7(x):
hashmap = {char: ord(char) for char in x}
if (value := hashmap.get('z')) is not None:
return f5(chr(value - 1) + x)
else:
return f7(x + 'z')

f7(f6(f4(f2(f0()))))

0 comments on commit 7c3b5b9

Please sign in to comment.