-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
66 lines (43 loc) · 2.09 KB
/
main.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# This is a sample Python script.
# Press Maj+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
# Press the green button in the gutter to run the script.
from resources.code_bidon import bidon, bidon_validate, bidon_deux, call_fn, bidon_vil, bidon_adder
from correcteur.feedback.errorRepporter import ErrorReporter
from correcteur.feedback.textRepporter import TestRepporter
from correcteur.fuzzing.fuzz import fuzz_explicit_arguments, fuzz
from correcteur.fuzzing.input.int import Int
from correcteur.fuzzing.token.magic_token_finder import find_token
from correcteur.steps.Step import Step
from correcteur.steps.StepsRunner import StepRunner
from correcteur.symbolic.symbolic import analyse_file
# This one is kinda finished
def step_analyse(reporter: ErrorReporter):
runner = StepRunner(stop_on_first_error=True)
runner.add_step(Step([lambda: 0], [lambda: 0]))
runner.add_step(Step([lambda: 0, lambda: 1/0], [lambda: 0, lambda: 0]))
runner.add_step(Step([lambda: 0], [lambda: 0]))
runner.compare_codes(reporter)
# This one is not finished at all
def analyse_semantic(reporter: ErrorReporter):
analyse_file("resources/code_bidon.py", "lol")
# This one is on it's way
def fuzz_it(reporter: ErrorReporter, modu: [str]):
fuzz_explicit_arguments(reporter, bidon, bidon_validate, [Int(), Int()], modu, runs=1000)
def blind_fuzz(reporter: ErrorReporter, modu: [str]):
fuzz(reporter, bidon_adder, bidon_validate, modu, runs=1000)
def blind_fuzz_noref(reporter: ErrorReporter, modu: [str]):
fuzz(reporter, bidon_adder, None, modu, runs=1000)
def token_finder(fn, modu):
tokens = find_token(fn, modu)
for token in tokens:
print("token discovered: {}".format(token))
if __name__ == '__main__':
reporter = TestRepporter()
valid_modules = ["resources.code_bidon"]
blind_fuzz_noref(reporter, valid_modules)
token_finder(call_fn, valid_modules)
step_analyse(reporter)
fuzz_it(reporter, valid_modules)
for line in reporter.get_output():
print(line)