Skip to main content

Make a protected link unsafe

Project description

kachi

Make a protected link unsafe.

Requirements

  • Python 3.10+

Installation

pip install kachi

Usage

from kachi import unsafe_link

result = unsafe_link("https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fexample.com")
print(result)  # https://example.com

Bundled Rules

Rule Service
azure_email Azure Email Safe Links
barracuda Barracuda Link Protect
esvalabs EsvaLabs URL Sandbox
fireeye FireEye URL Defense
o365_safelinks Microsoft 365 Safe Links
proofpoint_v1 Proofpoint URL Defense v1
proofpoint_v2 Proofpoint URL Defense v2
ses_awstrack AWS SES Click Tracking
sophos Sophos Email Protection
trendmicro Trend Micro Email Security
urldefense_v3 Proofpoint URL Defense v3
whatsapp WhatsApp Link Redirect

Rule Schema

Each rule is a YAML file with the following structure:

name: example_rule
filter:
  hostname: example.com # exact match, or /regex/
  path: /redirect # optional, exact match or /regex/
pre_extract: # optional, transforms applied to URL before extraction
  - html_unescape
  - url_decode
extract:
  from: query_param # query_param, path_regex, or url_regex
  keys: [url, u] # for query_param: parameter names to try in order
  pattern: "/L0/(http[^/?#]+)" # for path_regex/url_regex: regex with capture group
  select: first # for query_param: first (default) or last
post_extract: # optional, transforms applied to extracted value
  - url_decode

Filter

  • hostname (required): string or list of strings. Exact match or /regex/.
  • path (optional): string or list of strings. Exact match or /regex/.

Extract Sources

Source Description
query_param Extract from URL query parameters. Requires keys.
path_regex Match regex against URL path. Requires pattern with a capture group.
url_regex Match regex against full URL. Requires pattern with a capture group.

Transforms

Name Description
html_unescape Decode HTML entities (& -> &)
url_decode Percent-decode (%2F -> /)
base64_decode Base64 decode
prepend Prepend a string (requires a value, e.g. {prepend: "http://"})
proofpoint_v2_decode Decode Proofpoint v2 URL encoding

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

kachi-0.1.0.tar.gz (29.5 kB view details)

Uploaded Source

Built Distribution

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

kachi-0.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file kachi-0.1.0.tar.gz.

File metadata

  • Download URL: kachi-0.1.0.tar.gz
  • Upload date:
  • Size: 29.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kachi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ed8bea0df699ee093436151e0ffcfcad7cc181d35e853f4a4a0402a24f80dcf7
MD5 2a516f4a41e3e99c0b6cdfc2e4b7c7b1
BLAKE2b-256 e5eb113b1f82bc4f81816b8c28fea102bb186ef7f2d45fd630b4ac668a751998

See more details on using hashes here.

Provenance

The following attestation bundles were made for kachi-0.1.0.tar.gz:

Publisher: publish.yml on ninoseki/kachi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kachi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kachi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kachi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92321e01be78bacbab915b12c06ce77ffbe4738019071346665a62335249f6e7
MD5 5247300af473d2d6dbc4e16befe8b6a7
BLAKE2b-256 59afeb61b371cb27d9aa930fbf950c251a6eafac91f97aa5ee8dcade02607b3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for kachi-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ninoseki/kachi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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