Skip to content

Instantly share code, notes, and snippets.

@atoonk
atoonk / AWS_v4prefixes.md
Last active April 28, 2024 06:48
AWS prefixes

Summary

Total number of IPv4 addresses: 100,750,168. That’s the equivalent of just over six /8’s Also see this blog: https://toonk.io/aws-and-their-billions-in-ipv4-addresses/

just for fun, let's put a value number on that

Total value at, $20 per IP: => $2,015,003,360

Total value at, $25 per IP: => $2,518,754,200

@atoonk
atoonk / afpacket.c
Created March 25, 2024 00:36
sending a packet with AF_PACKET in C
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/ether.h>
#include <netinet/ip.h> // Include for struct iphdr
@atoonk
atoonk / main.go
Created March 11, 2024 20:15
net.dial http get
package main
import (
"bufio"
"fmt"
"io"
"net"
)
func main() {
@atoonk
atoonk / gist:46f60156bfad71d4ac43b7460367121d
Created February 27, 2024 22:43
af_packet_compare.go
// POC for sending packets using tpacket and afpacket
// tpacket is a high-performance packet sending mechanism using MMap'd AF_PACKET
// afpacket is a regular packet sending mechanism
package main
import (
"fmt"
"log"
"net"
@atoonk
atoonk / ipv4_prefixes_aws_2023.md
Last active February 20, 2024 10:24
ipv4_prefixes_aws_2023

Summary

2023 AWS data Total number of IPv4 addresses: 127,972,688 That’s the equivalent of 7.6 /8’s Also see this blog: https://toonk.io/aws-ipv4-estate-now-worth-4-5-billion/index.html

just for fun, let's put a value number on that

value at $20 per ip: $2,559,453,760
value at $25 per ip: $3,199,317,200
value at $30 per ip: $3,839,180,640
@atoonk
atoonk / ipv4_prefixes_aws_2024.md
Last active February 8, 2024 10:50
IPv4 addresses allocated to Amazon and their worth
arin_entities = ["GOOGL-2", "GOOGL-1", "YL-29", "GOGL"]
urls = ["https://www.gstatic.com/ipranges/cloud.json", "https://www.gstatic.com/ipranges/goog.json"]
4.3.2.0/24
8.8.4.0/24
8.8.8.0/24
8.34.208.0/20
8.35.192.0/20
23.236.48.0/20
23.251.128.0/19
@atoonk
atoonk / dpdk_ifstats.py
Created April 7, 2021 22:43
VPP DPDK interface stats
#!/usr/bin/env python3
import subprocess
import time
import signal
import sys, os
def get_stats(interface):
command=["vppctl", "show", "hardware-interfaces", interface]
#!/bin/bash
if [ `whoami` != 'root' ]; then
echo "Please run this as root..., don't worry about it..."
exit 1
fi
echo "updating fstab"
r=`grep hugetlbfs /etc/fstab`
@atoonk
atoonk / gif_service.py
Last active December 7, 2020 01:54
a random gif web-service
#!/usr/bin/python3
import platform
import giphy_client
from giphy_client.rest import ApiException
from http.server import HTTPServer, BaseHTTPRequestHandler
api_key = "REPLACE_WITH_YOUR_GIPHY_API_KEY" # str | Giphy API Key.
# create an instance of the API class
api_instance = giphy_client.DefaultApi()