Method backdoor_apk
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def backdoor_apk(apkfile, raw_payload, signature = true, manifest = true, apk_data = nil, service = true)
unless apk_data || apkfile && File.readable?(apkfile)
usage
raise RuntimeError, "Invalid template: #{apkfile}"
end
- 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 backdoor_apk
has 162 lines of code (exceeds 25 allowed). Consider refactoring. Open
def backdoor_apk(apkfile, raw_payload, signature = true, manifest = true, apk_data = nil, service = true)
unless apk_data || apkfile && File.readable?(apkfile)
usage
raise RuntimeError, "Invalid template: #{apkfile}"
end
Method find_hook_point
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def find_hook_point(manifest)
return unless manifest
package = manifest.xpath('//manifest').first['package']
- 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
File apk.rb
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rex/text'
require 'tmpdir'
require 'nokogiri'
require 'fileutils'
require 'optparse'
Method extract_cert_data_from_apk_file
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_cert_data_from_apk_file(path)
orig_cert_data = []
# extract signing scheme v1 (JAR signing) certificate
# v1 signing is optional to support older versions of Android (pre Android 11)
Method fix_manifest
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fix_manifest(tempdir, package, main_service, main_broadcast_receiver)
#Load payload's manifest
payload_manifest = parse_manifest("#{tempdir}/payload/AndroidManifest.xml")
payload_permissions = payload_manifest.xpath("//manifest/uses-permission")
Method extract_cert_data_from_apk_file
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def extract_cert_data_from_apk_file(path)
orig_cert_data = []
# extract signing scheme v1 (JAR signing) certificate
# v1 signing is optional to support older versions of Android (pre Android 11)
- 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 find_hook_point
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_hook_point(manifest)
return unless manifest
package = manifest.xpath('//manifest').first['package']
Method backdoor_apk
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def backdoor_apk(apkfile, raw_payload, signature = true, manifest = true, apk_data = nil, service = true)
Method fix_manifest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fix_manifest(tempdir, package, main_service, main_broadcast_receiver)
#Load payload's manifest
payload_manifest = parse_manifest("#{tempdir}/payload/AndroidManifest.xml")
payload_permissions = payload_manifest.xpath("//manifest/uses-permission")
- 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"