diff --git a/.gitignore b/.gitignore index f4d432a..97c3ab8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,20 @@ -# ---> Go -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ - +# ---> Go +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Images +*.iso +*.qcow2 diff --git a/LICENSE b/LICENSE index 2071b23..985488e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,9 @@ -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 0cc51b2..450ab6e 100644 --- a/README.md +++ b/README.md @@ -1,74 +1,74 @@ -# eaas-vde-proxy - -## Overview - -![overview](README.assets/overview.png) - -## Pseudocode - -```python -class vde_proxy: - def handle_frame(frame): - try: - frame.mac = self.new_mac - except NameError: - self.new_mac = random_mac() - self.new_ip = do_dhcp(new_mac) - finally: - frame.mac = self.new_mac - frame.packet = handle_packet(frame.packet) - - def handle_packet(packet): - protocols = { - "ip" : handle_ip, - "arp": handle_arp, - } - return protocols[packet.protocol](packet) - - def handle_ip(packet): - # Todo: Check DHCP lease and get new one if necessary - packet.ip = self.new_ip - if is_dhcp(packet): - packet = handle_dhcp(packet) - return packet - - def handle_arp(packet): - pass - - def handle_dhcp(packet): - pass - - def do_dhcp(mac): - # Do DHCP - return ip -``` - - - -## Problematic protocols - -Important: - -* DHCP -* ARP - -Nice to have: - -* NetBEUI / NetBIOS - -Keep in mind: - -* IPv6 (NDP, Interface Identifier, ...) -* IPSec -* 802.1X - -## Library support - -### Go: - -* Internet layer packet modification: https://github.com/google/gopacket / https://pkg.go.dev/github.com/google/gopacket -* Link layer frame modification: https://github.com/mdlayher/ethernet / https://pkg.go.dev/github.com/mdlayher/ethernet (not recently updated, alternative?) - -### Rust: - -* https://docs.rs/etherparse/0.9.0/etherparse +# eaas-vde-proxy + +## Overview + +![overview](README.assets/overview.png) + +## Pseudocode + +```python +class vde_proxy: + def handle_frame(frame): + try: + frame.mac = self.new_mac + except NameError: + self.new_mac = random_mac() + self.new_ip = do_dhcp(new_mac) + finally: + frame.mac = self.new_mac + frame.packet = handle_packet(frame.packet) + + def handle_packet(packet): + protocols = { + "ip" : handle_ip, + "arp": handle_arp, + } + return protocols[packet.protocol](packet) + + def handle_ip(packet): + # Todo: Check DHCP lease and get new one if necessary + packet.ip = self.new_ip + if is_dhcp(packet): + packet = handle_dhcp(packet) + return packet + + def handle_arp(packet): + pass + + def handle_dhcp(packet): + pass + + def do_dhcp(mac): + # Do DHCP + return ip +``` + + + +## Problematic protocols + +Important: + +* DHCP +* ARP + +Nice to have: + +* NetBEUI / NetBIOS + +Keep in mind: + +* IPv6 (NDP, Interface Identifier, ...) +* IPSec +* 802.1X + +## Library support + +### Go: + +* Internet layer packet modification: https://github.com/google/gopacket / https://pkg.go.dev/github.com/google/gopacket +* Link layer frame modification: https://github.com/mdlayher/ethernet / https://pkg.go.dev/github.com/mdlayher/ethernet (not recently updated, alternative?) + +### Rust: + +* https://docs.rs/etherparse/0.9.0/etherparse