Description
Windows users wishing to install the HawkScan CLI may do so conveniently with either:
Option 1: Windows MSI Installer (Beta)
Option 2: Manual ZIP File Installation
the StackHawk CLI ZIP file download
Procedure -- MSI Installer
Simply follow the instructions in Install with MSI (Windows) (BETA).
This is the preferred method for installation where possible.
Procedure -- ZIP File Installation
Requirements
The overall requirements to run HawkScan on Windows are:
A full OpenJDK environment is installed (a JRE only is insufficient)
The Windows
Path
Environment Variable contains:the directory of the
java
program associated with the JDKthe directory containing HawkScan (
talon-bootstrap-x.x.x.jar
)
The Windows
JAVA_HOME
Environment Variable is present and contains:the directory of the
java
program associated with the JDK
Phase 1: Install Java
Install an OpenJDK
Examples:
Install Microsoft JDK (Microsoft JDK 17)
Install OpenJDK on Windows (Redhat JDK 11)
Ensure that the JDK's directory is present in the Windows Path variable
Powershell:
echo $env:PATH
Windows GUI: Settings-->Edit Environment Variables-->Select System or User-->Path
Create a System Environment variable, JAVA_HOME, containing the same path to java as is populated in
$env:PATH
Examples:
Powershell (after Microsoft JDK 17 install):
PS C:\Users\Dan\hawk-2.7.0> echo $env:PATH
C:\Program Files\Microsoft\jdk-17.0.4.101-hotspot\bin; [...]
GUI (after Microsoft JDK 17 install):
(In the above case, C:\Program Files\Microsoft\jdk-17.0.4.101-hotspot\bin
was already in the path as a result of the JDK installation; if it's absent, it can be added via the 'New' button)
Phase 2: Install and run HawkScan
obtain the latest version of the HawkScan CLI ZIP file
unzip the cli zip file in your preferred directory
for instance:
C:'Users\Dan\hawk-2.7.0
create a .hawk directory under the associated user’s home directory (local scan logs will be stored here)
Powershell example:
mkdir ~/.hawk
set HawkScan into the
PATH
variable:Windows GUI:
Settings-->Edit Environment Variables-->Select System or User-->Path-->Add hawk directory to Path (e.g.,
C:\Users\Dan\hawk-2.7.0
)
Powershell:
$env:PATH="C:\Users\Dan\hawk-2.7.0; $Env:PATH"
ensure that the OpenJDK is in the path; set it if not
Example:
$env:PATH="C:\Program Files\Java\jdk-18.0.1.1\bin;$Env:PATH"
create a System-level
JAVA_HOME
variable containing the OpenJDK path(exit and re-launch Powershell after setting all PATH entries)
run the appropriate
hawk
in Powershell (hawk commands run from thehawk.ps1
script). For example:
Notes:
Options syntax in Powershell follows the CLI Command Options syntax.
For instance, to turn on debug:
hawk scan --debug
Additional Information
Another Option for Running the CLI on Windows is to enable WSL and install Ubuntu (or another linux distro), then install the CLI on that linux distro.
See How to run the HawkScan CLI on Ubuntu for details