Code Monkey home page Code Monkey logo

ipt_xor's Introduction

iptables xor module

The XOR target enables the user to encrypt TCP and UDP traffic using a very simple xor encryption.
Xor is its own inverse. That is, to undo xor, the same algorithm is applied, so the same action can be used for encoding and decoding.
warning: This is not a real encryption.

Install

  1. first install kernel-devel, iptables-devel and etc.
  2. To compile the userpace so,
cd userspace;make libxt_XOR.so
cp libxt_XOR.so /lib64/xtables/  # debian/ubuntu is /usr/lib/x86_64-linux-gnu/xtables/
  1. To compile the kernel module,
cd kernel;make
insmod xt_XOR.ko

Usage

XOR takes one mandatory parameter.

--key '1234' where 1234 is a byte string (As 5f6e == 0x5f, 0x6e). Warning: don't use key of length > 1 with tcp, because tcp is a stream.

Example

To use this target between hosts 1.2.3.4 and 1.2.3.5.

(on host A, 1.2.3.4)

iptables -t mangle -A OUTPUT -d 1.2.3.5 -p udp --dport 1234 -j XOR --key 6142
iptables -t mangle -A INPUT -s 1.2.3.5 -p udp --sport 1234 -j XOR --key 6142

(on host B, 1.2.3.5)

iptables -t mangle -A OUTPUT -d 1.2.3.4 -p udp --sport 1234 -j XOR --key 6142
iptables -t mangle -A INPUT -s 1.2.3.4 -p udp --dport 1234 -j XOR --key 6142

Notice

  • Support kernel version >= 2.6.32.
  • Tested on Centos6.5(2.6.32-431.23.3.el6.x86_64), centos7.2(3.10.0-327.22.2.el7.x86_64) and kernel 4.1.0.
  • Tested on Ubuntu18.04(4.15.0-101-generic) and Ubuntu 20.04(5.4.0-29-generic)

License

This project is under the MIT license. See the LICENSE file for the full license text.

ipt_xor's People

Contributors

faicker avatar mrsobakin avatar t123yh avatar

Stargazers

Lev Gorodetskii 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.