Quick Blog Links

             
projects
  MacOS Applications     [x-code + objective-c]  
  SSHPass Automation Program     [python]  
  VPN-Like Tunneled Interface & Traffic     [python  /  networking]  
  DHCP/ARP Relay-Bridge ~ Proxying     [c  /  networking]  
  DNS A-Forwarder + Regex-Blocker     [go]  
written   Secure LAN Communication     [College Thesis]  
  College Project – Teaching Hacking!     [Course Paper]  
  ARM Assembly – A Basic Introduction…     [Blog Post]  
configs   WiFi Bridge ~ Network Diagram     Firewalling ~ eb|iptables  
  Cisco and OpenWRT     Ubiquiti and OpenWRT  
gear   Mac Mini     WiFi Networks  
about   root @           
 
 
# 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 '[email protected]<[email protected]~<[email protected]' | tr ' \t\r\n' ' ' | tr -s ' ' | tr '~' '\n' \
    | sed -e '[email protected]^.*<title>\(.*\)</title>.*<link>\(.*\)</link>.*[email protected]<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 
Quick Blog Links

Local HTTP Proxy Server – No Proxy Host Regex – Split Destination Client Connection

No usage documentation, however, posting this for historical purposes:

#ok:www.google.com:false
python3 proxy.py ~/.proxy.txt host:port
export https_proxy='http://127.0.0.1:9090'
import os, sys, re
import select, socket, socketserver


class proxysrv(socketserver.BaseRequestHandler):
    def init(self):
        self.size = (8 * 1024)
        self.file = sys.argv[1]
        self.info = sys.argv[2].split(":")
        self.host = (self.info[0], int(self.info[1]), True)
        self.sock = self.request

    def config(self, file):
        proxlist = []
        try:
            fobj = open(file, "r")
            for line in fobj.readlines():
                line = line.strip().split(":")
                stat = False
                if ("true" in line[2].lower()):
                    stat = True
                proxlist.append([line[0], line[1], stat])
        except:
            print("error","config")
        return proxlist

    def checks(self, conf, data):
        try:
            proxyreq = data.decode().split("\n")
            hostreqs = proxyreq[0].strip().split(" ")
            hostinfo = hostreqs[1].split(":")
            hostname = hostinfo[0]
            hostport = int(hostinfo[1])
            lasthost = ()
            for item in conf:
                regx = re.match("^.*%s$" % (item[1]), hostname)
                if ((item[0] == "no") and (not regx)):
                    lasthost = (hostname, hostport, item[2])
                if ((item[0] == "ok") and regx):
                    lasthost = (hostname, hostport, item[2])
            if (lasthost and (not lasthost[2])):
                return lasthost
        except:
            print("error","checks")
        return self.host

    def newcon(self, srcs, data, host):
        try:
            senddata = "HTTP/1.1 200 Connection established\r\nProxy-Connection: Keep-Alive\r\n\r\n".encode()
            sockobjc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sockobjc.connect((host[0], host[1]))
            if (host[2]):
                sockobjc.sendall(data)
            else:
                srcs.sendall(senddata)
            return sockobjc
        except:
            print("error","newcon")
        return None

    def relays(self, srcs, dsts):
        try:
            while True:
                (readlist, _, _) = select.select([srcs, dsts], [], [])
                for sockitem in readlist:
                    if (sockitem == dsts):
                        data = dsts.recv(self.size)
                        print("dsts",len(data))
                        if (not data):
                            raise
                        srcs.sendall(data)
                    if (sockitem == srcs):
                        data = srcs.recv(self.size)
                        print("srcs",len(data))
                        if (not data):
                            raise
                        dsts.sendall(data)
        except:
            pass

    def handle(self):
        self.init()

        proxlist = self.config(self.file)
        recvdata = self.sock.recv(self.size)
        desthost = self.checks(proxlist, recvdata)
        sockobjc = self.newcon(self.sock, recvdata, desthost)

        print("addr",self.client_address)
        print("data",recvdata)
        print("host",desthost)

        if (sockobjc):
            self.relays(self.sock, sockobjc)


if (__name__ == "__main__"):
    for e in ["http_proxy", "https_proxy", "no_proxy"]:
        for v in [e.upper(), e.lower()]:
            print("envr",v)
            os.environ[v] = ""

    sockobjc = socketserver.TCPServer(("127.0.0.1", 9090), proxysrv)
    sockobjc.serve_forever()
Local HTTP Proxy Server – No Proxy Host Regex – Split Destination Client Connection

