Metadata-Version: 2.1
Name: JSFinder2
Version: 0.2
Summary: JSFinder2 can be used to find urls and subdomains in JS files.
Author: Richard Schwabe
Maintainer-email: Richard Schwabe <hello@richardschwabe.de>
License: MIT License
        
        Copyright (c) 2023 Richard Schwabe
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/richardschwabe/JSFinder2/blob/main/README.md
Project-URL: Documentation, https://github.com/richardschwabe/JSFinder2/blob/main/README.md
Project-URL: Bug Tracker, https://github.com/richardschwabe/JSFinder2/issues
Project-URL: Source, https://github.com/richardschwabe/JSFinder2
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: anyio ==4.0.0
Requires-Dist: beautifulsoup4 ==4.12.2
Requires-Dist: certifi ==2023.7.22
Requires-Dist: charset-normalizer ==3.2.0
Requires-Dist: filelock ==3.12.4
Requires-Dist: h11 ==0.14.0
Requires-Dist: httpcore ==0.18.0
Requires-Dist: httpx ==0.25.0
Requires-Dist: idna ==3.4
Requires-Dist: requests ==2.31.0
Requires-Dist: requests-file ==1.5.1
Requires-Dist: six ==1.16.0
Requires-Dist: sniffio ==1.3.0
Requires-Dist: soupsieve ==2.5
Requires-Dist: tldextract ==3.5.0
Requires-Dist: urllib3 ==2.0.4

<div align="center">
    <h1>JSFinder2</h1>
    <p>Find subdomains and urls in js files</p>

![GitLab last commit](https://img.shields.io/gitlab/last-commit/richardschwabe/JSFinder2)
![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white)

</div>

<h1>Table of Contents</h1>

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)
  - [Deep check of url](#deep-check-of-url)
  - [Check urls from file](#check-urls-from-file)
  - [Custom User-Agent and Cookies](#custom-user-agent-and-cookies)
  - [Verbose output](#verbose-output)
  - [Results location](#results-location)
- [Todo](#todo)
- [License](#license)
- [Contributing](#contributing)

# Introduction

Rewrite & loosely based on [JSFinder](https://github.com/Threezh1/JSFinder/blob/master/JSFinder.py).

This allows bug bounty hunters to find references, that you might not otherwise find in SSL cert scraping or similar.

Allows to recursively check for subdomains & urls in JS files. i.e.

Open `a.js` finds references to `hub.foo.bar`, opens `hub.foo.bar` and finds `b.js`, checks `b.js` and finds `zoo.foo.bar`, goes to `zoo.foo.bar` etc...

Should be used together with other tools in automation. Though be aware, there might be a lot of false positives URLs. The tool uses regex, which is orginally from [LinkFinder](https://github.com/GerbenJavado/LinkFinder/blob/095bb6218faca9e00169357f663feba0a84202a5/linkfinder.py#L29). (Though [issue 59](https://github.com/GerbenJavado/LinkFinder/issues/59) has been applied.)

Furthermore, a couple of domains are blacklisted, such as:

```python
    "twitter.com",
    "youtube.com",
    "pinterest.com",
    "facebook.com",
    "w3.org",
    "vimeo.com",
    "redditstatic.com",
    "reddit.com",
    "schema.org",
    "unpkg.com",
    "gitter.im",
    "cookielaw.org",
```

Furthermore if any of the following words appear in the url, they will not be saved:

```python
"jquery",
"node_modules"
```

You won't find any of these in the urls.

# Installation

Preferred via pipx

```
pipx install JSFinder2
```

or a simple pip command

```
pip install JSFinder2
```

The pip page is: https://pypi.org/project/JSFinder2/

# Usage

```
python -m jsfinder2 -h
usage: jsfinder2 [-h] [-v] [--debug] [--deep] [-os [OUTPUT_FILE_SUBDOMAINS]] [-ou [OUTPUT_FILE_URLS]] [-c [COOKIE]] [-ua [USER_AGENT]] [-u [REMOTE_JS_FILE_URL] | -f [LOCAL_URL_LIST_FILE]]

Examples:
            jsfinder2 -u https://www.example.com/js/main.js

options:
  -h, --help            show this help message and exit
  -v, --verbose         increase output verbosity (> INFO)
  --debug               sets output to very verbose
  --deep                sets to crawl very deep
  -os [OUTPUT_FILE_SUBDOMAINS], --output-sub [OUTPUT_FILE_SUBDOMAINS]
                        Specify the output file otherwise subdomains.txt is used in ~/jsfinder2
  -ou [OUTPUT_FILE_URLS], --output-url [OUTPUT_FILE_URLS]
                        Specify the output file otherwise urls.txt is used in ~/jsfinder2
  -c [COOKIE], --cookie [COOKIE]
                        Optional Cookie
  -ua [USER_AGENT], --user-agent [USER_AGENT]
                        Optional custom User-Agent
  -u [REMOTE_JS_FILE_URL], --url [REMOTE_JS_FILE_URL]
                        Specify the url to a JS file
  -f [LOCAL_URL_LIST_FILE], --file [LOCAL_URL_LIST_FILE]
                        Specify a local file with URLs

```

## Deep check of url

Follows subdomains and looks for script tags

```
jsfinder2 --deep -u https://www.tesla.com/
```

## Check urls from file

```
jsfinder2 -f myurls.txt
```

## Custom User-Agent and Cookies

To specify the user agent and/or cookie use
`-ua` for the User Agent and `-c` for the Cookie.

## Verbose output

You can use `--debug` to show more developer infos and `-v` for more console output (this might be a lot, as all urls and subdomains are shown!)

## Results location

By default all findings are stored in the home directory of the user in the domains folder i.e.:

```bash
# Linux
cat ~/jsfinder2/tesla.com/urls.txt
cat ~/jsfinder2/tesla.com/subdomains.txt

# Windows
type C:\Users\<USERNAME>\jsfinder2\tesla.com\urls.txt
type C:\Users\<USERNAME>\jsfinder2\tesla.com\subdomains.txt
```

You can adjust the file location via `-os` for subdomains and `-ou` for urls.

# Todo

- [x] create a subfolder for each domain
- [x] add option to load urls from file
- [ ] support flag that url is a js file
- [ ] crawl subdomains for more js files
- [ ] threading ?
- [ ] json output file ?

# License

[MIT](LICENSE)

# Contributing

Feel free to open an issue with any feedback, a PR or similar.

It would also help to star the project!
