GithubHelp home page GithubHelp logo

00jciv00 / zing Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 0.0 4.12 MB

A small Zig tool & library to craft and interact with basic network datagrams based on IETF specifications.

License: MIT License

Zig 100.00%
networking packets

zing's Introduction

zing

A small Zig tool for crafting datagrams and interacting with networks, based on IETF specifications.

Overview

This project is an experiment to learn more about the basics of how network datagrams (Frames, Packets, and Segments/UDP Datagrams) work by coding parts of the IETF spec in Zig. This is a continuation of packt-lib, a similar project written in Kotlin. I've moved to Zig to help myself understand the lower level intricasies of networking and bit/byte manipulation. Optimally, the tool will allow users to manipulate network directly through the library, a DSL (.json, .toml?, and .zon?), or an interactive shell.

Goals

  • Replicate Basic Networking Headers:
    • IP
    • ICMP
    • UDP
    • TCP
    • Ethernet
  • Replicate Basic Networking Addresses:
    • IPv4
    • IPv6
    • MAC
  • Add data to Networking Headers to create Datagrams
  • Craft & Send Datagrams on an interface:
Datagram Layer Craft Send
Ethernet 2 Y Y
WiFi 2 Y N
Bluetooth 2 N N
IP 3 Y Y
ICMP 3 Y Y
ARP 3 Y Y
UDP 4 Y Y
TCP 4 Y Y
  • Implement Sending a Stream of Datagrams

  • Implement Receiving Datagrams

  • Implement Basic Connection Protocol Handling

    • ICMP
    • ARP
    • TCP
  • Network Scanning tools

  • File Transfer tools

Resources

zing's People

Contributors

00jciv00 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zing's Issues

WiFi Frame Handling

  • Add parity between WiFi Frames and Ethernet Frames.
  • Support Data, Management, and Control Frames.

Iptables

I hear you're having trouble with your packets getting marked invalid by iptables. Have you thought about rewriting it in rust? Not sure, but I'm guessing it'll fix the issue.

BPF Filtering on Interfaces

  • Filters should be based on user input for the Zing tool.
  • Simple abstractions should be available in the Zing library.
  • This filtering should be applied in either connect.zig or receive.zig.

Solution for Variable Length Headers

Several Datagram Headers can be of a variable length. Typically, this just means that there's an associated length field in the fixed part of the header, then a number of "options" (or similar) that may or may not be at the end.

Datagrams.zig should include "Layer Options" that will be kept in slices between each layer. During the checksum/CRC calculations, these slices will be narrowed down to the required bytes which are then passed on to the required functions.

Interaction Context Expressions for Datagram Crafting

When crafting a Datagram, there needs to be a way to add small expressions that can be handled during Interactions. These expressions would allow for simple tasks like incrementing/decrementing a field or setting specific value based on the context of the Interaction.

One possible solution for this is using a StringHashMap that holds Datagram fields in dot notation as the keys and simple expressions as the values.

PCAP Encoding

  • Add PCAP Encoding to craft.zig and record.zig.
  • Choose between PCAP or PCAP-NG. (Probably the latter).
  • Figure out the simplest way to both ingest and append GPS data.

Optional `libc`

The library should be able to optionally use libc if it's linked at build time. While Zing is intended to be "pure" Zig, there are a few areas that could benefit from having that available. Namely, getting Linux constants from the target OS's C header files, which could overwrite the defaults in constants.zig.

Scan Tool

The Scan Tool should be able to make basic scans across Layer 2 (ARP), Layer 3 (ICMP), Layer 4 (TCP).

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.