Git Product home page Git Product logo

cthulhu's Introduction

   __
\ (..) /           ▄    █            ▀▀█    █
 \ mm /    ▄▄▄   ▄▄█▄▄  █ ▄▄   ▄   ▄   █    █ ▄▄   ▄   ▄
  |  |    █▀  ▀    █    █▀  █  █   █   █    █▀  █  █   █
  |__|    █        █    █   █  █   █   █    █   █  █   █
  |  |    ▀█▄▄▀    ▀▄▄  █   █  ▀▄▄▀█   ▀▄▄  █   █  ▀▄▄▀█
  |  |

C  Container
T  Technology for
H  Hardcore
U  Users of
L  Linux that's
H  Hardcore and
U  Useful

--------------------------------------------------------

A very simple tool for starting a shell in a "container".

Demonstration use only. If you want to use this for anything other than education, I'm not here to judge you.

Designed to demonstrate:

  • Linux Namespaces
  • CGroups
  • Chroot
  • Virtual Ethernet devices
  • Rust system programming

Running ./cthulhu (as root eeeeeeee) will

  • Dial up all the namespaces
  • Set up a veth pair with IP 10.0.0.1 (host) This part needs some work due to some netlink behaviour I haven't quite had time to work through. You can manually configure an IP in the container, though, and it works. Essentially the bindings for netlink need to allow use of the IFLA_NET_NS_PID flag, so that the netlink messages can configure the interface inside of the namespace. For now, ip a a dev veth1 10.0.0.2/24 inside the container will do it.
  • Mount-namespace (chroot) the contained process to the "chroot" directory in cwd - To populate your chroot, run something like debootstrap bullseye chroot This will be your container filesystem.

To run, after preparing the chroot, run cargo run. All sources are in src/main.rs. Refer to cthulhu.c for the original C version.

screenshot showing cthulhu output

Happy namespace (ab)use!

cthulhu's People

Contributors

dependabot[bot] avatar

Stargazers

Lou Manglass avatar Guo Qiao (Joe) avatar

Watchers

James Cloos avatar Guo Qiao (Joe) avatar Rayne avatar  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.