Coder Social home page Coder Social logo

scapy-scion-int's Introduction

SCION and In-band Network Telemetry Layers for Scapy

Scapy is an interactive packet manipulation program/library for Python. This repository contains Scapy packet header definitions ("layers") for SCION and In-band Network Telemetry (INT) on top of SCION. Just start Scapy by running sudo ./scapy_scion.py and the new headers are available at the interactive command line.

Supported headers:

  • SCION (with path types EmptyPath, SCION, and OneHopPath)
  • SCION Hop-by-Hop and End-to-End Options Header
  • SCMP (only Echo Request and Reply)
  • BFD over SCION
  • INT-MD over UDP
  • Inter-domain INT for SCION

Some SCION tools built with Scapy are available in tools.

Dependencies

  • Python 3
  • Scapy (2.5.0)
  • Additional Python packages:
    • cryptography (39.0.0)

Installation on Ubuntu 22.04.1:

sudo apt-get install python3 python3-pip
sudo pip install --pre scapy[basic]
pip install cryptography

Run Unit Tests

python -m unittest

Getting Started: Craft and Send a SCION Packet

  1. Ping the target AS.

Replace 127.0.0.27:30255 with the address of your SCION daemon and the destination AS with the AS you want to send packets to.

bin/scion ping --sciond 127.0.0.27:30255 2-ff00:0:211,127.0.0.1
  1. Launch Scapy in a second terminal and capture one of the echo requests.

Replace IP 127.0.0.25 and port 31014 with the internal address of your border router.

sudo ./scapy_scion.py
bind_layers(UDP, SCION, dport=31014)
bind_layers(UDP, SCION, sport=31014)
pkts = sniff(iface="lo",
    filter="host 127.0.0.25 and port 31014",
    lfilter=lambda pkt: pkt.haslayer(SCMP) and pkt[SCMP].Type==128,
    prn=lambda pkt: pkt.summary(), count=1)
  1. Extract the IP/UDP underlay and the SCION header.
p = pkts[0][IP]
p[SCION].remove_payload()
del p[IP].len
del p[IP].chksum
del p[UDP].len
del p[UDP].chksum
del p[SCION].NextHdr
del p[SCION].HdrLen
del p[SCION].PayloadLen
  1. Build a new packet (e.g., a new echo request) and send it.

Changing conf.L3Socket to L3RawSocket is required in order to send packets to local applications. Refer to this FAQ.

req = p/SCMP(Message=EchoRequest(Identifier=0xabcd, Data=b"Hello!"))
req[SCION].DstHostAddr = "127.0.0.2"
conf.L3socket = L3RawSocket
resp = sr1(req, iface="lo", timeout=1)
resp.show()

scapy-scion-int's People

Contributors

lschulz avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hawkcorrigan

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.