File HookManager.js
has 1251 lines of code (exceeds 250 allowed). Consider refactoring. Open
var FRIDA = null;
const co = require("co");
const fs = require("fs");
const md5 = require("md5");
const Chalk = require("chalk");
HookManager
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class HookManager
{
/**
*
* @param {*} pProject
Function makeHookFor
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Hook.prototype.makeHookFor = function(method){
/*if(method instanceof CLASS.MissingReference){
console.log(Chalk.bold.yellow("TODO : implement MissingReference probing"));
this.enable = false;
return null;
Function start
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
start(hook_script, pType=null, pExtra=null, pDevice=null){
let target = null;
let PROBE_SESSION = this.newSession();
Function makeHookFor
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Hook.prototype.makeHookFor = function(method){
/*if(method instanceof CLASS.MissingReference){
console.log(Chalk.bold.yellow("TODO : implement MissingReference probing"));
this.enable = false;
return null;
- 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 start
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
start(hook_script, pType=null, pExtra=null, pDevice=null){
let target = null;
let PROBE_SESSION = this.newSession();
- 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 makeArgsHelper
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Hook.prototype.makeArgsHelper = function(args_arr){
if(args_arr.length ==0) return null;
let raw_name = null;
let helper = {
// Value to pass to the "overload()" method of Frida
- 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 deploy
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
HookSet.prototype.deploy = function(){
let hookManager = this.context.hook; //ctx.hook;
let hook, method, hconfig;
// if the hookset is already deployed only not deployed hooks are generated
- 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 hookRoutine
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
var hookRoutine = co.wrap(function *() {
let session = null, pid=null, applications=null, bridge=null;
let device = null;
Function buildCustomScript
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Hook.prototype.buildCustomScript = function(method){
if(method instanceof CLASS.MissingReference){
console.log(Chalk.bold.yellow("TODO : implement MissingReference probing"));
this.enable = false;
return null;
Function makeArgsHelper
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Hook.prototype.makeArgsHelper = function(args_arr){
if(args_arr.length ==0) return null;
let raw_name = null;
let helper = {
// Value to pass to the "overload()" method of Frida
Function deploy
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
HookSet.prototype.deploy = function(){
let hookManager = this.context.hook; //ctx.hook;
let hook, method, hconfig;
// if the hookset is already deployed only not deployed hooks are generated
Function toIntercept
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
HookPrimitive.prototype.toIntercept = function(context,set){
let hook = new Hook(context);
hook.variables = this.variables;
Function addIntercept
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
HookSet.prototype.addIntercept = function(interceptConfig){
if(interceptConfig.method == null && interceptConfig.raw == null){
Logger.error("[HOOK MANAGER] addIntercept(): The method to hook is not defined");
return null;
}
Function buildCustomScript
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Hook.prototype.buildCustomScript = function(method){
if(method instanceof CLASS.MissingReference){
console.log(Chalk.bold.yellow("TODO : implement MissingReference probing"));
this.enable = false;
return null;
- 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 Hook
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Hook(context){
this.id = null;
// ! important
// It is used in order to link in-hook method call with method declared outside of the hook
Function toJsonObject
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Hook.prototype.toJsonObject = function(){
let o = new Object();
o.id = this.id;
o.parentID = this.parentID;
o.color = this.color;
Function toJsonObject
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
HookSet.prototype.toJsonObject = function(){
let o = new Object();
for(let i in this){
switch(i){
case "id":
Function prepareHookScript
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
prepareHookScript(){
let script = `Java.perform(function() {
var DEXC_MODULE = {};
`;
- 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 addIntercept
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
HookSet.prototype.addIntercept = function(interceptConfig){
if(interceptConfig.method == null && interceptConfig.raw == null){
Logger.error("[HOOK MANAGER] addIntercept(): The method to hook is not defined");
return null;
}
- 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 toJsonObject
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
HookSet.prototype.toJsonObject = function(){
let o = new Object();
for(let i in this){
switch(i){
case "id":
- 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 toIntercept
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
HookPrimitive.prototype.toIntercept = function(context,set){
let hook = new Hook(context);
hook.variables = this.variables;
- 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 addProbe
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
HookSet.prototype.addProbe = function(probeConfig){
if(probeConfig.method != null){
if(typeof probeConfig.method != "string"){
let probe = null;
for(let i=0; i<probeConfig.method.length; i++){
- 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 addCustomHook
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
HookSet.prototype.addCustomHook = function(config){
if(config.method == null && config.raw == null){
Logger.error("[HOOK MANAGER] addCustomHook(): The method to hook is not defined");
return null;
}
- 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 makeRetHelper
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Hook.prototype.makeRetHelper = function(ret){
if(ret == null) return null;
let helper = {
// Format string for the logger
- 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 toJsonObject
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Hook.prototype.toJsonObject = function(){
let o = new Object();
o.id = this.id;
o.parentID = this.parentID;
o.color = this.color;
- 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 write
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
write(){
let str=` [
`;
for(let i=0; i<this.data.length; i++){
if(typeof this.data[i] == 'string'){
- 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 push
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
push(msg){
let hm = new HookMessage();
if(msg.type == "error") return null;
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if(method.args.length > 0){
let argHelp = this.makeArgsHelper(method.args);
if(argHelp.data=="") argHelp.data = "pass:''";
tags["@@__ARGS__@@"] = argHelp.call_signature;
tags["@@__ARGS_DATA__@@"] = "{"+argHelp.data+"}";
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 118.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if(method.args.length > 0){
let argHelp = this.makeArgsHelper(method.args);
if(argHelp.data=="") argHelp.data = "pass:1";
tags["@@__ARGS__@@"] = argHelp.call_signature;
tags["@@__ARGS_DATA__@@"] = "{"+argHelp.data+"}";
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 118.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
removeHooksOf(hookset){
let npro = [];
for(let i=0; i<this.hooks.length; i++){
if(this.hooks[i].parentID != hookset.getID()){
npro.push(this.hooks[i]);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 103.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
removePrologueOf(hookset){
let npro = [];
for(let i=0; i<this.prologues.length; i++){
if(this.prologues[i].parentID != hookset.getID()){
npro.push(this.prologues[i]);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 103.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
}else{
config.custom = true;
primitive = new HookPrimitive(config);
primitive.isIntercept = true;
primitive.isCustom = true;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 92.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
for(let i=0; i<config.method.length; i++){
config.custom = true;
primitive = new HookPrimitive(config);
primitive.isIntercept = true;
primitive.isCustom = true;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 92.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76