Package: appthreat-chen
chenCode Hierarchy Exploration Net (chen) is an advanced exploration toolkit for your application source code and its dependency hierarchy. This repo contains the source code for chen library and an advanced REPL console called chennai (chen not AI).RequirementsJava >= 21Python >= 3.10Node.js >= 18 (To runatom)Minimum 16GB RAMGetting startedchen container image has everything needed to get started.Jupyter notebook with docker composeUse the docker compose from this repo to try chennai with Jupyter Notebook.gitclonehttps://github.com/AppThreat/chencdchen
dockercomposeupNavigate to the link "http://127.0.0.1:9999/tree?token=chennai"Click notebooks and thengetting-started.ipynbUse the controls in Jupyter to interact with the cells. For a preview via github clickhereInteractive consoleTo start the interactive console, runchennaicommand.dockerrun--rm-v/tmp:/tmp-v$HOME:$HOME-v$(pwd):/app:rw-itghcr.io/appthreat/chenchennaiChennai server modechennaicould also be run as an HTTP server.dockerrun--rm-v/tmp:/tmp-v$HOME:$HOME-v$(pwd):/app:rw-p8080:8080-itghcr.io/appthreat/chenchennai--serverDefaults:Port 8080Username chenadminPassword chenpasswordLocal Installation# Install atom and cdxgensudonpminstall-g@appthreat/atom@cyclonedx/cdxgen--omit=optional# Install chen from pypipipinstallappthreat-chenTo download the chen distribution.chen--downloadTo generate custom graphs and models with atom for data science, download the scientific pack which installs support for the PyTorch ecosystem.condais recommended for the best experience.chen--download--with-scienceOnce the download finishes, the command will display the download location along with the environment variables that need to be set to invokechennaiconsole. Example output below:[21:53:36]INFOTorunchennaiconsole,addthefollowingenvironmentvariablestoyour.zshrcor.bashrc:exportJAVA_OPTS="-Xmx16G"exportJAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8 -Djna.library.path=<lib dir>"exportSCALAPY_PYTHON_LIBRARY=python3.11exportCHEN_HOME=/home/user/.local/share/chenexportPATH=$PATH:/home/user/.local/share/chen/platform:/home/user/.local/share/chen/platform/bin:It is important to set these environment variables without which the console commands would fail with errors.Running the consoleTypechennaito launch the console.chennai_______
/|__._.__.o|_/\/\/\/|_|_\_||(/_||||(_|||_)\_/\_/\_//|Version:0.0.7
Type`help`tobegin


chennai>Sample commmandsHelp commandchennai>helpvalres0:Helper=Welcometotheinteractivehelpsystem.Belowyoufindatableofallavailable
top-levelcommands.Togetmoredetailedhelponaspecificcommand,justtype`help.<command>`.

Try`help.importCode`tobeginwith.
_______________________________________________________________________________________________________________________________________________________________command|description|example|=============================================================================================================================================================|annotations|Listannotations|annotations|callTree|Showcalltreeforthegivenmethod|callTree(methodfullname)|close|Closeprojectbyname|close(projectName)|declarations|Listdeclarations|declarations|distance|Showgrapheditdistancefromthesourcemethodtothecomparisonmethods|distance(sourcemethoditerator,comparisonmethoditerators)|exit|ExittheREPL||files|Listfiles|files|importAtom|Createnewprojectfromexistingatom|importAtom("app.atom")|importCode|Createnewprojectfromcode|importCode("example.jar")|imports|Listimports|imports|methods|Listmethods|methods('Methods',includeCalls=true,tree=true)|sensitive|Listsensitiveliterals|sensitive|showSimilar|Showmethodssimilartothegivenmethod|showSimilar(methodfullname)|summary|Displaysummaryinformation|summary|reachables|Showreachableflowsfromasourcetosink.Defaultsource:framework-inputandsink:framework-output|reachables|cryptos|Showreachableflowsfromasourcetosink.Defaultsource:crypto-algorithmandsink:crypto-generate|cryptos|Refer to the documentation site to learn more about the commands.Languages supportedC/C++ (Requires Java 21 or above)H (C/C++ Header files alone)Java (Requires compilation) - 8 to 17JarAndroid APK (Requires Android SDK. Set the environment variableANDROID_HOME)JavaScriptTypeScriptPythonPHP (Requires PHP >= 7.0. Supports PHP 5.2 to 8.3)TroubleshooingCommands throw errors in chennai consoleYou might see errors like this in chennai console.chennai>help--[E006]NotFoundError:-----------------------------------------------------1|help|^^^^|Notfound:help|-----------------------------------------------------------------------------|Explanation(enabledby`-explain`)|---------------------------------------|Theidentifierfor`help`isnotbound,thatis,|nodeclarationforthisidentifiercanbefound.|Thatcanhappen,forexample,if`help`oritsdeclarationhaseitherbeen|misspeltorifanimportismissing.-----------------------------------------------------------------------------1errorfoundThis error is mostly due to missing python .so (linux), .dll (windows) or .dylib (mac) file. Ensure the environment variables below are set correctly.SCALAPY_PYTHON_LIBRARY - Use values such as python3.10, python3.11 based on the version installed. On Windows, there are no dots. python311JAVA_TOOL_OPTIONS - jna.library.path must be set to the python lib directorySCALAPY_PYTHON_PROGRAMNAME - Path to Python executable in case of virtual environments (Usually not required)Origin of chenchen is a fork of the popularjoernproject. We deviate from the joern project in the following ways:Make code analysis accessible by adding first-class integration with Python and frameworks such as NetworkX and PyTorch.Enable broader hierarchical analysis (Application + Dependency + Container + OS layer)By creating a welcoming community more appropriate for beginner users with great enterprise support. We want to democratize code analysis.We don't intend for bug-to-bug compatibility and often rewrite patches to suit our needs. We also do not bring features and passes that do not add value for hierarchical analysis.LicenseApache-2.0Enterprise supportEnterprise support including custom language development and integration services is available via AppThreat Ltd. Free community support is also available viaDiscord.SponsorsYourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications.
YourKit is the creator ofYourKit Java Profiler,YourKit .NET Profiler, andYourKit YouMonitor.