def __init__(self, configuration):
"""
Class that represent a JSON object
"""
self.logger = self.init_logger()
if ["json", "json_file", "strong_fuzz", "parameters", "exclude_parameters", "url_encode", "indent",
"utf8"] not in configuration:
raise PJFMissingArgument("Some arguments are missing from PJFFactory object")
self.config = configuration
self.mutator = PJFMutation(self.config)
other = self.config.json
if not self.config.strong_fuzz:
if type(other) == dict:
self.json = other
elif type(other) == list:
self.json = {"array": other}
else:
raise PJFInvalidType(other, dict)
else:
if self.config.json_file:
self.json = other
else:
self.json = json.dumps(other)
self.logger.debug("[{0}] - PJFFactory successfully initialized".format(time.strftime("%H:%M:%S")))
评论列表
文章目录