Showing 85 of 1,244 total issues
Function machoc_get_similar_functions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def machoc_get_similar_functions(cls, sample_dst, sample_src):
"""
Diff two sample in order to identify similar functions.
This is performed by:
- getting unique machoc hashes;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method printCallTree
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def printCallTree(fromaddr, toaddr)
@currenttree_done = []
i = 0
@glinestree = 9999
log('')
Function execute_yara_task
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def execute_yara_task(mqueue):
"""
Special dedicated YARA worker. Dispatches newly created yara rules on the
samples pool. There is no analysis in this case,
nor priority considerations, that's why it has been separated.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function renamed
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def renamed(self, *args):
logger.debug("[IDB Hook] Something is renamed")
ea, new_name, is_local_name = args
min_ea = idc.get_inf_attr(idc.INF_MIN_EA)
max_ea = idc.get_inf_attr(idc.INF_MAX_EA)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function parse_ida_cmds
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_ida_cmds(self, sid, functions):
"""
Parse and add IDA commands dumped by AnalyzeIt,
and updates the functions names if needed
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function api_post_samples
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def api_post_samples():
"""
@description : Insert a new sample in database, launch analysis
@arg: string filename
@arg: binary data : the sample content
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function match_by_importhash
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def match_by_importhash(cls, sample):
"""
Match samples by import hash.
"""
if sample.import_hash is None or sample.import_hash == "":
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
printCallTree(dasm.normalize(ep), orifunc) if isFuncTreeLink(dasm.normalize(ep), orifunc)
Avoid deeply nested control flow statements. Open
if di.block.list[i - 1].opcode.name == 'push'
if carg == arg
return $gdasm.normalize(di.block.list[i - 1].instruction.args.first)
end
carg += 1
Function ui_search
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ui_search():
"""
Handle search forms
"""
hform = HashSearchForm()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if (di.block.list[i].opcode.name == 'call') && (di.block.list[i].instruction.args.first == creg)
i -= 1
while i >= 0
if di.block.list[i].opcode.name == 'push'
if carg == arg
Avoid deeply nested control flow statements. Open
AddTagFunction(basefunc, 'Net_') unless basefunc.nil?
Function create_sample_from_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_sample_from_file(self, file_data, orig_filename="", user=None,
tlp_level=TLPLevel.TLPWHITE):
"""
Creates a sample from file data. Updates metadata, etc.
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function search_machoc_full_hash
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def search_machoc_full_hash(self, machoc_hash, limit=0.8):
"""
Search a full machoc hash.
In one word, diffs with other samples in database.
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if (di.block.list[i - 1].opcode.name == 'mov') && ((di.block.list[i - 1].instruction.args.first.to_s == "dword ptr [esp+0#{arg.to_s(16)}h]") || (((di.block.list[i - 1].instruction.args.first.to_s == 'dword ptr [esp]') && (esp == 0))))
return $gdasm.normalize(di.block.list[i - 1].instruction.args.last)
end
Avoid deeply nested control flow statements. Open
AddTagFunction(basefunc, 'Net_') unless basefunc.nil?
Avoid deeply nested control flow statements. Open
printCallTree(dasm.normalize(ep), orifunc) if isFuncTreeLink(dasm.normalize(ep), orifunc)
Function get_filter_arguments
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_filter_arguments(mrequest):
"""
Get timestamp and address from request
"""
data = mrequest.args
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function dispatch_sample_creation
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def dispatch_sample_creation(self,
Avoid deeply nested control flow statements. Open
return nil if di.block.list[i - 1].opcode.name == 'call'