-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert to 0.3.1 on master to avoid complaints until dev is released.
- Loading branch information
Fabian Yamaguchi
committed
Dec 26, 2016
1 parent
d928ff1
commit 642e2c1
Showing
1,610 changed files
with
28,913 additions
and
76,746 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> | ||
<classpathentry kind="lib" path="lib/commons-cli-1.2.jar"/> | ||
<classpathentry kind="lib" path="lib/lucene-core-3.6.2.jar"/> | ||
<classpathentry kind="lib" path="lib/geronimo-jta_1.1_spec-1.1.1.jar"/> | ||
<classpathentry kind="lib" path="lib/antlr4-annotations-4.2.1-SNAPSHOT.jar"/> | ||
<classpathentry kind="lib" path="lib/antlr4-runtime-4.2.1-SNAPSHOT.jar"/> | ||
<classpathentry kind="lib" path="lib/neo4j-kernel-2.1.5.jar"/> | ||
<classpathentry kind="lib" path="lib/neo4j-lucene-index-2.1.5.jar"/> | ||
<classpathentry kind="lib" path="lib/neo4j-primitive-collections-2.1.5.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>joern</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
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,5 @@ | ||
Fabian Yamaguchi <fabian.yamaguchi@cs.uni-goettingen.de> | ||
|
||
Contributors: | ||
|
||
Fabian Yamaguchi <fabian.yamaguchi@cs.uni-goettingen.de> (main developer) | ||
Alwin Maier <alwin.maier@stud.uni-goettingen.de> | ||
Malte Skoruppa <skoruppa@cs.uni-saarland.de> (php support) |
This file was deleted.
Oops, something went wrong.
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,86 @@ | ||
<?xml version="1.0"?> | ||
<project name="Joern" default="jar" basedir="."> | ||
|
||
<property name="src.dir" location="src" /> | ||
<property name="build.dir" location="bin" /> | ||
<property name="lib.dir" location="lib" /> | ||
<property name="test.dir" location="src" /> | ||
<property name="test.report.dir" location="testreport" /> | ||
|
||
<!-- Junit class path --> | ||
<path id="junit.class.path"> | ||
<pathelement location="lib/junit.jar" /> | ||
<pathelement location="${build.dir}" /> | ||
</path> | ||
|
||
<!-- Add jars to the classpath --> | ||
<path id="joern.classpath"> | ||
<pathelement location="bin"/> | ||
<path refid="junit.class.path"/> | ||
<pathelement location="${lib.dir}/antlr4-runtime-4.2.1-SNAPSHOT.jar"/> | ||
<pathelement location="${lib.dir}/antlr4-annotations-4.2.1-SNAPSHOT.jar"/> | ||
<pathelement location="${lib.dir}/commons-cli-1.2.jar"/> | ||
<pathelement location="${lib.dir}/lucene-core-3.6.2.jar"/> | ||
<pathelement location="${lib.dir}/neo4j-kernel-2.1.5.jar"/> | ||
<pathelement location="${lib.dir}/neo4j-lucene-index-2.1.5.jar"/> | ||
<pathelement location="${lib.dir}/neo4j-primitive-collections-2.1.5.jar"/> | ||
</path> | ||
|
||
<target name="clean"> | ||
<delete dir="${build.dir}" /> | ||
<delete dir="${test.report.dir}" /> | ||
</target> | ||
|
||
<target name="makedir"> | ||
<mkdir dir="${build.dir}" /> | ||
<mkdir dir="${test.report.dir}" /> | ||
</target> | ||
|
||
<target name="compile"> | ||
<javac srcdir="${src.dir}" destdir="${build.dir}" includeantruntime="false"> | ||
<src path="src"/> | ||
<classpath refid="joern.classpath"/> | ||
</javac> | ||
</target> | ||
|
||
<target name="jar" depends="clean,makedir,compile"> | ||
<jar destfile="${build.dir}/joern.jar" | ||
basedir="${build.dir}" | ||
includes="**/*.class"> | ||
<manifest> | ||
<attribute name="Main-Class" value="tools.index.IndexMain" /> | ||
</manifest> | ||
<fileset dir="${build.dir}" includes="**/*.class" /> | ||
<zipgroupfileset dir="${lib.dir}" includes="**/*.jar" /> | ||
</jar> | ||
</target> | ||
|
||
<target name="tools" depends="icfg,argumentTainter"> | ||
</target> | ||
|
||
<target name="icfg" depends="compile"> | ||
<jar destfile="${build.dir}/icfg.jar" | ||
basedir="${build.dir}" | ||
includes="**/*.class"> | ||
<manifest> | ||
<attribute name="Main-Class" value="tools.icfg.ICFGMain" /> | ||
</manifest> | ||
<fileset dir="${build.dir}" includes="**/*.class" /> | ||
<zipgroupfileset dir="${lib.dir}" includes="**/*.jar" /> | ||
</jar> | ||
</target> | ||
|
||
<target name="argumentTainter" depends="compile"> | ||
<jar destfile="${build.dir}/argumentTainter.jar" | ||
basedir="${build.dir}" | ||
includes="**/*.class"> | ||
<manifest> | ||
<attribute name="Main-Class" value="tools.argumentTainter.ArgumentTainterMain" /> | ||
</manifest> | ||
<fileset dir="${build.dir}" includes="**/*.class" /> | ||
<zipgroupfileset dir="${lib.dir}" includes="**/*.jar" /> | ||
</jar> | ||
</target> | ||
|
||
|
||
</project> |
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,92 @@ | ||
Accessing Code with python-joern | ||
================================= | ||
|
||
Once code has been imported into a Neo4j database, it can be accessed | ||
using a number of different interfaces and programming languages. One | ||
of the simplest possibilities is to create a standalone Neo4J server | ||
instance as described in the previous section and connect to this | ||
server using ``python-joern``, the python interface to joern. | ||
|
||
**General Note:** It is highly recommended to test your installation on a | ||
small code base first. The same is true for early attempts of creating | ||
search queries, as erroneous queries will often run for a very long | ||
time on large code bases, making a trial-and-error approach | ||
unfeasible. | ||
|
||
Basic Usage | ||
----------- | ||
|
||
Python-joern currently provides a single class, JoernSteps, that | ||
allows to connect to the database server and run queries. The | ||
following is a simple sample script that employs JoernSteps to | ||
configure the database connection, connect to the server and run a | ||
Gremlin query. | ||
|
||
:: | ||
|
||
from joern.all import JoernSteps | ||
|
||
j = JoernSteps() | ||
|
||
j.setGraphDbURL('http://localhost:7474/db/data/') | ||
|
||
# j.addStepsDir('Use this to inject utility traversals') | ||
|
||
j.connectToDatabase() | ||
|
||
res = j.runGremlinQuery('getFunctionsByName("main")') | ||
# res = j.runCypherQuery('...') | ||
|
||
for r in res: print r | ||
|
||
|
||
python-joern API | ||
---------------- | ||
|
||
The sample script described in the previous section employs all | ||
methods offered by JoernSteps. We now discuss each of these methods in | ||
detail. | ||
|
||
setGraphDbURL(url) | ||
""""""""""""""""""" | ||
|
||
**Sets the URL of the graph database server.** The REST API of the | ||
Neo4J Database server is exposed on port 7474 by default. If your | ||
server runs on a different port or server, you can use setGraphDbURL | ||
to specify the alternate URL. | ||
|
||
addStepsDir(dirname) | ||
"""""""""""""""""""" | ||
|
||
**Add a source directory for utility traversals.** By default, | ||
python-joern will inject all utility traversals contained in any of | ||
the source files in joern/joernsteps into the database before running | ||
scripts. Additional traversals specific to your application or | ||
analysis are best placed in a separate directory. python-joern can be | ||
instructed to honor this additional directory using addStepsDir. | ||
|
||
connectToDatabase() | ||
""""""""""""""""""" | ||
|
||
**Connect to the database.** Call this method once the connection has | ||
been configured to connect to the database server. A connection is | ||
required before queries can be executed. | ||
|
||
runGremlinQuery(query) | ||
"""""""""""""""""""""" | ||
|
||
**Run the specified Gremlin query.** The supplied query is executed | ||
and the result is returned. Depending on the query, the result may | ||
have a different data type, however, it is typically an iterable | ||
containing nodes that match the query. | ||
|
||
|
||
runCypherQuery(query) | ||
""""""""""""""""""""" | ||
|
||
**Run the specified Cypher query.** The supplied query is executed | ||
and the result is returned. Depending on the query, the result may | ||
have a different data type, however, it is typically an iterable | ||
containing nodes that match the query. | ||
|
||
|
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.