-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
4,173 additions
and
53 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
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
30 changes: 30 additions & 0 deletions
30
console/src/main/scala/io/joern/console/cpgcreation/IdaCpgGenerator.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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.joern.console.cpgcreation | ||
|
||
import io.joern.console.FrontendConfig | ||
import io.joern.php2cpg.{Config, Frontend, Php2Cpg} | ||
import io.joern.x2cpg.X2Cpg | ||
import io.joern.x2cpg.passes.frontend.XTypeRecoveryConfig | ||
import io.shiftleft.codepropertygraph.Cpg | ||
|
||
import java.nio.file.Path | ||
import scala.util.Try | ||
|
||
case class IdaCpgGenerator(config: FrontendConfig, rootPath: Path) extends CpgGenerator { | ||
private lazy val command: Path = if (isWin) rootPath.resolve("ida2cpg.bat") else rootPath.resolve("ida2cpg") | ||
private var phpConfig: Option[Config] = None | ||
|
||
override def generate(inputPath: String, outputPath: String): Try[String] = { | ||
val arguments = List(inputPath) ++ Seq("-o", outputPath) ++ config.cmdLineParams | ||
phpConfig = X2Cpg.parseCommandLine(arguments.toArray, Frontend.cmdLineParser, Config()) | ||
runShellCommand(command.toString, arguments).map(_ => outputPath) | ||
} | ||
|
||
override def isAvailable: Boolean = | ||
command.toFile.exists | ||
|
||
override def isJvmBased = true | ||
|
||
override def applyPostProcessingPasses(cpg: Cpg): Cpg = { | ||
cpg | ||
} | ||
} |
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
Oops, something went wrong.