Quick Blog Links

about   root @       
 
  MacOS/iOS Applications   [x-code + objective-c]  
 
  SSHPass Automation Program   [python / app]  
 
  DHCP/ARP Relay-Bridge ~ Proxying   [c / lan]  
 
  ARP Sync + Route Replacement   [python / networking]  
 
  DNS-VPN ~ UDP-SSL   [python / networking]  
 
  OpenVPN MODs ~~ BULK ++ MTIO ++ DUAL   [c / networking]  
 
  VPN Multi-Proc/Thread TUN-TCP Full-MTU Bulk-Data EXE   [c / networking]  
 
written   Secure LAN Communication   [College Thesis]  
 
  College Project – Teaching Hacking!   [Course Paper]  
 
  ARM Assembly – A Basic Introduction…   [Blog Post]  
 
configs   Mac Mini ++ Lenovo Mini   Firewalling ~~ eb|iptables  
 
  Cisco and OpenWRT   NFTables FlowTable  
  Ubiquiti and OpenWRT   Routing ~~ Balancing  
 
gear   vpn   @   xorcipher.com             Home Stuff   ||   WiFi Networks  
 
 
# Note: github.com/fossjon <- I lost access due to missing 2fa, so now I'm using -> github.com/stoops
for p in `seq 1 3` ; do
  curl -sL "https://fossjon.com/feed/?paged=$p" | grep -Ei '<(title|link)>' \
    | sed -e 's@<title@~<title@g' | tr ' \t\r\n' ' ' | tr -s ' ' | tr '~' '\n' \
    | sed -e 's@^.*<title>\(.*\)</title>.*<link>\(.*\)</link>.*$@<a href="\2" style="text-decoration:none;font-family:monospace;">\1</a><br/>@' \
    | grep -i '/fossjon.com/'
done > blog.html
   
   pages  
   1   2   3   4   5   |  6   7   8   9   10   
 11   12   13   14   15   |  16   17   18   19   20 

My first usage of AI for specific tech help and my thoughts so far…

I have first since used a couple web based AI systems for different specific tech things and they are pretty useful if you do the extra work to verify and modify what they are telling you. I’ve found that Google Gemini AI is really good a general tech questions and configuration items (with looking it over and understanding it and modifying it of course for your specific needs) and Claude Sonnet AI is really amazing at verifying that your code is correct and other more in-depth programming related tasks (for example, memory allocation and pointer safety handling).

I’ve been using these systems lightly whenever I get stuck and they are able to find the exact code snippets I was looking for to complete the rest of my projects!

~

AES-256 ARM Hardware Instruction Usage In C!

I wanted to eventually experiment with using the AES hardware instruction but for the ARM architecture because there are ways to turn block ciphers into stream ciphers for future usage. There appears to be a C header include file that exists on both Mac and Ubuntu (arm_neon.h) and you can compile this small C program file with standard gcc options (no special arguments needed). The hardware instruction method names appear very cryptic, however, they do seem to work when I tested the hex output against other sites!

K: [00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ]
R: [00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 62 63 63 63 62 63 63 63 62 63 63 63 62 63 63 63 aa fb fb fb aa fb fb fb aa fb fb fb aa fb fb fb 6f 6c 6c cf 0d 0f 0f ac 6f 6c 6c cf 0d 0f 0f ac 7d 8d 8d 6a d7 76 76 91 7d 8d 8d 6a d7 76 76 91 53 54 ed c1 5e 5b e2 6d 31 37 8e a2 3c 38 81 0e 96 8a 81 c1 41 fc f7 50 3c 71 7a 3a eb 07 0c ab 9e aa 8f 28 c0 f1 6d 45 f1 c6 e3 e7 cd fe 62 e9 2b 31 2b df 6a cd dc 8f 56 bc a6 b5 bd bb aa 1e 64 06 fd 52 a4 f7 90 17 55 31 73 f0 98 cf 11 19 6d bb a9 0b 07 76 75 84 51 ca d3 31 ec 71 79 2f e7 b0 e8 9c 43 47 78 8b 16 76 0b 7b 8e b9 1a 62 74 ed 0b a1 73 9b 7e 25 22 51 ad 14 ce 20 d4 3b 10 f8 0a 17 53 bf 72 9c 45 c9 79 e7 cb 70 63 85 ]
I: [00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ]
O: [dc 95 c0 78 a2 40 89 89 ad 48 a2 14 92 84 20 87 ]
I: [dc 95 c0 78 a2 40 89 89 ad 48 a2 14 92 84 20 87 ]
O: [00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ]

