<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Interface with the Masses</title>
	<atom:link href="http://direct.z-95.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://direct.z-95.com:8888</link>
	<description>Random thoughts, views, and rantings</description>
	<lastBuildDate>Fri, 18 Mar 2011 18:26:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Determining Vendor information from MAC Addresses &#8211; Redux</title>
		<link>http://direct.z-95.com:8888/2010/06/07/determining-vendor-information-from-mac-addresses-redux/</link>
		<comments>http://direct.z-95.com:8888/2010/06/07/determining-vendor-information-from-mac-addresses-redux/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 13:53:44 +0000</pubDate>
		<dc:creator>Z-95</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://direct.z-95.com:8888/?p=272</guid>
		<description><![CDATA[I was never really happy with the old way that I had parsed the IEEE oui.txt file to determine vendor names based on MAC addresses.  It was slow, required manual manipulation of the oui file before processing, and was tailored only to gpsdrive&#8217;s geoinfo MYSQL schema.  Along with the ongoing Kismet/AP work I&#8217;ve been (slowly) ]]></description>
			<content:encoded><![CDATA[<p>I was never really happy with the old way that I had parsed the IEEE oui.txt file to determine vendor names based on MAC addresses.  It was slow, required manual manipulation of the oui file before processing, and was tailored only to gpsdrive&#8217;s geoinfo MYSQL schema.  Along with the ongoing Kismet/AP work I&#8217;ve been (slowly) doing, I wanted a better way to determine AP vendors from MAC addresses that was easily run, updatable, and fast.</p>
<p>The best way I found was to store parsed MAC to vendor information in a database table which was easy to do since I was already using SQLite for the WIP Kismet parsing code.  I used this schema:</p>
<pre><code>CREATE TABLE manuf (
mac TEXT PRIMARY KEY NOT NULL,
manuf TEXT NOT NULL);</code></pre>
<p>and the following parsing code:</p>
<pre><code>&lt;?php
try
{
  $dbh = new PDO("sqlite:/path/to/database.sqlite");
}
catch(PDOException $e)
{
  echo $e-&gt;getMessage();
}

$ouifile = file("http://standards.ieee.org/regauth/oui/oui.txt");

$dbh-&gt;exec("BEGIN;");
$delete = $dbh-&gt;prepare("DELETE FROM manuf;");

$insert = $dbh-&gt;prepare("INSERT INTO manuf (mac, manuf) VALUES (?, ?);");
$insert-&gt;bindParam(1, $mac);
$insert-&gt;bindParam(2, $manuf);

$vacuum = $dbh-&gt;prepare("VACUUM;");

$delete-&gt;execute();
$vacuum-&gt;execute();

foreach ($ouifile as $line)
{
  if (!substr_count($line, "(hex)"))
  {
    continue;
  }
  $mac = str_replace("-", ":", substr($line, 0, 8));
  $manuf = trim(substr($line, strpos($line, "(hex)") + 5));
  $manuf = preg_replace('/[\',\.\(\)]/', '', $manuf);
  $manuf = preg_replace(
    '/(the|inc|incorporated|plc|s\/a|a\/s|ab|ag|kg|gmbh|limited|ltd|spa|llc)/i',
    '', $manuf);
  $manuf = ucwords(strtolower($manuf));
  $manuf = preg_replace('/\s\s+/', ' ', $manuf);
  $manuf = trim($manuf);
  $insert-&gt;execute();
}

$dbh-&gt;exec("END;");
$dbh = null;
echo "Done inserting";
?&gt;</code></pre>
<p>Basically, it pulls the oui.txt from the IEEE, parses it and removes some unneeded characters/info, and puts it in the database.  This is then easy to query against using standard SQL and it is now easily run and updated and takes milliseconds instead of seconds to run.</p>
]]></content:encoded>
			<wfw:commentRss>http://direct.z-95.com:8888/2010/06/07/determining-vendor-information-from-mac-addresses-redux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Server!</title>
		<link>http://direct.z-95.com:8888/2010/05/28/new-server/</link>
		<comments>http://direct.z-95.com:8888/2010/05/28/new-server/#comments</comments>
		<pubDate>Fri, 28 May 2010 14:45:57 +0000</pubDate>
		<dc:creator>Z-95</dc:creator>
				<category><![CDATA[Site]]></category>

		<guid isPermaLink="false">http://direct.z-95.com:8888/?p=269</guid>
		<description><![CDATA[Yesterday I finally sat down and set up my new Dell PowerEdge 2450 server and moved all my configuration and data from the old server.
About a month or so ago, the CPU fan in my old server, which had been getting louder and louder for a while, finally got to the point where it was ]]></description>
			<content:encoded><![CDATA[<p>Yesterday I finally sat down and set up my new Dell PowerEdge 2450 server and moved all my configuration and data from the old server.</p>
<p>About a month or so ago, the CPU fan in my old server, which had been getting louder and louder for a while, finally got to the point where it was so loud that I couldn&#8217;t stand it any longer (most likely dust buildup in the motor).  I ripped it out of the server which fixed the noise problem, but since I didn&#8217;t have any spare fans it meant that now the server was running on passive CPU cooling&#8211;something I was not fond of and could lead to total hardware failure.</p>
<p>So, I began investigating my options, and eventually found someone selling 2 Dell PowerEdge 2450 servers on Craigslist along with a bunch of server parts.  I drove to the guy&#8217;s place, checked out the servers, and bought them along with a bunch of server parts and drives.</p>
<p>The only problem was that I didn&#8217;t really have room for rackmount servers in my room, and even if I did, they were much too loud to be in the open.  So I designed and built a rack for the two servers and fit them into my closet where they couldn&#8217;t be heard.  My clothes muffle the sound even more, and with some experimenting with airflow they only cause the closet to be 5-10 degrees hotter than normal.  It did take some clever wire management to run power and networking into my closet though!</p>
<p>So now, I have the main server running 24/7 with the second server as a parts machine.  It runs, but has a fault I need to investigate (and in fairness, it was sold to me as only a parts machine with the benefit that it actually does run).  Its specs (and benefits over the old server) are:</p>
<p>Dual PIII 733MHz CPUs (over 2x increase)<br />
1.5 GB RAM (currently, might step up to 2GB) (4x increase)<br />
4x 147GB 10K RPM SCSI drives in RAID 10 (7x the space, ~2x the speed)<br />
1x 10/100 LAN (built in)<br />
3x 10/100/1000 LAN (PCI) (Gigabit LAN is really nice when transferring lots of files since I upgraded my room network to gigabit recently)<br />
2x Hot Swap Power Supplies</p>
<p>It runs the new Ubuntu Server 10.04 with my standard Apache, PHP, MySQL, SQLite, SSH, FTP, TeamSpeak, etc. setup.  Pages should load faster now (depending on network speeds) and I have a lot more room to expand.  Another hit like my Portal 2 SSTV discovery should be less hard on my server now (over 1000 hits in about 15 minutes on a 400KB image).</p>
<p>Enjoy the newness!</p>
]]></content:encoded>
			<wfw:commentRss>http://direct.z-95.com:8888/2010/05/28/new-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Proposed Kismet schema</title>
		<link>http://direct.z-95.com:8888/2010/01/22/proposed-kismet-schema/</link>
		<comments>http://direct.z-95.com:8888/2010/01/22/proposed-kismet-schema/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 01:00:11 +0000</pubDate>
		<dc:creator>Z-95</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://direct.z-95.com:8888/?p=263</guid>
		<description><![CDATA[I&#8217;ve created a preliminary database schema for kismet log info that I think holds all useful information from the netxml files.
CREATE TABLE networks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
bssid TEXT DEFAULT NULL,
essid TEXT DEFAULT NULL,
cloaked BOOLEAN DEFAULT NULL,
channel INTEGER DEFAULT NULL,
encryption TEXT DEFAULT NULL,
manuf TEXT DEFAULT NULL,
ipaddress TEXT DEFAULT NULL,
iptype TEXT DEFAULT NULL,
maxrate INTEGER DEFAULT NULL,
maxseenrate ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created a preliminary database schema for kismet log info that I think holds all useful information from the netxml files.</p>
<pre><code>CREATE TABLE networks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
bssid TEXT DEFAULT NULL,
essid TEXT DEFAULT NULL,
cloaked BOOLEAN DEFAULT NULL,
channel INTEGER DEFAULT NULL,
encryption TEXT DEFAULT NULL,
manuf TEXT DEFAULT NULL,
ipaddress TEXT DEFAULT NULL,
iptype TEXT DEFAULT NULL,
maxrate INTEGER DEFAULT NULL,
maxseenrate INTEGER DEFAULT NULL,
beaconrate INTEGER DEFAULT NULL,
llcpackets INTEGER DEFAULT NULL,
datapackets INTEGER DEFAULT NULL,
cryptpackets INTEGER DEFAULT NULL,
totalpackets INTEGER DEFAULT NULL,
datasize INTEGER DEFAULT NULL,
firsttime TEXT DEFAULT NULL,
lasttime TEXT DEFAULT NULL,
gpsminlat NUMERIC DEFAULT NULL,
gpsminlon NUMERIC DEFAULT NULL,
gpsminalt NUMERIC DEFAULT NULL,
gpsmaxlat NUMERIC DEFAULT NULL,
gpsmaxlon NUMERIC DEFAULT NULL,
gpsmaxalt NUMERIC DEFAULT NULL,
gpspeaklat NUMERIC DEFAULT NULL,
gpspeaklon NUMERIC DEFAULT NULL,
gpspeakalt NUMERIC DEFAULT NULL)

CREATE TABLE clients (
id INTEGER PRIMARY KEY AUTOINCREMENT,
netid INTEGER DEFAULT NULL,
macaddress TEXT DEFAULT NULL,
channel INTEGER DEFAULT NULL,
manuf TEXT DEFAULT NULL,
ipaddress TEXT DEFAULT NULL,
iptype TEXT DEFAULT NULL,
maxseenrate INTEGER DEFAULT NULL,
llcpackets INTEGER DEFAULT NULL,
datapackets INTEGER DEFAULT NULL,
cryptpackets INTEGER DEFAULT NULL,
totalpackets INTEGER DEFAULT NULL,
datasize INTEGER DEFAULT NULL)
</code></pre>
<p>Its a two table design&#8211;the networks table holds the info about the APs while the clients table holds info about seen clients.  If you don&#8217;t recognize the SQL variant, its SQLite, a choice I&#8217;m thinking of making so that the database can easily be replicated/edited/utilized without running a server.</p>
<p>And yes, the netid in the clients table should be a foreign key to id in the networks table, but as SQLite just added support for foreign keys, I&#8217;m not sure I want to include that yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://direct.z-95.com:8888/2010/01/22/proposed-kismet-schema/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgrades and a new look</title>
		<link>http://direct.z-95.com:8888/2010/01/22/upgrades-and-a-new-look/</link>
		<comments>http://direct.z-95.com:8888/2010/01/22/upgrades-and-a-new-look/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 05:54:44 +0000</pubDate>
		<dc:creator>Z-95</dc:creator>
				<category><![CDATA[Site]]></category>

		<guid isPermaLink="false">http://direct.z-95.com:8888/?p=253</guid>
		<description><![CDATA[I&#8217;ve done lots of work behind the scenes (hence the lack of posts) on the server, and I got bored of the default Wordpress theme so I found a nice-looking one, edited it to my needs, and the site is not so boring!
The AP code work I started last year is about complete for the ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve done lots of work behind the scenes (hence the lack of posts) on the server, and I got bored of the default Wordpress theme so I found a nice-looking one, edited it to my needs, and the site is not so boring!</p>
<p>The AP code work I started last year is about complete for the old gpsdrive database from 2005/2006, but I am currently researching and planning on moving the AP code to a much better database that holds more AP information; the only problem is that all the old data cannot be used.  But as Videlais and I geocache, the data will slowly build.  When I am more pleased with the quality of the code I will release it.</p>
<p>My &#8220;stuff&#8221; pages are almost complete; books are 100%, movies are 99%, and games are around 80%.  Those pages will be pubic eventually&#8230;maybe.</p>
<p>Also, the site is now open to search bots, and I&#8217;ve been watching them trickle in through my access logs.  Sadly, I lose almost all referrer info because of the frame mess I must do to get around port 80.  But its interesting seeing hits&#8211;and at least one a day is a vulnerability scan.</p>
<p>I have hidden all my old Nucleus and Blogger posts because I didn&#8217;t want all that info public to the search bots and whoever finds their way here.</p>
<p>Lastly, I have re-enabled comment posting but all comments are moderated to eliminate spam.  I don&#8217;t want to open up user registration due to spam bots and the havoc they can cause, but if someone really wants one for whatever reason, I can make it happen.</p>
<p>So, whats the plan?  None really, this site continues to be mainly a learning platform and a place to mess around with.  I can host things for people and it makes a nice development platform I can SSH into from anywhere.  But as far as posts go, well, I&#8217;ll update when I have something to say.  I have a couple planned out (like instructions for cloning a Backtrack4 USB persistent install) but I need to spend time writing them up.</p>
]]></content:encoded>
			<wfw:commentRss>http://direct.z-95.com:8888/2010/01/22/upgrades-and-a-new-look/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Determining Vendor information from MAC Addresses</title>
		<link>http://direct.z-95.com:8888/2009/03/31/determining-vendor-information-from-mac-addresses/</link>
		<comments>http://direct.z-95.com:8888/2009/03/31/determining-vendor-information-from-mac-addresses/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 17:30:05 +0000</pubDate>
		<dc:creator>Z-95</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://direct.z-95.com:8888/?p=118</guid>
		<description><![CDATA[For my ongoing AP code work that I am doing, I wanted to supply AP vendors based on the MAC address of the AP.  Now, for any cloned MAC addresses this will be inaccurate or give an Unknown entry, but for any genuine MAC address the vendor can be determined!
I first started with the OUI ]]></description>
			<content:encoded><![CDATA[<p>For my ongoing AP code work that I am doing, I wanted to supply AP vendors based on the MAC address of the AP.  Now, for any cloned MAC addresses this will be inaccurate or give an Unknown entry, but for any genuine MAC address the vendor can be determined!</p>
<p>I first started with the OUI file published by the IEEE: http://standards.ieee.org/regauth/oui/oui.txt  This file gives the vendor information for the leading 3 bytes of the 6 byte MAC address.  Each leading 3 bytes is uniquely assigned to one vendor, which can hold 2^24 or 16.8 million unique MAC addresses.</p>
<p>To begin, I ran</p>
<pre><code>grep "(hex)" oui.txt&gt;ouitab.txt</code></pre>
<p>to get just the lines with the leading half of the mac in the form XX-XX-XX and the vendor&#8217;s name.  I then replaced the spaces, (hex), and one tab to get all lines in the form XX-XX-XX(tab)Vendor and saved this as oui.txt.</p>
<p>Instead of creating a new field in the geoinfo database from GPSDrive, I instead chose to use the unused comment field to hold the vendor information.  The rest was simple: write a php script to search the revised oui.txt file for the leading 3 bytes of the MAC for each AP in the database and then update the database by writing the Vendor to the comment field.  I came up with this:</p>
<pre><code>&lt;?php
$oui = file('oui.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$dbconnection = mysql_connect('localhost', 'root', 'Insert Password Here');
$dbselected = mysql_select_db('geoinfo', $dbconnection);
$result = mysql_query("SELECT * FROM waypoints");
while ($row = mysql_fetch_assoc($result)) {
  $mac = $row['macaddr'];
  $macorig = $row['macaddr'];
  $mac = substr($mac, 0, 8);
  $mac = str_replace(":", "-", $mac);
  $mac = strtoupper($mac);
  $search = preg_grep("/{$mac}/i", $oui);
  $search = array_values($search);
  $exploded = explode("\t", $search[0]);
  if ($exploded[1] == "")
    $update = "UPDATE waypoints SET comment = 'Unknown' WHERE macaddr = '$macorig'";
  else
    $update = "UPDATE waypoints SET comment = '$exploded[1]' WHERE macaddr = '$macorig'";
  $updateresult = mysql_query($update);
}
mysql_close($dbconnection);
echo "Complete";
?&gt;
</code></pre>
<p>This set the comment field with the found vendor name if it could be found or put Unknown if the MAC could not be found.</p>
<p>Note that using preg_grep in this way is VERY slow as it linearly searches oui.txt for a match for EACH AP.  For ~3700 APs it took about 45 seconds to run, which was fine for a quick and dirty script but for more APs would of course take longer.</p>
<p>More code updates to come as I work more on the AP code!</p>
]]></content:encoded>
			<wfw:commentRss>http://direct.z-95.com:8888/2009/03/31/determining-vendor-information-from-mac-addresses/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

