Security Scanner CLI Tool
A Command Line Interface (CLI) tool for scanning and analyzing mobile APK files, Docker images and code repository for security vulnerabilities using various security tools.
Table of Contents
Features
-
Mobile App Analysis: Scan APK files using MobSF for comprehensive mobile app security assessment.
-
Docker Image Scanning: Analyze Docker images for vulnerabilities using Trivy.
-
Code Repository Analysis:
- Use Bandit for Python code security checks.
- Custom shell escape vulnerability detection for Python, JavaScript, and Bash files.
-
Rich CLI Output: Enhanced readability with colored and formatted output using the Rich library.
-
Jira Integration: Create Jira tickets based on scan results for streamlined workflow integration.
Prerequisites
- Python 3.12+
- Docker (for MobSF and Trivy functionality)
- Git (for repository scanning features)
Installation
| :exclamation: Note: Make sure you have Docker installed and running. |
|---|
Install from Source Code
-
Clone the repository:
git clone https://github.com/briskdust/ingy-cli.git cd ingy-cli
-
Install the required Python packages:
poetry install -
Run the CLI tool:
python -m ingysec.ingy
Install using Pip
-
Install the tool from PyPI:
pip install ingysec
-
Run the CLI tool:
ingysec
Usage
This CLI tool supports multiple commands grouped under mobile, docker, and code.
Mobile Commands
Scan and analyze APK files for security vulnerabilities using MobSF.
Initialization
This command will initialize the MobSF docker container and run it on port 8000. It will also provide the API key for the MobSF server.
ingysec mobile mobsf_init
Configuration
Set the MOBSF_APIKEY environment variable with your MobSF API key:
export MOBSF_APIKEY=your_mobsf_api_key
Scan APK Files
ingysec mobile mobsf --apikey YOUR_API_KEY --pdf output.pdf path/to/file1.apk path/to/file2.apk
--apikey: API key for MobSF authentication. Or set theMOBSF_APIKEYenvironment variable.--pdf: Optional. If specified, generates a PDF report, otherwise the results will be displayed in terminal as a table.
Docker Commands
Run Trivy scan for a Docker image.
Installation
This command will install Trivy on your system. Only run it once, and it only works on Linux(Debian/Ubuntu) systems.
ingysec docker trivy_install
Scan Docker Images
ingysec docker trivy --name IMAGE_NAME --html template.html
--name: Name or ID of the Docker image to scan.--html: Optional. Path to an HTML template file for generating the report. If not present, the results will be displayed in the terminal as a table.
Code Commands
Run code inspection and scanning commands to detect security vulnerabilities in Python code.
Bandit
Run Bandit to check Python code for security vulnerabilities.
ingysec code bandit
Prompts the user to enter the path to the Python code. Recursively scans all Python files in the specified path using the Bandit configuration file bandit.yaml. Sets the severity level to high (-ll) and reports all discovered security issues.
Shell Escape
Scan code for potential shell escape vulnerabilities.
ingysec code shell-escape REPONAME --seckey PATH
The user needs to enter the path to the repository which can also be the URL of a remote repository and utilize the
--seckey flag to specify the path to the SSH private key for cloning the repository. Supports shell expansion, such as ~ to the full home directory path and verifies that the provided path is a directory.
Jira Commands
Create a new Jira ticket based on scan results or manual input:
ingysec ticket create_ticket \
--server https://your-domain.atlassian.net \
--email your-email@example.com \
--api_token your-api-token \
--project PROJ \
--summary "Security Issue Found" \
--description "Description of the security issue" \
--issuetype Bug \
--priority High \
--assignee username
You can also set environment variables for Jira credentials:
export JIRA_SERVER=https://your-domain.atlassian.net
export JIRA_EMAIL=your-email@example.com
export JIRA_API_TOKEN=your-api-token
Then run the command without these options:
ingysec ticket create_ticket \
--project PROJ \
--summary "Security Issue Found" \
--description "Description of the security issue" \
--issuetype Bug \
--priority High \
--assignee username
The tool will prompt for any missing required information.
Extending the Tool
Adding New Commands
To implement a new command, create a new command group in ingysec/ingy.py:
@main.group()
def example_command():
"""This is an example command group."""
pass
Then, add a new command to the group:
@example_command.command()
def new_command():
"""This is a new command."""
pass
Adding New Functions
For the purpose of maintainability and clean code, add new functions to the utils.py file.
Extending shell_escape_finder.py
To extend the script to support more languages, you need to update two main components:
- File Extensions: Add the file extensions of the new languages to the
FILE_EXTENSIONSlist. - Patterns: Add regex patterns to identify potential shell escape vulnerabilities in the
PATTERNSdictionary.
Metadata
Release files for ingysec 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ingysec-0.5.0.tar.gz | 12.7 kB | Without provenance | Details for ingysec-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ingysec-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for ingysec-0.5.0-py3-none-any.whl |
Total release size: 25.7 kB
Release files / ingysec-0.5.0.tar.gz
| Download URL | ingysec-0.5.0.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8098676a4bd4263e58440665eb7a2414c5b33df3a263db4a61f29e5b66204c34
|
|
BLAKE2b-256 checksum How to use checksums |
89ce0185d96d86c44e00e0f8f0ab6ce57920d1097daa457b407b26a42ca4a3c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|
Release files / ingysec-0.5.0-py3-none-any.whl
| Download URL | ingysec-0.5.0-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9434e5877bd67eb1e443903af7dca4bbed7ca8729bb2cc6ed4c277aa60b19585
|
|
BLAKE2b-256 checksum How to use checksums |
3d70c5f0f1e1d42e59bd56adf16d8957b4205ed687c55d74ca8e07dff309b55f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|
Security for ingysec 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.