Skip to main content

An automated GraphQL/API endpoint extractor using Playwright.

Project description

grAPI — Live API Discovery Tool

grAPI is a simple but powerful utility for pentesters and security researchers who need to discover API endpoints on websites by interacting with them in real time. It uses Playwright under the hood to launch a real browser so you can explore the target and see API calls pop up in your terminal as they happen.


What It Does

This tool:

  • Opens your target URL in a real browser so you can click around just like a user.
  • Captures any API endpoints the page hits via XHR, Fetch or other network calls.
  • Scans loaded JavaScript files for hidden or hardcoded API paths.
  • Gives you color coded output instantly so you don’t have to wait.
  • Lets you save the endpoints in a simple txt or json file.
  • Generates a Postman collection for easy import into Postman or Burp.

Why It’s Useful

Unlike traditional scanners that only look at source code, grAPI listens to actual traffic as you use the page. That means it catches dynamic APIs that appear after a click, form submit or other interaction.

And because you do the browsing yourself, you control exactly which parts of the app you want to explore. The output is kept clean and minimal so you can jump straight into testing.


Installation

Make sure you have Python 3.10+ installed.

You can install grAPI using pip:

# Install grapi
pip install grapix

# Install Playwright browser binaries
playwright install

Or from source

git clone https://github.com/DghostNinja/grAPI.git
cd grAPI

# Install grapi
pip install .

# Install Playwright browser binaries
playwright install
  • OPTIONAL: Add this line to your shell config (~/.bashrc, ~/.zshrc, or ~/.profile depending on your shell):
export PATH="$HOME/.local/bin:$PATH"
source ~/.bashrc   # or source ~/.zshrc

Usage

Here’s a typical example:

python3 grAPI.py --url https://targetsite.com -o apis.txt -p apis.postman.json

OR(Recommended):

grAPI --url https://targetsite.com -o apis.txt -p apis.postman.json

This will:

  1. Launch the browser and open the target.
  2. Print API endpoints as they happen — color coded by HTTP method.
  3. Save them into a file (apis.txt) and a Postman collection (apis.postman.json).

When you’re done exploring the app, hit Enter in your terminal to stop the scan.


Optional Arguments

Argument Description
--url Target page URL
--timeout Page load timeout in seconds. 0 disables timeout
--scroll Automatically scrolls the page to trigger more API calls
-o Output filename for saving endpoints (txt or json)
-p Export captured endpoints as a Postman collection file

Example Output

[API detected] POST: http://crapi.apisec.ai/identity/api/auth/forget-password
[API detected] GET: http://crapi.apisec.ai/shop/api/products
[JS-detected] /user/profile/update-profile-picture/

After hitting Enter:

[+] Total API endpoints captured: 3
[+] Saved 3 endpoints to apis.txt
[+] Saved Postman collection to apis.postman.json

License

This project is licensed under the terms of the MIT License. You are free to use, modify, and distribute it as needed.


Contribute

If you’ve got feature ideas or improvements, feel free to open an issue or send a pull request.

That’s it. Have fun breaking things and stay curious.

Made with ☕ by iPsalmy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grapix-0.1.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grapix-0.1.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file grapix-0.1.1.tar.gz.

File metadata

  • Download URL: grapix-0.1.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for grapix-0.1.1.tar.gz
Algorithm Hash digest
SHA256 20446a12b1ae167d8d0089b24be46a4667e6ada719f05a9f9a6bcc454ad1f396
MD5 6dbd4689adde3b45b9a4e1780c890859
BLAKE2b-256 28f89be76e3d40f7e7186ff05d98c39c7dde1cee253da6c38f817c69952a35fe

See more details on using hashes here.

File details

Details for the file grapix-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: grapix-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for grapix-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ddfa845af0a799e80568afe1a27395ebe974c9749ceec57f8c248793d21c7b64
MD5 4c8ba795ade7ca30b6574b301480ed6b
BLAKE2b-256 1ff02f766e5e4006b656227287357e905c685fac9ffaacff1a0b567c4c4de264

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page