Description
Ubuntu users wishing to install the HawkScan CLI may do so conveniently with a combination of:
apt
the CLI ZIP file download
Procedure (Ubuntu)
The procedure below uses apt to install openjdk; various other methods could be used as well, so long as the end results are:
A full openjdk is installed (a JRE only is insufficient)
java -version
returns the installed openjdkjava
itself is in$PATH
hawk
is in$PATH
--
Steps:
update apt:
sudo apt update && sudo apt upgrade -y
locate available openjdk versions:
apt-cache search openjdk
install latest openjdk version (e.g., 17):
sudo apt-get install openjdk-17-jdk -y
this will also add the openjdk to $PATH automatically
sudo apt get install unzip
(if unzip isn't installed)Install the ZIP file (2.6.0 example below; the zip file and directory name will change over time)
curl -v https://download.stackhawk.com/hawk/cli/hawk-2.6.0.zip -o hawk-2.6.0.zip
unzip hawk-2.6.0.zip
Add hawk to
$PATH
:echo "export PATH=$HOME/hawk-2.6.0:$PATH" >> ~/.bash_profile
source ~/.bash_profile
Confirm that the hawk dir and java dir are in the
echo $PATH
outputRun
hawk version
β should output a version (e.g.,v2.6.0
)Run
hawk init
Add API KEY
--
Example command outputs when all elements are in place:
dan@DESKTOP:~$ java -version
openjdk version "17.0.4" 2022-07-19
OpenJDK Runtime Environment (build 17.0.4+8-Ubuntu-120.04)
OpenJDK 64-Bit Server VM (build 17.0.4+8-Ubuntu-120.04, mixed mode, sharing)
dan@DESKTOP:~$ which java
/bin/java
dan@DESKTOP:~$ echo $PATH
/home/dan/hawk-2.6.0:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
dan@DESKTOP:~$ hawk version
v2.6.0
Notes:
On Ubuntu, $PATH management may vary depending on the presence or absence of .profile, .bash_profile, and .bashrc.
Procedure (Ubuntu on WSL on Windows)
Simply pre-pend the above procedure with the following step:
Other Windows notes:
If scanning a local application, Windows Firewall may intercept you when you first run
hawk scan
and require you to allow java to access the host endpointWhen manipulating configuration files, note that the underlying Windows filesystem may be accessible via the
/mnt
filesystem, allowing you to pull Windows files into the linux directories you're scanning fromfor instance, you could copy yml files from your Documents folder into your Ubuntu user's home dir:
cp /mnt/c/Users/Dan/Documents/stackhawk.yml ~