# Threat Agent - Installation & Scanning

## Getting Ready to Scan

Before running a scan with Threat Agent you should create an API key and collect your Organization ID and Entity ID from your profile screen as shown below. These can be set as environment variables or passed directly as arguments to Threat Agent during a scan.&#x20;

<figure><img src="https://3093892275-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbsieSiu0D66DBFP4uh%2Fuploads%2FZzvdE9oLEOfVKhSW0vcA%2FSnag_2b33fb7.png?alt=media&#x26;token=fa134cc7-90ae-496e-b9c9-211379456a07" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3093892275-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbsieSiu0D66DBFP4uh%2Fuploads%2F8ZTR8Kv3BqTuEDuTQMFw%2FSnag_2b8da1a.png?alt=media&#x26;token=7231d8e1-e4cb-4a66-a0dc-eae342a98353" alt=""><figcaption></figcaption></figure>

## Threat Agent Deployment Types

Threat Agent can be deployed in two ways.&#x20;

1. **Download and install directly on host -** This requires that you have all your dependency managers  installed on you host as they will be required by Threatrix to perform a scan
2. **Docker Deployment -** If you're familiar with Docker and your deployment environment supports it, this is the easiest way to get up and running with our Threat Agent.&#x20;

## Host install and scanning

### 1. Download Threat Agent CLI

```
curl -LJO https://github.com/threatrix/threat-matrix/releases/download/agent-release-latest/threat-agent-latest.jar
```

### 2. Run Threat Agent CLI

```
java -jar threat-agent-latest.jar --oid={ORGID} --eid={ENTITYID} --api-key={AIPKEY} $PATH_TO_PROJECT
```

## Docker Scanning

```
sudo docker run --rm --name threatrix-threat-agent -v $(pwd):/app threatrix/threat-agent \
 --oid={ORGID} \
 --eid={ENTITYID} \
 --api-key={API_KEY} $PATH_TO_PROJECT
```

## Command line options

<table data-header-hidden><thead><tr><th width="203"></th><th width="130">Type</th><th width="118">Required</th><th></th></tr></thead><tbody><tr><td><strong>Argument/Flag</strong></td><td><strong>Type</strong></td><td></td><td><strong>Description</strong></td></tr><tr><td>--app-name</td><td>argument</td><td>Optional</td><td>Set or override the default project name</td></tr><tr><td>--api-key</td><td>argument</td><td>Required</td><td>API Key from your user profile</td></tr><tr><td>--api-url</td><td>argument</td><td>Optional</td><td>Threatrix API url (no need to change unless you have a self-hosted Threatrix server)</td></tr><tr><td>--oid</td><td>argument</td><td>Required</td><td>OrganizationID from user profile</td></tr><tr><td>--eid</td><td>argument</td><td>Required</td><td>EntityID from user profile</td></tr><tr><td>--scpId</td><td>argument</td><td>Optional</td><td>Existing AICertify or CodeCertify projectId</td></tr><tr><td>--repo-owner</td><td>argument</td><td>Optional</td><td>Repository Owner</td></tr><tr><td>--repo-name</td><td>argument</td><td>Optional</td><td>Repository Name</td></tr><tr><td>--branch</td><td>argument</td><td>Optional</td><td>Current Branch</td></tr><tr><td>--scm</td><td>argument</td><td>Optional</td><td><p>Indicates the sourced control management system</p><p> to which the build is attached. Possible options are</p><ul><li>GITHUB</li><li>GITLAB</li><li>BITBUCKET</li></ul></td></tr><tr><td>--scm-access-token</td><td>argument</td><td>Optional</td><td><p>The token required to create pull/merge request scan</p><p>reports.</p></td></tr><tr><td>--verbose</td><td>flag</td><td>Optional</td><td>Activate debugging</td></tr><tr><td>--progress</td><td>flag</td><td>Optional</td><td>Show progress during scan</td></tr></tbody></table>
