Skip to main content

Overview

Output options control how scan4all saves and formats scan results. You can export data in multiple formats for further analysis, reporting, or integration with other tools.

Output Configuration

-o, -output
string
File path to write scan results.If not specified, results are only displayed on stdout. The output format depends on the format flags used (-json, -csv).Examples:
# Save results to text file
scan4all -host example.com -o results.txt

# Save with absolute path
scan4all -host example.com -o /path/to/scan_results.txt

# Save with timestamp
scan4all -host example.com -o scan_$(date +%Y%m%d_%H%M%S).txt
The output file is created or overwritten. Ensure you have write permissions for the specified path.
-json
boolean
default:"false"
Write output in JSON Lines format.Each line in the output file is a valid JSON object representing a discovered service or finding. This format is ideal for programmatic processing and integration with other tools.JSON Output Structure:
{"host":"example.com","ip":"93.184.216.34","port":80,"protocol":"tcp"}
{"host":"example.com","ip":"93.184.216.34","port":443,"protocol":"tcp"}
Examples:
# JSON output to file
scan4all -host example.com -o results.json -json

# JSON to stdout
scan4all -host example.com -json

# JSON for multiple hosts
scan4all -l targets.txt -o scan_results.json -json
JSON format is perfect for:
  • Parsing with jq or similar tools
  • Importing into databases
  • Integration with CI/CD pipelines
  • Automated analysis scripts
-csv
boolean
default:"false"
Write output in CSV (Comma-Separated Values) format.Results are formatted as CSV for easy import into spreadsheets, databases, or analysis tools.CSV Output Structure:
host,ip,port,protocol
example.com,93.184.216.34,80,tcp
example.com,93.184.216.34,443,tcp
Examples:
# CSV output to file
scan4all -host example.com -o results.csv -csv

# CSV for reporting
scan4all -l targets.txt -o report.csv -csv
CSV format is ideal for:
  • Excel or Google Sheets analysis
  • Database imports
  • Report generation
  • Data visualization tools

Output Formats

Text Format (Default)

When no format flag is specified, results are output in human-readable text format:
example.com:80
example.com:443
example.com:8080
Example:
scan4all -host example.com -o results.txt

JSON Lines Format

Structured data with one JSON object per line:
{"host":"example.com","ip":"93.184.216.34","port":80,"protocol":"tcp","service":"http"}
{"host":"example.com","ip":"93.184.216.34","port":443,"protocol":"tcp","service":"https"}
Example:
scan4all -host example.com -o results.json -json

CSV Format

Tabular data with headers:
host,ip,port,protocol,service
example.com,93.184.216.34,80,tcp,http
example.com,93.184.216.34,443,tcp,https
Example:
scan4all -host example.com -o results.csv -csv

Output Processing Examples

Processing JSON Output

# Scan and extract specific fields with jq
scan4all -host example.com -json | jq '.port'

# Filter results
scan4all -l targets.txt -o results.json -json
cat results.json | jq 'select(.port == 443)'

# Count open ports
cat results.json | jq -s 'length'

Processing CSV Output

# Import into sqlite
scan4all -l targets.txt -o results.csv -csv
sqlite3 scan.db ".import results.csv results"

# Filter with awk
cat results.csv | awk -F',' '$3 == 443 {print $1}'

Processing Text Output

# Extract unique hosts
scan4all -l targets.txt -o results.txt
cat results.txt | cut -d':' -f1 | sort -u

# Filter by port
cat results.txt | grep ':443$'

Combining with Other Options

Silent Output Mode

# Only save results, no console output
scan4all -host example.com -o results.txt -silent

Verbose with File Output

# Detailed console logs + file output
scan4all -host example.com -o results.json -json -v

Stream Mode Output

# Real-time streaming to file
scan4all -l large_targets.txt -o results.txt -stream

Output Locations

Current Directory

scan4all -host example.com -o results.txt

Absolute Path

scan4all -host example.com -o /var/log/scans/results.txt

Home Directory

scan4all -host example.com -o ~/scans/results.txt

Temporary Directory

scan4all -host example.com -o /tmp/scan_results.txt

Best Practices

  1. Always save results: Use -o for important scans to preserve findings
  2. Use descriptive names: Include target, date, or scan type in filenames
  3. Choose appropriate format:
    • Text for quick review
    • JSON for automation
    • CSV for reporting and analysis
  4. Organize outputs: Create directory structure for different scan types
  5. Archive results: Keep historical scan data for comparison
  6. Secure output files: Scan results may contain sensitive information
  7. Check disk space: Large scans can generate substantial output

Output Organization Example

# Create organized directory structure
mkdir -p scans/{web,infrastructure,reconnaissance}

# Web application scans
scan4all -host webapp.com -p 80,443,8080,8443 -o scans/web/webapp_$(date +%Y%m%d).json -json

# Infrastructure scans
scan4all -l servers.txt -tp 1000 -o scans/infrastructure/servers_$(date +%Y%m%d).csv -csv

# Reconnaissance
scan4all -l targets.txt -tp 100 -o scans/reconnaissance/recon_$(date +%Y%m%d).txt

Troubleshooting

No Output File Created

  • Check file path and permissions
  • Ensure parent directory exists
  • Verify disk space availability

Empty Output File

  • No open ports found
  • Scan failed or was interrupted
  • Check with -v or -debug flags

Incomplete Output

  • Scan was interrupted
  • Use -resume to continue
  • Check with -stats for progress

Format Issues

  • Verify format flag is specified (-json or -csv)
  • Check for proper command syntax
  • Ensure no conflicting flags

Build docs developers (and LLMs) love