Skip to main content

Silent Push - Command Line Interface

Project description

SP - CLI

The Silent Push CLI (Command Line Interface)

Requirements

Installation

python3 -m pip install SilentPushCLI

Linux and MacOS users

After installed, export your Silent Push API key to your terminal:

export SILENT_PUSH_API_KEY=YOUR-API-KEY

Windows Users

After installed, export your Silent Push API key to your terminal:

setx /m SILENT_PUSH_API_KEY YOUR-API-KEY

Restart your CMD - Command Prompt

Usage

Syntax:

sp COMMAND [SUB-COMMAND...] IOC [PARAMETER=VALUE...] [OPTION...]

Use the help verbose command to get a detailed list of the available commands:

sp help -v

Use the help flag on any command to get more details:

sp padns query a --help

Examples:

sp score ig.com
sp enrich ig.com -es
sp bulk_enrich ig.com x.com ibm.com -es
sp padns query a ig.com limit=2 sort=last_seen/- -t

Supported commands and sub-commands so far

  • score
  • enrich
  • bulk_enrich
  • padns
    • query
      • any
      • anyipv4
      • anyipv6
      • a
      • aaaa
      • cname
      • mx
      • ns
      • ptr4
      • ptr6
      • soa
      • txt
    • answer
      • a
      • aaaa
      • cname
      • mx
      • mxhash
      • ns
      • nshash
      • ptr4
      • ptr6
      • soa
      • soahash
      • txt
      • txthash
  • spql (multiline commands)
    • feedsearch
    • websearch
  • threatcheck
  • bulk_threatcheck
  • load
  • unload

Options

  • all commands
    • -j, --json: JSON output (default)
    • -c, --csv: CSV output
    • -t, --tsv: TSV output
    • -h, --help: show help
    • -v, --verbose: verbosity output
  • enrich/bulk_enrich
    • -e, --explain: show details of data used to calculate the different scores in the response
    • -s, --scan_data: show details of data collected from host scanning

Interactive mode

We also have an interactive console, If you type 'sp' alone, it will enter the 'sp console' and you can type commands without preceding 'sp', example:

SP# score ig.com
{
  "domain": "ig.com",
  "sp_risk_score": 18,
  "sp_risk_score_explain": {
    "sp_risk_score_decider": "ns_reputation_score"
  }
}

SP# padns query a ig.com limit=1
{
  "records": [
    {
      "answer": "195.234.39.132",
      "count": 2681,
      "first_seen": "2021-04-17 03:47:18",
      "last_seen": "2024-08-16 12:11:22",
      "query": "ig.com",
      "type": "A"
    }
  ]
}

The load and unload command

This command gives you the ability of switching the console to a specific context and loading that group of commands. As an example, 'padns' contains various sub-commands, so you can do like:

SP# load padns
PADNS loaded
SP (PADNS)# query ns ig.com limit=1
{
  "records": [
    {
      "answer": "dns1.p09.nsone.net",
      "count": 5963,
      "first_seen": "2020-12-26 00:41:26",
      "last_seen": "2024-08-16 09:25:09",
      "nshash": "981275157feda43a53ff6d166de985ff",
      "query": "ig.com",
      "ttl": 172800,
      "type": "NS"
    }
  ]
}

SP (PADNS)# answer ns dns1.p09.nsone.net limit=1
{
  "records": [
    {
      "answer": "dns1.p09.nsone.net",
      "count": 138,
      "first_seen": "2024-01-27 21:23:33",
      "last_seen": "2024-08-16 13:42:25",
      "nshash": "9b484fe18c1a52f56775302e5be302f8",
      "query": "tumblersforyou.com",
      "ttl": 3600,
      "type": "NS"
    }
  ]
}

SP (PADNS)# unload padns
PADNS unloaded

You still can use any other command normally.

SPQL Commands

SPQL commands are multiline, since they can be quite complex. Use single quotes to span the query along the lines and use semicolon to finish it, example in interactive mode:

SP# websearch 'domain="ibm.com" 
  AND scan_date > "2025-01-01"' limit=2 -tv;
[
  {
    "HHV": "8c95d8a118b637509273f7a5d3",
    "adtech": {
      "ads_txt": false,
      "app_ads_txt": false,
      "sellers_json": false
    },
... (lots of results)

The same example but in a single line:

websearch 'domain="ibm.com" AND scan_date > "2025-01-01"' limit=2 -tv;

Scripting

run_pyscript command

There are 2 special commands for executing scripts using the 'sp' command, so you can easily use it in your projects, here's a simple python script example:

# my_script.py
result = app('score ibm.com -t')
print(result.data)

and this is how you can execute it:

sp run_pyscript my_script.py

run_script command

Also, you can create a file with batch commands one per line and easily execute them, let's suppose we have this file:

# my_script.txt
padns query mx ig.com limit=2
score ig.com -c 

and then you can execute this batch commands file with:

sp run_script my_script.txt

or you can simply redirect the input (like importing a database):

sp < my_script.txt

Batch execution tips

As you might know already, one of the greatest feature of shell scripting is the ability of loading batch parameters from files. Here's one idea for the bulk_enrich command:

cat to_enrich.txt | xargs sp bulk_enrich

Everything inside to_enrich.txt file will be treated as one parameter for the bulk_enrich command, don't mix domains with IPs though, since the command will depend on the type of enrichment being executed.

For Devs

Using the library

I you need to use the library on your own, here some examples:

from sp.main import main as sp

sp(['enrich ig.com'])
sp(['padns query ns ig.com limit=2'])

another way of doing the same

from sp.main import App
from sp.common.utils import AppFileManager

app = App(application_manager=AppFileManager('my app'))
app.onecmd_plus_hooks('enrich ig.com')
print(app.last_result)
app.onecmd_plus_hooks('padns query ns ig.com limit=2')
print(app.last_result)

Support

Don't hesitate to contact me at jorgeley@silentpush.com if you need any help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

silentpushcli-1.3.0.tar.gz (38.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

silentpushcli-1.3.0-py3-none-any.whl (42.0 kB view details)

Uploaded Python 3

File details

Details for the file silentpushcli-1.3.0.tar.gz.

File metadata

  • Download URL: silentpushcli-1.3.0.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for silentpushcli-1.3.0.tar.gz
Algorithm Hash digest
SHA256 3c29e178c6b0f1c9435285c4cf3cb4d2f65e4329618ba5a9fb75b4c966ea2068
MD5 038d817d766fbed94bbd552b075e61b8
BLAKE2b-256 7bd8d5d875074c1287cf1fa82d2a2f5bd4b76666e004178964865b4f559fcd93

See more details on using hashes here.

File details

Details for the file silentpushcli-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: silentpushcli-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 42.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for silentpushcli-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f51a59e80eb5e8c39281cef785bd719f021d064cd1ba77379063379e16c3ed57
MD5 cf648fc3386a2a46809cbe3c593d8da7
BLAKE2b-256 228b7e2f15175a3d345fdc1ede795955f9d0210738ecf1c5253f3cf7c5eaf2a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page