Giter Site home page Giter Site logo

verovaleros / pythonbotnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from happystoic/pythonbotnet

0.0 0.0 0.0 1.23 MB

Simple C&C botnet written in asynchronous Python3.7 communicating through websockets

License: MIT License

Python 100.00%

pythonbotnet's Introduction

PythonBotnet (C&C)

Simple Command and Control (C&C) botnet written asynchronously using asyncio in Python3.7. Communication is implemented using unencrypted websockets.

Features

  • Run bash command on multiple bot clients simultaneously
  • Enable reverse-shell on a specific bot client
  • Bot client authentication using password

See planned features

Example

Why?

Developed as a part of an assignment in CTU class Introduction to Security

Getting started

Run via docker-compose

Required: docker, docker-compose

The easiest way to test the botnet is to run prepared docker-compose.yml file. To build images and run docker-compose in detached mode:

$ docker-compose build
$ docker-compose up -d

To connect to the control panel, websocket cli client is needed (e.g. wscat)

$ wscat -c localhost:6767
Connected (press CTRL+C to quit)
< Enter: 
* "0" - to print bot clients collection
* Indexes of clients separated by space to send bash command to
* Index of one client to jump into bash (send "exit" for termination)

>

Run locally

Project can be also installed locally:

$ pip install . 

Then run control panel server, bot client and websocket cli client in separated terminals:

$ python3.7 src/server.py
$ python3.7 src/client.py
$ wscat -c localhost:6767
...

Configuration

Control panel server

$ python3.7 server.py --help
Usage: server.py [OPTIONS]

Options:
  -cp, --cac_port INTEGER     Port where command and control center listens
  -bp, --bot_port INTEGER     Port where bots should connect in order to join
                              the botnet
  -s, --secret_password TEXT  Password needed for bots to connect
  -i, --ip_address TEXT       Ip address for server to listen on
  --help                      Show this message and exit.

Botnet client

$ python3.7 client.py --help
Usage: client.py [OPTIONS]

Options:
  -s, --server_address TEXT       Ip address or host of a running c&c
  -p, --port INTEGER              Port where the running c&c listens
  -i, --connection_interval INTEGER
                                  Interval in seconds in which client tries to
                                  connect to c&c server
  --help                          Show this message and exit.

Note: password for client authentication needs to be written directly to src/client.py. (Default values match)

To be done:

New features:

  • Encrypt the websocket communication using TLS
  • Add option to provide configuration in file
    • Log into file
    • Tls keys for encrypted communication
    • Ports
    • ...
  • Make client less dependant on 3rd party libraries
  • Add option for domain generating algorithms
  • Prettify the CLI view

Issues to be solved:

  • reverse shell freezes when interactive command as htop or ping is executed

License

This project is licensed under the terms of the MIT license.

pythonbotnet's People

Contributors

happystoic avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.