Skip to main content
Version: 1.1.3-alpha.1

Strings command

The strings command is used to extract strings, URLs, and secrets from a directory of JavaScript files. This is useful for identifying sensitive information and potential API endpoints.

Usage

js-recon strings -d <directory> [options]

Options

OptionAliasDescriptionDefaultRequired
--directory <directory>-dDirectory containing JS files.Yes
--output <file>-oJSON file to save the extracted strings.strings.jsonNo
--extract-urls-eExtract URLs from the strings.falseNo
--extracted-url-path <file>Output file for extracted URLs and paths (without extension).extracted_urlsNo
--permutate-pPermutate the URLs and paths found.falseNo
--openapiGenerate an OpenAPI specification from the paths found.falseNo
--scan-secrets-sScan for secrets within the strings.falseNo

Examples

Basic usage

Extract all strings from a directory of JS files and save them to strings.json:

js-recon strings -d /path/to/js-files

Extract URLs

Extract strings and also identify and save any URLs found within them:

js-recon strings -d /path/to/js-files -e

This will write a new file called extracted_urls.json along with the default strings.json

Scan for secrets

Extract strings and scan for any potential secrets or sensitive information:

js-recon strings -d /path/to/js-files -s

This will print all the potential finds on the terminal window.

Please note that this process could be memory and compute intensive, and can take longer to run.

Generate OpenAPI specification

Extract URLs and paths, and then generate an OpenAPI specification:

js-recon strings -d /path/to/js-files -e --openapi

This will generate the default strings.json, the extracted_urls.json file with URLs and paths in simple JSON format, and the extracted_urls-openapi.json file. The extracted_urls-openapi.json can be imported into API clients like Postman, Bruno, etc.

Permutate URLs and Paths

The --permutate (-p) flag generates new potential endpoints by combining the base of found URLs with all discovered paths. This requires the -e flag to be active.

For example, if the tool finds the URL https://api.example.com/v1/users and the path /v2/orders, it will generate https://api.example.com/v2/orders.

js-recon strings -d /path/to/js-files -e -p

The permuted URLs will be saved to extracted_urls.txt along with strings.json and extracted_urls.json