Bored on Reddit and submitting funny coding comments

So there was a Reddit thread today that was diverging into bad coding tests plus grade evaluation puns (C++) – so I tried to make a purposefully confusing C program behave in a way that a coder or programmer wouldn’t exactly expect. After I wrote it, I had to put in some for-loop-printf-debug statements just to confirm and demonstrate how the right-to-left side value-lookup to delayed-increase to index-assignment works in C, it’s pretty neat to try and analyze how and why this is “working” lol!

#include <stdio.h>
int main()
{
    char A = 'A', B = 'B', C = 'C', D = 'D', E = 'E', F = 'F';
    char grades[256];
    grades[A++] = A++;
    grades[B++] = B++;
    grades[C++] = C++;
    grades[D++] = D++;
    grades[E++] = E++;
    grades[F++] = F++;
    printf("My grade is %c!\n",grades[C++]);
}

And basically this will print out “My grade is D!” – but it’s fun to trace through how each line will process the value statement first and then the assignment index is processed afterwards. In addition, each line will affect the next statement below because of the increases that take place in between processing sides, so the future lookup index values are being changed along the way! 🙂

Bored on Reddit and submitting funny coding comments

Another Helper App – BrowserBot

So, there was one more app I needed to complete my personal trilogy, and it’s named BrowserBot! It’s an app that will help “curl” the web for any page you’d like to monitor for changes, and you can feed it custom commands (similar to ClippyCommand) so it will parse out any field/value you specify. I had scripts running in a crontab to do this but I wanted a more centralized and official place to quickly view the latest and refreshed web data that I was interested in tracking for security reasons!

Source Code: github.com/stoops/BrowserBot

Another Helper App – BrowserBot

A new MacOS app – ClippyCommand!

So as a Mac/Linux/BSD fan, I’ve posted a few different Microsoft related creations/customizations that I use as a daily reminder of the good old days! Even though I wasn’t the biggest fan of Windows and Explorer, I still tried to make some dock icons to appreciate and represent both of them in the future. I was just missing one last memory of mine, which was, Clippy! I created a new MacOS app that allows you to pipe the copy-paste buffer into a set of your own customized bash shell command line programs and it will rewrite the paste buffer so you are ready to go! This is the second custom app in my dock, along side my DynaDock application.

Source Code: github.com/stoops/ClippyCommand

Some of my more useful and commonly used editing/formatting commands!

A new MacOS app – ClippyCommand!

A World Of Different Switches

So I recently ordered a Drop Alt keyboard with Halo True switches as it offered the ability to hot-swap them out. The case and frame is much more stable and solid compared to the Ducky Mini and it produces a much more clunky-analogue, type-writer kind of sound. I put in some Holy Panda switches and they have a greater feeling tactile bump at the start of the key travel along with a slightly lighter spring force for an easier press downwards. Both are great switches to type on overall!

Edit: For comparison, the Cherry Brown switch has a tactile resistance during the key travel, but the bump in the beginning is not as noticeable or pronounced as to what some of the other switches offer and the spring force is much lighter.

A World Of Different Switches

Computer Mouse Selection

The Logitech G500 (Gaming) – A long time ago, this mouse was one of the most comfortable and capable performing ones on the market!

The Logitech MX3 (Mac) – Still one of the best feeling mice in the hand. A simple design and clean layout along with free-wheel-scrolling continued plus thumb-ledge + slightly-angled + softer-feeling!

Main Keyboard Selection


Drop-Alt+Holy-Pandas!

~

Computer Mouse Selection

My first real mechanical keyboard!

Intro: So, I know I’m a little late to the game in terms of getting a mechanical keyboard, however, I thought it would be a good investment to have a quality one just in case while WFH. I picked up one of those Ducky One-2-Mini keyboards in a white color and it offers some great built-in-hardware features. There are some random color-matching keys that come with it which can make it look a little bit more vintage / retro / classic. It’s not the lowest-profile one but the PBT keycaps are great quality and hug your fingers!

Pros:

  • Programmable and saveable profiles
  • Swappable key mappings for caps/ctrl/alt/cmd/fn
  • Individually lit and bright RGB color patterns for every key
  • Cherry MX Brown Switches with a serious sound and tactile travel
  • Solid key stabilizers and firm case frame
  • Lays flat plus two levels of height adjustment all with rubber feet
  • USB-C detachable-cable + firmware updates

