A series of scripts that demonstrate how to use the Radar API
All of the demos use the same config file. You should create a ~/.radarapi file using the following command (substitute in your API key). Note that the file is not encrypted, so we protect with UNIX permissions:
echo "b3d1115c-cce6-41e6-a0a6-f694b4701388" > ~/.radarapi
chmod 0600 ~/.radarapiA golang (Go) module that pretty prints to the console.
You can run the source script directly from go, for example:
go run main.goExample output:
Asset ID: 23132
Host: ubuntu16 (192.168.0.90)
OS: ubuntu 16.04 (4.4.0-272-tuxcare.els43-generic)
Radar version: 1.3.0-1
Last scan: Thu, 03 Apr 2025 11:41:14 BST
Vulns: C=11, H=36, M=32, L=4m
Asset ID: 23202
Host: debian11 (192.168.0.75)
OS: debian 11 (5.10.0-34-amd64)
Radar version: 1.4.0-beta1
Last scan: Wed, 02 Apr 2025 16:31:39 BST
Vulns: C=0, H=0, M=0, L=0m
You can compile and install your platform's binary (there are no dependencies) into $GOPATH/bin/ using:
go install github.com/sej7278/radar-api@latestA python 3 script that prints to the console.
There is a generic shebang in the file, so you should be able to make it executable and then run it like so:
chmod u+x radar_api.py
./radar_api.pyAlternatively run using a specific or OS default python interpreter:
python radar_api.pyExample output:
Asset ID: 23132
Host: ubuntu16 (192.168.0.90)
OS: ubuntu 16.04 (4.4.0-272-tuxcare.els43-generic)
Radar version: 1.3.0-1
Last scan: 2025-04-03T10:41:14Z
Asset ID: 23202
Host: debian11 (192.168.0.75)
OS: debian 11 (5.10.0-34-amd64)
Radar version: 1.4.0-beta1
Last scan: 2025-04-02T15:31:39Z
A shell script that uses curl and jq to output CSV data.
Run it using:
chmod u+x radar_api.sh
./radar_api.shExample output (could be redirected to a file):
Asset ID,Hostname,IP,OS,Last Analyzed,Risk Score,Critical,High,Medium
23132,ubuntu16,192.168.0.90,ubuntu,2025-05-06T11:03:44Z,56.0,11,36,32
23202,debian11,192.168.0.75,debian,2025-05-06T08:36:02Z,0.0,0,0,0