Showing 85 of 1,244 total issues
File yara_rule.py
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
This file is part of Polichombr.
(c) 2017 ANSSI-FR
Function search_fulltext
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def search_fulltext(cls, needle, max_results=50):
"""
Search a text in lot of items and return associated samples.
Searchs in filenames, strings, functions names and anlysis
abstracts. Oh, and also in samples abstracts.
- 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 printSubCallTree
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def printSubCallTree(fromaddr, toaddr, indent, cnt)
return if fromaddr == toaddr
i = 0
space1 = ''
indent.each do |_id, iscontinue|
Method printCallTree
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def printCallTree(fromaddr, toaddr)
@currenttree_done = []
i = 0
@glinestree = 9999
log('')
- 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 load_tasks
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def load_tasks(self):
"""
Dynamically loads the tasks in the tasks/ folder. The tasks must
be loaded here in order to avoid too much memory usage.
"""
- 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 is_looping
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.is_looping(di)
@blocks_done = []
@loopcount = 0
result = false
- 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 execute
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def execute(self):
self.tstart = int(time.time())
self.tmessage = "STRINGS TASK %d :: " % (self.sid)
app.logger.debug(self.tmessage + "EXECUTE")
if os.path.exists(self.fpath):
- 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 view_user
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def view_user(user_id):
"""
View a single user activity
Useful for executive report
"""
- 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 ui_sample_upload
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def ui_sample_upload():
"""
Sample creation from binary file.
"""
upload_form = UploadSampleForm()
- 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 disassemble_sample_get_svg
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def disassemble_sample_get_svg(sample_id, address):
"""
Gets SVG file data, with functions names.
"""
graph = disassemble_sample(sample_id, address)
- 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 generate_family_row
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generate_family_row(family){
row = $("<div></div>");
row.attr("id", "family_" + family["id"]);
row.attr("class", "row panel panel-default families");
row.attr("style", "padding: 5px;");
Method calculate_machoc_hash
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.calculate_machoc_hash(dasm)
@fullFuncSign = ''
@fullHashSign = ''
@listoffunct = []
dasm.function.each do |addr, _symb|
Function generate_samples_zip_file
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def generate_samples_zip_file(family, tlp_level):
"""
Generates a sample ZIP file.
We actually store it in the storage under a
unique filename : family-tlp_level-sha256(samples sha256).
- 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 repareIatLinks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def repareIatLinks
$gdasm.decoded.each do |_addr, di|
next unless (di.opcode.name == 'mov') && defined?(di.instruction.args.last.symbolic.target)
label = $gdasm.get_label_at(di.instruction.args.last.symbolic.target.bind.reduce)
if label =~ /^iat_/
- 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 expand_callback
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function expand_callback(event_data){
/*
* Construct a subpanel with buttons linking to subfamilies
*/
console.log(`Family ${event_data["data"]} expand requested`);
Method calculateSizeSubCallTree
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def calculateSizeSubCallTree(fromaddr, toaddr, indent, cnt)
return 0 if fromaddr == toaddr
i = 0
total = 1
return total if indent.length > 5
- 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 sample_rename_from_diff
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def sample_rename_from_diff(cls, items, sample_dst, sample_src):
"""
Rename a sample's functions with other ones functions.
"""
for fid_dst, fid_src in items:
- 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 add_actions_fromfunc_infos
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def add_actions_fromfunc_infos(self, funcinfos, sample_dst, sample_src):
"""
Create IDAActions from the samples's FuncInfos from AnalyzeIt
"""
for fid_dst, fid_src in funcinfos:
- 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 ui_yara
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def ui_yara():
"""
Yara signatures view.
"""
create_yara_form = YaraForm()
- 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 is_linked_func
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def is_linked_func(currFunc, start_address, stop_address)
result = false
return true if currFunc == stop_address
@tree_done << currFunc
getToFunc(currFunc).each do |tdi_addr|
- 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"