Skip to content

Commit

Permalink
'#43 adds suport for multiple parameter python function override.
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickdalla committed Oct 18, 2023
1 parent c9e9ea4 commit 6ad1a2e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions iped-utils/src/main/java/iped/utils/pythonhook/PythonHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,16 @@ public void overrideModuleFunction(String module, String functionName, Method me
String packageName = method.getDeclaringClass().getPackageName();
String className = method.getDeclaringClass().getSimpleName();
String methodName = method.getName();
StringBuffer params = new StringBuffer("");
for (int i = 0; i < method.getParameterCount(); i++) {
params.append("param" + i);
if (i < method.getParameterCount()) {
params.append(",");
}
}
addModification(module, "def " + functionName, "def " + functionName
+ "(str):\n from " + packageName + " import " + className + "\n " + className + "." + methodName
+ "(str)\ndef " + functionName + "2");
+ "(" + params + "):\n from " + packageName + " import " + className + "\n " + className + "."
+ methodName + "(" + params + ")\ndef " + functionName + "2");
}

/*
Expand Down

0 comments on commit 6ad1a2e

Please sign in to comment.