Common testssl.sh Command-Line Options and Flags: A Complete Guide
testssl.sh processes over 100 command-line switches through its parse_cmd_line function around line 9,300, using boolean do_* variables to gate specific test blocks executed by lets_roll and various run_* functions.
testssl.sh is a single-file Bash utility developed by drwetter/testssl.sh that provides comprehensive SSL/TLS security testing through an extensive command-line interface. Understanding the available testssl.sh command-line options allows security professionals to customize scans for specific protocols, output formats, and vulnerability checks while controlling network behavior and performance characteristics.
Core testssl.sh Command-Line Architecture
The script's argument processing centers on the parse_cmd_line function located near line 9,300 in testssl.sh. This function populates boolean variables prefixed with do_* that gate individual test blocks through a large case statement around line 25,000. The lets_roll function subsequently executes enabled tests by calling specific run_* functions such as run_protocols(), run_cipherlists(), and run_heartbleed().
Target Specification and Network Options
Basic Invocation Methods
- Single target scan:
testssl.sh <URI> - Mass testing from file:
testssl.sh --file <FILE>
IP Version and Proxy Configuration
- Force IPv4 or IPv6: Use
-4or-6to restrict the connection protocol - Custom IP resolution:
--ip <addr|one|proxy>resolves a specific IP address or interaction method - HTTP proxy routing:
--proxy <host:port>routes all checks through the specified proxy - Native OpenSSL only:
--ssl-nativeforces OpenSSL client usage and disables socket fallback
Output Control and Reporting Formats
Structured Data Export
- JSON output:
--jsonor--json-prettyfor machine-readable results - CSV export:
--csvor--csvfile <directory>for spreadsheet compatibility - HTML reports:
--htmlfor standalone documentation - Combined formats:
-oA <name>generates all formats, while-oa <name>creates log and CSV only
Display and Logging Tuning
- Suppress banner:
-qor--quiethides the startup header - Wide output:
--wideenables full-column display - Color schemes:
--color <0|1|2|3>controls colorization;--colorblindadjusts for accessibility - Log files:
--logor--logfile <file>writes raw output to disk - Output prefixing:
--outprefix <prefix>prepends a string to all output filenames
Scanning Scope and Test Categories
Protocol and Cipher Analysis
- Protocol versions:
-por--protocolstests SSLv2 through TLSv1.3 - Standard cipher groups:
-sor--stdor--categoriesruns predefined cipher list checks - Forward secrecy:
-for--fsfocuses on PFS-capable cipher suites - Server preferences:
-Por--server-preferenceevaluates the server's cipher ordering - Server defaults:
-Sor--server_defaultsanalyzes negotiated parameters - HTTP headers:
-hor--headerchecks security-related HTTP headers - Client simulation:
-cor--client-simulationemulates specific browser SSL/TLS behavior - Grease tests:
-gor--greasesends invalid values to test robustness
Exhaustive Cipher Testing
- Individual ciphers:
-eor--each-ciphertests every cipher separately (computationally expensive) - Per-protocol ciphers:
-Eor--cipher-per-protogroups cipher tests by protocol version
STARTTLS Support
The -t <protocol> or --starttls <protocol> flag enables testing of protocols that upgrade plain connections to TLS, supporting smtp, ftp, pop3, imap, xmpp, ldap, nntp, mysql, postgres, and irc.
Vulnerability Detection Flags
Individual CVE checks can be run with specific switches:
- Heartbleed:
-Hor--heartbleed - CCS Injection:
-Ior--ccs - Ticketbleed:
--ticketbleed - ROBOT:
--robot - Renegotiation:
--renegotiation - CRIME:
-Cor--crime - BREACH:
-Bor--breach - POODLE:
-Oor--poodle - TLS Fallback:
-Zor--tls-fallback - Sweet32:
-Wor--sweet32 - FREAK:
-For--freak - DROWN:
-Dor--drown - Logjam:
-Jor--logjam - BEAST:
-Aor--beast - Lucky13:
-Lor--lucky13 - RC4:
--rc4 - Winshock:
--winshock
Run all vulnerability checks simultaneously with -U or --vulnerable.
Advanced Tuning and Debugging
Performance and Timeout Controls
- Custom OpenSSL binary:
--openssl <path>overrides the bundled or system OpenSSL - OpenSSL timeout:
--openssl-timeout <sec>sets the OpenSSL connection timeout - Socket timeout:
--socket-timeout <sec>controls native socket timeouts
Authentication and Request Modification
- HTTP Basic Auth:
--basicauth <user:pass>supplies credentials for protected endpoints - Custom headers:
--reqheader <Header: value>injects arbitrary HTTP headers - Mutual TLS:
--mtls <pem>provides client certificates for authentication - Additional CA bundles:
--add-ca <ca-file>extends the trusted certificate chain
Rating and Debugging Options
- Rating calculation only:
--rating-onlyruns only the grading logic without full tests - Disable rating:
--disable-ratingsuppresses the final grade output - Severity filtering:
--severity <LEVEL>filters findings by severity (low, medium, high, critical) - Debug verbosity:
--debug <0-6>enables increasing levels of diagnostic output - Hints display:
--hintsshows additional remediation guidance
Practical testssl.sh Usage Examples
Default comprehensive scan against a single target:
testssl.sh https://example.com
Protocol and cipher order scanning with structured output:
testssl.sh -p -P --json --html https://example.com
STARTTLS SMTP scan with IPv4 forcing and suppressed banner:
testssl.sh -4 -t smtp --ssl-native --quiet smtp.mail.example.com:25
Mass testing with CSV and log output to a directory:
testssl.sh --file hosts.txt --log --csvfile results/
Specific vulnerability check with socket timeout:
testssl.sh --heartbleed --socket-timeout 5 example.org
Custom OpenSSL binary with accessibility features:
testssl.sh --openssl /opt/openssl-3.2/bin/openssl --wide --colorblind https://secure.example.net
Summary
- testssl.sh command-line options are parsed by the
parse_cmd_linefunction intestssl.sh, which sets booleando_*variables to enable specific test blocks executed bylets_rollandrun_*functions - Network configuration includes IPv4/IPv6 forcing (
-4,-6), HTTP proxy support (--proxy), and custom IP resolution (--ip) - Output formats encompass JSON (
--json), CSV (--csv), HTML (--html), and combined logging (-oA) for comprehensive documentation - Scanning scope is controlled via protocol checks (
-p), cipher tests (-s,-e), server preference analysis (-P), and STARTTLS support (-t) - Individual vulnerability tests can be targeted with flags like
--heartbleed,--robot, and--logjam, or run collectively with--vulnerable - Advanced tuning allows custom OpenSSL binaries (
--openssl), timeout configuration, HTTP basic authentication, and mutual TLS client certificates
Frequently Asked Questions
How does testssl.sh handle command-line parsing internally?
According to the drwetter/testssl.sh source code, the parse_cmd_line function around line 9,300 processes arguments using a large case statement near line 25,000. It populates boolean variables prefixed with do_* that determine which tests execute when lets_roll calls the corresponding run_* functions such as run_protocols() or run_heartbleed().
What is the difference between the -oA and -oa output options?
The -oA <name> switch generates output in all supported formats including JSON, CSV, HTML, and log files, while -oa <name> creates only log and CSV files for lighter documentation. Both options automatically handle file naming by appending appropriate extensions to the specified prefix.
Can I use testssl.sh to test STARTTLS protocols like SMTP and IMAP?
Yes, use the -t <protocol> or --starttls <protocol> flag followed by the protocol name such as smtp, imap, pop3, ftp, xmpp, or ldap. This instructs testssl.sh to establish a plaintext connection first, then issue the STARTTLS command before beginning the SSL/TLS test sequence against the upgraded connection.
Where are the OpenSSL binaries stored in the testssl.sh repository?
The repository includes pre-compiled OpenSSL binaries in bin/openssl.* for Linux, macOS, and FreeBSD platforms. The script references these when the system OpenSSL lacks required features for specific tests, or you can specify a custom binary path using the --openssl <path> option.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →