Fraunhofer-AISEC / cpg

A library to extract Code Property Graphs from C/C++, Java, Go, Python, Ruby and every other language through LLVM-IR.
https://fraunhofer-aisec.github.io/cpg/
Apache License 2.0
248 stars 60 forks source link

Export cpg graph #247

Closed peckto closed 6 months ago

peckto commented 3 years ago

At the moment, the cpg graph can only be used within the cpg library. (We have the cpg-vis-neo4j, but this is only feasible for small graphs) For compatibility reasons, it would be nice, to have the capability, to export/serialize the graph to a machine readable format. This allows a bulk import of the cpg to other tools/databases. When discussing the right format to use, we need to take the properties of the cpg into account. One standard format for graph representation is GraphML. But as far as I know, GraphML does not support edge properties. For this reason, I would suggest a csv based format, similar to the format accepted by the neo4j database: https://neo4j.com/docs/operations-manual/current/tutorial/import-tool/

I submit this issue to the cpg repo for now, because I do not know a better place.

This issue may depend on #246

oxisto commented 3 years ago

I would suggest a separate project for this or an extension of cpg-vis-neo4j, we want to keep this project solely as a library. The main reason for this is the difficult minefile of different licenses for different graph connectors. This project is and should stay as Apache 2.0.

peckto commented 3 years ago

I see your point with the license and the library. I'm still not sure, if the csv export should replace the cpg-vis-neo4j or if there should be something like cpg-vis-csv.

oxisto commented 3 years ago

https://github.com/anon767/cpg-to-dot

I just made a tool to extract the cpg into the Dot format. Maybe this helps.

Very interesting! BTW, i noted that you were using a quite old version of cpg (2.x). The current one is 3.1.0.

aifight commented 3 years ago

https://github.com/anon767/cpg-to-dot

I just made a tool to extract the cpg into the Dot format. Maybe this helps.

Great solution! But I noticed the link is not found, could you share it?

oxisto commented 2 years ago

Related to https://github.com/Fraunhofer-AISEC/cpg/issues/246

KuechA commented 6 months ago

Closed by #1215