Code Monkey home page Code Monkey logo

ebpf's Introduction

Warning This git repository was meant to be a small (and fun) demonstration of what can be done with eBPF. It was clearly over-engineered as it was not developped nor optimized for any kind of use.

Knockles - eBPF Port Knocking Tool ๐Ÿšช๐Ÿ

Knockles, is a port knocking tool based on eBPF ๐Ÿ. It allows to remotely open a TCP connection while being completely invisible to port scanners.

  • A single SYN request is sent on an opened || closed port ๐Ÿ“จ ๐Ÿ“ซ
  • It carries an OTP for authentication so you can be the only one to open a port ๐Ÿ”
  • Once authentified, a random (HMAC based) port is opened for a TCP connection ๐ŸŽฒ
  • Then, the port is closed as soon as a connection has been established ๐Ÿšช

Server configuration

Modify the following macros/variables

./knockles/src/knockles.bpf.c
  • PORT: Port monitored for knocks [default: 80]
./knockles/src/knockles.c
  • HMAC_DURATION: Time range between two different OTP (in seconds) [default: 30]
  • LISTENING_DURATION: Timeout of the opened port if no connection occurs (in seconds) [default: 30]
  • SECRET: HMAC secret key [default: MY_SECRET_KEY]

Server compilation

Requirements

Debian

sudo apt install git make pkg-config libelf-dev clang-11 libc6-dev-i386 bpftool libssl-dev -y
pip install scapy

Ubuntu

sudo apt install git make pkg-config libelf-dev clang-11 libc6-dev-i386 linux-tools-common linux-tools-$(uname -r) libssl-dev -y
pip install scapy

Build

cd ./knockles/src
make

Usage

Server side

Usage: ./knockles [OPTION]...
eBPF port knocking tool - Server.
      --help             display this help and exit
      --daemon           run program as daemon

Client side

usage: knuckknock.py [-h] -s KEY  -t TIME -d IP -p PORT

eBPF port knocking tool - Client.

optional arguments:
  -h, --help            show this help message and exit
  -s KEY , --secret KEY 
                        HMAC secret key
  -t TIME, --time TIME  generated HMAC duration
  -d IP, --dst IP       destination IP address
  -p PORT, --port PORT  monitored port

ebpf's People

Contributors

eeriedusk avatar compehacks avatar

Stargazers

 avatar

Watchers

 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.