~

Source Code: github.com/stoops/aes/blob/main/aes.c

~

Finally got multi-queue batch-io linux kernel tun interface in C!

Thanks to Google’s AI code snippets, I was able to finally implement multiple threads all reading from a singular tun interface as well as each thread performing larger batch reads/writes in one singular syscall (up to 65536 bytes per call)! Here are the parameters (IFF_MULTI_QUEUE | IFF_VNET_HDR) and calls you need to set to get it:

[xorcipher.com]

~

Source Code: github.com/stoops/vpn/blob/main/gtun.c

Elliptic Curve Memory Refresher

EC ElGamal
point=f(x, y)
G - point (public)
k - integer (private)
Q=kG - point (public)
r - integer [random integer] (private)
s - integer [secret integer] (private)
M=sG - point [secret point] (private)
C=rG - point [reference point] (public)
E=rQ+M - point [encrypted point] (public)
(C, E) - message [(rG, rkG+M)] (public)
D=k*C - point [decryption point] (private)
M=E−D - point [((rkG+M)-krG)] (private)
note: must generate a unique r/M value/coordinate each time for a given key
note: encryption only works in one direction from public key to private key

~

EC DH
- each side generates a secret integer (r) and multiplies with point G (rG)
- each side sends their point multiplication result (rG) to the other
- each side multiplies their secret integer (r) with the exchanged point r(xG)
- each side can encrypt their results before sending with EC ElGamal

~

You can see point S has the same X, Y coordinates in the client as in the server and only points C and E were published!

~

Source Code: github.com/stoops/vpn/blob/main/lib/key.c

Key Generator: github.com/stoops/eckx/blob/main/ecdh.c

~

The Monkey-in-the-Middle Solution Revisited – VPN Style Proxy – LAN==2.5gbps && WAN==1.5gbps

So a little while back I upgraded all my lan components to 2.5gbps and I recently upgraded my wan to 1.5gbps and I wanted to tune up both the VPN solution I had previously made as well as the long since passed Proxy solution. The proxy solution, which is essentially a “Monkey-in-the-Middle” proxy on behalf of all network clients (no TUN interface read/writes are required) but the down side is managing thousands of client based UDP/TCP socket connections and firewall states and file descriptors and memory allocs. On a side note though, as a long time select caller, I finally learnt how to use poll as a better replacement.

With the VPN solution, I like and prefer the clean routing setup, however, I was only able to achieve ~900mbps whereas with the Proxy solution, it’s all pure sockets only where I am able to get ~1300mbps!

I wanted to retest what the performance would be of the MITM Proxy network solution over WiFi 6GHz@2400mbps and I was able to hit pretty fast VPN-style speeds over the network! I will have to retest to see how the VPN solution performs, however, I am trying to explore how multiple bulk IP packets can be read/written to/from the TUN interface in one singular syscall or being able to process larger size packet data before they get broken up by the interface MTU in the Linux Kernel… IFF_VNET_HDR / IFF_MULTI_QUEUE

Over 1.21 Jiggawatts! I mean Gigabits!!

~

~

Warning: Long Screenshot

Connection Management

🙂

MTUN: github.com/stoops/vpn

MITM: github.com/stoops/mitm

~

Trying Out Some Hacky Tampermonkey Javascript Modifications For A Better kick.com Live Stream Video Experience!

The kick.com live stream video experience on the web is not the best overall, it seems to constantly lose track of a previously buffered section of the live stream and then sends you to the live portion but mine also gets stuck on reconnecting again and remains frozen until a manual refresh! I tried to write a series of hacky javascript modifications to help solve the following issues:

  • Always show the bottom video controls bar on the live stream video
  • Always set the volume level to 100% instead of the continually defaulted 50%
  • Accepts a basic timestamp parameter to seek to in a live stream video
  • Keeps track of your latest buffered video seek position
  • Auto reseeks to the last known tracked timestamp if the buffered video jumps forward to live stream and auto reloads the page with the timestamp parameter if the stream connection becomes frozen
// ==UserScript==
// @name         klol
// @namespace    http://tampermonkey.net/
// @version      2026-08-19
// @description  try to take over the world!
// @author       You
// @match        https://kick.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=kick.com
// @grant        none
// @noframes
// ==/UserScript==

