<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>blog.farhan.codes</title>
    <link>https://blog.farhan.codes/</link>
    <description>Recent content on blog.farhan.codes</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 18 Aug 2025 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.farhan.codes/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Container Primitives - Linux Namespaces</title>
      <link>https://blog.farhan.codes/2025/08/18/container-primitives-linux-namespaces/</link>
      <pubDate>Mon, 18 Aug 2025 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2025/08/18/container-primitives-linux-namespaces/</guid>
      <description>&lt;p&gt;Container technology revolutionized software development and deployment, enabling unprecedented levels of efficiency, scalability, and consistency across computing environments. They allow for greater server density by avoiding rerunning a resource hungry second operating system within a virtual machine. And while Docker leaders the pack, there are numerous other implementations that all conform to the &lt;a href=&#34;https://opencontainers.org/&#34;&gt;OCI standard&lt;/a&gt;, such as Podman, LXC, Mesos, Flatpak and others. Though they may appear different, all of these container technologies are fundamentally built upon the same basic Linux kernel primitives.&lt;/p&gt;</description>
    </item>
    <item>
      <title>BSD WiFi Buffer Management</title>
      <link>https://blog.farhan.codes/2025/06/30/bsd-wifi-buffer-management/</link>
      <pubDate>Mon, 30 Jun 2025 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2025/06/30/bsd-wifi-buffer-management/</guid>
      <description>&lt;p&gt;FreeBSD (and all systems using net80211) utilize memory buffers to receive, manipulate and process network traffic. These buffers&#xA;are pre-allocated during attachment, due to the performance cost associated with dynamic allocation, and utilize a single-linked&#xA;&lt;code&gt;queue(3)&lt;/code&gt; structure.&lt;/p&gt;&#xA;&lt;p&gt;Devices utilize two buffer queues, Rx and Tx. The underlying structure is often the same.&lt;/p&gt;&#xA;&lt;h1 id=&#34;receive-buffers&#34;&gt;Receive Buffers&lt;/h1&gt;&#xA;&lt;p&gt;There are two types of Rx buffers: Inactive and Active, included in the softc as &lt;code&gt;sc_rx_inactive&lt;/code&gt; and &lt;code&gt;sc_rx_active&lt;/code&gt;, respectively.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Power Management During Driver Development Environment</title>
      <link>https://blog.farhan.codes/2025/04/11/power-management-during-driver-development-environment/</link>
      <pubDate>Fri, 11 Apr 2025 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2025/04/11/power-management-during-driver-development-environment/</guid>
      <description>&lt;p&gt;You can use Power Per Port Switch (PPPS) functionality to power-cycle a USB device during driver development.&lt;/p&gt;&#xA;&lt;h1 id=&#34;introduction-to-the-problem&#34;&gt;Introduction to the Problem&lt;/h1&gt;&#xA;&lt;p&gt;To reduce my hardware footprint, I typically work on device driver development in a VM running on the same multi-use personal system that houses my notes, files, picture backup, etc. This works fine for general development if the kernel crashes often the device is becomes unresponsible without a power-cycle. That leaves me with one of two options:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Debugging a running FreeBSD kernel in a VM using kgdb</title>
      <link>https://blog.farhan.codes/2023/12/21/debugging-a-running-freebsd-kernel-in-a-vm-using-kgdb/</link>
      <pubDate>Thu, 21 Dec 2023 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2023/12/21/debugging-a-running-freebsd-kernel-in-a-vm-using-kgdb/</guid>
      <description>&lt;h1 id=&#34;using-kgdb-remote-debugging-for-freebsd-vms&#34;&gt;Using KGDB Remote Debugging for FreeBSD VMs&lt;/h1&gt;&#xA;&lt;p&gt;This guide explains how to debug a running FreeBSD kernel in a VM using &lt;code&gt;kgdb&lt;/code&gt;. The default &lt;code&gt;ddb&lt;/code&gt; debugger has decent functionality, but unless you somehow know dynamic memory addresses, those capabilities are effectively unusable. Conversely, &lt;code&gt;kdb&lt;/code&gt; offers a more robust interface and set of features.&lt;/p&gt;&#xA;&lt;p&gt;While there is a &lt;a href=&#34;https://docs.freebsd.org/en/books/developers-handbook/kerneldebug/#kerneldebug-online-gdb&#34;&gt;handbook section&lt;/a&gt; on &lt;code&gt;kgdb&lt;/code&gt;, it assumes you are running FreeBSD on bare-metal with a physical serial port connected to another serial host, not on modern virtualized infrastructure. In this guide I hope to bridge this gap and make the process I went through easier for the next person. I ran into this problem after trying to set a breakpoint on a variable, only to realize that &lt;code&gt;ddb&lt;/code&gt; required me to know exact memory addresses and setting up &lt;code&gt;kgdb&lt;/code&gt; for my use-case was not well documented and hope it benefits someone later down the line.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Sarf Generator</title>
      <link>https://blog.farhan.codes/2023/11/21/sarf-generator/</link>
      <pubDate>Tue, 21 Nov 2023 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2023/11/21/sarf-generator/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m making available a Arabic word conjugator tool I wrote in TypeScript. It is located here &lt;a href=&#34;https://sarf.farhan.codes&#34;&gt;https://sarf.farhan.codes&lt;/a&gt;. Aside from the basics, it takes into account some foundational rules of تعللات (special conjugation of certain letters)&lt;/p&gt;&#xA;&lt;p&gt;There is some stuff its missing, such as repeating letters or edge-cases, but its a good general tool that I use myself when I&amp;rsquo;m confused. It is also the first project I ever wrote in Typescript.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Benchmarking Base32 vs Base64</title>
      <link>https://blog.farhan.codes/2023/01/02/benchmarking-base32-vs-base64/</link>
      <pubDate>Mon, 02 Jan 2023 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2023/01/02/benchmarking-base32-vs-base64/</guid>
      <description>&lt;p&gt;This is a very rudimentary benchmark of Base32 vs Base64 performance in Golang. This should also serve as an example of Golang&amp;rsquo;s benchmarking toolchain. Conclusion: Base64 is faster.&lt;/p&gt;&#xA;&lt;p&gt;This code works by creating 1000 test strings, then performing Base32 and Base64 conversions. Timing is done by Go&amp;rsquo;s built-in benchmarking tooling, which is part of the testing framework. Here is the code:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;package main&#xA;&#xA;import &amp;#34;os&amp;#34;&#xA;import &amp;#34;time&amp;#34;&#xA;import &amp;#34;testing&amp;#34;&#xA;import &amp;#34;math/rand&amp;#34;&#xA;import &amp;#34;encoding/base32&amp;#34;&#xA;import &amp;#34;encoding/base64&amp;#34;&#xA;&#xA;var strings = []string{}&#xA;&#xA;func setupStrings(n int) []string {&#xA;&#x9;charset := &amp;#34;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&amp;#34;&#xA;&#x9;strings := []string{}&#xA;&#x9;rand.Seed(time.Now().UnixNano())&#xA;&#xA;&#x9;for i := 0; i &amp;lt; n; i++ {&#xA;&#x9;&#x9;newstring := genRandomString(charset, 32)&#xA;&#x9;&#x9;strings = append(strings, newstring)&#xA;&#x9;}&#xA;&#xA;&#x9;return strings&#xA;}&#xA;&#xA;func genRandomString(charset string, length int) string {&#xA;&#x9;b := make([]byte, length)&#xA;&#xA;&#x9;for i := range b {&#xA;&#x9;&#x9;b[i] = charset[rand.Intn(len(charset))]&#xA;&#x9;}&#xA;&#x9;return string(b)&#xA;}&#xA;&#xA;func setup() {&#xA;&#x9;strings = setupStrings(1000)&#xA;}&#xA;&#xA;func BenchmarkBase32Run(b *testing.B) {&#xA;&#x9;for i := 0; i &amp;lt; b.N; i++ {&#xA;&#x9;&#x9;for _, s := range strings {&#xA;&#x9;&#x9;&#x9;_ = base32.StdEncoding.EncodeToString([]byte(s))&#xA;&#x9;&#x9;}&#xA;&#x9;}&#xA;}&#xA;&#xA;func BenchmarkBase64Run(b *testing.B) {&#xA;&#x9;for i := 0; i &amp;lt; b.N; i++ {&#xA;&#x9;&#x9;for _, s := range strings {&#xA;&#x9;&#x9;&#x9;_ = base64.StdEncoding.EncodeToString([]byte(s))&#xA;&#x9;&#x9;}&#xA;&#x9;}&#xA;}&#xA;&#xA;func TestMain(m *testing.M) {&#xA;&#x9;setup()&#xA;&#x9;code := m.Run()&#xA;&#x9;os.Exit(code)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You will also need a main function, mine is as follows:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Let IRC Die</title>
      <link>https://blog.farhan.codes/2022/12/30/let-irc-die/</link>
      <pubDate>Fri, 30 Dec 2022 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2022/12/30/let-irc-die/</guid>
      <description>&lt;p&gt;For the sake of progress, let IRC die!&lt;/p&gt;&#xA;&lt;p&gt;IRC was great, but its continued usage is a relic of an older internet, when storage was expensive and servers were expensive. At this stage, communities should migrate off of IRC to slack-like solutions like Mattermost or Matrix.&lt;/p&gt;&#xA;&lt;p&gt;IRC served as a workhorse for communication, but it has failed to adapt to modern demands. In particular:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Offline sending and retrieval&lt;/li&gt;&#xA;&lt;li&gt;Referenceable conversations (ie, URLs to a conversation)&lt;/li&gt;&#xA;&lt;li&gt;Editing messages&lt;/li&gt;&#xA;&lt;li&gt;Formatted text (including media)&lt;/li&gt;&#xA;&lt;li&gt;True decentralization&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Many of these problems can be remediated at the client-level, but not without a cost.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Simple dtrace use-case</title>
      <link>https://blog.farhan.codes/2022/07/22/simple-dtrace-use-case/</link>
      <pubDate>Fri, 22 Jul 2022 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2022/07/22/simple-dtrace-use-case/</guid>
      <description>&lt;p&gt;Very small example of using &lt;code&gt;dtrace&lt;/code&gt;, mostly for me to refernece in the future.&lt;/p&gt;&#xA;&lt;p&gt;As I port this wifi card, I am running into a situation where &lt;code&gt;ifconfig&lt;/code&gt; is&#xA;reporting an error that I do not understand. From previous reading, I know that&#xA;&lt;code&gt;ifconfig&lt;/code&gt; interfaces with the kernel through &lt;code&gt;ioctl&lt;/code&gt;. Driver code initially&#xA;handles &lt;code&gt;ioctl&lt;/code&gt; requests by implementing the &lt;code&gt;ic-&amp;gt;ic_ioctl&lt;/code&gt; handler.&lt;/p&gt;&#xA;&lt;p&gt;To that end, in my handler I printed the &lt;code&gt;u_long cmd&lt;/code&gt; variable with the intention&#xA;of looking up the value. However, the source has them listed like this in&#xA;&lt;code&gt;/usr/src/sys/sys/sockio.h&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>My FreeBSD Development Environment</title>
      <link>https://blog.farhan.codes/2022/03/16/my-freebsd-development-environment/</link>
      <pubDate>Wed, 16 Mar 2022 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2022/03/16/my-freebsd-development-environment/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m writing this primarily for myself, but also for others to reference and improve upon.&lt;/p&gt;&#xA;&lt;p&gt;I run FreeBSD CURRENT in a VM. I use a VM for the inevitable situation where it crashes. I prefer to use Qemu on KVM, almost exclusively because of the ease of using the graphical &lt;code&gt;virt-manager&lt;/code&gt; over ssh, and the ease of rebooting.&lt;/p&gt;&#xA;&lt;p&gt;FreeBSD cannot do crash dumps to VT disks (vtdb0) so I make sure the Disk type is SATA. Also, the disk should be at least 40GBs, or else you won&amp;rsquo;t be able to dump the kernel core in the event of a crash.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rebuilt This Blog</title>
      <link>https://blog.farhan.codes/2021/08/04/rebuilt-this-blog/</link>
      <pubDate>Wed, 04 Aug 2021 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2021/08/04/rebuilt-this-blog/</guid>
      <description>&lt;p&gt;I rebuilt this blog after a few months of having it down.&lt;/p&gt;&#xA;&lt;p&gt;Long story short, I ran the blog off of WordPress and self-hosted on my personal server for years. When I moved into a house and migrated off my personal server, I somehow lost the &lt;code&gt;wp_content.sql&lt;/code&gt; file, and &lt;em&gt;only&lt;/em&gt; that file, somewhere in the mix. An accidental deletion? Who knows. So all posts died. Bummer. Fortunately, I was able to rebuild the content from Wayback Machine (seriously) and Google Cache (yeah, seriously).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Unexpected IPv6 Behavior on Linux</title>
      <link>https://blog.farhan.codes/2020/05/18/unexpected-ipv6-behavior-on-linux/</link>
      <pubDate>Mon, 18 May 2020 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2020/05/18/unexpected-ipv6-behavior-on-linux/</guid>
      <description>&lt;p&gt;Linux has some strange default IPv6 behavior. Here are a few things I noticed…&lt;/p&gt;&#xA;&lt;p&gt;You can bind to a port on an IPv4 address while all of your tools will report that the port is on IPv6. For example, if your host is 198.51.100.1, you can bind to ::FFFF:198.51.100.1 and all state-checking tools like netstat, ss or lsof will report the listener as on an IPv6-port. You can do this in netcat with &lt;code&gt;nc -6 -l ::FFFF:192.51.100.1&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Capturing Input/Output of Another Process in C</title>
      <link>https://blog.farhan.codes/2019/08/26/capturing-input/output-of-another-process-in-c/</link>
      <pubDate>Mon, 26 Aug 2019 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2019/08/26/capturing-input/output-of-another-process-in-c/</guid>
      <description>&lt;p&gt;In my travels in C programming, I periodically need to run another process and redirect its standard output back to the first process. While it is straight forward to perform, it is not always obvious. This article will explain the process of how this is done in three sections.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;High Level Overview&lt;/li&gt;&#xA;&lt;li&gt;Explanation of each line&lt;/li&gt;&#xA;&lt;li&gt;Code Sample&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;High Level Overview&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Create a three &lt;a href=&#34;https://www.freebsd.org/cgi/man.cgi?query=pipe&amp;amp;apropos=0&amp;amp;sektion=2&#34;&gt;pipe(2)&lt;/a&gt;s for standard input, output and error&#xA;&lt;a href=&#34;https://www.freebsd.org/cgi/man.cgi?query=fork&amp;amp;apropos=0&amp;amp;sektion=2&#34;&gt;fork(2)&lt;/a&gt; the process&#xA;The child process runs &lt;a href=&#34;https://www.freebsd.org/cgi/man.cgi?query=dup2&amp;amp;apropos=0&amp;amp;sektion=2&#34;&gt;dup2(2)&lt;/a&gt; to over the pipes to redirect the new processes’s standard&#xA;input, output and error to the pipe.&#xA;The parent process reads from the &lt;a href=&#34;https://www.freebsd.org/cgi/man.cgi?query=pipe&amp;amp;apropos=0&amp;amp;sektion=2&#34;&gt;pipe(2)&lt;/a&gt; descriptors as needed.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Avoiding Redundancy with Function Pointers</title>
      <link>https://blog.farhan.codes/2019/07/24/avoiding-redundancy-with-function-pointers/</link>
      <pubDate>Wed, 24 Jul 2019 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2019/07/24/avoiding-redundancy-with-function-pointers/</guid>
      <description>&lt;p&gt;I am currently writing OpenGit, a BSD-licensed re-implementation of Linus Torvald’s Git (lower-cased going forward). This frequently involves reviewing git’s source code to understand how it works under the hood. One of the things I consistently encounter is git performing similar and sizable tasks in multiple different ways and places, resulting in redundancy and a higher maintenance cost.&lt;/p&gt;&#xA;&lt;p&gt;In this brief entry, I will discuss a classic problem and how I solve it: When minor variants of a routine result in multiple implementations.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Generating a &#34;vanity&#34; PGP Key ID Signature</title>
      <link>https://blog.farhan.codes/2019/02/14/generating-a-vanity-pgp-key-id-signature/</link>
      <pubDate>Thu, 14 Feb 2019 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2019/02/14/generating-a-vanity-pgp-key-id-signature/</guid>
      <description>&lt;p&gt;Here’s a quick bash script I used to generated a “vanity” PGP key with the last two bytes (four characters) set to FFFF.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/usr/bin/env bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; :&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gpg --debug-quick-random -q --batch --gen-key &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;lt;&amp;lt; EOF&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;Key-Type: RSA&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;Key-Length: 2048&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;Name-Email: user@domain&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;Name-Real: Real Name&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;Passphrase: yourverylongpassphrasegoeshere&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;EOF&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; gpg -q --list-keys | head -4 | tail -c &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt; | grep FFFF&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;then&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        echo Break&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        exit &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        gpg2 --batch -q --yes --delete-secret-and-public-key &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;gpg -q --list-keys&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;| head -4 | tail -n 1&lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;fi&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I also added no-secmem-warning to &lt;code&gt;~/.gnupg/options&lt;/code&gt; to suppress the insecure memory warnings. When I set it to a 1024-bit key, it only took about 3 hours, while 2048-bit took 20 hours across.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Passing by Reference, C&#39;s Garbage Collection</title>
      <link>https://blog.farhan.codes/2019/01/13/passing-by-reference-cs-garbage-collection/</link>
      <pubDate>Sun, 13 Jan 2019 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2019/01/13/passing-by-reference-cs-garbage-collection/</guid>
      <description>&lt;p&gt;The C programming language has no built-in garbage-collection mechanism – and it very likely never will. This can (and does) lead to memory leaks by even the best programmers. It is also an imputes for the Rust language. However, depending on your use-case, it is still possible to structure your code to use the stack as a sort of zero-cost “garbage collector”.&lt;/p&gt;&#xA;&lt;p&gt;Lets jump directly into the code!&lt;/p&gt;&#xA;&lt;p&gt;This is how many applications instantiate and utilize a structure or arbitrary object.&lt;/p&gt;</description>
    </item>
    <item>
      <title>SHA1 on FreeBSD Snippet</title>
      <link>https://blog.farhan.codes/2018/10/01/sha1-on-freebsd-snippet/</link>
      <pubDate>Mon, 01 Oct 2018 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2018/10/01/sha1-on-freebsd-snippet/</guid>
      <description>&lt;p&gt;I needed some code that produces SHA1 digests for a project I am working on. I hunted through the FreeBSD’s sha1(1) code and produced this minimal snippet. Hopefully this helps someone else in the future.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Including optimized-out kernel symbols in dtrace on FreeBSD</title>
      <link>https://blog.farhan.codes/2018/08/16/including-optimized-out-kernel-symbols-in-dtrace-on-freebsd/</link>
      <pubDate>Thu, 16 Aug 2018 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2018/08/16/including-optimized-out-kernel-symbols-in-dtrace-on-freebsd/</guid>
      <description>&lt;p&gt;&lt;em&gt;Warning: This is a hack that involves modifying the build scripts. tldr; modify /usr/src/sys/conf/kern.pre.mk to change all references of -O2 to -O0.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Have you ever had dtrace(1) on FreeBSD fail to list a probe that should exist in the kernel? This is because Clang will optimize-out some functions. The result is ctfconvert(1) will not generate debugging symbols that dtrace(1) uses to identify probes. I have a quick solution to getting those probes visible to dtrace(1).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Linux maintains bugs, The real reason ifconfig on Linux is deprecated</title>
      <link>https://blog.farhan.codes/2018/06/25/linux-maintains-bugs-the-real-reason-ifconfig-on-linux-is-deprecated/</link>
      <pubDate>Mon, 25 Jun 2018 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2018/06/25/linux-maintains-bugs-the-real-reason-ifconfig-on-linux-is-deprecated/</guid>
      <description>&lt;p&gt;In my third installment of FreeBSD vs Linux, I will discuss underlying reasons for why Linux moved away from ifconfig(8) to ip(8).&lt;/p&gt;&#xA;&lt;p&gt;In the past, when people said, “Linux is a kernel, not an operating system”, I knew that was true but I always thought it was a rather pedantic criticism. Of course no one runs just the Linux kernel, you run a distribution of Linux. But after reviewing userland code, I understand the significant drawbacks to developing “just a kernel” in isolation from the rest of the system.&lt;/p&gt;</description>
    </item>
    <item>
      <title>fsync(2) on FreeBSD vs Linux</title>
      <link>https://blog.farhan.codes/2018/05/16/fsync2-on-freebsd-vs-linux/</link>
      <pubDate>Wed, 16 May 2018 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2018/05/16/fsync2-on-freebsd-vs-linux/</guid>
      <description>&lt;p&gt;Even with our modern technology, hard-disk operations tend to be the slowest and most painful part of any modern system. As such, modern operations implement buffering mechanism. In this schema, when an application calls write(2), rather than immediately performing physical disk operations, the operating stores data in a kernel buffer. When the buffer exceeds a certain amount or the when an application falls the fsync(2) system call, the kernel begins writing to the disk.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Tracing ifconfig commands from userspace to device driver</title>
      <link>https://blog.farhan.codes/2018/02/23/tracing-ifconfig-commands-from-userspace-to-device-driver/</link>
      <pubDate>Fri, 23 Feb 2018 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2018/02/23/tracing-ifconfig-commands-from-userspace-to-device-driver/</guid>
      <description>&lt;p&gt;I am currently working on expanding FreeBSD’s rtwn(4) wireless device driver. I have the basics down, such as initialization, powering on and off, loading the firmware, etc, and am now trying to fill in specific ifconfig(8) methods. This requires having an in depth knowledge of how ifconfig(8) commands pass are ultimately delivered to the driver. I could not find concise documentation that outlines each stage of the process. So I wrote one! 🙂&lt;/p&gt;</description>
    </item>
    <item>
      <title>That time I Reverse-Engineered the Motorola CBEP Protocol</title>
      <link>https://blog.farhan.codes/2017/12/04/that-time-i-reverse-engineered-the-motorola-cbep-protocol/</link>
      <pubDate>Mon, 04 Dec 2017 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2017/12/04/that-time-i-reverse-engineered-the-motorola-cbep-protocol/</guid>
      <description>&lt;p&gt;This is the tale of how I reverse-engineered a Motorola CPS radio protocol to make it work on Linux. While this may have been of questionable legality and thus lost interest in the project, I learned a lot on how to reverse engineer. I’m writing this entry more than a year after I initially did this, so I may be a little rusty on the details, but this is the gist of it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Migrating from FreeNAS to FreeBSD</title>
      <link>https://blog.farhan.codes/2017/11/21/migrating-from-freenas-to-freebsd/</link>
      <pubDate>Tue, 21 Nov 2017 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2017/11/21/migrating-from-freenas-to-freebsd/</guid>
      <description>&lt;p&gt;I love FreeNAS. Its awesome, well built, well-supported. But as my needs increased, I wanted to use my FreeNAS box for more than the basics. In particular, I was moving towards a single host to run as a:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Family NAS server&lt;/li&gt;&#xA;&lt;li&gt;Development server&lt;/li&gt;&#xA;&lt;li&gt;IRC client&lt;/li&gt;&#xA;&lt;li&gt;VM server&lt;/li&gt;&#xA;&lt;li&gt;Web server&lt;/li&gt;&#xA;&lt;li&gt;Email Server&lt;/li&gt;&#xA;&lt;li&gt;Git Server&lt;/li&gt;&#xA;&lt;li&gt;Home Firewall&lt;/li&gt;&#xA;&lt;li&gt;Home IPv6 gateway&lt;/li&gt;&#xA;&lt;li&gt;IPv6 VPN and Jump box&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;FreeNAS could easily do all of this. But I found myself using the device for everything but a NAS server. Also, as my experience on FreeBSD reaching proficient-status, I wanted to jump in the deep end and manually configure a production system from scratch. So I thanked FreeNAS for their contribution, yanked out the USB disks and installed FreeBSD 11.1 on a separate USB disk.&lt;/p&gt;</description>
    </item>
    <item>
      <title>FreeBSD kernel Makefile variables SRCTOP and SYSDIR</title>
      <link>https://blog.farhan.codes/2017/11/15/freebsd-kernel-makefile-variables-srctop-and-sysdir/</link>
      <pubDate>Wed, 15 Nov 2017 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2017/11/15/freebsd-kernel-makefile-variables-srctop-and-sysdir/</guid>
      <description>&lt;p&gt;I am currently writing a FreeBSD device driver and find myself lugging around the entire src. As you can imagine, this is quite large, especially if you are using any sort of version tracking system. So following the example &lt;a href=&#34;https://github.com/s3erios/rtwn&#34;&gt;here&lt;/a&gt;, I extracted out:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;/usr/src/sys/modules/rtwn/&#xA;/usr/src/sys/dev/rtwn/&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;into&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;/home/user/src/rtwn/sys/modules/rtwn/&#xA;/home/user/src/rtwn/sys/dev/rtwn/&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;However, when I ran make(1) in the &lt;code&gt;/home/user/src/rtwn/sys/modules/rtwn&lt;/code&gt;, I received an error saying:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;make: don&amp;#39;t know how to make r92c_attach.c. Stop&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This error message is extremely non-descriptive of the actual issue. After reviewing the aforementioned functioning Makefiles, I identified that the &lt;code&gt;SRCTOP&lt;/code&gt; and &lt;code&gt;SYSDIR&lt;/code&gt; were not set correctly.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Switched from Ubuntu-based to Fedora</title>
      <link>https://blog.farhan.codes/2017/09/25/switched-from-ubuntu-based-to-fedora/</link>
      <pubDate>Mon, 25 Sep 2017 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2017/09/25/switched-from-ubuntu-based-to-fedora/</guid>
      <description>&lt;p&gt;tl;dr: Fedora’s debugging packages work, Ubuntu’s are out of date.&lt;/p&gt;&#xA;&lt;p&gt;Linux = Linux = Linux, whether Arch or Slackware or Ubuntu or OpenSUSE or Linux from scratch as I once did (before there were instructions!). Unless and until the kernel forks and someone decides to modify the syscall table, they all use the same basic syscalls, they typically share the same basic libraries and core utilities, etc. They’re all the same.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Custom Kernel Modules for Chromebook</title>
      <link>https://blog.farhan.codes/2017/04/16/custom-kernel-modules-for-chromebook/</link>
      <pubDate>Sun, 16 Apr 2017 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2017/04/16/custom-kernel-modules-for-chromebook/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Note: I wrote this about a year and a half ago, but I refer to it all the time. Hopefully the instructions have not changed too much! Enjoy!&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I recently purchased a Chromebook. It’s great, it symbolizes the direction the PC market should head – inexpensive, low-powered ARM processor, defense in depth resistance to malware and simple for non-technical users. And with crouton, it functions quite cleanly as a Debian-based workstation.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Draw this shape without picking up your pen</title>
      <link>https://blog.farhan.codes/2017/03/30/draw-this-shape-without-picking-up-your-pen/</link>
      <pubDate>Thu, 30 Mar 2017 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2017/03/30/draw-this-shape-without-picking-up-your-pen/</guid>
      <description>&lt;p&gt;For many years, while in a meeting or in a moment of free time, I have tried to draw this shape without picking up my pen or drawing over the same two points twice.&lt;/p&gt;&#xA;&lt;p&gt;At best I would get 1 line away, but never completed the shape.&lt;/p&gt;&#xA;&lt;p&gt;I wanted to know if it was even possible. So I wrote some python code to try every possible combination.&lt;/p&gt;&#xA;&lt;p&gt;But, the code is below.&lt;/p&gt;</description>
    </item>
    <item>
      <title>FreeBSD and Linux Remote Dual Booting</title>
      <link>https://blog.farhan.codes/2017/03/10/freebsd-and-linux-remote-dual-booting/</link>
      <pubDate>Fri, 10 Mar 2017 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2017/03/10/freebsd-and-linux-remote-dual-booting/</guid>
      <description>&lt;p&gt;The following is a quick and dirty guide on how to setup remote dual booting for FreeBSD (12.0-CURRENT) and Linux (Ubuntu 16.04). Granted, this method is slightly a hack, but it works and suits my needs.&lt;/p&gt;&#xA;&lt;p&gt;*&lt;em&gt;Why remote dual-booting?&lt;/em&gt; I am currently developing a FreeBSD kernel module for a PCIe card. The device is supported on Linux and I am using the Linux implementation as documentation. As such, I find myself frequently rebooting into Linux to look printk() outputs, or booting into FreeBSD to test kernel code. This device is located at my house, and I typically work on it during my downtime at work.&lt;/p&gt;</description>
    </item>
    <item>
      <title>My Python3 Programming Environment</title>
      <link>https://blog.farhan.codes/2016/12/26/my-python3-programming-environment/</link>
      <pubDate>Mon, 26 Dec 2016 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2016/12/26/my-python3-programming-environment/</guid>
      <description>&lt;p&gt;UPDATE: I have since started using &lt;a href=&#34;http://vim.fisadev.com/&#34;&gt;a very good vimrc&lt;/a&gt;. I recommend it over mine listed below. My only modification is that I removed all line numbers, eww.&lt;/p&gt;&#xA;&lt;p&gt;I ssh into a FreeBSD jail with everything setup.&lt;/p&gt;&#xA;&lt;p&gt;The Jail runs on code.mydomainname.com, which has an internet-routable IPv6 address – and IPv4 behind a NAT, (boo!)&lt;/p&gt;&#xA;&lt;p&gt;I have a virtualenv already built-out. (more about my pip list later)&lt;/p&gt;&#xA;&lt;p&gt;The set my &lt;code&gt;~/.bashrc&lt;/code&gt; to execute source &lt;code&gt;enter-env.sh&lt;/code&gt; (even though I run ksh)&lt;/p&gt;</description>
    </item>
    <item>
      <title>Hotspot Hijacking &amp; Password Capturing</title>
      <link>https://blog.farhan.codes/2016/04/18/hotspot-hijacking-password-capturing/</link>
      <pubDate>Mon, 18 Apr 2016 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2016/04/18/hotspot-hijacking-password-capturing/</guid>
      <description>&lt;p&gt;There are two types of penetration testers in the industry.&lt;/p&gt;&#xA;&lt;p&gt;Those who identify risk and vulnerabilities beyond a simple Nexpose/Nessus/Qualys scan. And those who want to “win”.&lt;/p&gt;&#xA;&lt;p&gt;The job of the “winner” is to get DA on their client’s network. Great! But once they’ve gotten it, they show off. Look how much information I can get with the DA account! I can get access to these databases and these spreadsheets. Sensitive Information! Be afraid! I pwned you noobs!!!&lt;/p&gt;</description>
    </item>
    <item>
      <title>Easytether running on ARMv7l Chromebook</title>
      <link>https://blog.farhan.codes/2015/11/03/easytether-running-on-armv7l-chromebook/</link>
      <pubDate>Tue, 03 Nov 2015 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2015/11/03/easytether-running-on-armv7l-chromebook/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;http://www.mobile-stream.com/index.html&#34;&gt;Easytether&lt;/a&gt; is a proprietary application, so you can’t just apt-get it on a chroot’ed crouton environment. Additionally, I am not running an x86 or x64 CPU, so most of these packages will not work.&lt;/p&gt;&#xA;&lt;p&gt;Crouton mostly comes for Debian, so I downloaded the Ubuntu package. I installed the package ‘alien’. Then unzipped the deb file as follows:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;alien easytether_0.8.5-1_armhf.deb&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will 3 tar.xz files, mostly importantly data.tar.xz. Unzip it with the following command:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Differences between Mint and Ubuntu</title>
      <link>https://blog.farhan.codes/2015/10/18/differences-between-mint-and-ubuntu/</link>
      <pubDate>Sun, 18 Oct 2015 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2015/10/18/differences-between-mint-and-ubuntu/</guid>
      <description>&lt;p&gt;I looked into the differences between Mint and Ubuntu to see which was best for me. I watched tons of videos, reviews, comparisons, ran them both for months, etc. Here’s what I learned…&lt;/p&gt;&#xA;&lt;p&gt;They’re the same damn thing. No really, they are identical. The only differences are what software comes pre-installed and some user interface prettiness. Otherwise, no difference in the  underlying system at all. Literally no difference.&lt;/p&gt;&#xA;&lt;p&gt;Next question?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Adding Arbitrary XML to python-docx</title>
      <link>https://blog.farhan.codes/2015/08/15/adding-arbitrary-xml-to-python-docx/</link>
      <pubDate>Sat, 15 Aug 2015 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2015/08/15/adding-arbitrary-xml-to-python-docx/</guid>
      <description>&lt;p&gt;I am thankful to the developers of python-docx, they did a great job, especially since OpenXML is beyond confusing. However, I have two respectful criticisms: Python-docx lacks several key features and though it is properly written…its really confusing to follow the code.&lt;/p&gt;&#xA;&lt;p&gt;Its just a few steps. Identify the entry-point, create a new tag, and append it to the document.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;from docx.oxml.shared import OxmlElement # Necessary Import&#xA;tags = document.element.xpath(&amp;#39;//w:r&amp;#39;) # Locate the right &amp;lt;w:r&amp;gt; tag&#xA;tag = tags[0] # Specify which &amp;lt;w:r&amp;gt; tag you want&#xA;child = OxmlElement(&amp;#39;w:ARBITRARY&amp;#39;) # Create arbitrary tag&#xA;tag.append(child) # Append in the new tag&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And that’s it!&lt;/p&gt;</description>
    </item>
    <item>
      <title>Convert Docx to Markdown</title>
      <link>https://blog.farhan.codes/2014/12/31/convert-docx-to-markdown/</link>
      <pubDate>Wed, 31 Dec 2014 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2014/12/31/convert-docx-to-markdown/</guid>
      <description>&lt;p&gt;I needed to convert a Docx file to Markdown, but Pandoc kept giving me this obnoxious error:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ pandoc test.docx -o test.md&#xA;pandoc: Cannot decode byte &amp;#39;\xae&amp;#39;: Data.Text.Encoding.Fusion.streamUtf8: Invalid UTF-8 stream&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;However, you can use the tool unoconv to make an intermediary step to convert first to HTML and then to Markdown.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ unoconv --stdout -f html test.docx | pandoc -f html -t markdown -o test.md&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;On Ubuntu (And other Debian-based systems I would imagine)  you can get unoconv with a simple &lt;code&gt;apt-get install unoconv&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Duplicate a Django modelformset_factory Form</title>
      <link>https://blog.farhan.codes/2014/12/14/duplicate-a-django-modelformset_factory-form/</link>
      <pubDate>Sun, 14 Dec 2014 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2014/12/14/duplicate-a-django-modelformset_factory-form/</guid>
      <description>&lt;p&gt;I created a &lt;code&gt;formset_factory&lt;/code&gt; and wanted to have a simple “click me to add another form”. This seemed like a routine task, but the solutions I found online were unnecessarily complicated or required me to install a separate Django app, which I had no intention of doing.&lt;/p&gt;&#xA;&lt;p&gt;So I created my own…&lt;/p&gt;&#xA;&lt;p&gt;The only pre-requirement that this needs besides standard Django is &lt;a href=&#34;http://jquery.com/&#34;&gt;jQuery&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So here is a rough overview of how this works:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Custom Django Fixture Imports</title>
      <link>https://blog.farhan.codes/2014/12/06/custom-django-fixture-imports/</link>
      <pubDate>Sat, 06 Dec 2014 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2014/12/06/custom-django-fixture-imports/</guid>
      <description>&lt;p&gt;I needed to convert an XML document into a customize Django model with modifications to the based on programmable logic. Converting it to my model’s fixture would take too long and be unnecessary work, so I instead opted to manually convert the data.&lt;/p&gt;&#xA;&lt;p&gt;I figured I could just import the Django model object, as is follows:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;from&lt;/span&gt; tester.models &lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; Control&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;a &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Control()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;However, I got the following vexing error in red:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Hotspot Hijacking &amp; Password Capturing</title>
      <link>https://blog.farhan.codes/2012/03/16/hotspot-hijacking-password-capturing/</link>
      <pubDate>Fri, 16 Mar 2012 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2012/03/16/hotspot-hijacking-password-capturing/</guid>
      <description>&lt;p&gt;Unless you know enough about security to know what’s going on behind the scenes, Wifi is beyond insecure. Even with SSL as an attempt to secure a web connection, your connection is still fundamentally insecure. This is an explanation of how someone would capture passwords and other variables sent over an SSL connection that uses Wifi. In essence, its a Man in the Middle (MiM) attack over Wifi that modifies the victim’s HTTP connection and thus gathers GET and POST variables. I was not the first to create it, but I independently thought of it and then combined a few techniques together.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Old Chat Framework in C</title>
      <link>https://blog.farhan.codes/2011/03/06/old-chat-framework-in-c/</link>
      <pubDate>Sun, 06 Mar 2011 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2011/03/06/old-chat-framework-in-c/</guid>
      <description>&lt;p&gt;During my high school years, I used to be part of an “underground” IRC server. We would talk about security-related topics and the latest exploits, usually about some Unix variant. Even though no one would really care about our late-night computer conversations, I thought it best that we chat over an encrypted medium, and considering that I knew nothing about how SSL could serve to transparently encrypt IRC daemons and clients, I decided to write my own encrypted chat server. Below is the C code using the Unix API for the very simple framework. I planned on adding encryption for which I was learning the GMP library - I was not familiar with OpenSSL. I was a kid, sue me 🙄. I wrote the code below my junior year of HS.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Simple Economics of the IPv6 Transition</title>
      <link>https://blog.farhan.codes/2010/01/22/simple-economics-of-the-ipv6-transition/</link>
      <pubDate>Fri, 22 Jan 2010 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/2010/01/22/simple-economics-of-the-ipv6-transition/</guid>
      <description>&lt;p&gt;The vast majority of the Internet currently operates on Internet Protocol Version 4 (IPv4), a 32-bit addressing system which theoretically allows for 4,294,967,295 (2^32-1) unique IP addresses. Though this may seem like an inexhaustible supply of addresses, current figures estimate less than 10% of it remains. The remaining address space would be far less had it not been for the deployment of Network Address Translation (NAT), which extends IPv4’s life, but also breaks the i&lt;a href=&#34;https://en.wikipedia.org/wiki/End-to-end_principle&#34;&gt;End-to-End principle&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>About</title>
      <link>https://blog.farhan.codes/about/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/about/</guid>
      <description>&lt;p&gt;Hi! I’m Farhan. As the sub-title says, this is my personal and professional technical blog. It is designed to showcase my contributions to the IT sector.&lt;/p&gt;&#xA;&lt;p&gt;I’m a tech enthusiast, both for business and pleasure. I work professionally in IT Security and Penetration Testing and I am particularly interested in low-level programming, systems design, radio, IPv6 (check this site’s IPv6 address :), FreeBSD, Linux, security, and anything in “the world of the electron and the switch”.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Current and Future Projects</title>
      <link>https://blog.farhan.codes/projects/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/projects/</guid>
      <description>&lt;p&gt;Here is a list of current and future projects I would like to work on:&lt;/p&gt;&#xA;&lt;h2 id=&#34;current&#34;&gt;Current&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Porting the OpenBSD &lt;a href=&#34;https://man.openbsd.org/athn&#34;&gt;athn&lt;/a&gt; driver to FreeBSD, tracked in &lt;a href=&#34;https://reviews.freebsd.org/D45821&#34;&gt;D45821&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/khanzf/i3e_driver&#34;&gt;i3e_driver&lt;/a&gt;, a software implementation of FreeBSD&amp;rsquo;s net80211 stack.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;future-no-guarantees&#34;&gt;Future (no guarantees)&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Implementing RTL8188GU (0x0BDA:0xB711) in FreeBSD. In theory, this should just be implementing a subset of specific operations to the rtwn USB driver.&lt;/li&gt;&#xA;&lt;li&gt;Implementing &lt;a href=&#34;https://man.freebsd.org/cgi/man.cgi?query=usb_modeswitch&#34;&gt;usb_modeswitch&lt;/a&gt; in FreeBSD&amp;rsquo;s &lt;a href=&#34;https://man.freebsd.org/cgi/man.cgi?query=usbconfig&#34;&gt;usbconfig&lt;/a&gt; utility.&lt;/li&gt;&#xA;&lt;li&gt;USB-over-IP - Plug in a USB device in one computer and use have it present as plugged into another computer. This is pretty low priority, but would be useful in device driver development.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;maybe&#34;&gt;Maybe?&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Porting Linux&amp;rsquo;s Broadcom BCM43438 driver to FreeBSD. This is already an ISC-licensed driver, but converting from Linux&amp;rsquo;s ieee80211 stack to FreeBSD&amp;rsquo;s net80211 stack will not be easy.&lt;/li&gt;&#xA;&lt;li&gt;Implementing a VS Code SSH remote plugin that works on FreeBSD, maybe I will do, maybe not.&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
    </item>
    <item>
      <title>Open Source Contributions</title>
      <link>https://blog.farhan.codes/opensource/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://blog.farhan.codes/opensource/</guid>
      <description>&lt;p&gt;A brief list of my open-source contributions.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/giampaolo/psutil/commit/e98db38f97c542042ab6edb662512c4092085562&#34;&gt;Fix psutil.virtual_memory() type mismatch for NetBSD&lt;/a&gt; – NetBSD had a minor UTF-8 bug and would crash on NetBSD. I just changed the quotes and set a string type to binary.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/butlerx/wetty/commit/dc8c06e736f3c53c31ac605756094d8d951e9371&#34;&gt;Modified wetty to support FreeBSD&lt;/a&gt; – Wetty was using a Linuxism when referencing file paths, so I generalized it to utilize /usr/bin/env.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/mozilla/fxa-local-dev/pull/110&#34;&gt;Updated Firefox’s fxa-local-dev scripts to run on FreeBSD&lt;/a&gt; – I have a long-term goal to get Firefox’s authentication servers running on FreeBSD. This requires docker support, so it is low on my priorities list. However, there is still value in working through everything up to the point of docker.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/python-openxml/python-docx/pull/423&#34;&gt;Added Canon EOS Jpeg support for python-docx (un-merged)&lt;/a&gt; – python-docx would fail to install a a JPEG image, when the image header was slightly different than the standard header.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/substack/node-bigint/pull/43&#34;&gt;Added FreeBSD support for node-bigint (un-merged)&lt;/a&gt; – This library is now deprecated and the code does not compile anyways, even on Linux.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://svnweb.freebsd.org/base?view=revision&amp;amp;revision=342682&#34;&gt;Revision 342682&lt;/a&gt; Added Realtek RTL8188EE Wifi driver on FreeBSD&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://svnweb.freebsd.org/base?view=revision&amp;amp;revision=335757&#34;&gt;Revision 335757&lt;/a&gt; – ifconfig(8): Attempt to render non-printable sequences w/ UTF-8 Environment – Added support for ifconfig(8) on FreeBSD will print UTF-8 characters&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://svnweb.freebsd.org/base?view=revision&amp;amp;revision=351573&#34;&gt;Revision 351573&lt;/a&gt; – Document fetchReqHTTP() – Just added documentation for an undocumented call in fetch(3).&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://reviews.freebsd.org/rS357968&#34;&gt;Revision rS357968&lt;/a&gt; - Added SOCKS5 support to FreeBSD&amp;rsquo;s libfetch.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://reviews.freebsd.org/rD54114&#34;&gt;Revision rD54114&lt;/a&gt; - Updated FreeBSD Kerberos documentation.&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
    </item>
  </channel>
</rss>
