GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - 003random/getJS: A tool to fastly get all javascript sources/files

BranchesTags
Open more actions menu

Latest commit

 

History

61 Commits
61 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
extractor
extractor
 
 
runner
runner
 
 
.dockerignore
.dockerignore
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
main.go
main.go
 
 

Repository files navigation

JavaScript Extraction CLI & Package

This is a powerful tool for extracting JavaScript sources from URLs, web pages, and HTTP responses. It offers a command-line interface (CLI) for straightforward URL processing and a package interface for custom integrations, making it ideal for pentesters, bug bounty hunters, and developers needing to extract JS sources efficiently.

Table of Contents

  • Installation
  • Docker
  • CLI Usage
    • Options
    • Examples
  • Package Usage
    • Importing the Extractor
    • Example
  • Version Information
  • Contributing
  • License

Installation

To install getJS, use the following command:

go install github.com/003random/getJS/v2@latest

Docker

Build the image from the repository root:

docker build -t getjs:local .

Run getJS against a URL:

docker run --rm getjs:local -url https://example.com

When piping a URL or HTTP response into the container, keep stdin open with --interactive:

curl https://example.com | docker run --rm --interactive getjs:local

Mount URL-list files read-only and refer to them by their container path:

docker run --rm --volume "${PWD}:/data:ro" getjs:local -input /data/urls.txt

Results are written to stdout by default, so they can be saved on the host without granting the container write access:

docker run --rm getjs:local -url https://example.com > results.txt

CLI Usage

Options

getJS provides several command-line options to customize its behavior:

  • -url string: The URL from which JavaScript sources should be extracted.
  • -input string: Optional URLs input files. Each URL should be on a new line in plain text format. Can be used multiple times.
  • -output string: Optional output file where results are written to. Can be used multiple times.
  • -complete: Complete/Autofill relative URLs by adding the current origin.
  • -resolve: Resolve the JavaScript files. Can only be used in combination with --complete.
  • -threads int: The number of processing threads to spawn (default: 2).
  • -verbose: Print verbose runtime information and errors.
  • -method string: The request method used to fetch remote contents (default: "GET").
  • -header string: Optional request headers to add to the requests. Can be used multiple times.
  • -timeout duration: The request timeout while fetching remote contents (default: 5s).

Examples

Extracting JavaScript from a Single URL

getJS -url https://destroy.ai

or

curl https://destroy.ai | getJS

Using Custom Request Options

getJS -url "http://example.com" -header "User-Agent: foo bar" -method POST --timeout=15s

Processing Multiple URLs from a File

getJS -input foo.txt -input bar.txt

Saving Results to an Output File

getJS -url "http://example.com" -output results.txt

Package Usage

Importing the Extractor

To use getJS as a package, you need to import the extractor package and utilize its functions directly.

Example

package main

import (
    "fmt"
    "log"
    "net/http"
    "net/url"

    "github.com/003random/getJS/extractor"
)

func main() {
    baseURL, err := url.Parse("https://google.com")
    if (err != nil) {
        log.Fatalf("Error parsing base URL: %v", err)
    }

    resp, err := extractor.FetchResponse(baseURL.String(), "GET", http.Header{})
    if (err != nil) {
        log.Fatalf("Error fetching response: %v", err)
    }
    defer resp.Body.Close()

    // Custom extraction points (optional).
    extractionPoints := map[string][]string{
        "script": {"src", "data-src"},
        "a": {"href"},
    }

    sources, err := extractor.ExtractSources(resp.Body, extractionPoints)
    if (err != nil) {
        log.Fatalf("Error extracting sources: %v", err)
    }

    // Filtering and extending extracted sources.
    filtered, err := extractor.Filter(sources, extractor.WithComplete(baseURL), extractor.WithResolve())
    if (err != nil) {
        log.Fatalf("Error filtering sources: %v", err)
    }

    for source := range filtered {
        fmt.Println(source.String())
    }
}

Version Information

This is the v2 version of getJS. The original version can be found under the tag v1.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any bugs, feature requests, or improvements.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A tool to fastly get all javascript sources/files

Topics

bugbountyextractfilesgogolanggoqueryhackinghacktoberfestjavascriptparserpentestingreconreconnaissanceurls

Resources

Readme
MIT license
Activity

Stars

902 stars

Watchers

11 watching

Forks

122 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.