(function() {
    'use strict';

    var murl = location.href;
    var wait = 5;
    var redo = 0;

    function mmov() {
        var elem = document.getElementsByTagName("video");
        if (elem.length > 0) {
            const mous = new MouseEvent("mousemove", { bubbles:true, cancelable:true, view:window });
            elem[0].dispatchEvent(mous);
        }
        setTimeout(mmov, 0.91 * 1000);
    }
    setTimeout(mmov, 0.91 * 1000);

    function msec(inpt) {
        var info = inpt.split(":");
        if (info.length == 3) {
            return ((parseInt(info[0]) * 3600) + (parseInt(info[1]) * 60) + parseInt(info[2]));
        }
        return 0;
    }

    function mbuf(objc, time) {
        var left = new KeyboardEvent("keydown", { bubbles:true, cancelable:true, keyCode:37, which:37, key:"ArrowLeft", code:"ArrowLeft" });
        document.dispatchEvent(left);
        objc.currentTime = time;
    }

    var r = -1;
    var d = -2;
    function mtxt() {
        var s = location.href.replace(/\?.*$/mig, "");
        var l = document.getElementsByClassName("tabular-nums");
        if ((l.length > 0) && (l[0].innerText.match(/^[0-9]*:[0-9]*:[0-9]*$/mig))) {
            var t = l[0].innerText;
            var u = msec(t);
            var c = document.getElementById("channel-content");
            if (c) {
                var o = c.getElementsByClassName("min");
                if (o.length > 0) {
                    var q = document.querySelector("video");
                    var w = document.getElementById("time");
                    var z = document.querySelectorAll('[role="slider"]');
                    if (!w) {
                        o[0].innerHTML = ("<span style='font-family:Monaco;'><span id='stop' style='display:none;'></span><span id='last' style='display:none;'>0</span> &nbsp; <a href='" + s + "'><b>&lt;---&gt;</b></a> &nbsp; <a href='javascript:void(0);' onclick='var o = document.getElementById(\"stop\"); var v = document.querySelector(\"video\"); if (o.innerText == \"\") { o.innerText = \"stop\"; v.pause(); } else { v.play(); o.innerText = \"\"; }'><span id='secs'>[X]</span></a> &nbsp; <span id='time'>" + t + "</span> &nbsp; </span>" + o[0].innerHTML);
                    } else if (z.length > 1) {
                        if (murl.includes("?t=")) {
                            var p = (parseFloat(murl.replace(/^.*t=/mig, "")) - 5.0);
                            console.log(" TIME " + q.readyState + " p:" + p);
                            mbuf(q, p);
                            murl = "";
                        }
                        var stop = document.getElementById("stop");
                        if ((q.readyState != 4) && (stop.innerText == "")) {
                            console.log(" LOAD " + q.readyState + " r:" + r);
                            if (wait > 0) {
                                wait -= 1;
                            } else {
                                if (r > 15) {
                                    location.href = (s + "?t=" + r);
                                } else {
                                    location.href = s;
                                }
                                stop.innerText = "x";
                            }
                        }
                        var last = document.getElementById("last");
                        var g = parseFloat(z[1].parentNode.style.left.replace(/[^0-9.]/mig, " "));
                        var f = parseInt(u / ((g + 0.1) / 100));
                        var e = parseInt(u + ((f - u) * 0.75));
                        var h = parseInt(last.innerText);
                        var x = parseInt(q.currentTime);
                        if ((r > 15) && ((x < 15) || (redo > 0))) {
                            if (x < r) {
                                console.log(" BACK " + q.readyState + " w:" + w.innerText + " x:" + x + " u:" + u + " h:" + h + " e:" + e + " f:" + f + " g:" + g + " r:" + r);
                                mbuf(q, r);
                            }
                            if (redo > 0) { redo -= 1; }
                        } else if ((r < 0) || (u < h)) {
                            var y = document.getElementById("secs");
                            if ((x > 15) && (Math.abs(x - d) > 15)) {
                                y.style.color = "#31e531";
                                y.innerText = (" [" + x + "] ");
                                r = x; d = -9;
                                last.innerText = e;
                            } else if (d > -5) {
                                y.style.color = "#e95555";
                                y.innerText = (" [" + x + "|" + u + "] ");
                                r = -9; d = x;
                                last.innerText = "0";
                            }
                            w.innerText = t;
                        } else if (r > 15) {
                            console.log(" KICK " + q.readyState + " w:" + w.innerText + " x:" + x + " u:" + u + " h:" + h + " e:" + e + " f:" + f + " g:" + g + " r:" + r);
                            mbuf(q, r);
                            redo = 5;
                        }
                    }
                }
            }
        }
        setTimeout(mtxt, 1.91 * 1000);
    }
    setTimeout(mtxt, 1.91 * 1000);

    function maud() {
        var volu = document.querySelector("video");
        if (volu) { volu.volume = 1; }
        setTimeout(maud, 3.91 * 1000);
    }
    setTimeout(maud, 3.91 * 1000);
})();