Mods:

  • Remapped dedicated arrow keys, removed one stab set
  • Added some extra PBT keycap colors
  • Added one O-Ring to the space-bar keycap stem
  • Removed the top case cover piece
  • Replaced the bottom case feet with more medium-sized felt-pads
  • Taped small pieces cut out from the keyboard box inside the bottom case
  • Purchased some M3-Sized self-tapping screws for more secure plate mounting

Cons:

  • Not filled with foam inside the keyboard case
  • Not hot-swappable switches
  • Not screw-in stabs

Mod-Sound(Impact): I placed a single O-Ring on the space-bar and it sounds much less hollow and more gentle, similar to a regular key press. I was able to replace the bottom rubber feet with felt pads and the resulting feel and sound is much softer and warmer. I also taped some thin pieces of cardboard cut out from the keyboard box to the inside of case so that the key presses sound a bit deeper and quieter as they are absorbed and dampened.

Mod-Sound(Airborne): I removed the top cover piece which greatly reduces and lessens the amount of sound wave interference that bounces around down within the inside of the case. From the mounting plate upwards, the top portion of the switch and keycap now sit at the highest point on the keyboard. You can hear a little spring ping if you listen closely along with slightly rougher switch noise, but the sound can now directly travel outwards and away from the keys and case, unobstructed. Each key press has a greater distinction and clarity to it, thus making it a much quieter and smoother typing experience.

Mod-Visual(Keycaps): So after spending some time with this little keyboard, I was able to remap dedicated arrow keys to be on the right side while keeping the main modifier keys on the left side (I also remapped caps lock key to be a backup fn key, as this setup is geared more towards coding on the mac). I purchased some extra keycap colors although it would be nice to find some properly wide arrow keys in the future!


Finale: It’s a pretty good MK overall esp for just a stock unit. I wish I could get one of the ones like Taeha makes as they sound soo super smooth and clean and crisp — mechanical contact points only. He’s able to lube all of the sub-components like springs, switches, stabilizers and basically eliminate or reduce most of the noises, thus creating some purrre asmr — buttery sounding — Holy Pandas! (:

¯\_(ツ)_/¯
My first real mechanical keyboard!

Exploring GIT Commit Hashes & Generating Cryptographic Zeros

So I was trying to research what goes into generating a GIT commit hash and I thought I would try to personalize the cryptographic hash output a little bit. My computer isn’t that powerful but it may be possible to generate more zeros!

import time, hashlib, subprocess

head = subprocess.check_output("git cat-file commit HEAD | sed -e 's/> .*$/> %d %s/'", shell=True)
secs = int(time.time())
rnds = (secs - 99999999)
offs = "-0500"
begs = ("0" * 6)
ghsh = ""

while (not ghsh.startswith(begs)):
    rnds = (rnds + 1)
    comm = (head % (secs, offs, rnds, offs))
    data = ("commit %d\0%s" % (len(comm), comm))
    ghsh = hashlib.sha1(data).hexdigest()

chk = raw_input("Commit hash [%s]?: " % (ghsh)).strip()
if (chk.lower().startswith("y")):
    comd = ("GIT_COMMITTER_DATE='%d %s' git commit -a --amend --no-edit --date='%d %s'" % (rnds, offs, secs, offs))
    subprocess.call(comd, shell=True)
Exploring GIT Commit Hashes & Generating Cryptographic Zeros

The Year End

Well, 2021 has been another crazy year – almost like 2020, with lots of ups and downs. I tried post as much content as I could but it’s been tough of course with everything going on in life. I was also bored and trying to make a Music app icon but I didn’t like how it turned out so I’ll post it here to save it for the future. Hopefully the next year coming up will turn out better – happy holidays, stay safe out there!

The Year End

Manually Configuring Some MacOS Apps

Just wanted to keep a list of manual configuration items for each macOS app, in case anyone also finds them useful as well.

Brave (FF UI is freezing when waking from sleep)

  • redirector-extension
    • glob -> http*://www.reddit.com/* -> https://old.reddit.com/$2
    • regex -> ://[^/]*(facebook|fbcdn|fbsbx|fbstatic)[^/]*/ -> http://127.0.0.1

Firefox

  • about:config
    • gfx.webrender.all = true
    • gfx.direct2d.disabled = true
    • layers.acceleration.disabled = true

TextMate

  • command_line
    • defaults write com.macromates.TextMate disableTypingPairs -bool YES

macOS

Music

  • Restore Library
    • Hold “Option” during launch & select “Choose Library” to load a saved music library file
Manually Configuring Some MacOS Apps