-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update gitignore to ignore preprocessor. * Update Joern to use the latest script manager. * Remove unused project. * Symlink to scripts folder. * Run scalafmt.
- Loading branch information
1 parent
2d103c1
commit af659e0
Showing
29 changed files
with
101 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ fuzzyc2cpg | |
.idea/ | ||
joern-cli.zip | ||
joern-server.zip | ||
fuzzyppcli-dist | ||
fuzzyppcli/ | ||
cpg.bin.zip | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import java.io.FilenameFilter | ||
|
||
enablePlugins(JavaAppPackaging) | ||
enablePlugins(UniversalPlugin) | ||
|
||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"scripts": [ | ||
{ | ||
"name": "ast-for-funcs", | ||
"description": "Returns the corresponding AST for each function as Json object." | ||
}, | ||
{ | ||
"name": "ast-for-funcs-dump", | ||
"description": "Prints the corresponding AST for each function as Json string to a file." | ||
}, | ||
{ | ||
"name": "cfg-for-funcs", | ||
"description": "Returns the corresponding CFG for each function as Json object." | ||
}, | ||
{ | ||
"name": "cfg-for-funcs-dump", | ||
"description": "Prints the corresponding CFG for each function as Json string to a file." | ||
}, | ||
{ | ||
"name": "cfgToDot", | ||
"description": "Generates a dot graph for your cfg." | ||
}, | ||
{ | ||
"name": "functions-to-dot", | ||
"description": "Generates a list of strings, each containing a dot graph for every internal function in the provided CPG." | ||
}, | ||
{ | ||
"name": "graph-for-funcs", | ||
"description": "Returns the corresponding graph (AST+CFG+PDG) for each function as Json object." | ||
}, | ||
{ | ||
"name": "list-funcs", | ||
"description": "Lists all functions." | ||
}, | ||
{ | ||
"name": "pdg-for-funcs-dump", | ||
"description": "Prints the corresponding PDG for each function as Json string to a file." | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 1 addition & 26 deletions
27
joern-cli/src/main/scala/io/shiftleft/joern/JoernScriptManager.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,5 @@ | ||
package io.shiftleft.joern | ||
|
||
import cats.effect.IO | ||
import io.shiftleft.codepropertygraph.Cpg | ||
import io.shiftleft.console.ScriptManager | ||
import io.shiftleft.console.query.{CpgOperationFailure, CpgOperationResult, CpgOperationSuccess} | ||
|
||
class JoernScriptManager(executor: JoernScriptExecutor = new JoernScriptExecutor()) extends ScriptManager(executor) { | ||
|
||
private def scriptContent(name: String): String = | ||
(DEFAULT_SCRIPTS_FOLDER / name / s"$name.scala").lines.mkString(System.lineSeparator()) | ||
|
||
private def handleQueryResult(result: IO[CpgOperationResult[AnyRef]]): AnyRef = { | ||
val scriptExecutionResult = for { | ||
queryResult <- result | ||
result <- queryResult match { | ||
case CpgOperationSuccess(result) => IO(result) | ||
case CpgOperationFailure(ex) => IO.raiseError[AnyRef](ex) | ||
} | ||
} yield result | ||
scriptExecutionResult.handleErrorWith(IO(_)).unsafeRunSync() | ||
} | ||
|
||
def runScript(name: String, cpgFilename: String): AnyRef = | ||
handleQueryResult(executor.executeQuerySync(CpgLoader.load(cpgFilename), scriptContent(name))) | ||
|
||
def runScript(name: String, cpg: Cpg): AnyRef = | ||
handleQueryResult(executor.executeQuerySync(cpg, scriptContent(name))) | ||
|
||
} | ||
class JoernScriptManager(executor: JoernScriptExecutor = new JoernScriptExecutor()) extends ScriptManager(executor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ enablePlugins(JavaAppPackaging) | |
enablePlugins(UniversalPlugin) | ||
|
||
organization := "io.shiftleft" | ||
name := "Joern Server" | ||
name := "joern-server" | ||
maintainer := "[email protected]" | ||
|
||
resolvers += Classpaths.typesafeReleases | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
|
||
import sbt._ | ||
|
||
object Projects { | ||
lazy val joerncli = project.in(file("joern-cli")) | ||
lazy val joernserver = project.in(file("joern-server")) | ||
lazy val joerncli = project.in(file("joern-cli")) | ||
lazy val joernserver = project.in(file("joern-server")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
joern-cli/src/main/resources/scripts |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.