Lessons Learned From Implementing Multi-Threaded VPNs!

When reading packets or network data from a tunnel interface, the order in which they are read does matter as they can impact connectionless protocols and also cause stateful protocols to spend time re-ordering data! There were three techniques that I tried implementing to solve this issue:

  • Map a packet address to a thread index during the entire time of every connection state
  • Index and order every packet read by number and wait to write them out in the same sequence
  • Lock and time and order each threaded process just like many pistons firing inside of an engine block

Added note: Making a VPN-style MITM Proxy service which handles thousands of network states and file descriptors is all about connection management and thread management!

Final note: Building the solutions on top of TCP allows for larger payloads, ordered delivery, auto keepalives, and connection management!

MTUN: github.com/stoops/vpn

MITM: github.com/stoops/mitm

~

A Highly Modified ARCF Stream Cipher Implementation In C

So after spending a few years working first on a encrypted proxy solution and then moving to a encrypted tunnel solution, I’ve carried forward this highly modified version of the (ARCF) RC4 stream cipher, trying to tune it up and make improvements to it over time. This latest version includes the following features over the original version.

ARCF [DROP-INIT-XCTR-XKEY-XCBC-KSMG-HASH] MODS

  • Extended key state generation algorithm to shuffle and drop the first 768-bytes (DROP)
  • Enhanced KSGA to incorporate and weight both the secret key as well as a 256-bit initialization vector (INIT)
  • Added IV can also include a 40-bit increasing counter to help prevent replay attacks (XCTR)
  • The key state itself is never directly used but instead only the XOR of two other key state byte index values (XKEY)
  • Core crypto allows for Cipher Byte Chaining which will XOR the last output byte with the next input byte (XCBC)
  • Core crypto loop also mixes in the IV and the CBC byte values back into the key state (KSMG)
  • The IV is then encrypted by the unique key state to provide a trailing 256-bit pseudo hash integrity tag checksum (HASH)

[Code Snippet]

~

[Example Zero-Out/One-Bit Changes Inputs/Outputs]

~

Source Code: github.com/stoops/vpn/blob/main/lib/enc.c

~

There Are Two Kinds Of VPNs…

I’ve spent a few years now looking for a higher-performing network-wide Proxy or VPN service. I’ve modified some frameworks, like nginx and openvpn, and I’ve created my own versions of those frameworks as well. After modifying OpenVPN, I decided to implement my own version of that modified functionality in roughly 1000 lines of C from 0. I spent some time recently fixing it up and tuning it up and I just wanted to summarize and write about it again. I’ve observed that there are 2 kinds of VPNs with 2 highly different use cases and design differences required. For example:

Client (WiFi) -> VPN -> Server (Wire) [service] - This can be UDP based as the client is directly setting the lower sized MTU tunnel interface on it's operating system so that it can properly size the outgoing packets before they are sent out from the machine so they won't be fragmented or dropped during the routing through the network as well as the underlying connection can also be too flakey for other protocols. 
Router (Wire) -> VPN -> Server (Wire) [infrastructure] - This should be TCP based which can handle a full sized MTU tunnel interface as the data is sent out in a synchronous stream rather than individual packets and the clients are not aware of any smaller sized MTUs in the middle of the network routing path as they assume a standardized 1500 byte MTU size by default and in addition there is less risk of communication interruption for a wired connection. 

The code is written in C and can be ran with multiple processes at the same time and each process will launch multiple threads which will all operate on a TUN interface created by that process so that the traffic can be load balanced across interfaces as well. The threads will read multiple packets in bulk and transfer them all over TCP in a single large size write/read socket call. It is fairly efficient and performative in my testing so far! No Bloat!!

Update note: I have since re-visited and re-worked my original VPN tun C framework to be much better in this blog post.

🙂

MTUN: github.com/stoops/vpn

MITM: github.com/stoops/mitm

~