Integrate Joern in your project. REST APIs are there for you 🤝
So, you have your own DIY code analysis tool with a swanky UI, but you also fell in love with Joern? We understand that!
Get Joern
$ curl -L https://github.com/joernio/joern/releases/latest/download/joern-install.sh | sudo bash
Start the Joern Server
$ joern --server
Integrate queries into your code
Let’s get the Python CPG Query Language client library so we can test some integrations with Python. Don’t worry. We also have a JavaScript integration for your gloriously hipster JS UI!
$ pip install cpgqls-client
from cpgqls_client import CPGQLSClient, import_code_query
server_endpoint = "localhost:8080"
client = CPGQLSClient(server_endpoint)
query = import_code_query("/home/suchakra/Projects/test.jar", "test-app")
result = client.execute(query)
print(result['stdout'])
# execute a simple CPG query to list all methods in the code
query = "cpg.method.name.l"
result = client.execute(query)
print(result)
That’s it! For additional information, check out the Server documentation or get a closer look at the Python client library 👈