Jekyll2019-09-25T11:26:01-04:00http://localhost:4000/feed.xmlWords from Josha personal blogJosh Schmelzlerandmac.py: Generating LAA MAC Addresses2019-02-27T17:30:00-05:002019-02-27T17:30:00-05:00http://localhost:4000/2019/02/27/randmac-python-project<p>Sometimes, and in some select situations, I want to share a screenshot or some terminal output that contains MAC addresses. But for privacy reasons, I do not want to reveal the actual MAC addresses. Why? Because they’re unique identifiers (unless intentionally changed).</p>
<p>If the output only contained one or two physical addresses, I could manually mask them. But I wanted to explore another way to solve this problem. So, I wrote a Python module that pseudo randomizes MAC addresses for me.</p>
<p>So not to confuse myself, or others that may see the output, with what is the actual MAC vs randomized, I use the locally administered address (LAA) format. This means tje randomized MAC addresses from my module can be identified as such.</p>
<h1 id="locally-administered-addresses">locally administered addresses</h1>
<p>To differentiate MAC addresses, as stated above, the module creates Locally Administered Addresses (LAA).</p>
<p>The LAA is distinguished by setting the second least significant bit (LSB) of the addresses first octet. If the second LSB is set to 1, the address is administered locally.</p>
<p>For example, the first octet of <code class="highlighter-rouge">d6:70:b6:a2:b8:8a</code> contains <code class="highlighter-rouge">d6</code> (2 hex digits). The binary representation of the first octect is <code class="highlighter-rouge">11010110</code>. Where bits 7-4 = <code class="highlighter-rouge">1101</code> or hex digit <code class="highlighter-rouge">d</code>, and then bits 3-0 = <code class="highlighter-rouge">0110</code> or hex digit <code class="highlighter-rouge">6</code>.</p>
<p>The second LSB is 1. It’s bit 1 in the table below (the value two from the far right).</p>
<table>
<thead>
<tr>
<th>b7</th>
<th>b6</th>
<th>b5</th>
<th>b4</th>
<th>b3</th>
<th>b2</th>
<th>b1</th>
<th>b0</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td>MSB</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td>LSB</td>
</tr>
</tbody>
</table>
<p>So this represents a unicast LAA. Here’s how we know it’s unicast:</p>
<p>b0 values:</p>
<ul>
<li>0: unicast</li>
<li>1: multicast</li>
</ul>
<p>b1 values:</p>
<ul>
<li>0: globally unique (OUI enforced)</li>
<li>1: locally administered</li>
</ul>
<h1 id="laa-identifiers">LAA identifiers</h1>
<p>Here are other possible values that identify unicast LAA addresses:</p>
<ul>
<li>LSB <code class="highlighter-rouge">0010</code> = <code class="highlighter-rouge">02:00:00:00:00:00</code></li>
<li>LSB <code class="highlighter-rouge">0110</code> = <code class="highlighter-rouge">06:00:00:00:00:00</code></li>
<li>LSB <code class="highlighter-rouge">1010</code> = <code class="highlighter-rouge">0a:00:00:00:00:00</code></li>
<li>LSB <code class="highlighter-rouge">1110</code> = <code class="highlighter-rouge">0e:00:00:00:00:00</code></li>
</ul>
<p>Note: <code class="highlighter-rouge">0</code> in the MAC address examples above could be any hexadecimal digit.</p>
<h1 id="formats">formats</h1>
<p>The module supports a few common MAC address formats and can output using any of these:</p>
<ul>
<li><code class="highlighter-rouge">FF-FF-FF-FF-FF-FF</code></li>
<li><code class="highlighter-rouge">FF.FF.FF.FF.FF.FF</code></li>
<li><code class="highlighter-rouge">FFFF.FFFF.FFFF</code></li>
</ul>
<p>One caveat is the way I implemented formatting. It requires you to tell the module what format you want. It needs to know what format for output. For example providing something like <code class="highlighter-rouge">00-00-00-00-00-00</code> to the module would return something like <code class="highlighter-rouge">00-00-00-c7-11-fc</code>.</p>
<p>This is clunky, and could be improved. Let me know how you think it could be better.</p>
<h1 id="installation">installation</h1>
<p>I put the module on <a href="https://pypi.org">PyPi</a> so that it can be installed using pip:</p>
<p><code class="highlighter-rouge">pip install randmac</code></p>
<h1 id="example-usage">example usage</h1>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>>>> from randmac import RandMac
>>> RandMac("00-00-00-00-00-00")
'00-00-00-c7-11-fc'
>>> RandMac("00:00:00:00:00:00", True)
'ba:ac:5f:09:fc:bb'
>>> RandMac("0000.0000.0000", True)
'fe84.857f.900f'
</code></pre></div></div>
<p>or</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ python3 randmac.py 00:00:00:00:00:00
00:00:00:fc:e1:5b
$ python3 randmac.py 00:00:00:00:00:00 -f
2a:81:b0:e7:1d:08
</code></pre></div></div>
<h1 id="links">links</h1>
<p>you can find it at these locations on the Internet:</p>
<ul>
<li><a href="https://pypi.org/project/randmac/">PyPi Project</a></li>
<li><a href="https://github.com/joshschmelzle/randmac">GitHub</a></li>
</ul>
<h1 id="feedback">feedback</h1>
<p>I’d love to hear any constructive feedback or suggestions on how to improve this project.</p>Josh SchmelzleSometimes, and in some select situations, I want to share a screenshot or some terminal output that contains MAC addresses. But for privacy reasons, I do not want to reveal the actual MAC addresses. Why? Because they’re unique identifiers (unless intentionally changed). If the output only contained one or two physical addresses, I could manually mask them. But I wanted to explore another way to solve this problem. So, I wrote a Python module that pseudo randomizes MAC addresses for me. So not to confuse myself, or others that may see the output, with what is the actual MAC vs randomized, I use the locally administered address (LAA) format. This means tje randomized MAC addresses from my module can be identified as such. locally administered addresses To differentiate MAC addresses, as stated above, the module creates Locally Administered Addresses (LAA). The LAA is distinguished by setting the second least significant bit (LSB) of the addresses first octet. If the second LSB is set to 1, the address is administered locally. For example, the first octet of d6:70:b6:a2:b8:8a contains d6 (2 hex digits). The binary representation of the first octect is 11010110. Where bits 7-4 = 1101 or hex digit d, and then bits 3-0 = 0110 or hex digit 6. The second LSB is 1. It’s bit 1 in the table below (the value two from the far right). b7 b6 b5 b4 b3 b2 b1 b0 1 1 0 1 0 1 1 0 MSB LSB So this represents a unicast LAA. Here’s how we know it’s unicast: b0 values: 0: unicast 1: multicast b1 values: 0: globally unique (OUI enforced) 1: locally administered LAA identifiers Here are other possible values that identify unicast LAA addresses: LSB 0010 = 02:00:00:00:00:00 LSB 0110 = 06:00:00:00:00:00 LSB 1010 = 0a:00:00:00:00:00 LSB 1110 = 0e:00:00:00:00:00 Note: 0 in the MAC address examples above could be any hexadecimal digit. formats The module supports a few common MAC address formats and can output using any of these: FF-FF-FF-FF-FF-FF FF.FF.FF.FF.FF.FF FFFF.FFFF.FFFF One caveat is the way I implemented formatting. It requires you to tell the module what format you want. It needs to know what format for output. For example providing something like 00-00-00-00-00-00 to the module would return something like 00-00-00-c7-11-fc. This is clunky, and could be improved. Let me know how you think it could be better. installation I put the module on PyPi so that it can be installed using pip: pip install randmac example usage >>> from randmac import RandMac >>> RandMac("00-00-00-00-00-00") '00-00-00-c7-11-fc' >>> RandMac("00:00:00:00:00:00", True) 'ba:ac:5f:09:fc:bb' >>> RandMac("0000.0000.0000", True) 'fe84.857f.900f' or $ python3 randmac.py 00:00:00:00:00:00 00:00:00:fc:e1:5b $ python3 randmac.py 00:00:00:00:00:00 -f 2a:81:b0:e7:1d:08 links you can find it at these locations on the Internet: PyPi Project GitHub feedback I’d love to hear any constructive feedback or suggestions on how to improve this project.My Mac Mini (Late 2012) Adventures2018-09-24T00:00:00-04:002018-09-24T00:00:00-04:00http://localhost:4000/2018/09/24/my-mac-mini-late-2012-adventures<p>I’ve been using Microsoft Windows as my primary Operating System for well over a decade (since Windows 3.1). And from time to time I’ve also used various Linux (Arch, Crunchbang, Ubuntu, Mint to name a few) distributions<sup id="fnref:1"><a href="#fn:1" class="footnote">1</a></sup> <sup id="fnref:2"><a href="#fn:2" class="footnote">2</a></sup>.</p>
<p>Lately, I’ve grown more open to trying different things. In 2015, I replaced my Android phone with an iPhone 6s Plus (<em>I’m still using a 6s+ in 2019</em>). But I’d never given Apple Mac’s a chance. I’d always been a “PC” user.</p>
<p>That changed in October of 2017 when I received a Mac mini (Macmini6,2 aka Late 2012). I won it on in an eBay auction. Frustratingly, it was my 6th attempt on eBay, but I sealed the deal with a last second bid. I chose this model because it cost less than $1k and had some upgradeability. Both in hardware (RAM, SSD, etc) and software.</p>
<p>I’m no longer that guy who speaks about Apple without having any practical experience with their products. My issues with Apple had mainly been the cost of hardware to performance ratio (overclocker bias). I picked that up from an overclocking forum I frequented. Overclockers despise Apple for lack of both customizability and overclocking. Sometimes there is more to computing than overclocking. ¯\<em>(ツ)</em>/¯</p>
<h3 id="specifications">Specifications</h3>
<p>I was looking for one with a 2.6 GHz (3.6 GHz Turbo) Intel i7-3720QM (Ivy Bridge). Why? I’m aiming to get several years of computing out of it.</p>
<p>Specifications it came with:</p>
<ul>
<li>22nm <a href="https://ark.intel.com/content/www/us/en/ark/products/64891/intel-core-i7-3720qm-processor-6m-cache-up-to-3-60-ghz.html">i7-3720QM</a> CPU with 4 cores and 8 threads</li>
<li>8 GB (4 GB x 2) of memory</li>
<li>256 GB SSD for storage</li>
</ul>
<p><img src="/assets/images/2017-07-09-specs.png" alt="" /></p>
<h3 id="memory-upgrade">Memory Upgrade</h3>
<p>To help with system performance on my Mac mini (Late 2012), I upgraded the memory from 8 GB to 16 GB. After evaluating a few different memory models, I went with the G.Skill Ripjaws DDR3 1600 MHz PC3-12800 SO-DIMM. They had a lower Column Access Strobe (CAS) latency than the others I was looking at.</p>
<p>What’s CAS? CAS is the time it takes the CPU to ask for data, and then for memory (RAM) to provide it. Lower is better. Folks might argue that CAS only matters for benchmarks and that real world use won’t show a difference, but I did it anyways. Why not?</p>
<p>With that said, the memory upgrade from 8 GB to 16 GB was a noticeable performance boost. More so because I doubled memory.</p>
<p>Like most of us, I always have many applications and browser tabs open that I forget to close. The additional RAM sure helps with this. You could say I did this for the Chrome tabs.</p>
<p><img src="/assets/images/2017-07-13-16gb.png" alt="" /></p>
<h3 id="storage">Storage</h3>
<p>I upgraded the 256 GB SSD it came with to a Samsung SSD 860 EVO 1 TB.</p>
<h3 id="first-os-upgrade-sierra---high-sierra">First OS Upgrade: Sierra -> High Sierra</h3>
<p>The version of macOS it came with was OS X 10.8 Mountain Lion. This version is also when they transitioned naming from OS X (<em>spoken like OS ten, not OS X</em>) to macOS.</p>
<p>OS upgradeability was one of the reasons I bought the Mac Mini. I wanted to run High Sierra.</p>
<p>Upgrading was easy and free of cost (at the original time of writing macOS Sierra was the latest public release).</p>
<p><img src="/assets/images/2017-07-13-specs.png" alt="" /></p>
<p><img src="/assets/images/2017-10-20-highsierra.png" alt="" /></p>
<h3 id="initial-impressions">Initial Impressions</h3>
<p>I’m only a few days in and I’m learning a lot about what I’ve been missing in the macOS world. I love it so far.</p>
<h3 id="second-os-upgrade-high-sierra---mojave">Second OS Upgrade: High Sierra -> Mojave</h3>
<p>When Mojave came out in September of 2018, I was ecstatic that Apple was still pushing OS updates to their older products. I didn’t have any issues with running Mojave on it.</p>
<p><img src="/assets/images/2018-09-24-mojave.png" alt="" /></p>
<h3 id="third-os-upgrade-mojave---catalina">Third OS Upgrade: Mojave -> Catalina</h3>
<p><PENDING></p>
<p>Update: I’m reading macOS Catalina will also support this Mac Mini. I think I made a good purchase back in 2017. I got a 7 year old Mac Mini that still gets software updates (I’d be surprised if I get another major OS update for it though). I’ll try to update this post once Catalina is officially released.</p>
<hr />
<div class="footnotes">
<ol>
<li id="fn:1">
<p><em>2018 update: my portable’s daily OS is Ubuntu (MSI GE60)</em> <a href="#fnref:1" class="reversefootnote">↩</a></p>
</li>
<li id="fn:2">
<p><em>2019 update: my portable’s daily OS is Windows 10 (Thinkpad T440p) running the Windows Subsystem for Linux (WSL) with Ubuntu 16.04.</em> <a href="#fnref:2" class="reversefootnote">↩</a></p>
</li>
</ol>
</div>Josh SchmelzleI’ve been using Microsoft Windows as my primary Operating System for well over a decade (since Windows 3.1). And from time to time I’ve also used various Linux (Arch, Crunchbang, Ubuntu, Mint to name a few) distributions1 2. Lately, I’ve grown more open to trying different things. In 2015, I replaced my Android phone with an iPhone 6s Plus (I’m still using a 6s+ in 2019). But I’d never given Apple Mac’s a chance. I’d always been a “PC” user. That changed in October of 2017 when I received a Mac mini (Macmini6,2 aka Late 2012). I won it on in an eBay auction. Frustratingly, it was my 6th attempt on eBay, but I sealed the deal with a last second bid. I chose this model because it cost less than $1k and had some upgradeability. Both in hardware (RAM, SSD, etc) and software. I’m no longer that guy who speaks about Apple without having any practical experience with their products. My issues with Apple had mainly been the cost of hardware to performance ratio (overclocker bias). I picked that up from an overclocking forum I frequented. Overclockers despise Apple for lack of both customizability and overclocking. Sometimes there is more to computing than overclocking. ¯\(ツ)/¯ Specifications I was looking for one with a 2.6 GHz (3.6 GHz Turbo) Intel i7-3720QM (Ivy Bridge). Why? I’m aiming to get several years of computing out of it. Specifications it came with: 22nm i7-3720QM CPU with 4 cores and 8 threads 8 GB (4 GB x 2) of memory 256 GB SSD for storage Memory Upgrade To help with system performance on my Mac mini (Late 2012), I upgraded the memory from 8 GB to 16 GB. After evaluating a few different memory models, I went with the G.Skill Ripjaws DDR3 1600 MHz PC3-12800 SO-DIMM. They had a lower Column Access Strobe (CAS) latency than the others I was looking at. What’s CAS? CAS is the time it takes the CPU to ask for data, and then for memory (RAM) to provide it. Lower is better. Folks might argue that CAS only matters for benchmarks and that real world use won’t show a difference, but I did it anyways. Why not? With that said, the memory upgrade from 8 GB to 16 GB was a noticeable performance boost. More so because I doubled memory. Like most of us, I always have many applications and browser tabs open that I forget to close. The additional RAM sure helps with this. You could say I did this for the Chrome tabs. Storage I upgraded the 256 GB SSD it came with to a Samsung SSD 860 EVO 1 TB. First OS Upgrade: Sierra -> High Sierra The version of macOS it came with was OS X 10.8 Mountain Lion. This version is also when they transitioned naming from OS X (spoken like OS ten, not OS X) to macOS. OS upgradeability was one of the reasons I bought the Mac Mini. I wanted to run High Sierra. Upgrading was easy and free of cost (at the original time of writing macOS Sierra was the latest public release). Initial Impressions I’m only a few days in and I’m learning a lot about what I’ve been missing in the macOS world. I love it so far. Second OS Upgrade: High Sierra -> Mojave When Mojave came out in September of 2018, I was ecstatic that Apple was still pushing OS updates to their older products. I didn’t have any issues with running Mojave on it. Third OS Upgrade: Mojave -> Catalina <PENDING> Update: I’m reading macOS Catalina will also support this Mac Mini. I think I made a good purchase back in 2017. I got a 7 year old Mac Mini that still gets software updates (I’d be surprised if I get another major OS update for it though). I’ll try to update this post once Catalina is officially released. 2018 update: my portable’s daily OS is Ubuntu (MSI GE60) ↩ 2019 update: my portable’s daily OS is Windows 10 (Thinkpad T440p) running the Windows Subsystem for Linux (WSL) with Ubuntu 16.04. ↩Stitches and Antenna Elements2017-12-15T00:00:00-05:002017-12-15T00:00:00-05:00http://localhost:4000/2017/12/15/stitches-and-antennas<p>Taking one of these antenna elements apart cost me 3 stitches today. Curiosity can hurt. Guess which one?</p>
<p><img src="/assets/images/2017-12-15-antenna.jpg" alt="" /></p>Josh SchmelzleTaking one of these antenna elements apart cost me 3 stitches today. Curiosity can hurt. Guess which one?Stackoverflow Helps 2,000,000 Exit Vim2017-05-25T00:00:00-04:002017-05-25T00:00:00-04:00http://localhost:4000/2017/05/25/stackoverflow-helps-millions-exit-vim<p>Since the <a href="https://stackoverflow.com/questions/11828270/how-to-exit-the-vim-editor">question appeared in August of 2012</a>, over <del>1 million</del> 2 million people have learned how to quit (exit?) Vim.</p>
<p>No one said exiting Vim would be easy.</p>
<p><em>*chuckles*</em></p>
<p>䛇</p>
<hr />
<p>My favorite exit method is exit and save by pressing <code class="highlighter-rouge">Z</code> twice from command mode. Those keystrokes lead to a quick exit.</p>
<p>Simple ways to quit Vi or Vim from command mode (tip: hit <code class="highlighter-rouge">Esc</code> to leave insert mode and enter command mode):</p>
<ul>
<li><code class="highlighter-rouge">:q</code> - quit</li>
<li><code class="highlighter-rouge">:q!</code> - quit without saving the file</li>
<li><code class="highlighter-rouge">:wq</code> - write and quit</li>
</ul>
<hr />
<p>Update: On September, 10th 2019, page views reached 2 million.</p>Josh SchmelzleSince the question appeared in August of 2012, over 1 million 2 million people have learned how to quit (exit?) Vim. No one said exiting Vim would be easy. *chuckles* 䛇 My favorite exit method is exit and save by pressing Z twice from command mode. Those keystrokes lead to a quick exit. Simple ways to quit Vi or Vim from command mode (tip: hit Esc to leave insert mode and enter command mode): :q - quit :q! - quit without saving the file :wq - write and quit Update: On September, 10th 2019, page views reached 2 million.Hello World2017-04-08T00:00:00-04:002017-04-08T00:00:00-04:00http://localhost:4000/2017/04/08/hello-world<p>Long term lurker here.</p>
<p>This is where I plan to share what I find interesting.</p>
<p>Why now? Where have you been?</p>
<p><strong>Well, I thought I needed a cool entrance.</strong></p>
<p>In reality, I was wrong. All I need is a text editor and an Internet connection.</p>
<p>In this case, I’m using a terminal emulator and Vim. And I’m not even using any Vim settings or plugins. I wrote this post in a text file that contains the code needed to display it in your browser.</p>
<p>¯\<em>(ツ)</em>/¯</p>Josh SchmelzleLong term lurker here. This is where I plan to share what I find interesting. Why now? Where have you been? Well, I thought I needed a cool entrance. In reality, I was wrong. All I need is a text editor and an Internet connection. In this case, I’m using a terminal emulator and Vim. And I’m not even using any Vim settings or plugins. I wrote this post in a text file that contains the code needed to display it in your browser. ¯\(ツ)/¯