Skip to main content

PyCloaker - A Cloaking Module

Cloaking Module For Python

Installation

pip install pycloaker

What It Does ?

You can cloak your python based website with this module.
There is what does the module do :

  • Checks User-Agent
  • Checks ASN Company
  • Blocks Cities You Determined
  • Blocks Countries You Determined
  • Blocks Ip Addresses You Determined

There is what you can do with this module :

  • Block Ip Addresses
  • Block Cities
  • Block Countries

Usage

from pycloaker import *

url_is_humans_redirect = "https://x.com"
url_is_bots_redirect = "https://a.com"

clients_ip = "85.233.55.78"
clients_user_agent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_2_9) AppleWebKit/533.39 (KHTML, like Gecko) Chrome/47.0.2873.193 Safari/537"

cloaker = PyCloaker(
    url_is_humans_redirect,
    url_is_bots_redirect
)

cloaker.blockedCities(["paris","london"])
cloaker.blockedCountries(["us","ru"])
cloaker.blockedIpAddresses(["85.233.97.58"])

url = cloaker.cloak(clients_ip,clients_user_agent)

print(url)

It's gonna print https://x.com. Because there isn't any match with determined rules.

Trying another example:

from pycloaker import *

url_is_humans_redirect = "https://x.com"
url_is_bots_redirect = "https://a.com"

clients_ip = "85.233.55.78"
clients_user_agent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_2_9) AppleWebKit/533.39 (KHTML, like Gecko) Chrome/47.0.2873.193 Safari/537"

cloaker = PyCloaker(
    url_is_humans_redirect,
    url_is_bots_redirect
)

cloaker.blockedIpAddresses(["1.1.1.1","85.233.55.78"])

url = cloaker.cloak(clients_ip,clients_user_agent)

print(url)

It's gonna print https://a.com. Because client's ip address is matches with determined ip address.

You can see its very easy and user friendly.

Usage in Flask

from flask import Flask,url_for,redirect,request
from pycloaker import PyCloaker

app = Flask(__name__)

cloaker = PyCloaker("/human-url","/bot-url")
cloaker.blockedCountries(["rus","us"])

@app.route("/")
def index():
    #ip = request.headers['X-Forwarded-For'] # If its a real website you can use that
    ip = "85.214.122.50" # We determined this statically. Just a random ip
    userAgent = request.headers["User-Agent"]

    url = cloaker.cloak(ip,userAgent)

    return redirect(url)


@app.route("/human-url")
def human():
    return "You're a human!"

@app.route("/bot-url")
def bot():
    return "You're a bot :("


if __name__ == "__main__":
    app.run(debug=True)

WARNING : THIS MODULE MADE FOR JUST TESTS AND EDUCATİONAL PURPOSE.

DO NOT USE THAT IN A REAL WEBSITE

Metadata

Release files for pycloaker 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycloaker 0.0.4
File Size Uploaded Provenance Actions
pycloaker-0.0.4.tar.gz 4.5 kB Without provenance Details for pycloaker-0.0.4.tar.gz

Release files / pycloaker-0.0.4.tar.gz

Download URL pycloaker-0.0.4.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5117a50acae5fb357b2ce20dc9871238ee8ac9b56f12cb13aaebc7614b03c859
BLAKE2b-256 checksum
How to use checksums
5960892553a85e4de8c9b11a25f66fa2a5899172af11269fb137e8b4b16016ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Security for pycloaker 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.4 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page