Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu committed Jan 23, 2025
1 parent e0d554b commit addf2df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ A file called `openapi.generated.json` would be created with the endpoints infor
ATOM_TOOLS_OPENAPI_FILENAME=openapi.json atom usages --extract-endpoints -o app.atom --slice-outfile usages.json -l ruby .
```

Container-based invocation:

```shell
docker run --rm -v /tmp:/tmp -e ATOM_TOOLS_OPENAPI_FILENAME=openapi.json -v $(pwd):/app:rw -t ghcr.io/appthreat/atom atom usages --extract-endpoints -l ruby -o /app/app.atom -s /app/usages.slices.json /app
# podman run --rm -v /tmp:/tmp -e ATOM_TOOLS_OPENAPI_FILENAME=openapi.json -v $(pwd):/app:rw -t ghcr.io/appthreat/atom atom usages --extract-endpoints -l ruby -o /app/app.atom -s /app/usages.slices.json /app
```


### Export atom to graphml or dot format

It is possible to export each method along with data dependencies in an atom to graphml or dot format. Simply pass `--export` to enable this feature.
Expand Down
9 changes: 7 additions & 2 deletions src/main/scala/io/appthreat/atom/Atom.scala
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,14 @@ object Atom:
val openapiFileName =
sys.env.getOrElse("ATOM_TOOLS_OPENAPI_FILENAME", "openapi.generated.json")
val openapiFormat = sys.env.getOrElse("ATOM_TOOLS_OPENAPI_FORMAT", "openapi3.1.0")
val atomToolsWorkDir =
sys.env.getOrElse("ATOM_TOOLS_WORK_DIR", config.inputPath.parent.pathAsString)
println(s"atom-tools convert -i ${config.outputSliceFile} -t ${config.language} -f ${openapiFormat} -o ${config
.inputPath.pathAsString}${java.io.File.separator}${openapiFileName}")
val result = ExternalCommand.run(
s"atom-tools convert -i ${config.outputSliceFile} -t ${config.language} -f ${openapiFormat} -q -o ${config
s"atom-tools convert -i ${config.outputSliceFile} -t ${config.language} -f ${openapiFormat} -o ${config
.inputPath.pathAsString}${java.io.File.separator}${openapiFileName}",
"."
atomToolsWorkDir
)
result match
case Success(_) =>
Expand All @@ -378,6 +382,7 @@ object Atom:
println(
s"Failed to run atom-tools. Use the atom container image or perform 'pip install atom-tools' and re-run this command. Exception: ${exception.getMessage}"
)
end if
case _: ReachablesConfig =>
saveSlice(config.outputSliceFile, sliceCpg(ag).map(_.toJson))
case x: AtomParseDepsConfig =>
Expand Down

0 comments on commit addf2df

Please sign in to comment.