When no encoding is specified, the actual encoding used is platform dependent. This means that if you prepare example files for a reviewer, he might not be able to run the code on his machine.
Note however that reviewers might have then a problem if they prepare files with a different encoding than the one you specified.
|
with open('inputs') as f: |
|
inputs = [line.strip() for line in f] |
|
|
|
if len(inputs) == 0: |
|
print("inputs file is empty! Please provide inputs.") |
|
sys.exit() |
|
|
|
for input_str in inputs: |
|
regexes.append(phase_1([i for i in input_str])) |
|
print("One regex done") |
|
|
|
print("\n+++++ Phase 1 Done +++++\n") |
|
|
|
# Combine regexes into one regex as explained in Section 6.1 |
|
regex = regexes[0] |
|
regexes.pop(0) |
|
for reg in regexes: |
|
regex = Alt(regex, reg, False) |
|
|
|
print("Final regex: " + str(regex)) |
|
|
|
cfg, start = phase_2(regex) |
|
|
|
with open('grammar_.json', 'w+') as f: |
|
json.dump({'<start>': [[start]], **cfg}, indent=4, fp=f) |
|
|
|
print('\n+++++ Merging Phase Begins +++++\n') |
|
merged = phase_3(cfg, start) |
|
|
|
# Save the final grammar in the fuzzing book format |
|
with open('grammar.json', 'w+') as f: |
|
json.dump({'<start>': [[start]], **merged}, indent=4, fp=f) |
When no encoding is specified, the actual encoding used is platform dependent. This means that if you prepare example files for a reviewer, he might not be able to run the code on his machine.
Note however that reviewers might have then a problem if they prepare files with a different encoding than the one you specified.
PyGlade/src/glade.py
Lines 787 to 818 in dcf503d
PyGlade/src/fuzz.py
Line 174 in dcf503d