cpg-miner
A tool that is able to extract source code and various IRs from a given CPG and method name.
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 1 committers (100.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.5%) to scientific vocabulary
Repository
A tool that is able to extract source code and various IRs from a given CPG and method name.
Basic Info
- Host: GitHub
- Owner: DavidBakerEffendi
- Language: Scala
- Default Branch: main
- Size: 735 KB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 4
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
CPG Miner
A program that makes use of Joern take a CPG and some target procedure and extract the code as well as the sub-graphs of that procedure.
Getting Started
To build and launch (with a specific Log4j2 config)
sbt stage
./cpg_miner -Dlog4j.configurationFile=log4j2.xml
Usage
Generate a CPG using Joern, e.g. joern-parse <input_dir> -o <output_cpg>. Use this <output_cpg> as the input for
cpg-miner.
Alternatively, you can use ./cpg_miner from-code <input_dir> and it will generate a CPG for you to ingest. This will
be created at <input_dir>/cpg.bin.
```
Mines code snippets and sub-graphs from CPGs.
Usage: cpg_miner [from-graph|from-code] [options]
--help
-o, --output-dir
input-cpg The input cpg to mine from. Command: from-code input-dir
input-dir The input directory to generate a CPG from
```
Note: The <output-dir> is not cleaned before run, but existing results will be overwritten during successive runs.
Output
The structure of the output directory is as follows:
- <method_name>
| - ast.json # Serialized AST
| - cfg.json # Serialized CFG
| - code.<ext> # Code snippet, where <ext> is the language file suffix
| - ddg.json # Serialized DDG
| - pdg.json # Serialized PDG (DDG + CDG)
If there are more than 1 matches for the method, then it will be suffixed by _idx where idx is a counter.
Graph Schema
The JSON graphs follow the following schema.
Graph
json
{
"nodes": "<Node[]>",
"edges": "<Edge[]>"
}
Node
json
{
"id": "<number>",
"label": "<string>",
"name": "<string>",
"code": "<string>"
}
Edge
json
{
"src": "<number>",
"dst": "<number>",
"value": "<string>",
"label": "<string>"
}
Owner
- Name: David Baker Effendi
- Login: DavidBakerEffendi
- Kind: user
- Location: Stellenbosch
- Website: https://davidbakereffendi.github.io/
- Twitter: SDBakerEffendi
- Repositories: 3
- Profile: https://github.com/DavidBakerEffendi
PhD Candidate: Computer Science @ Stellenbosch University.
GitHub Events
Total
Last Year
Committers
Last synced: almost 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| David Baker Effendi | d****e@s****a | 5 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: over 1 year ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0