Metadata-Version: 2.4
Name: geoflag
Version: 0.1.1
Summary: WAF fingerprinting and authorized capacity load-testing from the command line.
Author: Muhammed Reis
License: MIT
Project-URL: Homepage, https://github.com/muhammedreis/geoflag
Project-URL: Issues, https://github.com/muhammedreis/geoflag/issues
Keywords: waf,security,fingerprint,load-test,benchmark,web
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Security
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# geoflag

`geoflag` fingerprints the Web Application Firewall (WAF) in front of a website,
and — for sites you own — measures how much traffic that site can sustain before
it starts to degrade. The command is `link`.

It is dependency-free (standard library only) and ships ready for PyPI.

```
link example.com
```

```
[*] Checking https://example.com
[+] The site https://example.com is behind Cloudflare (Cloudflare Inc.).
[~] Number of requests: 2
```

## Install

```bash
pip install .
# or, once published:
pip install geoflag
```

This installs two equivalent console commands: `link` and `geoflag`.

## WAF detection

```bash
link example.com            # detect the first matching WAF
link example.com -a         # list every matching signature
link example.com -k         # skip TLS verification
link example.com -y         # skip the authorization prompt (automation)
link --version              # show version and signature count
```

Every scan first asks a plain question — `Are you authorized? (y/n)` — and only
continues when you answer `y`. Pass `-y`/`--yes` to skip it in scripts.

Detection sends one benign baseline request and one probe request that carries
obvious attack *markers* (so a WAF has something to react to), then matches the
responses against a database of public WAF fingerprints — Server headers, cookie
names, response headers and block-page strings that products expose on purpose.
If no known product matches but the site behaves differently under the probe,
`geoflag` reports a generic/unknown WAF.

## Capacity load test (your own sites only)

This answers: *how many requests per second can my site comfortably serve?*

```bash
link yoursite.com --loadtest
```

- It first asks `Are you authorized to test this target? (y/n)` and only
  continues on `y` (pass `-y`/`--yes` for automation).
- It **ramps load up in stages** instead of dumping it all at once.
- At each stage it reports throughput (req/s), p50/p95 latency and error rate.
- It **stops the moment the site degrades** — the point is to find the limit,
  not to keep hammering a struggling server.
- It talks only to the single URL you give it.

```
[~] conc=5    rps=  420.0  p50=     11ms  p95=     18ms  errors=   0%
[~] conc=10   rps=  780.0  p50=     12ms  p95=     21ms  errors=   0%
...
[+] Peak throughput: 1850 requests/sec
[+] Comfortably sustained: ~1700 req/sec at 40 concurrent connections.
[~] Stopped at 55 concurrent: p95 latency 920ms exceeded 4x baseline (190ms).
```

### Authorization

The load test (and every scan) asks `Are you authorized? (y/n)` before it runs
and continues only when you answer `y`. Load-testing a site you do not own or
have permission to test can be illegal — don't. Use `-y`/`--yes` to skip the
prompt only in automation you control.

Tune the ramp:

```bash
link yoursite.com --loadtest \
     --start 10 --max 300 --step 10 --requests 200
```

## Library use

```python
from geoflag.detector import Detector
res = Detector("example.com").run()
print(res.detected)        # [("Cloudflare", "Cloudflare Inc."), ...]

from geoflag.loadtest import LoadTest, authorize
authorize("localhost:8000", asserted=True)
result = LoadTest("http://localhost:8000").run()
print(result.sustained_rps)
```

## Project layout

```
geoflag/
  cli.py              # the `link` command
  detector/
    engine.py         # baseline + probe requests, signature matching
    signatures.py     # public WAF fingerprint database
  loadtest/
    runner.py         # staged capacity test
    authorization.py  # ownership / authorization gate
  utils/
    http.py           # stdlib HTTP wrapper
    output.py         # plain-text, wafw00f-style output
```

## Scope

`geoflag` is a diagnostics and benchmarking tool. The detector is passive
fingerprinting; the load test is a capacity benchmark gated behind an
authorization check. It is not, and will not become, an attack tool.

## License

MIT
