Skip to content

Development

tester2024 edited this page Oct 27, 2026 · 1 revision

Development

Layout

MHDDoS/
├── start.py              single-file CLI
├── config.json           bot prefix, protocol default, proxy providers
├── requirements.txt      Python dependencies
├── pyproject.toml        Ruff format and lint settings
├── files/
│   ├── useragent.txt
│   ├── referers.txt
│   └── proxies/          downloaded and checked proxy lists
├── web/
│   ├── src/server.ts     Express panel
│   ├── public/           Node panel UI
│   ├── app.py            optional Flask panel
│   ├── templates/
│   ├── static/
│   └── scripts/          install and start launchers
└── .github/workflows/    Docker, CodeQL, release

Toolchain

Tool Use
Python 3.11+ CLI and Flask panel
Ruff Formatting and linting
Node.js 18+ Web panel build
Docker Image build and testing

Python checks

uvx ruff check start.py web/app.py
uvx ruff format --check start.py web/app.py
python -m py_compile start.py web/app.py
python start.py DOCTOR

Format and auto-fix:

uvx ruff format start.py web/app.py
uvx ruff check start.py web/app.py --fix

The Ruff configuration is in pyproject.toml. It targets Python 3.11, uses a 100-column line length, and keeps Optional[...] style for compatibility with older editor inspections.

Web checks

cd web
npm ci
npm run build
npm run serve

npm start runs the TypeScript server through tsx. npm run build writes CommonJS output to web/dist.

Adding a method

A Layer 7 method needs:

  1. a name in Methods.LAYER7_METHODS;
  2. an entry in HttpFlood.METHOD_NAMES if the name differs from the handler;
  3. a handler that builds and sends the payload;
  4. a request-method mapping in HttpFlood.GET_METHODS, POST_METHODS, or HEAD_METHODS;
  5. a row in the README method table and in Methods.

A Layer 4 method needs:

  1. a name in Methods.LAYER4_METHODS;
  2. a handler name in Layer4.METHOD_NAMES;
  3. the handler itself;
  4. raw-socket registration if it uses one;
  5. proxy support only if the handler can use a proxy socket.

Keep payloads in the handler. The CLI parses method names and numbers; it does not validate payload logic.

Error handling

Workers catch exceptions at the thread boundary, log the first failure, and retry with a short backoff. Do not add a broad except inside a hot loop; let FloodWorker.run handle it. Connection setup uses try/finally so a failed socket is always closed.

Formatting

The project uses Ruff with:

  • 100-column line length;
  • double quotes;
  • two blank lines between top-level definitions;
  • one blank line between methods.

Run the formatter before committing. Do not hand-align tables or imports.

Tests

There is no test suite yet. Useful additions:

  • payload builders (Minecraft, HTTP methods, amplification packets);
  • CLI argument validation;
  • proxy file parsing;
  • worker backoff.

Until then, run DOCTOR, a short localhost run, and npm run build after changes.

Commits

Keep commits focused. A commit message should explain the reason, not list every changed line. Examples:

Pass web tasks over stdin

The panel now starts a fixed command and streams the spec to the child,
so request data never reaches argv.

License

MIT. See LICENSE in the repository.

Clone this wiki locally