pyjfuzz/core/pjf_factory.py
def fuzz_elements(self, element):
        """
        Fuzz all elements inside the object
        """
        try:
            if type(element) == dict:
                tmp_element = {}
                for key in element:
                    if len(self.config.parameters) > 0:
                        if self.config.exclude_parameters:
                            fuzz = key not in self.config.parameters
                        else:
                            fuzz = key in self.config.parameters
                    else:
                        fuzz = True
                    if fuzz:
                        if type(element[key]) == dict:
                            tmp_element.update({key: self.fuzz_elements(element[key])})
                        elif type(element[key]) == list:
                            tmp_element.update({key: self.fuzz_elements(element[key])})
                        else:
                            tmp_element.update({key: self.mutator.fuzz(element[key])})
                    else:
                        tmp_element.update({key: self.fuzz_elements(element[key])})
                element = tmp_element
                del tmp_element
            elif type(element) == list:
                arr = []
                for key in element:
                    if type(key) == dict:
                        arr.append(self.fuzz_elements(key))
                    elif type(key) == list:
                        arr.append(self.fuzz_elements(key))
                    else:
                        if len(self.config.parameters) <= 0:
                            arr.append(self.mutator.fuzz(key))
                        else:
                            arr.append(key)
                element = arr
                del arr
        except Exception as e:
            raise PJFBaseException(e.message if hasattr(e, "message") else str(e))
        return element
def fuzz_elements(self, element):
        """
        Fuzz all elements inside the object
        """
        try:
            if type(element) == dict:
                tmp_element = {}
                for key in element:
                    if len(self.config.parameters) > 0:
                        if self.config.exclude_parameters:
                            fuzz = key not in self.config.parameters
                        else:
                            fuzz = key in self.config.parameters
                    else:
                        fuzz = True
                    if fuzz:
                        if type(element[key]) == dict:
                            tmp_element.update({key: self.fuzz_elements(element[key])})
                        elif type(element[key]) == list:
                            tmp_element.update({key: self.fuzz_elements(element[key])})
                        else:
                            tmp_element.update({key: self.mutator.fuzz(element[key])})
                    else:
                        tmp_element.update({key: self.fuzz_elements(element[key])})
                element = tmp_element
                del tmp_element
            elif type(element) == list:
                arr = []
                for key in element:
                    if type(key) == dict:
                        arr.append(self.fuzz_elements(key))
                    elif type(key) == list:
                        arr.append(self.fuzz_elements(key))
                    else:
                        if len(self.config.parameters) <= 0:
                            arr.append(self.mutator.fuzz(key))
                        else:
                            arr.append(key)
                element = arr
                del arr
        except Exception as e:
            raise PJFBaseException(e.message if hasattr(e, "message") else str(e))
        return element
def fuzz_elements ( self , element ) : try : if type ( element ) == dict : tmp_element = { } for key in element : if len ( self . config . parameters ) > 0 : if self . config . exclude_parameters : fuzz = key not in self . config . parameters else : fuzz = key in self . config . parameters else : fuzz = True if fuzz : if type ( element [ key ] ) == dict : tmp_element . update ( { key : self . fuzz_elements ( element [ key ] ) } ) elif type ( element [ key ] ) == list : tmp_element . update ( { key : self . fuzz_elements ( element [ key ] ) } ) else : tmp_element . update ( { key : self . mutator . fuzz ( element [ key ] ) } ) else : tmp_element . update ( { key : self . fuzz_elements ( element [ key ] ) } ) element = tmp_element del tmp_element elif type ( element ) == list : arr = [ ] for key in element : if type ( key ) == dict : arr . append ( self . fuzz_elements ( key ) ) elif type ( key ) == list : arr . append ( self . fuzz_elements ( key ) ) else : if len ( self . config . parameters ) <= 0 : arr . append ( self . mutator . fuzz ( key ) ) else : arr . append ( key ) element = arr del arr except Exception as e : raise PJFBaseException ( e . message if hasattr ( e , "message" ) else str ( e ) ) return element
Fuzz all elements inside the object
Fuzz all elements inside the object