<?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>Maartendamen&#039;s blog &#187; Reverse engineering</title>
	<atom:link href="http://www.maartendamen.com/tag/reverse-engineering/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maartendamen.com</link>
	<description>Blogging on various IT subjects</description>
	<lastBuildDate>Tue, 22 Nov 2011 21:27:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Product review: BugLogic logic analyzer from Robomotic</title>
		<link>http://www.maartendamen.com/2011/03/product-review-buglogic-logic-analyzer-from-robomotic/</link>
		<comments>http://www.maartendamen.com/2011/03/product-review-buglogic-logic-analyzer-from-robomotic/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 22:05:18 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[analyzer]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[logic]]></category>
		<category><![CDATA[Reverse engineering]]></category>
		<category><![CDATA[serial]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=629</guid>
		<description><![CDATA[Last weekend I received a nice little package from the UK. It was the BugLogic logic analyzer from Robomotic. I quickly unpacked it and found this logic analyzer inside: On the bottom you see the aluminum enclosure, on top you see the sensor cables/clips. You can use those to easily clamp onto anywhere in an [...]]]></description>
			<content:encoded><![CDATA[<p>Last weekend I received a nice little package from the UK. It was the <a href="http://buglogic.robomotic.com/tiki-index.php">BugLogic</a> logic analyzer from Robomotic.<br />
I quickly unpacked it and found this logic analyzer inside:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/03/2011-03-01_21-26-52_605_Doetinchem2.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/03/2011-03-01_21-26-52_605_Doetinchem2.png" alt="" title="2011-03-01_21-26-52_605_Doetinchem" width="622" height="464" class="alignnone size-full wp-image-642" /></a></p>
<p><span id="more-629"></span></p>
<p>On the bottom you see the aluminum enclosure, on top you see the sensor cables/clips. You can use those to easily clamp onto anywhere in an electronics circuit.<br />
There&#8217;s not a lot more to tell about the enclosure itself, there&#8217;s a micro USB connector to connect the device to your computer.. and that&#8217;s it. Here&#8217;s a picture of the PCB:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/03/5317497561_fa55e4c0b7.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2011/03/5317497561_fa55e4c0b7.jpg" alt="" title="5317497561_fa55e4c0b7" width="500" height="375" class="alignnone size-full wp-image-631" /></a></p>
<p>Some specifications of this logic analyzer (taken from manufacturers website):</p>
<ul>
<li>open source hardware and software</li>
<li>low cost</li>
<li>supports existing softwares like the Salae, USBee and Sigrok</li>
<li>small</li>
<li>easy to customize</li>
</ul>
<p><strong>Let&#8217;s hook it up!</strong><br />
I am testing the Saleae logic analyzer software, because it looks like the nicest analyzer software of the three supported software products.<br />
You can&#8217;t use the Saleae software from the Saleae website because they prevented the use of cloned logic analyzers. Robomotic provides a local copy of the software.</p>
<p>Saleae claims the cloned logic analyzers are counterfeit, I totally disagree. It&#8217;s just a hardware design based on a certain micro controller.<br />
There&#8217;s no way Saleae has the exclusive right to this hardware. I do agree that they have the right to protect their software though, and that&#8217;s what they are doing right now.</p>
<p>The software installation is pretty easy, it&#8217;s basically a next->next->finish job. Please note that .NET framework 3.5 is required.<br />
After the you start the software the logic analyzer is immediately recognized by the Saleae software. Now I had to hook it up to something, I choose the serial console port from the Belkin home base.. remember that one from previous posts ? :-)<br />
A logic analyzer is a very nice device to analyze asynchronous serial communication. I hooked up these three pins: RX (input 2), TX (input 1) and ground (input 3).<br />
Here&#8217;s a picture of my setup:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/03/Copy-2-of-2011-03-01_22-44-38_995_Doetinchem.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/03/Copy-2-of-2011-03-01_22-44-38_995_Doetinchem.png" alt="" title="Copy (2) of 2011-03-01_22-44-38_995_Doetinchem" width="622" height="464" class="alignnone size-full wp-image-644" /></a></p>
<p>Do you notice the little analyzer clips on the board?<br />
In the Saleae software you have to pick a sample rate and sample frequency. I chose the following, which are more then enough for the boot log of the Belkin home base:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/03/logic_settings.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/03/logic_settings.png" alt="" title="logic_settings" width="358" height="84" class="alignnone size-full wp-image-637" /></a></p>
<p>And here&#8217;s the result:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/03/logic_result.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/03/logic_result.png" alt="" title="logic_result" width="685" height="458" class="alignnone size-full wp-image-639" /></a></p>
<p>Input 1 shows the TX pin of the Belkin home base, the boot messages. Works like a charm!</p>
<p><strong>Conclusion</strong><br />
The BugLogic is a very good value for money (around €40,- including shipping!) logic analyzer. It utilizes a lot of existing logic analyzing software around.<br />
Furthermore it&#8217;s very compact in size. There&#8217;s just two minor points of improvement if you ask me:</p>
<ul>
<li>The cable clips are a bit cheap quality, some were actually broken on arrival. There&#8217;s 10 clips so more then enough anyway.</li>
<li>Pin 1 is not clearly marked on the enclosure so I had to open it to figure out.</li>
</ul>
<p>This concludes this product review. Would you like a professional review of your product as well? Please contact me using my contact form.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2011/03/product-review-buglogic-logic-analyzer-from-robomotic/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting root on the Belkin Home Base</title>
		<link>http://www.maartendamen.com/2011/02/getting-root-on-the-belkin-home-base/</link>
		<comments>http://www.maartendamen.com/2011/02/getting-root-on-the-belkin-home-base/#comments</comments>
		<pubDate>Sun, 20 Feb 2011 19:00:55 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[Reverse engineering]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[serial]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=596</guid>
		<description><![CDATA[After we found the TX pin in previous blog post and can have a look at the console messages, we can continue to look for the RX pin. The RX pin is still unknown, but we couldn&#8217;t test for it, as serial logins are prohibited on the Home Base. Luckily the Home Base firmware files [...]]]></description>
			<content:encoded><![CDATA[<p>After we found the TX pin in previous blog post and can have a look at the console messages, we can continue to look for the RX pin.<br />
The RX pin is still unknown, but we couldn&#8217;t test for it, as serial logins are prohibited on the Home Base.<br />
Luckily the Home Base firmware files are released under GPL, this allows me to have a peek around in the code and look for the protection.<br />
After that I could compile a custom firmware without the protection. Compiling of the firmware is beyond the subject of this blog post, but it&#8217;s not that complicated if you follow Belkin&#8217;s guidelines.</p>
<p>Please note that flashing custom firmware&#8217;s can wreck your device! I am pretty confident of doing this, I have done it several times in the past with other devices. Another reason which makes me just do it, is that I have serial console access. So, there must be some way to unbrick this device.<br />
<span id="more-596"></span><br />
After looking around in the firmware structure I found a startup file (in preinstall/etc/rc.d/rc.S) with the following content:</p>
<pre class="brush: bash; title: ; notranslate">
# serial login
DEBUGMODE=`sxromconf -c GET_DEBUG`
if [ &quot;${DEBUGMODE}&quot; = &quot;on&quot; ]; then
  /sbin/getty -L ttyS0 115200 vt100 &amp;
else
  echo &quot;Serial login always is disabled by DEBUGMODE setting!&quot;
fi
</pre>
<p>Aha! Now that looks familiar, it&#8217;s the code preventing us to login to the console.<br />
I changed the code to the following:</p>
<pre class="brush: bash; title: ; notranslate">
/sbin/getty -L ttyS0 115200 vt100 &amp;
</pre>
<p>After that I compiled the new firmware, and restarted the device. Does it work?</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/belkin_login.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/belkin_login.png" alt="" title="belkin_login" width="575" height="150" class="alignnone size-full wp-image-601" /></a><br />
<em>Belkin Home Base serial login</em></p>
<p>Success! Now we can continue to find the RX pin, just connect a test wire to the USB-BUB TX pin and randomly test the pins. After a few attempts I found out that pin 3 is the RX pin.<br />
Now let&#8217;s try to login, and check our privileges:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/belkin_priv.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/belkin_priv.png" alt="" title="belkin_priv" width="580" height="155" class="alignnone size-full wp-image-602" /></a><br />
<em>Belkin Home Base root privileges</em></p>
<p>So there you have it! Full root access on the Belkin Home Base. Time to celebrate, cheers!</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/Grolsch.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/Grolsch.jpg" alt="" title="Grolsch" width="212" height="242" class="aligncenter size-full wp-image-605" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2011/02/getting-root-on-the-belkin-home-base/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Finding a serial console on the Belkin Home Base part 2</title>
		<link>http://www.maartendamen.com/2011/02/finding-a-serial-console-on-the-belkin-home-base-part-2/</link>
		<comments>http://www.maartendamen.com/2011/02/finding-a-serial-console-on-the-belkin-home-base-part-2/#comments</comments>
		<pubDate>Sat, 19 Feb 2011 18:30:32 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[oscilloscope]]></category>
		<category><![CDATA[Reverse engineering]]></category>
		<category><![CDATA[serial]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=547</guid>
		<description><![CDATA[This blog post continues upon yesterday&#8217;s post. In this post we will attempt to find the two missing serial console pins (RX and TX). We will start with the TX (transmit) pin, this one is easy to detect, as most devices log their status during start-up. So, there are some high/low voltage bumps during start-up. [...]]]></description>
			<content:encoded><![CDATA[<p>This blog post continues upon yesterday&#8217;s post. In this post we will attempt to find the two missing serial console pins (RX and TX).<br />
We will start with the TX (transmit) pin, this one is easy to detect, as most devices log their status during start-up. So, there are some high/low voltage bumps during start-up.<br />
I will do this using a oscilloscope (I have a <a href="http://www.seeedstudio.com/depot/micro-digital-storage-oscilloscopedso-nano-p-512.html">DSO nano</a> pocket scope), although there are sveral other methods. One other (cheap) example is using a piezoelectric buzzer:<br />
<a href="http://www.maartendamen.com/wp-content/uploads/2011/02/piezo.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/piezo.png" alt="" title="piezo" width="211" height="211" class="alignnone size-full wp-image-560" /></a><br />
<em>Piezoelectric buzzer</em><br />
<span id="more-547"></span><br />
To use this buzzer you have to tie the black wire to ground, and connect/touch the suspected TX pin with the red wire. The piezo buzzer will then beep during start-up.</p>
<p>Let&#8217;s continue with the scope option though. Here&#8217;s a picture of my setup:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/2011-02-18_18-41-13_641_Doetinchem.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/2011-02-18_18-41-13_641_Doetinchem.png" alt="" title="2011-02-18_18-41-13_641_Doetinchem" width="570" height="425" class="alignnone size-full wp-image-572" /></a><br />
<em>DSO Nano connected to the Home Base.</em></p>
<p>The ground clip from my scope is connected to another ground point I found using the continuity tester function, remember last post? The test clip from my scope is connected to one of the pins on the header. Hey, what are those waves on the scope display ?!</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/Copy-of-2011-02-18_18-40-29_773_Doetinchem.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/Copy-of-2011-02-18_18-40-29_773_Doetinchem.png" alt="" title="Copy of 2011-02-18_18-40-29_773_Doetinchem" width="570" height="425" class="alignnone size-full wp-image-574" /></a><br />
<em>Houston, we&#8217;ve got signal!</em></p>
<p>The waves we got is serial communication from the Belkin Home Base right to our scope! It actually took me 5 restarts of the Home Base. Pin 5 is our TX pin.<br />
To locate our last pin (RX) we will first have to connect our Belkin Home Base to our PC. I use a <a href="http://shop.moderndevice.com/products/usb-bub">USB-BUB</a> for this. Any other FTDI cable will most likely be ok, i&#8217;ve also seen people use old telephone data cables for this purpose.</p>
<p>Here&#8217;s the USB-BUB with the Belkin Home Base TX pin connected to the BUB&#8217;s RX pin:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/2011-02-18_20-05-35_350_Doetinchem.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/2011-02-18_20-05-35_350_Doetinchem.png" alt="" title="2011-02-18_20-05-35_350_Doetinchem" width="570" height="425" class="alignnone size-full wp-image-594" /></a></p>
<p>Great, so does it work? After fiddling around a bit with the baudrate/parity settings etc. I came up with the following settings:</p>
<p>Baudrate: 115200<br />
Data bits: 8<br />
Stop bits: 1<br />
Partiy: Off</p>
<p>Here&#8217;s the result:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/yay2.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/yay2.png" alt="" title="yay" width="607" height="511" class="alignnone size-full wp-image-585" /></a></p>
<p>After it finished booting, I noticed the following:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/yay21.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/yay21.png" alt="" title="yay2" width="576" height="102" class="alignnone size-full wp-image-586" /></a></p>
<p>Crap! It doesn&#8217;t allow us to login, so there is no way to test for the RX pin :-(<br />
Normally I would just connect it to random pins and check if I can &#8220;type&#8221; to the serial console, unfortunately that&#8217;s not an option for this device.<br />
To be continued&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2011/02/finding-a-serial-console-on-the-belkin-home-base-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding a serial console on the Belkin Home Base</title>
		<link>http://www.maartendamen.com/2011/02/finding-a-serial-console-on-the-belkin-home-base/</link>
		<comments>http://www.maartendamen.com/2011/02/finding-a-serial-console-on-the-belkin-home-base/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 18:30:41 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[multimeter]]></category>
		<category><![CDATA[Reverse engineering]]></category>
		<category><![CDATA[serial]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=529</guid>
		<description><![CDATA[Most consumer devices have some way of debugging for the ease of development of the board (JTAG). Most routers, and other network devices have a serial console connection as well. I&#8217;m pretty sure this Belkin device also has one, in this blog post I will show you how I locate serial console ports on consumer [...]]]></description>
			<content:encoded><![CDATA[<p>Most consumer devices have some way of debugging for the ease of development of the board (<a href="http://en.wikipedia.org/wiki/JTAG">JTAG</a>). Most routers, and other network devices have a serial console connection as well.<br />
I&#8217;m pretty sure this Belkin device also has one, in this blog post I will show you how I locate serial console ports on consumer devices. A basic serial console connection consist of the following pins:</p>
<p>- RX pin, the receiving pin as seen by the device (in this case the data the Belkin receives from the PC)<br />
- TX pin, the transmitting pin as seen by the device (in this case the data send from the Belkin to the PC)<br />
- GND pin, the ground connection between the device and the PC.<br />
- 3.3V/5V pin, a constant power supply.. in most cases this is not needed. But you could use it to power a MAX232 chip.<br />
<span id="more-529"></span><br />
The first step is to visually look at the board, most serial connection headers are 4-6 pins. Do you remember the 6 pin header I described in the previous blog post?</p>
<p>So, this is going to be our target. The second step in the process is to find the ground (GND) connection of the serial port header. To do this I prefer to use a multimeter (with continuity tester functionality), the continuity test function looks like this:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/2011-02-17_22-24-31_749_Doetinchem1.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/2011-02-17_22-24-31_749_Doetinchem1.png" alt="" title="2011-02-17_22-24-31_749_Doetinchem" width="570" height="425" class="alignnone size-full wp-image-532" /></a><br />
<em>Continuity tester</em></p>
<p>The test will beep and/or visually indicate whether two electrical connections are connected to one another. Knowing that the continuity tester function can do this, it&#8217;s rather easy to find the ground connection. You need a reference pin for the ground connection (I used the dc-jack ground connection) and then test each pins of the header on at the time.</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/Copy-of-2011-02-17_22-31-43_726_Doetinchem.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/Copy-of-2011-02-17_22-31-43_726_Doetinchem.png" alt="" title="Copy of 2011-02-17_22-31-43_726_Doetinchem" width="570" height="425" class="alignnone size-full wp-image-536" /></a><br />
<em>Searching for ground!</em></p>
<p>Aha! Pin 6 is the ground connection. </p>
<p>Now that we found the ground connection we can proceed to the next step, which is finding the VCC (+) connection. Usually this is 3.3v or 5v. For this step we use the multimeter once again, but now on the dc-voltage setting. Something in the range of 5-20v should be good:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/2011-02-17_22-40-00_965_Doetinchem.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/2011-02-17_22-40-00_965_Doetinchem.png" alt="" title="2011-02-17_22-40-00_965_Doetinchem" width="425" height="570" class="alignnone size-full wp-image-540" /></a><br />
<em>Multimeter for dc voltage measurement</em></p>
<p>Leave the ground clip connected to the same reference point as we used in the previous step. Now touch each of the pins on the header to check for a voltage, looks like I found something:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/2011-02-17_22-45-57_191_Doetinchem.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/2011-02-17_22-45-57_191_Doetinchem.png" alt="" title="2011-02-17_22-45-57_191_Doetinchem" width="570" height="425" class="alignnone size-full wp-image-542" /></a><br />
<em>Found the 3.3v (+) connection!</em></p>
<p>So pin 1 is the 3.3v connection. This post will continue later on for the sake of readability. In that future post we will figure out the TX (Transmit) and RX (Receive) pins.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2011/02/finding-a-serial-console-on-the-belkin-home-base/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Opening the Belkin Home Base</title>
		<link>http://www.maartendamen.com/2011/02/opening-the-belkin-home-base/</link>
		<comments>http://www.maartendamen.com/2011/02/opening-the-belkin-home-base/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 05:06:37 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Reverse engineering]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=508</guid>
		<description><![CDATA[Today I received a new gadget, the Belkin Home Base. It&#8217;s a wireless and wired network USB hub. After playing around a bit with (works just fine!) I decided to open it.. why? Just because I can :-) Opening this things was a piece of cake, just mind that there is a Torx T7 screw [...]]]></description>
			<content:encoded><![CDATA[<p>Today I received a new gadget, the Belkin Home Base. It&#8217;s a wireless and wired network USB hub.</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/homebase.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/homebase.jpg" alt="" title="homebase" width="472" height="277" class="aligncenter size-full wp-image-509" /></a></p>
<p>After playing around a bit with (works just fine!) I decided to open it.. why? Just because I can :-)<br />
Opening this things was a piece of cake, just mind that there is a Torx T7 screw in the right bottom corner. It&#8217;s hidden underneath the information label:<br />
<span id="more-508"></span></p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/17-2-2011-22.02.16-0000.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/17-2-2011-22.02.16-0000.png" alt="" title="17-2-2011 22.02.16 0000" width="622" height="464" class="aligncenter size-full wp-image-521" /></a></p>
<p>Here are some pictures of the board itself: </p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/17-2-2011-21.55.42-0001.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/17-2-2011-21.55.42-0001.png" alt="" title="17-2-2011 21.55.42 0001" width="574" height="769" class="alignnone size-full wp-image-513" /></a><br />
<em>Frontside of the Home Base PCB.</em></p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/17-2-2011-21.55.42-0002.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/17-2-2011-21.55.42-0002.png" alt="" title="17-2-2011 21.55.42 0002" width="574" height="769" class="alignnone size-full wp-image-515" /></a><br />
<em>Backside of the Home Base PCB.</em></p>
<p>There are two interesting headers on the board (1&#215;6 pin and 1x2x7 pin), I will play around with them a bit later on (in fact, I already did.. I&#8217;ll just save that for a later blog post..):</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/02/headers.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/02/headers.png" alt="" title="headers" width="194" height="308" class="alignnone size-full wp-image-523" /></a></p>
<p>To be continued.. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2011/02/opening-the-belkin-home-base/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Z-wave and python node discovery, more bitwise trickery</title>
		<link>http://www.maartendamen.com/2010/11/z-wave-and-python-node-discovery-more-bitwise-trickery/</link>
		<comments>http://www.maartendamen.com/2010/11/z-wave-and-python-node-discovery-more-bitwise-trickery/#comments</comments>
		<pubDate>Sun, 07 Nov 2010 14:00:42 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Home automation]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Reverse engineering]]></category>
		<category><![CDATA[z-wave]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=467</guid>
		<description><![CDATA[This post continues upon the last blog post, in the last post we looked at some z-wave protocol basics. At the same time we had a look at a bitwise operation (XOR), in this post some more bitwise tricks will be used to do z-wave node discovery. Node discovery is essential to get information about [...]]]></description>
			<content:encoded><![CDATA[<p>This post continues upon the last blog post, in the last post we looked at some z-wave protocol basics.<br />
At the same time we had a look at a bitwise operation (XOR), in this post some more bitwise tricks will be used to do z-wave node discovery.<br />
Node discovery is essential to get information about the members of a z-wave network.<br />
The serial port sniff in the previous post, showed the FUNC_ID_SERIAL_API_GET_INIT_DATA command. Let&#8217;s dive into this packet&#8230;<br />
Here&#8217;s the packet response again:<br />
#06#01#25#01#02#05#00#1D#03#00#00#00#00#00#00#00#00#<br />
00#00#00#00#00#00#00#00#00#00#00#00#00#00#00#00#00#00#00#00#03#01#C0<br />
<span id="more-467"></span><br />
The first 4 bytes are not relevant for this post, I have to look into them later on. The fun starts at byte &#8220;02&#8243;, this byte represents the function response code (in this case FUNC_ID_SERIAL_API_GET_INIT_DATA). The byte following (05) is the z-wave protocol version, in this case v5. Next byte is &#8220;00&#8243; which is the controller type (primary or secondary)<br />
&#8220;1D&#8221; indicates the amount of node bytes. 1D is 29 decimal.<br />
Z-wave uses these node bytes to indicate whether or not a node is in use within the network (the bytes are bit masked). For example the first node byte value 03, is as follows in binary:<br />
0000 0011 </p>
<p>This means node 1 and 2 are in use, another example:</p>
<p>0000 1011</p>
<p>This would indicate node 4, 2 and 1 being used. So, how do we figure this out from code? This is where bitwise AND comes into play. A bitwise AND takes two binary representations of equal length and performs the logical AND operation on each pair of corresponding bits. In each pair, the result is 1 if the first bit is 1 AND the second bit is 1. Otherwise, the result is 0.<br />
We can use this from our python code in the following matter:</p>
<pre class="brush: python; title: ; notranslate">
    length = ord(response[7]) - 1
    index = 1

    for i in range(0, length):
        buffer_index = response[8+i]
        num = 1
        j = 0

        while j &lt;= 7:
            if (ord(buffer_index) &amp; num &gt; 0):
                print &quot;node exists!&quot;, index
            else:
                print &quot;node does not exist&quot;, index

            index = index+1

            if j &lt; 7:
                num = num * 2 

            j = j+1
</pre>
<p>And does it work?</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/11/node_discovery.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/11/node_discovery.png" alt="" title="node_discovery" width="475" height="247" class="alignnone size-full wp-image-473" /></a></p>
<p>Looks fine!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/11/z-wave-and-python-node-discovery-more-bitwise-trickery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting started with z-wave and python</title>
		<link>http://www.maartendamen.com/2010/11/getting-started-with-z-wave-and-python/</link>
		<comments>http://www.maartendamen.com/2010/11/getting-started-with-z-wave-and-python/#comments</comments>
		<pubDate>Sat, 06 Nov 2010 10:30:20 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Home automation]]></category>
		<category><![CDATA[bitwise operations]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Reverse engineering]]></category>
		<category><![CDATA[z-wave]]></category>
		<category><![CDATA[zwave]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=438</guid>
		<description><![CDATA[I started playing around with my new z-wave kit. I ordered an Aeon-Labs Z-stick (series 2) and a Duwi dimmer module to start with. Here are some images of both devices: After playing around a bit with a demo Homeseer license to test whether the stick and module worked (setup was really easy), I quickly [...]]]></description>
			<content:encoded><![CDATA[<p>I started playing around with my new z-wave kit. I ordered an Aeon-Labs Z-stick (series 2) and a Duwi dimmer module to start with.<br />
Here are some images of both devices:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/11/duwi.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/11/duwi-300x300.jpg" alt="" title="duwi" width="300" height="300" class="alignnone size-medium wp-image-439" /></a><a href="http://www.maartendamen.com/wp-content/uploads/2010/11/aeo_usb.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/11/aeo_usb-300x300.jpg" alt="" title="aeo_usb" width="300" height="300" class="alignleft size-medium wp-image-440" /></a><br />
<span id="more-438"></span><br />
After playing around a bit with a demo Homeseer license to test whether the stick and module worked (setup was really easy), I quickly switched over to my &#8216;bits and bytes view&#8217;..<br />
Here&#8217;s a log of the Aeon-Labs stick initializing:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/11/zwave_log1.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/11/zwave_log1.png" alt="" title="zwave_log" width="635" height="207" class="alignnone size-full wp-image-450" /></a></p>
<p>The yellow text is the command that get&#8217;s transmitted from the PC to the controller. This article will focus just on the sending command (my first starting point with python and z-wave)<br />
So let&#8217;s have a look at the basics, these are the 5 bytes that get send to the controller: #01#03#00#02#FE<br />
Let&#8217;s translate these bytes to bits (a lot of people still seem to have trouble to distinct between the two of them):</p>
<p>01 = 0000 0001<br />
03 = 0000 0011<br />
00 = 0000 0000<br />
02 = 0000 0010<br />
FE = 1111 1110</p>
<p>From some z-wave documentation publicly available, I figured out that the checksum is the last byte of the command. In most documents they referred to the checksum as a CRC checksum, I actually think it&#8217;s an LRC (Longitudinal Redundancy Check). A LRC is computed by XOR all the byte values of the packet together. XOR stands for a bitwise eXclusive OR. A bitwise exclusive or takes two bit patterns of equal length and performs the logical XOR operation on each pair of corresponding bits. The result in each position is 1 if the two bits are different, and 0 if they are the same. For example:</p>
<pre>
    0101
XOR 0011
  = 0110
</pre>
<p>So how does our calculation look at bit level? (remember that we skip the first byte):</p>
<p>00000011 (03) XOR 00000000 (00) = 00000011 (03) (Nothing happens on this operation)<br />
00000011 (03) XOR 00000010 (02) = 00000001 (01) (See how one + one is 0 here?)</p>
<p>So the outcome is 01.. hmm, not quite the LRC value we&#8217;d expected. We expected &#8216;FE&#8217; (last byte in our command). This is because the LRC calculation z-wave uses starts with a starter value, which is &#8220;FF&#8221; or 1111 1111. So let&#8217;s try our calculation again, now with three steps:</p>
<p>11111111 (FF) XOR 00000011 (03) = 11111100 (FC) (Note the last two bits as a result of our XOR operation)<br />
11111100 (FC) XOR 00000000 (00) = 11111100 (FC) (Nothing happens on this operation)<br />
11111100 (FC) XOR 00000010 (02) = 11111110 (FE) (Aha! There&#8217;s our value!)</p>
<p>So, there we go.. through some calculations we figured out the checksum algorithm that z-wave uses. This is an important first step in understanding the protocol.<br />
Now for the python part, here&#8217;s the code I used to test the checksum:</p>
<pre class="brush: python; title: ; notranslate">
def generateChecksum(message):
    lrc = 0xFF
    for b in message:
        lrc ^= ord(b)
    message += chr(lrc)
    return message

testmessage = &quot;\x03\x00\x02&quot;
generateChecksum(testmessage)
</pre>
<p>And this is me, testing the code :-)</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/11/python_lrc.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/11/python_lrc.png" alt="" title="python_lrc" width="635" height="324" class="alignleft size-full wp-image-454" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/11/getting-started-with-z-wave-and-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New router part 2: Linksys WRT320N serial console</title>
		<link>http://www.maartendamen.com/2010/09/new-router-part-2-linksys-wrt320n-serial-console/</link>
		<comments>http://www.maartendamen.com/2010/09/new-router-part-2-linksys-wrt320n-serial-console/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 18:00:04 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Routers]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[Reverse engineering]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[wireless]]></category>
		<category><![CDATA[wrt]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=422</guid>
		<description><![CDATA[Yesterday I posted about my new Linksys router, I had to open it because I flashed a wrong firmware image to it. All it did was flashing a blue led.. but there&#8217;s a cure. In this post I will explain how to connect a serial console to your Linksys WRT320N router! Remember the solder pads [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I posted about my new Linksys router, I had to open it because I flashed a wrong firmware image to it.<br />
All it did was flashing a blue led.. but there&#8217;s a cure.</p>
<p>In this post I will explain how to connect a serial console to your Linksys WRT320N router!<br />
<span id="more-422"></span><br />
Remember the solder pads from the last post? Here&#8217;s a closeup image:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/router31.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/router31.jpg" alt="" title="router3" width="634" height="475" class="alignnone size-full wp-image-425" /></a></p>
<p>The pads are labeled, it&#8217;s a serial connection. Connecting only the RX/TX signals and the GND signal is sufficient.<br />
Please note that you need a logic level converter (such as a max232, or telephone datacables) to convert the signal.</p>
<p>Now that we have a possibility to connect to the console of the router, we can all sorts of cool stuff. Including interrupting the bootloader to flash a new firmware image!<br />
Here&#8217;s a boot log of the router with a dd-wrt (big) image:</p>
<p><code><br />
CFE version 1.0.37 for BCM947XX (32bit,SP,LE)<br />
Build Date: Fri Jul 24 07:15:00 EDT 2009 (root@Raymond.Lai)<br />
Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.</p>
<p>Initializing Arena<br />
Initializing Devices.</p>
<p>No DPN<br />
This is a Serial Flash<br />
Boot partition size = 262144(0x40000)<br />
Found a 8MB ST compatible serial flash<br />
Partition information:<br />
boot    #00   00000000 -> 0003FFFF  (262144)<br />
trx     #01   00040000 -> 0004001B  (28)<br />
os      #02   0004001C -> 007F7FFF  (8093668)<br />
nvram   #03   007F8000 -> 007FFFFF  (32768)<br />
Partition information:<br />
boot    #00   00000000 -> 0003FFFF  (262144)<br />
trx     #01   00040000 -> 007F7FFF  (8093696)<br />
nvram   #02   007F8000 -> 007FFFFF  (32768)<br />
BCM47XX_GMAC_ID<br />
et0: Broadcom BCM47XX 10/100/1000 Mbps Ethernet Controller 5.10.56.9<br />
CPU type 0x19740: 354MHz<br />
Total memory: 32768 KBytes</p>
<p>Total memory used by CFE:  0x80700000 - 0x807A1D80 (662912)<br />
Initialized Data:          0x80735D20 - 0x80738920 (11264)<br />
BSS Area:                  0x80738920 - 0x8073BD80 (13408)<br />
Local Heap:                0x8073BD80 - 0x8079FD80 (409600)<br />
Stack Area:                0x8079FD80 - 0x807A1D80 (8192)<br />
Text (code) segment:       0x80700000 - 0x80735D18 (220440)<br />
Boot area (physical):      0x007A2000 - 0x007E2000<br />
Relocation Factor:         I:00000000 - D:00000000</p>
<p>Boot version: v5.4<br />
The boot is CFE<br />
Nothing...</p>
<p>### CLKDIV= 0x80a082c, SFlashClkDiv=8 clkdivsf=2 ###<br />
### Change it to 0x20a082c (2) ###<br />
CMD: [ifconfig eth0 -addr=192.168.1.1 -mask=255.255.255.0]<br />
Device eth0:  hwaddr 68-7F-74-96-43-CC, ipaddr 192.168.1.1, mask 255.255.255.0<br />
        gateway not set, nameserver not set<br />
CMD: [go;]<br />
Check CRC of image1<br />
  Len:     0x6E0000     (7208960)       (0xBC040000)<br />
  Offset0: 0x1C         (28)            (0xBC04001C)<br />
  Offset1: 0x9A8        (2472)  (0xBC0409A8)<br />
  Offset2: 0x14CC00     (1362944)       (0xBC18CC00)<br />
  Header CRC:    0x853EE8DC<br />
  Calculate CRC: 0x853EE8DC<br />
Image 1 is OK<br />
Try to load image 1.<br />
Waiting for 5 seconds to upgrade ...<br />
CMD: [load -raw -addr=0x807a1d80 -max=0x185e280 :]<br />
Loader:raw Filesys:tftp Dev:eth0 File:: Options:(null)<br />
Loading: _tftpd_open(): retries=0/5<br />
_tftpd_open(): retries=1/5<br />
_tftpd_open(): retries=2/5<br />
_tftpd_open(): retries=3/5<br />
_tftpd_open(): retries=4/5</p>
<p>### Start=486462851 E=1250622957 Delta=764160106 ###<br />
Failed.<br />
Could not load :: Timeout occured<br />
CMD: [boot -raw -z -addr=0x80001000 -max=0x6ff000 flash0.os:]<br />
Loader:raw Filesys:raw Dev:flash0.os File: Options:(null)<br />
Loading: .. 3856 bytes read</p>
<p>### Start=1257679943 E=1260915130 Delta=3235187 ###<br />
Entry at 0x80001000<br />
Closing network.<br />
Starting program at 0x80001000<br />
Linux version 2.6.24.111 (root@dd-wrt) (gcc version 4.1.2) #1987 Sat Aug 7 02:06:16 CEST 2010<br />
CPU revision is: 00019740<br />
Found a 8MB ST compatible serial flash<br />
Determined physical RAM map:<br />
 memory: 02000000 @ 00000000 (usable)<br />
Built 1 zonelists in Zone order.  Total pages: 8128<br />
Kernel command line: console=ttyS0,115200 root=1f02 rootfstype=squashfs noinitrd<br />
Primary instruction cache 32kB, physically tagged, 4-way, linesize 32 bytes.<br />
Primary data cache 32kB, 4-way, linesize 32 bytes.<br />
Synthesized TLB refill handler (20 instructions).<br />
Synthesized TLB load handler fastpath (32 instructions).<br />
Synthesized TLB store handler fastpath (32 instructions).<br />
Synthesized TLB modify handler fastpath (31 instructions).<br />
PID hash table entries: 128 (order: 7, 512 bytes)<br />
CPU: BCM4716 rev 1 at 354 MHz<br />
Using 177.000 MHz high precision timer.<br />
console [ttyS0] enabled<br />
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)<br />
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)<br />
Memory: 27344k/32768k available (3144k kernel code, 5424k reserved, 1479k data, 144k init, 0k highmem)<br />
Mount-cache hash table entries: 512<br />
NET: Registered protocol family 16<br />
Generic PHY: Registered new driver<br />
PCI: Using membase 8000000<br />
PCI: Disabled<br />
PCI: Fixing up bus 0<br />
PCI: Fixing up bus 1<br />
NET: Registered protocol family 2<br />
Time: MIPS clocksource has been installed.<br />
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)<br />
TCP established hash table entries: 1024 (order: 1, 8192 bytes)<br />
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)<br />
TCP: Hash tables configured (established 1024 bind 1024)<br />
TCP reno registered<br />
devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)<br />
devfs: boot_options: 0x1<br />
squashfs: version 3.0 (2006/03/15) Phillip Lougher<br />
io scheduler noop registered<br />
io scheduler deadline registered (default)<br />
HDLC line discipline: version $Revision: 4.8 $, maxframe=4096<br />
N_HDLC line discipline registered.<br />
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled<br />
serial8250: ttyS0 at MMIO 0x0 (irq = 8) is a 16550A<br />
PPP generic driver version 2.4.2<br />
PPP Deflate Compression module registered<br />
PPP BSD Compression module registered<br />
MPPE/MPPC encryption/compression module registered<br />
NET: Registered protocol family 24<br />
PPPoL2TP kernel driver, V1.0<br />
tun: Universal TUN/TAP device driver, 1.6<br />
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com><br />
eth0: Broadcom BCM47XX 10/100/1000 Mbps Ethernet Controller 5.10.56.27<br />
pflash: found no supported devices<br />
bootloader size: 262144<br />
sflash: Filesystem type: squashfs, size=0x585356<br />
partition size = 5846016<br />
Creating 5 MTD partitions on "sflash":<br />
0x00000000-0x00040000 : "cfe"<br />
0x00040000-0x007f0000 : "linux"<br />
0x0018cc00-0x00720000 : "rootfs"<br />
mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-only<br />
0x007f0000-0x00800000 : "nvram"<br />
0x00720000-0x007f0000 : "ddwrt"<br />
Broadcom Watchdog Timer: 0.07 initialized.<br />
u32 classifier<br />
    Actions configured<br />
Netfilter messages via NETLINK v0.30.<br />
nf_conntrack version 0.5.0 (1024 buckets, 4096 max)<br />
ctnetlink v0.93: registering with nfnetlink.<br />
IPv4 over IPv4 tunneling driver<br />
GRE over IPv4 tunneling driver<br />
ip_tables: (C) 2000-2006 Netfilter Core Team<br />
ClusterIP Version 0.8 loaded successfully<br />
TCP bic registered<br />
TCP cubic registered<br />
TCP westwood registered<br />
TCP highspeed registered<br />
TCP hybla registered<br />
TCP htcp registered<br />
TCP vegas registered<br />
TCP scalable registered<br />
NET: Registered protocol family 1<br />
NET: Registered protocol family 17<br />
Welcome to PF_RING 3.2.1<br />
(C) 2004-06 L.Deri <deri@ntop.org><br />
NET: Registered protocol family 27<br />
PF_RING: bucket length    128 bytes<br />
PF_RING: ring slots       4096<br />
PF_RING: sample rate      1 [1=no sampling]<br />
PF_RING: capture TX       No [RX only]<br />
PF_RING: transparent mode Yes<br />
PF_RING initialized correctly.<br />
PF_RING: registered /proc/net/pf_ring/<br />
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com><br />
All bugs added by David S. Miller <davem@redhat.com><br />
decode 1f02<br />
VFS: Mounted root (squashfs filesystem) readonly.<br />
Mounted devfs on /dev<br />
Freeing unused kernel memory: 144k freed<br />
start service<br />
starting Architecture code for broadcom<br />
Booting device: Linksys WRT320N<br />
loading bcm57xx<br />
[USB] checking...<br />
sh: can't create /proc/switch/eth0/reset: nonexistent directory<br />
sh: can't create /proc/switch/eth1/reset: nonexistent directory<br />
sh: can't create /proc/switch/eth0/vlan/1/ports: nonexistent directory<br />
sh: can't create /proc/switch/eth0/vlan/1/ports: nonexistent directory<br />
sh: can't create /proc/switch/eth0/vlan/2/ports: nonexistent directory<br />
sh: can't create /proc/switch/eth0/vlan/2/ports: nonexistent directory<br />
/etc/preinit: line 66: can't create /proc/sys/net/ipv4/ip_conntrack_max: nonexistent directory<br />
Unlocking ddwrt ...<br />
eth1: Operation not supported<br />
wl0.1: No such device<br />
wl0.2: No such device<br />
wl0.3: No such device<br />
nbw = 20<br />
eth1: Operation not supported<br />
eth1: Operation not supported<br />
eth1: Operation not supported<br />
eth1: Operation not supported<br />
br0: Dropping NETIF_F_UFO since no NETIF_F_HW_CSUM feature.<br />
device br0 entered promiscuous mode<br />
Algorithmics/MIPS FPU Emulator v1.5<br />
br0: Bad file descriptor<br />
device vlan1 entered promiscuous mode<br />
device eth0 entered promiscuous mode<br />
br0: Bad file descriptor<br />
eth1: Operation not supported<br />
wl0.1: No such device<br />
wl0.2: No such device<br />
wl0.3: No such device<br />
nbw = 20<br />
eth1: Operation not supported<br />
eth1: Operation not supported<br />
eth1: Operation not supported<br />
eth1: Operation not supported<br />
device eth1 entered promiscuous mode<br />
br0: port 2(eth1) entering learning state<br />
br0: port 1(vlan1) entering learning state<br />
device br0 left promiscuous mode<br />
device br0 entered promiscuous mode<br />
device br0 left promiscuous mode<br />
device br0 entered promiscuous mode<br />
device vlan2 entered promiscuous mode<br />
br0: topology change detected, propagating<br />
br0: port 2(eth1) entering forwarding state<br />
br0: topology change detected, propagating<br />
br0: port 1(vlan1) entering forwarding state<br />
Key is a RSA key<br />
Wrote key to '/tmp/root/.ssh/ssh_host_rsa_key'<br />
device vlan2 left promiscuous mode<br />
Key is a DSS key<br />
Wrote key to '/tmp/root/.ssh/ssh_host_dss_key'<br />
SIOCGIFFLAGS: No such device<br />
SIOCGIFFLAGS: No such device<br />
SIOCGIFFLAGS: No such device<br />
SIOCGIFFLAGS: No such device<br />
etherip: Ethernet over IPv4 tunneling driver<br />
The Milkfish Router Services<br />
ERROR: Necessary service setting not found: milkfish_username - aborting.<br />
The Milkfish Router Services<br />
Restoring SIP ddsubscriber database from NVRAM...<br />
Empty.<br />
The Milkfish Router Services<br />
Restoring SIP ddaliases database from NVRAM...<br />
Empty.</p>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/09/new-router-part-2-linksys-wrt320n-serial-console/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New router: Linksys WRT320N</title>
		<link>http://www.maartendamen.com/2010/09/new-router-linksys-wrt320n/</link>
		<comments>http://www.maartendamen.com/2010/09/new-router-linksys-wrt320n/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 18:00:42 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Routers]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[Reverse engineering]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[wireless]]></category>
		<category><![CDATA[wrt]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=400</guid>
		<description><![CDATA[Last week I bought a new router, I wanted one with gigabit ports and wireless N. So I ended up buying the Linksys WRT320N. After doing a bad flash, I had to open it to find an unbrick method. Good thing though is that I got to see the inside of this nifty device. Opening [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I bought a new router, I wanted one with gigabit ports and wireless N.<br />
So I ended up buying the <a href="http://www.linksysbycisco.com/NL/nl/products/WRT320N">Linksys WRT320N</a>.<br />
After doing a bad flash, I had to open it to find an unbrick method.<br />
<span id="more-400"></span><br />
Good thing though is that I got to see the inside of this nifty device.<br />
Opening the case wasn&#8217;t such a tough job, it had little &#8220;chix with dix&#8221; torx (official name: security torx):</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/funnyscrew.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/funnyscrew-150x150.jpg" alt="" title="funnyscrew" width="150" height="150" class="alignnone size-thumbnail wp-image-411" /></a></p>
<p>Fortunately I could wrap around it with a little regular screwdriver (didn&#8217;t have any security torx driver handy, who does anyway?)<br />
Here&#8217;s a picture of the case from the inside (note the three, damn small antenna&#8217;s):</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/router11.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/router11.jpg" alt="" title="router1" width="634" height="475" class="alignnone size-full wp-image-415" /></a></p>
<p>Here&#8217;s a picture of the hardware board:<br />
<a href="http://www.maartendamen.com/wp-content/uploads/2010/09/router2.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/router2.jpg" alt="" title="router2" width="634" height="475" class="alignnone size-full wp-image-417" /></a></p>
<p>But wait.. what&#8217;s the soldered wire down the bottom left? [teaser]We will talk about that in the next blog post :-)[/teaser]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/09/new-router-linksys-wrt320n/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plugwise protocol unleashed part 1: introduction</title>
		<link>http://www.maartendamen.com/2010/01/plugwise-protocol-unleashed-part-1-introduction/</link>
		<comments>http://www.maartendamen.com/2010/01/plugwise-protocol-unleashed-part-1-introduction/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 20:53:16 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Plugwise unleashed]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Plugwise]]></category>
		<category><![CDATA[POL]]></category>
		<category><![CDATA[Reverse engineering]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=89</guid>
		<description><![CDATA[Introduction In the Plugwise protocol unleashed series, I will describe the plugwise protocol. As far as I have been able to re-engineer it. I did this re-engineering work because there is no Linux/OSX software available to control your plugwise devices. All information in these series are based on the 2.0 firmware version! DISCLAIMER: use of [...]]]></description>
			<content:encoded><![CDATA[<p><code><br />
</code></p>
<p><strong>Introduction</strong></p>
<p>In the Plugwise protocol unleashed series, I will describe the plugwise protocol. As far as I have been able to re-engineer it. I did this re-engineering work because there is no Linux/OSX software available to control your plugwise devices. All information in these series are based on the 2.0 firmware version!</p>
<p><strong><span style="text-decoration: underline;">DISCLAIMER: use of the information in these articles is at your own risk.<br />
This information is not supported by Plugwise B.V. in any way.</span></strong></p>
<p><strong>So what is plugwise anyway?</strong></p>
<p><strong><span id="more-89"></span><br />
</strong></p>
<p>Plugwise is a smart way of measuring power usage using a device called the Circle.<br />
It&#8217;s basically a plug between your device and the power socket.<br />
The device can be used to keep track of the following:</p>
<p>- Current power usage;<br />
- historic power usage, using buffers in the device itself;<br />
- you can also use it to power on/power off a device;<br />
- you can also use it as standby killer (using a schema).</p>
<p>For more information visit: <a title="Plugwise homepage" href="http://www.plugwise.com">http://www.plugwise.com</a></p>
<p><strong>General information</strong></p>
<p>Before we can dive deep into the plugwise protocol, we are first going through some basics of the protocol in part one of this series.<br />
Plugwise uses the zigbee protocol to communicatie over the air.<br />
Once all of your devices have been setup using Plugwise source (the default Plugwise software) you can control your devices using the plugwise stick (this is a little USB stick)</p>
<p><img class="size-full wp-image-90 alignnone" style="margin-top: 1px; margin-bottom: 1px;" title="Plugwise stick" src="http://www.maartendamen.com/wp-content/uploads/2010/01/plugwise_stick.jpg" alt="Plugwise stick" width="320" height="186" /></p>
<p><em>Image 1: the plugwise stick</em></p>
<p>To send commands to the Plugwise stick, plugwise uses a serial communication protocol.<br />
Actually the Plugwise stick has a FTDI FT232 UART aboard. The following information shows up when plugged into a Linux machine:</p>
<p><code>Bus 006 Device 003: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC</code></p>
<p>The serial communication takes place with the following settings:</p>
<ul>
<li>Baud rate: 115200</li>
<li>Data bits: 8</li>
<li>Stop bits: 1</li>
<li>Parity: none</li>
</ul>
<p><strong>Plugwise data packet</strong></p>
<p>The Plugwise data packet looks like this:</p>
<p><img class="alignnone size-full wp-image-97" title="plugwise_packet" src="http://www.maartendamen.com/wp-content/uploads/2010/01/plugwise_packet.png" alt="plugwise_packet" width="606" height="70" /></p>
<p><em>Image 2: the Plugwise protocol frame.</em></p>
<p>The start frame must be sent before sending any other data, the hexadecimal presentation of the start frame looks like this:</p>
<p><code>\x05\x05\x03\x03</code></p>
<p>The data formats varies, an example might look like this:</p>
<p><code>0017000D6F0000236XXX01</code></p>
<p>This actually is an example of the power change command (switch a device on or off, in this case a device on command)<br />
0017 is the command, <code>00D6F0000236XXX the mac address and 01 the power code (power on)</code></p>
<p>Followed by the data, is the CRC checksum.<br />
The used CRC checksum by Plugwise is a CRC16 checksum (often reffered to as ymodem or zmodem), it has the following properties:</p>
<ul>
<li>Polynomial: 0&#215;11021</li>
<li>Seed value: 0&#215;00000</li>
<li>Xor mask: 0&#215;00000</li>
<li>Width: 16</li>
</ul>
<p>The checksum is generated over the data piece of the packet.<br />
Last part of the packet is the end frame, this is basically a control feed followed by a linefeed. Which looks the following way, in hexadecimal:</p>
<p><code>\x0d\x0a</code></p>
<p>This concludes the first part of the Plugwise protocol unleashed series. If you have any specific protocol questions, please leave them in the comments so I can talk about it in the next part of this serie.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/01/plugwise-protocol-unleashed-part-1-introduction/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

