Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] encountering an error where I call my custom script below #5182

Open
CR7-source opened this issue Dec 14, 2024 · 0 comments
Open

[Bug] encountering an error where I call my custom script below #5182

CR7-source opened this issue Dec 14, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@CR7-source
Copy link

Describe the bug

I encountered an error where I call my custom script below.Can anyone help me to solve the problem?

To Reproduce
call script command
./joern --script methodcall.sc --param cpgFile=./cache/CVE-2022-29599_old_7660 5ac236ee5fb64062581209e8ee941efcea77.bin --param methodFullName="org.apache.maven.shared.utils.cli.shell.BourneShell.<init>:" --param methodCode="()"

@main def exec(cpgFile: String, methodFullName: String, methodCode: String) = {
  importCpg(cpgFile)
  cpg.method.filter(node => node.fullName.contains(methodFullName) && node.code.contains(methodCode)).repeat(_.caller)(_.times(1)).toJson |> "methodcaller.json"
}

Here is the error output.

executing methodcall.sc with params=Map(cpgFile -> ./cache/CVE-2022-29599_old_76605ac236ee5fb64062581209e8ee941efcea77.bin, methodFullName -> org.apache.maven.shared.utils.cli.shell.BourneShell.<init>:, methodCode -> ())
-- [E008] Not Found Error: /tmp/wrapped-script7778877123518982422.sc:9:43 ------
  9 |  val callers = methods.repeat(_.caller)(_.times(1))
    |                                         ^^^^^^^
    |value times is not a member of flatgraph.traversal.RepeatBehaviour.Builder[
    |  io.shiftleft.codepropertygraph.generated.nodes.Method]
-- [E008] Not Found Error: /tmp/wrapped-script7778877123518982422.sc:13:13 -----
 13 |  jsonOutput.writeTo("methodcaller.json")
    |  ^^^^^^^^^^^^^^^^^^
    |  value writeTo is not a member of String
2 errors found
error during script execution: Errors encountered during compilation - try `--verbose` for more output
Exception in thread "main" replpp.scripting.CompilerError: Errors encountered during compilation - try `--verbose` for more output
        at replpp.scripting.CompilerError$.apply(ScriptingDriver.scala:78)
        at replpp.util.SimpleDriver.compile$$anonfun$1(SimpleDriver.scala:61)
        at scala.util.Try$.apply(Try.scala:217)
        at replpp.util.SimpleDriver.compile(SimpleDriver.scala:65)
        at replpp.scripting.ScriptingDriver.compileAndRun(ScriptingDriver.scala:51)
        at replpp.scripting.NonForkingScriptRunner$.exec(NonForkingScriptRunner.scala:46)
        at replpp.scripting.NonForkingScriptRunner$.main(NonForkingScriptRunner.scala:20)
        at replpp.scripting.NonForkingScriptRunner.main(NonForkingScriptRunner.scala)
replpp.scripting.ScriptRunner$: error while invoking...

Desktop (please complete the following information):

  • OS ubuntu 20.04
  • Joern Version 4.0.185
  • Java version openjdk 21

Additional context
Add any other context about the problem here.

@CR7-source CR7-source added the bug Something isn't working label Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants