Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
suskind committed Feb 22, 2020
1 parent 7631d7b commit 907cff0
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 11 deletions.
82 changes: 81 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,82 @@
# jsfinder
Find relevant URLs and stuff in JS
Find paths or stuff in URL's JS files and XHR requests

```
Commands:
jsfinder jsfinder Parse JS files for paths and stuff. ex:
$ jsfinder -u https//example.com -o /tmp/out --insource
Options:
--version Show version number [boolean]
--url, -u URL to be parsed. ex: -u https://example.com [string]
--output, -o Output dir. ex: -o /tmp/out [string]
--header, -H Header [array]
--regexp, -r RegExp to Match (default: relative paths)
ex: --insource -r '(secret|pass).*' [string]
--logsufix, -s Log file sufix name.
ex: "-o /tmp/out -r pass -s secret" will create
/tmp/out/index_secret.md [string]
--browser Open chromium browser [boolean]
--ads Allow blacklisted ads related URLs [boolean]
--insource Search for paths in source [boolean]
--nocache Ignore previous cached requests [boolean]
--mobile, -m Emulate Mobile phone (iPhone X) [string]
--vscode Open output dir with VSCode.
ex: "-o /tmp/out --vscode" will exec "code /tmp/out" [boolean]
--noscroll Force to don't do autoscroll [boolean]
--help, -h Show help [boolean]
```

Examples:

* Load URL, JS and XHR assets

```
$ jsfinder -u https://example.com
```

* Load URL, JS and XHR assets, save them to `/tmp/out` and search for paths

```
$ jsfinder -u https://example.com -o /tmp/out --insource
```

* Load stuff ignoring cached files (requests are cached in `/tmp/jsfindercache` directory)

```
$ jsfinder -u https://example.com -o /tmp/out --insource --nocache
```

* Load and search "in sources" for the given regexp

```
$ jsfinder -u https://example.com -o /tmp/out --insource --nocache -r '(secret|pass).*' -s 'log_sufix'
```



## Output

```
$ jsfinder -u 'https://instagram.com' -o /tmp/testoutput --insource --vscode --nocache
No cache... will open URL....
document :: (200) text/html :: https://www.instagram.com/
script :: (200) text/javascript :: https://www.instagram.com/static/bundles/metro/Vendor.js/5a56d51ae30f.js
script :: (200) text/javascript :: https://www.instagram.com/static/bundles/metro/en_US.js/5ff6b8bc5f4a.js
script :: (200) text/javascript :: https://www.instagram.com/static/bundles/metro/ConsumerUICommons.js/7dbba70e0d07.js
script :: (200) text/javascript :: https://www.instagram.com/static/bundles/metro/ConsumerAsyncCommons.js/9a5d77a6330f.js
script :: (200) text/javascript :: https://www.instagram.com/static/bundles/metro/ConsumerLibCommons.js/613cb842a4b0.js
script :: (200) text/javascript :: https://www.instagram.com/static/bundles/metro/Consumer.js/f09a59b0a2dc.js
script :: (200) text/javascript :: https://www.instagram.com/static/bundles/metro/LandingPage.js/1b1f5d68432a.js
script :: (200) text/javascript :: https://www.instagram.com/static/bundles/metro/Polyfills.js/676f710a990a.js
xhr :: (200) application/json :: https://www.instagram.com/qp/batch_fetch_web/
xhr :: (200) application/json :: https://www.instagram.com/ajax/bz
Writing cache file...
Got 11 files...
Beautifying resources...
████████████████████████████████████████ 100% | ETA: 0s | 11/11
Done.
```

![VSCode](screens/jsfinder-vscode.png "VSCode")
Binary file added screens/jsfinder-vscode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,48 +27,48 @@ const {

let aURLs = [];

const argv = yargs.command('jsfinder', 'Parse JS files for URLs and stuff', {
const argv = yargs.command('jsfinder', 'Parse JS files for paths and stuff. ex:\n$ jsfinder -u https//example.com -o /tmp/out --insource ', {
}).option('url', {
description: 'URL to be parsed',
description: 'URL to be parsed. ex: -u https://example.com ',
alias: 'u',
type: 'string',
}).option('output', {
description: 'Output dir',
description: 'Output dir. ex: -o /tmp/out ',
alias: 'o',
type: 'string',
}).option('header', {
description: 'Header',
alias: 'H',
type: 'array',
}).option('regexp', {
description: 'RegExp to Match (default: relative paths)',
description: 'RegExp to Match (default: relative paths)\nex: --insource -r \'(secret|pass).*\'',
alias: 'r',
type: 'string',
}).option('logsufix', {
description: 'Log file sufix name',
description: 'Log file sufix name.\nex: "-o /tmp/out -r pass -s secret" will create /tmp/out/index_secret.md',
alias: 's',
type: 'string',
}).option('browser', {
description: 'Open browser',
description: 'Open chromium browser',
type: 'boolean',
}).option('ads', {
description: 'Allow blacklisted ads related URLs',
type: 'boolean',
}).option('insource', {
description: 'Search for URLs in source',
description: 'Search for paths in source',
type: 'boolean',
}).option('nocache', {
description: 'Ingore cache when it already exists',
description: 'Ignore previous cached requests',
type: 'boolean',
}).option('mobile', {
description: 'Emulate Mobile phone (iPhone X)',
type: 'string',
alias: 'm',
}).option('vscode', {
description: 'Open output dir with VSCode',
description: 'Open output dir with VSCode.\nex: "-o /tmp/out --vscode" will exec "code /tmp/out"',
type: 'boolean',
}).option('noscroll', {
description: 'Dont do autoscroll',
description: 'Force to don\'t do autoscroll',
type: 'boolean',
}).help().alias('help', 'h').argv;

Expand Down

0 comments on commit 907cff0

Please sign in to comment.