Skip to content

Commit

Permalink
combine print and text file
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminfisk committed Dec 2, 2023
1 parent 33b3d51 commit dc6a318
Showing 1 changed file with 36 additions and 32 deletions.
68 changes: 36 additions & 32 deletions KubeSec-master/fuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,42 @@
import parser

def fuzzValues():
input_list = [1]
for input in input_list:
flag = False
# print(f'Input: {input}\n')

try:
parser.checkIfValidHelm(input)
except Exception as e:
print(f'Input for checkIfValidHelm was invalid.\n Error: {e}\n')
flag = True
try:
parser.readYAMLAsStr(input)
except Exception as e:
print(f'Input for checkIfValidK8SYaml was invalid.\n Error: {e}\n')
flag = True
try:
parser.checkIfWeirdYAML(input)
except Exception as e:
print(f'Input for checkIfWeirdYAML was invalid.\n Error: {e}\n')
flag = True
# try:
# parser.checkParseError(input)
# except Exception as e:
# print(f'Input for checkParseError was invalid.\n Error: {e}\n')
# flag = True
# try:
# parser.count_initial_comment_line(input)
# except Exception as e:
# print(f'Input for count_initial_comment_line was invalid.\n Error: {e}\n')
# flag = True
# if not flag:
# print(f'Input {input} was valid for all functions.\n')
with open('fuzzValues.txt', 'w') as f:
input_list = [1]
for input in input_list:
flag = False
# print(f'Input: {input}\n')

try:
parser.checkIfValidHelm(input)
except Exception as e:
print(f'Input for checkIfValidHelm was invalid.\n Error: {e}\n')
f.write(f'Input for checkIfValidHelm was invalid.\n Error: {e}\n')
flag = True
try:
parser.readYAMLAsStr(input)
except Exception as e:
print(f'Input for checkIfValidK8SYaml was invalid.\n Error: {e}\n')
f.write(f'Input for checkIfValidK8SYaml was invalid.\n Error: {e}\n')
flag = True
try:
parser.checkIfWeirdYAML(input)
except Exception as e:
print(f'Input for checkIfWeirdYAML was invalid.\n Error: {e}\n')
f.write(f'Input for checkIfWeirdYAML was invalid.\n Error: {e}\n')
flag = True
# try:
# parser.checkParseError(input)
# except Exception as e:
# print(f'Input for checkParseError was invalid.\n Error: {e}\n')
# flag = True
# try:
# parser.count_initial_comment_line(input)
# except Exception as e:
# print(f'Input for count_initial_comment_line was invalid.\n Error: {e}\n')
# flag = True
# if not flag:
# print(f'Input {input} was valid for all functions.\n')

if __name__ == '__main__':
fuzzValues()

0 comments on commit dc6a318

Please sign in to comment.