Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
github.com/dennisping/tcp-ip-raw-sockets
TL;DR - Make an HTTP GET request from scratch; from the network layer to the application layer.
This project was originally done in Python and converted to Go for self-learning purposes.
This program called rawhttpget
takes one URL, downloads the target URL page, and saves it into the current directory. The TCP/IP network stack is custom implemented, and all incoming & outgoing data packets utilize raw sockets. Due to the low-level details and bitwise operations of this project, unit testing was done to ensure correctness. Manual debugging was also done on Wireshark.
Go 1.21+
This project only works on Linux.
sudo iptables -A OUTPUT -p tcp --tcp-flags RST RST -j DROP
ifconfig -a
and disable gro, tx, rxsudo ethtool -K <network interface> gro off
sudo ethtool -K <network interface> tx off rx off
sudo iptables -A OUTPUT -p tcp --tcp-flags RST RST -j DROP
sudo ethtool -K wlp4s0 gro off
sudo ethtool -K wlp4s0 tx off rx off
make
Usage: sudo ./rawhttpget [-v] URL
Options:
-p string
available profilers: cpu, mem
-v verbose output
The optional flag -v
is for verbose output.
Examples
sudo ./rawhttpget -v http://david.choffnes.com/classes/cs4700sp22/project4.php
sudo ./rawhttpget http://david.choffnes.com/classes/cs4700sp22/10MB.log
Standard mode
go test ./...
Verbose mode
go test -v ./...
Show test coverage
go test ./... -coverprofile=coverage.out
go tool cover -html=coverage.out
> sudo ./rawhttpget -v http://david.choffnes.com/classes/cs4700sp22/project4.php
Remote IP: 204.44.192.60
Local IP: 192.168.0.237
--> send 48 bytes Flags: SYN seq: 2123832061, ack: 0
<-- recv 48 bytes Flags: SYN ACK seq: 2154816049, ack: 2123832062
--> send 40 bytes Flags: ACK seq: 2123832062, ack: 2154816050
--> send 157 bytes Flags: ACK seq: 2123832062, ack: 2154816050
<-- recv 40 bytes Flags: ACK seq: 2154816050, ack: 2123832179
<-- recv 40 bytes Flags: ACK seq: 2154816050, ack: 2123832179
--> send 40 bytes Flags: ACK seq: 2123832179, ack: 2154816050
<-- recv 1500 bytes Flags: ACK seq: 2154816050, ack: 2123832179
--> send 40 bytes Flags: ACK seq: 2123832179, ack: 2154817510
<-- recv 1500 bytes Flags: ACK seq: 2154817510, ack: 2123832179
--> send 40 bytes Flags: ACK seq: 2123832179, ack: 2154818970
<-- recv 1500 bytes Flags: ACK seq: 2154818970, ack: 2123832179
--> send 40 bytes Flags: ACK seq: 2123832179, ack: 2154820430
<-- recv 1500 bytes Flags: ACK seq: 2154820430, ack: 2123832179
--> send 40 bytes Flags: ACK seq: 2123832179, ack: 2154821890
<-- recv 1500 bytes Flags: ACK seq: 2154821890, ack: 2123832179
--> send 40 bytes Flags: ACK seq: 2123832179, ack: 2154823350
<-- recv 1061 bytes Flags: PSH ACK seq: 2154823350, ack: 2123832179
--> send 40 bytes Flags: ACK seq: 2123832179, ack: 2154824371
<-- recv 1500 bytes Flags: ACK seq: 2154824371, ack: 2123832179
--> send 40 bytes Flags: ACK seq: 2123832179, ack: 2154825831
<-- recv 804 bytes Flags: PSH ACK seq: 2154825831, ack: 2123832179
--> send 40 bytes Flags: ACK seq: 2123832179, ack: 2154826595
<-- recv 40 bytes Flags: FIN ACK seq: 2154826595, ack: 2123832179
--> send 40 bytes Flags: FIN ACK seq: 2123832179, ack: 2154826596
<-- recv 40 bytes Flags: ACK seq: 2154826596, ack: 2123832180
200 OK
Wrote 22576 bytes to project4.php
rawsocket
package:
Wrap(IPHeader, TCPHeader) -> packet
Unwrap(packet) -> IPHeader, TCPHeader, error
http
package loosely mimics the Go std lib net
library.keep-alive
header, HTTP/1.0 is sufficient for our use case, and it greatly simplifies decoding.FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.