|
1 | 1 | # saferwall-cli |
2 | 2 |
|
3 | | -A CLI tool to interact with Saferwall.com to download samples, scan or re-scan new samples. |
| 3 | +A CLI tool to interact with Saferwall.com to scan, rescan and download malware samples. |
4 | 4 |
|
5 | 5 | ## Install |
6 | 6 |
|
7 | 7 | You can either download pre-built binaries or build the tool yourself. |
8 | 8 |
|
9 | 9 | ```sh |
10 | | -go install github.com/saferwall/cli |
| 10 | +go install github.com/saferwall/cli@latest |
11 | 11 | ``` |
12 | 12 |
|
| 13 | +## Getting Started |
13 | 14 |
|
14 | | -## Usage |
15 | | - |
16 | | -To use the CLI tool you need a [Saferwall](https://saferwall.com) account in order to authenticate yourself. |
17 | | - |
18 | | -Use the `config.example.toml` as a reference to reference your credendials. The file should be located in: |
19 | | -``~/.config/saferwall/config.toml`: |
20 | | - |
21 | | -```toml |
22 | | -[credentials] |
23 | | -# The URL used to interact with saferwall APIs. |
24 | | -url = "https://api.saferwall.com" |
25 | | -# The user name you choose when you sign-up for saferwall.com. |
26 | | -username = "YourUsername" |
27 | | -# The password you choose when you sign-up for saferwall.com. |
28 | | -password = "YourPassword" |
29 | | -``` |
30 | | - |
31 | | -The CLI app can also be used to interfact with a self-hosted deployment. |
| 15 | +To use the CLI you need a [Saferwall](https://saferwall.com) account. Run the `init` command to interactively set up your credentials: |
32 | 16 |
|
33 | 17 | ```sh |
34 | | -saferwall-cli - Saferwall command line tool |
| 18 | +saferwall-cli init |
| 19 | +``` |
35 | 20 |
|
36 | | - ███████╗ █████╗ ███████╗███████╗██████╗ ██╗ ██╗ █████╗ ██╗ ██╗ ██████╗██╗ ██╗ |
37 | | - ██╔════╝██╔══██╗██╔════╝██╔════╝██╔══██╗██║ ██║██╔══██╗██║ ██║ ██╔════╝██║ ██║ |
38 | | - ███████╗███████║█████╗ █████╗ ██████╔╝██║ █╗ ██║███████║██║ ██║ ██║ ██║ ██║ |
39 | | - ╚════██║██╔══██║██╔══╝ ██╔══╝ ██╔══██╗██║███╗██║██╔══██║██║ ██║ ██║ ██║ ██║ |
40 | | - ███████║██║ ██║██║ ███████╗██║ ██║╚███╔███╔╝██║ ██║███████╗███████╗ ╚██████╗███████╗██║ |
41 | | - ╚══════╝╚═╝ ╚═╝╚═╝ ╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝╚══════╝╚═╝ |
| 21 | +This launches an interactive prompt that asks for: |
| 22 | +- **URL** — the Saferwall API endpoint (defaults to `https://api.saferwall.com`) |
| 23 | +- **Username** — your Saferwall account username |
| 24 | +- **Password** — your Saferwall account password |
42 | 25 |
|
| 26 | +The credentials are saved to `~/.config/saferwall/config.toml`. To reconfigure, delete that file and run `init` again. |
43 | 27 |
|
44 | | -saferwall-cli allows you to interact with the saferwall API. You can |
45 | | -upload, scan samples from your drive, or download samples. |
46 | | -For more details see the github repo at https://github.com/saferwall |
| 28 | +The CLI can also be used with a self-hosted Saferwall deployment by providing your own API URL during init. |
47 | 29 |
|
48 | | -Usage: |
49 | | - saferwall-cli [flags] |
50 | | - saferwall-cli [command] |
| 30 | +## Usage |
51 | 31 |
|
| 32 | +``` |
52 | 33 | Available Commands: |
53 | | - completion Generate the autocompletion script for the specified shell |
54 | | - delete Delete a sample(s) given its SHA256 hash. |
55 | | - download Download a sample(s) or a behavior report |
56 | | - help Help about any command |
57 | | - list List users or files. |
58 | | - rescan Rescan an exiting file using its hash |
59 | | - scan Submit a scan request of a file using its hash |
60 | | - souk Populate malware-souk database. |
61 | | - upload Upload samples directly to object storage. |
| 34 | + init Configure saferwall CLI credentials |
| 35 | + scan Upload and scan files |
| 36 | + rescan Rescan an existing file using its hash |
| 37 | + download Download a sample (and its artifacts) |
| 38 | + souk Populate malware-souk database |
62 | 39 | version Version number |
| 40 | +``` |
| 41 | + |
| 42 | +### Scan |
| 43 | + |
| 44 | +Upload and scan files. Supports scanning a single file or an entire directory. |
63 | 45 |
|
64 | | -Flags: |
65 | | - -h, --help help for saferwall-cli |
| 46 | +```sh |
| 47 | +saferwall-cli scan -p /path/to/sample |
66 | 48 | ``` |
67 | 49 |
|
68 | | -### Download |
| 50 | +### Rescan |
69 | 51 |
|
70 | | -You can download files using their SHA256 hash and specify an output folder, you can also download a batch of samples by copying their SHA256 hash to the clipboard. |
| 52 | +Rescan an existing file by its SHA256 hash, or rescan a batch of hashes from a text file. |
71 | 53 |
|
72 | 54 | ```sh |
73 | | -cli download --hash 0001cb47c8277e44a09543291d95559886b9c2da195bd78fdf108775ac91ac53 |
| 55 | +saferwall-cli rescan <sha256> |
74 | 56 | ``` |
75 | 57 |
|
76 | | -### Scan |
| 58 | +### Download |
77 | 59 |
|
78 | | -You can scan or rescan files using the scan command. |
| 60 | +Download files by their SHA256 hash. You can also download a batch of samples from a text file. |
79 | 61 |
|
80 | 62 | ```sh |
81 | | -cli scan -p /samples/0001cb47c8277e44a09543291d95559886b9c2da195bd78fdf108775ac91ac53 |
| 63 | +saferwall-cli download --hash <sha256> |
82 | 64 | ``` |
0 commit comments