<?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>InputOutput.io</title>
	<atom:link href="http://www.inputoutput.io/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.inputoutput.io</link>
	<description>The free-thinkin' free-speakin' rabble-rousin' geek.</description>
	<lastBuildDate>Tue, 02 Apr 2013 18:36:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4</generator>
		<item>
		<title>Remote Monitoring of Network Connections with Arduino and LEDs</title>
		<link>http://www.inputoutput.io/remote-monitoring-network-connections-arduino-leds/</link>
		<comments>http://www.inputoutput.io/remote-monitoring-network-connections-arduino-leds/#comments</comments>
		<pubDate>Mon, 28 Jan 2013 10:43:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.inputoutput.io/?p=179</guid>
		<description><![CDATA[<p>Using cerealbox to create a colorful visualization of your TCP/UDP connections. Inspiration At Defcon in 2011 I attended a talk by Steve Ocepek over at Spider Labs introducing a neat little project he was working on. I recommend you watch the talk, but here&#8217;s the jist of it. Basically, he was using the Arduino with [...]</p><p>The post <a href="http://www.inputoutput.io/remote-monitoring-network-connections-arduino-leds/">Remote Monitoring of Network Connections with Arduino and LEDs</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>Using <a href="https://github.com/Hainish/cerealbox">cerealbox</a> to create a colorful visualization of your TCP/UDP connections.<br />
<br />
<iframe width="420" height="315" src="http://www.youtube.com/embed/CNhFA9XwXz0" frameborder="0" allowfullscreen></iframe><br />
<br />
<iframe width="420" height="315" src="http://www.youtube.com/embed/kIEDMqaeZ30" frameborder="0" allowfullscreen></iframe></p>
<h2>Inspiration</h2>
<p>At Defcon in 2011 I attended a <a href="https://www.youtube.com/watch?v=DajiwO006ys">talk</a> by Steve Ocepek over at Spider Labs introducing a neat little project he was working on. I recommend you watch the talk, but here&#8217;s the jist of it. Basically, he was using the <a href="http://www.arduino.cc/">Arduino</a> with an <a href="http://blog.iteadstudio.com/ah-colorduino-debut/">8&#215;8 LED board</a> (each coordinate having an RGB value) to visualize the current established connections on a given network interface. Each coordinate of the matrix was color-coded based on country code, so you could differentiate connections based on region. As you made an outbound connection, lights would suddenly appear on the board, indicating where you are connecting to. And when those connections dropped or you disconnected, the lights disappeared. Network monitoring was done with libpcap, and a list of the active connections were sent to the Arduino using the serial interface and a perl script he coded. He called it cerealbox. I thought it was really neat to have a display of network connections always visible, without exhausting valuable screen real estate. Not only was it really useful for network admins, it was also really pretty! I mean, who doesn&#8217;t like shiny bright LEDs? And he provided the <a href="https://github.com/SpiderLabs/cerealbox">source</a> for it, so you could buy the boards and set this up yourself.</p>
<p>I&#8217;d never worked with Arduino before, but I was inspired enough by this proof of concept to at least get his demo working for myself, and maybe make a few modifications. But suiting the project to my needs required a few additional considerations.</p>
<h2>Requirements</h2>
<h3>Continent Codes, not Country Codes</h3>
<p>Getting the demo set up was the easy part. But the color-coding was randomized based on country code. I wanted something a bit more useful &#8211; something that I could clearly see what region a connection was coming from, rather than a randomized color. The problem is that there&#8217;s a lot of countries in the world. Like, almost 200. With so many countries, the variations of color would be too slight for me to figure out at a glance which region a connection is coming from. So I wanted to code it based on continent code instead, with higher contrast between indicators. Here&#8217;s my schema:</p>
<ul>
<li>Blue = Europe</li>
<li>Orange = Asia</li>
<li>Purple = Oceania</li>
<li>Yellow = Africa</li>
<li>White = South America</li>
<li>Teal = North America</li>
<li>Pink = Antarctica &amp; Local</li>
<li>Green = United States</li>
<li>Red = Special IPs (My VPSes)</li>
</ul>
<p>Okay, so I cheated &#8211; not each one of those is a continent. US is it&#8217;s own color, and it seems a little weird to have Antarctica grouped with local connections. But connections coming from Antarctica seemed like such an extreme edge case, and I didn&#8217;t want to give up an entire color for a continent with no permanent r. So there are those exceptions, and then red for my own VPSes.</p>
<h3>Client-Server Architecture</h3>
<p>One of the things I really wanted to do was be able to visualize the connections of any machine, not just the one connected to the Arduino. The original project bundled the packet sniffing and serial connection to the Arduino in one neat little perl script, but I wanted to separate the part that monitors the network connection and the part that sends it to the arduino. The former will belong to the client, and the latter to the server.</p>
<p>I originally considered just using the Arduino standalone, with the color shield chained directly on top of a <a href="https://www.sparkfun.com/products/9954">WiFly</a> shield, and sending network connections to a server hosted directly on the Arduino. I even <a href="https://github.com/Hainish/colorduino-noconflict-wifly">modified</a> the Colorduino library to use different pins from the WiFly. But in the end I wanted to ensure that the connection to the Arduino was secure. This would be difficult to implement with the 32k space limitations of the Uno I was working with.</p>
<h3>Secure Transport Layer</h3>
<p>Between the client &amp; server, I wanted to add a secure network layer. I decided on having the client/server negotiate an SSL connection with a simple password authentication.</p>
<h3>Python, not Perl</h3>
<p>Not to start a religious war, but I&#8217;m more comfortable in Python, so I&#8217;d have to rewrite the network monitoring and serial communication components of the script Steve had written.</p>
<h3>RasPi</h3>
<p>I wanted the server to run on the <a href='http://www.raspberrypi.org/'>Raspberry Pi</a>.  Actually this was the easiest part &#8211; with Raspbian, it was just a matter of installing pip with python 2.7 and installing everything else with pip.  No assembly required!</p>
<h2>Implementation</h2>
<h3>Client</h3>
<p>Since the geolocation lookup happens immediately as a connection is read on the client-side, I needed to use a few geoip libraries: <a href="https://github.com/appliedsec/pygeoip">pygeoip</a> to perform a lookup on the country code, and <a href="http://pypi.python.org/pypi/incf.countryutils">incf.countryutils</a> to then fetch the continent code. Additionally, a packet sniffer was needed. I considered using <a href="http://www.secdev.org/projects/scapy/">scapy</a> for this task, which I&#8217;ve had a lot of fun with in the past and I highly recommend as a versatile tool for python packet-slicing. However, scapy seemed a bit heavyweight for the task at hand, so I decided on <a href="http://corelabs.coresecurity.com/index.php?module=Wiki&amp;action=view&amp;type=tool&amp;name=Pcapy">pcapy</a> for sniffing and <a href="http://corelabs.coresecurity.com/index.php?module=Wiki&amp;action=view&amp;type=tool&amp;name=Impacket">imapacket</a> for dissecting packets.</p>
<p>As packets come across the wire, we keep track of them, keeping a hash (in python parlance, a dict) of udp and tcp connections. For the TCP connections, we look for the syn + ack flags, indicating a connection is established. Conversely, a fin or rst flag indicates the connection has been severed. Since UDP packets are stateless, we immediately record that a connection is established when we see any UDP traffic. Periodically, we have a sweeper to handle timed out connections.</p>
<p>Once a connection is established or severed, perform a geoip lookup on the remote IP, and immediately send that data to the server via an ssl socket.</p>
<h3>Server</h3>
<p>The server is super simple. It just receives signals coming in over the ssl bind socket, and forwards that signal directly to the arduino. Serial communications are handled by the <a href="http://pyserial.sourceforge.net/">pyserial</a> module. Several other standard library modules are used by both the client and the server, such as ssl and socket to instantiate a secure communication.</p>
<p>By the time we write to the serial interface, the message we send contains the following information: [Connection Closed or Opened],[Remote Mac Address],[Remote ipv4 IP],[Remote Port],[Country Code],[Continent Code]</p>
<h3>Arduino</h3>
<p>I didn&#8217;t change what Steve wrote a whole lot here, except for reading the continent code and setting the colors appropriately. I did separate out a file for IP addresses I wanted to specially highlight.</p>
<h2>Challenges</h2>
<p>One of the challenges I&#8217;ve had is when to determine when a timeout on a TCP connection has occurred. Some connections (for example, SSH), can stand for several hours before timing out. Others (HTTP, for example) time out very quickly. From my understanding, it&#8217;s impossible to tell from the transport layer if a connection has timed out in a given period of time. We can infer the timeout from the application layer, but it seems a bit inelegant of a solution. I have yet to find a good way of dealing with this problem. If you know of a solution, please <a href="/contact">contact</a> me.</p>
<p>On the client, the sniffing of packets by pcapy is a blocking call. Sending a ctrl-c doesn&#8217;t throw a KeyboardInterrupt exception until a new packet is actually read. In order to ensure that users can kill the client immediately, I had to use the multiprocessing module and actually use a separate process to determine if a KeyboardInterrupt was issued, which killed both itself and the sniffing loop process. This seems a bit silly to me, but I&#8217;m not sure if there&#8217;s any better way to do this. Again, if you have any suggestions, let me know.</p>
<div style='width: 460px; font-size: 9pt; color: #333;'><img class="aligncenter size-full wp-image-185" style="display: inline-block; float: left;" title="IMG_20130113_033041" src="http://www.inputoutput.io/wp-content/uploads/2013/01/IMG_20130113_0330411.jpg" alt="" width="230" height="173" /> <img class="aligncenter size-full wp-image-186" style="display: inline-block; float: left;" title="IMG_20130128_014230" src="http://www.inputoutput.io/wp-content/uploads/2013/01/IMG_20130128_0142301.jpg" alt="" width="230" height="173" /></p>
<div style="clear: both;"></div>
<p>Left: cerealbox visualizing http(s) connections.  Right: bittorrent traffic</p></div>
<h2>Outcome</h2>
<p>There&#8217;s still a few bugs to squash.  But it works, it&#8217;s pretty, and it&#8217;s useful! Check out colorduino on my <a href="https://github.com/Hainish/cerealbox">github</a> and let me know what you think!</p>
<p>The post <a href="http://www.inputoutput.io/remote-monitoring-network-connections-arduino-leds/">Remote Monitoring of Network Connections with Arduino and LEDs</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.inputoutput.io/remote-monitoring-network-connections-arduino-leds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enigma Machine in Captain America: The First Avenger</title>
		<link>http://www.inputoutput.io/enigma-machine-captain-america-film/</link>
		<comments>http://www.inputoutput.io/enigma-machine-captain-america-film/#comments</comments>
		<pubDate>Wed, 04 Jul 2012 05:45:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.inputoutput.io/?p=170</guid>
		<description><![CDATA[<p>In a nod to the history of cryptography, the folks over at Marvel Studios included a modified replica of the Enigma Machine in one scene for the 2011 film Captain America: The First Avenger. If you don&#8217;t know, the Enigma Machine was a tool used by the German army and navy to encipher and decipher [...]</p><p>The post <a href="http://www.inputoutput.io/enigma-machine-captain-america-film/">Enigma Machine in Captain America: The First Avenger</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>In a nod to the history of cryptography, the folks over at Marvel Studios included a modified replica of the Enigma Machine in one scene for the 2011 film Captain America: The First Avenger. If you don&#8217;t know, the <a href="https://en.wikipedia.org/wiki/Enigma_machine">Enigma Machine</a> was a tool used by the German army and navy to encipher and decipher messages during WWII. The breaking of the cipher by the brilliant cryptographer <a href="https://en.wikipedia.org/wiki/Alan_turing">Alan Turing</a> gave the allies vital information on land movements of axis troops. In this scene, it was even used in the correct context: decrypting messages of the Nazi train system. I commend Marvel for their thoroughness on this one!</p>
<div id="attachment_171" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.inputoutput.io/wp-content/uploads/2012/07/captain_america_enigma_machine1.png"><img class="size-medium wp-image-171" title="captain_america_enigma_machine" src="http://www.inputoutput.io/wp-content/uploads/2012/07/captain_america_enigma_machine1-300x182.png" alt="" width="300" height="182" /></a><p class="wp-caption-text">A modified replica enigma as seen in the film</p></div>
<div id="attachment_172" class="wp-caption aligncenter" style="width: 235px"><a href="http://www.inputoutput.io/wp-content/uploads/2012/07/IMG_20110320_1615141.jpg"><img class="size-medium wp-image-172" title="IMG_20110320_161514" src="http://www.inputoutput.io/wp-content/uploads/2012/07/IMG_20110320_1615141-225x300.jpg" alt="" width="225" height="300" /></a><p class="wp-caption-text">An actual enigma machine from a picture I took last year at the Computer History Museum in Mountain View, CA</p></div>
<p>The post <a href="http://www.inputoutput.io/enigma-machine-captain-america-film/">Enigma Machine in Captain America: The First Avenger</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.inputoutput.io/enigma-machine-captain-america-film/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lookbehind / Lookahead Regex in Vim</title>
		<link>http://www.inputoutput.io/lookbehind-lookahead-regex-in-vim/</link>
		<comments>http://www.inputoutput.io/lookbehind-lookahead-regex-in-vim/#comments</comments>
		<pubDate>Sat, 23 Jun 2012 00:23:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[How-Tos]]></category>

		<guid isPermaLink="false">http://www.inputoutput.io/?p=142</guid>
		<description><![CDATA[<p>Here&#8217;s a nifty little vim tip for you. I recently had to switch a few variables in PHP from $varname to $somearray['varname']. Since there were quite a few of these replacements to be done, I found it convenient to use vim&#8217;s search/replace regex feature. In this case, I have to use lookbehind, since the matching [...]</p><p>The post <a href="http://www.inputoutput.io/lookbehind-lookahead-regex-in-vim/">Lookbehind / Lookahead Regex in Vim</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a nifty little vim tip for you.</p>
<p>I recently had to switch a few variables in PHP from $varname to $somearray['varname']. Since there were quite a few of these replacements to be done, I found it convenient to use vim&#8217;s search/replace regex feature. In this case, I have to use lookbehind, since the matching string is simply <em>varname</em>, and I&#8217;m not interested in catching the <em>$</em> at the beginning.  I just want the regex to match anything starting with the <em>$</em>, without having the <em>$</em> as part of the matching string itself.</p>
<p>So, let&#8217;s try to replace the following line:</p>
<pre class="brush: php; title: ; notranslate">
authenticate($key, $secret, $uri);
</pre>
<p>with this one:</p>
<pre class="brush: php; title: ; notranslate">
authenticate($somearray['key'], $somearray['secret'], $somearray['uri']);
</pre>
<p>We&#8217;ll want to construct a lookbehind for the <em>$</em>, with some string in front.  Then, we&#8217;ll replace it with $somearray['<em>matching_string</em>'].  In vim, lookbehind uses the special @ symbol, rather than the perl (?<=somestring) syntax.</p>
<pre class="brush: bash; title: ; notranslate">
:&#8217;&lt;,&#8217;&gt;s/\$\@&lt;=[a-z]\+/$somearray['&amp;']/g
</pre>
<p>This will do the trick.  As you can see, the $, @, and + must all be escaped.  The lookbehind positive search chars, <em>@&lt;=</em> can be replaced with <em>@&lt;!</em> if a negative search is desired.  Lookahead is similar to lookbehind's syntax, but uses <em>@=</em> and <em>@!</em> instead.  The special <em>&#038;</em> character in the replace string designates a matching token, which you can use to place the matching string in your replacement.</p>
<p>So for reference:</p>
<ul>
<li>
<pre class="brush: bash; title: ; notranslate">
:%s/\(some\)\@&lt;=thing/one/g
</pre>
<p>searches for all strings starting with <em>some</em>, then matching <em>thing</em><br />
changes <em>thing</em> into <em>one</em></p>
<p><strong>end result:</strong> <em>something</em> becomes <em>someone</em>
</li>
<li>
<pre class="brush: bash; title: ; notranslate">
:%s/\(some\)\@&lt;!thing/one/g
</pre>
<p>searches for all strings not starting with <em>some</em>, then matching <em>thing</em><br />
changes <em>thing</em> into <em>one</em></p>
<p><strong>end result:</strong> <em>something</em> is not changed, but <em>everything</em> changes to <em>everyone</em>
</li>
<li>
<pre class="brush: bash; title: ; notranslate">
:%s/some\(thing\)\@=/every/g
</pre>
<p>searches for all strings ending with <em>thing</em>, then matching <em>some</em><br />
changes <em>some</em> into <em>every</em></p>
<p><strong>end result:</strong> <em>something</em> becomes <em>everything</em>
</li>
<li>
<pre class="brush: bash; title: ; notranslate">
:%s/some\(thing\)\@!/every/g
</pre>
<p>searches for all strings not ending with <em>thing</em>, then matching <em>some</em><br />
changes <em>some</em> into <em>every</em></p>
<p><strong>end result:</strong> <em>something</em> is not changed, but <em>someone</em> becomes <em>everyone</em>
</li>
</ul>
<p>The post <a href="http://www.inputoutput.io/lookbehind-lookahead-regex-in-vim/">Lookbehind / Lookahead Regex in Vim</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.inputoutput.io/lookbehind-lookahead-regex-in-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hardening your VPN Setup with iptables</title>
		<link>http://www.inputoutput.io/hardening-your-vpn-setup-with-iptables/</link>
		<comments>http://www.inputoutput.io/hardening-your-vpn-setup-with-iptables/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 06:44:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[How-Tos]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[routes]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://www.inputoutput.io/?p=137</guid>
		<description><![CDATA[<p>I&#8217;ll be heading out to Defcon 19 next month, so I want my VPN connection to be stable and secure. You probably know the situation. You&#8217;re at your local coffee shop, using their (hopefully not) wide-open unsecured wifi hotspot. But you&#8217;re smart enough not to send all your data out over the clear, since there [...]</p><p>The post <a href="http://www.inputoutput.io/hardening-your-vpn-setup-with-iptables/">Hardening your VPN Setup with iptables</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be heading out to <a target='_blank' href='http://www.defcon.org/html/defcon-19/dc-19-index.html'>Defcon 19</a> next month, so I want my VPN connection to be stable and secure.</p>
<p>You probably know the situation.  You&#8217;re at your local coffee shop, using their (hopefully not) wide-open unsecured wifi hotspot.  But you&#8217;re smart enough not to send all your data out over the clear, since there might be malicious script kiddies ready to take your sensitive data and sell it to kids on the street.  So you use a VPN.  You fire up OpenVPN and connect to your VPN service.  Then you start browsing, comforted by the fact that your traffic is encapsulated in a secure SSL tunnel.  Better yet, the user experience is transparent: you don&#8217;t have to configure your applications to manually use a SOCKS5 proxy.  OpenVPN handles your routing tables and creates a virtual interface using the tun module.  It&#8217;s so simple, you don&#8217;t need to think about it.  But there&#8217;s a problem with this setup.</p>
<p>No one can reach into your stream and extract or insert data, but there&#8217;s a caveat.  Anyone can destroy your TCP stream by sending you a spoofed RST packet from the remote server, or otherwise making the service unavailable to you.  Destroying the TCP stream destroys the virtual (tun) interface, which, in turn, destroys the routes associated with that interface.  Now you&#8217;re using your physical interface unprotected from those pesky hackers.  Worse still, you don&#8217;t realize it.  Not a thing has changed from the perspective of user experience.  Since everything is transparent, you don&#8217;t notice any change at all.  Now you&#8217;re screwed.</p>
<p>Little did you know that this all could have been avoided by our friend iptables.  Sure, you could modify your routes further to ensure that only traffic going to the remote server goes over your physical interface, but that&#8217;s too easy.  Plus, routing tables aren&#8217;t intended for security, they&#8217;re inteded to move packets along.  iptables seems like the tool for the task, so I modified a script I found <a target='_blank' href='http://www.incubus.co.uk/?p=506'>here</a> to make sure that we disallow any traffic that we don&#8217;t want:</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
	echo &quot;This script must be run as root&quot; 1&gt;&amp;2
	exit 1
fi

# name of primary network interface (before tunnel)
PRIMARY=wlan0

# address of tunnel server
SERVER=seattle.vpn.riseup.net
# address of vpn server
VPN_SERVER=seattle.vpn.riseup.net

# gateway ip address (before tunnel - adsl router ip address)
# automatically determine the ip from the default route
GATEWAY=`route -n | grep $PRIMARY | egrep &quot;^0\.0\.0\.0&quot; | tr -s &quot; &quot; | cut -d&quot; &quot; -f2`

# provided by pppd: interface name
TUNNEL=tun0

openvpn --config /my/path/to/riseup.ovpn --auth-user-pass /my/path/to/authentication.conf &amp;

# iptables rules - important!

#LOCAL_NET=192.168.0.0/16
LOCAL_NET=$GATEWAY

# Flush all previous filter rules, you might not want to include this line if you already have other rules setup
iptables -t filter --flush

iptables -t filter -X MYVPN
iptables -t filter -N MYVPN

# Exceptions for local traffic &amp; vpn server
iptables -t filter -A MYVPN -o lo -j RETURN
iptables -t filter -A MYVPN -o ${TUNNEL} -j RETURN
iptables -t filter -A MYVPN --dst 127.0.0.1 -j RETURN
iptables -t filter -A MYVPN --dst $LOCAL_NET -j RETURN
iptables -t filter -A MYVPN --dst ${SERVER} -j RETURN
iptables -t filter -A MYVPN --dst ${VPN_SERVER} -j RETURN
# Add extra local nets here as necessary

iptables -t filter -A MYVPN -j DROP

# MYVPN traffic leaving this host:
iptables -t filter -A OUTPUT -p tcp --syn -j MYVPN
iptables -t filter -A OUTPUT -p icmp -j MYVPN
iptables -t filter -A OUTPUT -p udp -j MYVPN

echo &quot;nameserver 8.8.8.8&quot; &gt; /etc/resolv.conf
</pre>
<p>You&#8217;ll want to modify the openvpn command, interfaces, and servers to meet your needs.  And that&#8217;s it!  If your stream is taken down, you have these rules to protect you.  I have this script as a post-connect hook for any untrusted networks I connect to (<a href='http://wicd.sourceforge.net/' target='_blank'>wicd</a> is a nice network manager for adding hooks).  Later, if you want your traffic to go over the clear again, you can use this script:</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
	echo &quot;This script must be run as root&quot; 1&gt;&amp;2
	exit 1
fi

iptables -t filter --flush
iptables -t filter -X MYVPN
</pre>
<p>The post <a href="http://www.inputoutput.io/hardening-your-vpn-setup-with-iptables/">Hardening your VPN Setup with iptables</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.inputoutput.io/hardening-your-vpn-setup-with-iptables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rooting a router: Wiretapping dd-wrt / OpenWRT embedded linux firmware</title>
		<link>http://www.inputoutput.io/wiretapping-ddwrt-openwrt/</link>
		<comments>http://www.inputoutput.io/wiretapping-ddwrt-openwrt/#comments</comments>
		<pubDate>Sat, 15 Jan 2011 07:46:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Ideas]]></category>

		<guid isPermaLink="false">http://www.inputoutput.io/?p=128</guid>
		<description><![CDATA[<p>Note: The following post is written partially as a follow-up to the presentation I gave on dd-wrt at the December meeting of the Western North Carolina Linux Users Group. Concept If you&#8217;re running dd-wrt as your router (or OpenWRT, or Tomato for that matter), you already know how powerful it can be. Capabilities such as [...]</p><p>The post <a href="http://www.inputoutput.io/wiretapping-ddwrt-openwrt/">Rooting a router: Wiretapping dd-wrt / OpenWRT embedded linux firmware</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>Note: The following post is written partially as a follow-up to the presentation I gave on dd-wrt at the December meeting of the <a href='http://wnclug.ourproject.org/'>Western North Carolina Linux Users Group</a>.</p>
<p style="text-align: center;"><img class="size-medium wp-image-129 aligncenter" title="wrt54g" src="http://www.inputoutput.io/wp-content/uploads/2011/01/wrt54g-300x282.jpg" alt="" width="300" height="282" /></p>
<p><strong>Concept</strong></p>
<p>If you&#8217;re running dd-wrt as your router (or OpenWRT, or Tomato for that matter), you already know how powerful it can be.  Capabilities such as boosting signal strength, interacting with Dynamic DNS services, running a VPN server, and transitioning to ipv6 all come prepackaged standard edition, running on a mere 4MB of flash memory (and micro running on 2MB!)  What I will show you is that using the features commonly bundled with dd-wrt, you can turn your router into a wiretap, regardless of your wireless security.  I&#8217;ll be dealing specifically with dd-wrt v24-sp2, but you can also wiretap OpenWRT by following similar instructions.</p>
<p>The idea is this: you have a router sitting at a critical juncture in your network infrastructure.  Packets are rapidly being routed in and out of various interfaces on the router.  If we are dealing with a wireless router with security enabled, the router is an endpoint for this encryption.  Which means that the packets will be decrypted upon arrival, before being pushed through the wire.  Additionally, the OpenWRT / dd-wrt communities have ported a wide array of Linux projects to the platform.  Notably, they&#8217;ve ported tcpdump, the powerful command-line packet analyzer, and libpcap, the C/C++ library required for capturing network traffic.  Using such a tool at the router level means your network is owned.</p>
<p>There&#8217;s a problem though – once we have a capture going, where do we store it?  Most of these routers only have extremely limited flash storage space, usually barely enough for the embedded firmware alone.  Even those that have more can only store perhaps a few moments of a heavy traffic capture.  Where is all that data to go?  Well, we&#8217;re in luck: dd-wrt has precompiled support for CIFS (also known as SMB), Microsoft&#8217;s network sharing protocol.  If we&#8217;re able to mount a network share, and store our capture there, then we don&#8217;t have to worry about storage limitations.  We can even install the packages necessary for the capture on the remote filesystem.</p>
<p><strong>Implementation</strong></p>
<p>Let&#8217;s start with a base install.  We&#8217;ll need ssh access, so lets load up the web interface and under Services → Services enable SSHd.  The package manager OpenWRT uses is called ipkg.  This is not available until we enable JFFS2 under Administration → Management.  Next, create a CIFS share on the local machine.  Here, our local machine&#8217;s ip is 192.168.1.2, and the network share is named “share.”  SSH in as root, and issue the following commands to insert the CIFS module and mount the network share:</p>
<pre class="brush: bash; title: ; notranslate">
insmod /lib/modules/2.4.35/cifs.o
mount.cifs &quot;\\\\192.168.1.2\\share&quot; /jffs -o user=username,password=password</pre>
<p>Nice, now we have the network share mounted.  If you encounter an error issuing the mount.cifs command, double check your ip, share name, username, and password.  Since we&#8217;ve essentially mounted over the already mounted /jffs, we need to issue an additional command for ipkg to cleanly update:</p>
<pre class="brush: bash; title: ; notranslate">
mkdir -p /jffs/tmp/ipkg
ipkg update
</pre>
<p>Once ipkg has updated its package list, we can see all that is available to us by issuing:</p>
<pre class="brush: bash; title: ; notranslate">
ipkg list
</pre>
<p>As you can see, there&#8217;s a ton of stuff we can install.  At this point, though, I started encountering some problems.  When I issued the “ipkg install tcpdump” command, it fetched and installed the required libpcap first.  Then, it went to install tcpdump, and threw an error that libpcap wasn&#8217;t installed.  I tried to install them manually, but that didn&#8217;t work either.  So at this point I started looking for alternatives.  Optware is another way to install packages, using ipkg in /opt rather than /jffs.  Following the instructions <a href="http://www.dd-wrt.com/wiki/index.php/Optware#Optware_on_CIFS_-_Partition_in_a_file">here</a>, I created a local ext2 filesystem available via the network share:</p>
<pre class="brush: bash; title: ; notranslate">
dd if=/dev/zero of=share/optware.ext2 bs=1 count=1 seek=10M
mkfs.ext2 share/optware.ext2
</pre>
<p>If you want more space for packages, change the seek parameter.  Next, we&#8217;ll be mounting this to /opt  on the router side.  We&#8217;ll need to install kmod-loop first, and insert the loop and ext2 kernel modules:</p>
<pre class="brush: bash; title: ; notranslate">
ipkg install kmod-loop
insmod /lib/modules/2.4.35/ext2.o
insmod /jffs/lib/modules/2.4.30/loop.o
mount -o loop /jffs/optware.ext2 /opt
</pre>
<p>Great, now we have /opt mounted to the remote ext2 filesystem.  Get the install script and  install it:</p>
<pre class="brush: bash; title: ; notranslate">
wget http://www.3iii.dk/linux/optware/optware-install-ddwrt.sh -O - | tr -d '\r' &gt; /tmp/optware-install.sh
sh /tmp/optware-install.sh
</pre>
<p>Excellent, now we have the port of optware installed on /opt!  Lets run an ipkg update on this ipkg:</p>
<pre class="brush: bash; title: ; notranslate">
/opt/bin/ipkg update
</pre>
<p>For comparisons sake, lets just look at how many packages we now have available, as opposed to before:</p>
<pre class="brush: bash; title: ; notranslate">
root@DD-WRT:/opt# ipkg list | wc -l
652
root@DD-WRT:/opt# /opt/bin/ipkg list | wc -l
1242
</pre>
<p>So we&#8217;ve almost doubled the amount of packages available to us.  And most importantly, no more complications with tcpdump:</p>
<pre class="brush: bash; title: ; notranslate">
/opt/bin/ipkg install tcpdump
</pre>
<p>Now that we have tcpdump and libpcap, we can dump our packets to the network share:</p>
<pre class="brush: bash; title: ; notranslate">
tcpdump not host 192.168.1.2 -s 0 -w /jffs/network.cap
</pre>
<p>From here on in, we can open the packet dump with wireshark and find lots of useful information.  We can even store the commands in a start-up script in the dd-wrt web interface under Administration → Commands:</p>
<pre class="brush: bash; title: ; notranslate">
insmod /lib/modules/2.4.35/cifs.o
insmod /lib/modules/2.4.35/ext2.o
mount.cifs &quot;\\\\192.168.1.2\\share&quot; /jffs -o user=username,password=password
insmod /jffs/lib/modules/2.4.30/loop.o
mount -o loop /jffs/optware.ext2 /opt
tcpdump not host 192.168.1.2 -s 0 -w /jffs/network.cap &amp;
</pre>
<p><strong>Implications</strong></p>
<p>Given the wide range of routers supported by dd-wrt/OpenWRT, this is a major security concern.  Although this requires physical access to the device in question, there is nothing to stop an attacker from purchasing an identical model of router, installing dd-wrt and tcpdump on it, and swapping a target router with the malicious one.  If the attacker already knows the wireless password, the malicious router can be configured such a swap would not draw attention.  Resetting the router is no defense – the OpenWRT firmware modification kit can easily modify the firmware image file.  Modifying the image file to add code that monitors network traffic would mean that any reset would only be restoring malicious firmware.<br />
Such an attack need not be local.  Most ISPs block CIFS traffic, but the router could be made to forward the CIFS ports through an SSH tunnel to a remote endpoint.  The stock Dropbear SSH isn&#8217;t capable of tunneling, but openssh is available in the ipkg repository, and can be either included in the firmware or installed on the local /jffs space available.  Sending all network traffic that goes over the wire to a remote endpoint may be impractical for an attacker, but packet headers still provide a wealth of information.</p>
<p>The post <a href="http://www.inputoutput.io/wiretapping-ddwrt-openwrt/">Rooting a router: Wiretapping dd-wrt / OpenWRT embedded linux firmware</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.inputoutput.io/wiretapping-ddwrt-openwrt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Swinedroid, Snort Monitoring tool, available on the Android Market</title>
		<link>http://www.inputoutput.io/swinedroid-snort-monitoring-tool-available-on-the-android-market/</link>
		<comments>http://www.inputoutput.io/swinedroid-snort-monitoring-tool-available-on-the-android-market/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 03:29:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[ids]]></category>
		<category><![CDATA[intrusion detection system]]></category>
		<category><![CDATA[intrusion protection system]]></category>
		<category><![CDATA[ips]]></category>
		<category><![CDATA[snort]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[swinedroid]]></category>

		<guid isPermaLink="false">http://www.inputoutput.io/?p=83</guid>
		<description><![CDATA[<p>Swinedroid v0.20 has been released is now available on the Android Market. If you haven&#8217;t read my previous post about it, here&#8217;s the low down. Swinedroid is a remote Snort monitoring application for Android. Currently, it allows you to view server threat statistics, display the latest alerts, search alerts (by alert severity, signature name, time [...]</p><p>The post <a href="http://www.inputoutput.io/swinedroid-snort-monitoring-tool-available-on-the-android-market/">Swinedroid, Snort Monitoring tool, available on the Android Market</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></description>
			<content:encoded><![CDATA[<p><img style="margin: 10px; float: right;" src="/images/swinedroid-client_0.20.apk.png" alt="QR Code to Download Swinedroid Client">Swinedroid v0.20 has been released is now available on the Android Market.  If you haven&#8217;t read my <a href='/swinedroid-the-new-snort-monitoring-tool-for-android/'>previous post</a> about it, here&#8217;s the low down.  Swinedroid is a remote Snort monitoring application for Android.  Currently, it allows you to view server threat statistics, display the latest alerts, search alerts (by alert severity, signature name, time frame) and view alert details (including a hex dump if available).  It consists of two components: the client &#8211; which runs on your Android device, and the server &#8211; which runs on the system you wish to monitor (or a third party server that can access the snort server db port).  The server provides statistics requested by the client over a secure and authenticated SSL link.</p>
<p>Since the last (non-market) release, I&#8217;ve introduced a server threat graph (thaks to <a href='http://www.achartengine.org/'>AChartEngine</a>), alert detail breakdown, SSL authenticity negotiation, functional alert browsing, a more helpful launcher screen, and crash fixes.</p>
<div id="screenshots" style="overflow: visible; margin-top: 10px; margin-bottom: 10px;"><img style="border: 1px solid grey; float: left;" src="/images/swinedroid-client_0.20_server_overview.png" alt="Swinedroid Server Overview"><img style="border: 1px solid grey; float: right;" src="/images/swinedroid-client_0.20_alert_overview.png" alt="Swinedroid Alert Overview"></div>
<div id="clearer" style="clear: both; padding-top: 10px;"></div>
<p>Having an Android Snort monitoring application can prove handy for a variety of situations where access to web-based clients is either unavailable or inconvenient.  Since this is a monitoring tool that runs natively in Android, it will also be possible to recieve notifications based on alert statistics &#8211; a feature I plan to implement at some stage.  Also upcoming is alert tagging and deleting functionality, more advanced alert statistics, attacker profiling (including reverse DNS / location information), and more.  If you have suggestions, please post your feedback.</p>
<p>Download the client app <a href='market://details?id=com.legind.swinedroid'>here</a>.</p>
<p>Download the server <a href='/files/swinedroid-server_0.20.tar.gz'>here</a>.</p>
<p>The post <a href="http://www.inputoutput.io/swinedroid-snort-monitoring-tool-available-on-the-android-market/">Swinedroid, Snort Monitoring tool, available on the Android Market</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.inputoutput.io/swinedroid-snort-monitoring-tool-available-on-the-android-market/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Swinedroid &#8211; the new Snort Monitoring tool for Android</title>
		<link>http://www.inputoutput.io/swinedroid-the-new-snort-monitoring-tool-for-android/</link>
		<comments>http://www.inputoutput.io/swinedroid-the-new-snort-monitoring-tool-for-android/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 08:16:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[ids]]></category>
		<category><![CDATA[intrusion detection system]]></category>
		<category><![CDATA[intrusion protection system]]></category>
		<category><![CDATA[ips]]></category>
		<category><![CDATA[snort]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[swinedroid]]></category>

		<guid isPermaLink="false">http://www.inputoutput.io/?p=68</guid>
		<description><![CDATA[<p>If you&#8217;ve ever been on the go when crisis strikes, you know how convenient it is to have a mobile application for dealing with the problems you might face. For instance, I&#8217;ve found it really convenient that there&#8217;s an application that interfaces with the API for my Virtual Private Server, Slicehost. I no longer have [...]</p><p>The post <a href="http://www.inputoutput.io/swinedroid-the-new-snort-monitoring-tool-for-android/">Swinedroid &#8211; the new Snort Monitoring tool for Android</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></description>
			<content:encoded><![CDATA[<p><img style="float: right; margin: 10px;" src="/images/swinedroid-client_0.10.apk.png" alt="QR Code to Download Swinedroid Client" />If you&#8217;ve ever been on the go when crisis strikes, you know how convenient it is to have a mobile application for dealing with the problems you might face.  For instance, I&#8217;ve found it really convenient that there&#8217;s <a href="http://overhrd.com/?p=98">an application that interfaces with the API for my Virtual Private Server, Slicehost</a>.  I no longer have to fumble around with the browser trying find the page which reboots the VPS, I simply load the Slicehost application.  This stores my API key, and I&#8217;m able to manage my servers in a more streamlined fashion.</p>
<p>It is in this spirit that I began development on Swinedroid.  Swinedroid is an Android Snort monitoring and management application.  In its current state it allows you to view server alert statistics, display latest alerts, and search alerts based on severity, signature name, and time frame.  In the coming months, I plan to add support for viewing alert details (such as the hex dump and whois information), sorting alerts, managing alerts (e.g. tagging or deleting them), and interpreting a variety of Snort log formats.</p>
<p>Here&#8217;s the way it works.  There are two components: the server and the client.  The server runs on any machine that you want to monitor.  In order for the Swinedroid server component to work, you need to have Snort installed and logging alerts to MySQL.  The client you install on your Android device, and configure it to communicate with the server component.  This communication is done over SSL in a secure (but not authenticated) fashion.</p>
<div id="screenshots" style='overflow: visible; margin-top: 10px; margin-bottom: 10px;'><img style="margin-top: 40px; float: left; border: 1px solid grey;" src="/images/swinedroid_overview.png" alt="Swinedroid overview screen" /><img style="float: right; border: 1px solid grey;" src="/images/swinedroid_search.png" alt="Swinedroid overview screen" /></div>
<div id='clearer' style='clear: both; padding-top: 10px;'></div>
<p>The project is still very much in the beginning stages, and there are exciting features to come. Everything is free and open source.  I invite you to try it out, and give me your feedback.</p>
<p>Git Repository (Client): <a href="git://github.com/Hainish/Swinedroid.git">git://github.com/Hainish/Swinedroid.git</a></p>
<p>Git Repository (Server): <a href="git://github.com/Hainish/Swinedroid-Server.git">git://github.com/Hainish/Swinedroid-Server.git</a></p>
<p>Client Component: <a href="http://www.inputoutput.io/files/swinedroid-client_0.10.apk">http://www.inputoutput.io/files/swinedroid-client_0.10.apk</a></p>
<p>Server Component: <a href="http://www.inputoutput.io/files/swinedroid-server_0.10.tar.gz">http://www.inputoutput.io/files/swinedroid-server_0.10.tar.gz</a></p>
<p><strong>Update:</strong><br />
Swinedroid has been released on the Android Market.  See <a href='/swinedroid-snort-monitoring-tool-available-on-the-android-market/'></a>this post</a> for more info.</p>
<p>The post <a href="http://www.inputoutput.io/swinedroid-the-new-snort-monitoring-tool-for-android/">Swinedroid &#8211; the new Snort Monitoring tool for Android</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.inputoutput.io/swinedroid-the-new-snort-monitoring-tool-for-android/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SSL or S-S-Hell?</title>
		<link>http://www.inputoutput.io/ssl-or-s-s-hell/</link>
		<comments>http://www.inputoutput.io/ssl-or-s-s-hell/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 04:40:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cryptography]]></category>
		<category><![CDATA[exploits]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[tls]]></category>
		<category><![CDATA[vulnerabilities]]></category>
		<category><![CDATA[x509]]></category>

		<guid isPermaLink="false">http://www.inputoutput.io/?p=52</guid>
		<description><![CDATA[<p>2009’s Beating on SSL, Round One Hot on the heels of the Microsoft Crypto API patch comes another SSL vulnerability. The last round of attacks on SSL relied on a problem with the deployment of SSL on the web, as the research of Moxie Marlinspike shows. To sum up the crucial point in their research [...]</p><p>The post <a href="http://www.inputoutput.io/ssl-or-s-s-hell/">SSL or S-S-Hell?</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></description>
			<content:encoded><![CDATA[<p><img alt='Broken Key' style='border: 0px; float: right; margin-left: 10px;' src='/images/broken_key.jpg' /><strong>2009’s Beating on SSL, Round One</strong></p>
<p>Hot on the heels of the <a href="http://support.microsoft.com/kb/974571">Microsoft Crypto API patch</a> comes another SSL vulnerability.  The last round of attacks on SSL relied on a problem with the deployment of SSL on the web, as the <a href="http://www.thoughtcrime.org/papers/null-prefix-attacks.pdf">research of Moxie Marlinspike</a> shows.  To sum up the crucial point in their research in a nutshell: just because the x509 protocol in web certificates accepts strings such as www.paypal.com\0.thoughtcrime.org without terminating the string, that doesn’t mean your web browser will do the same.  We’re able to actually create a certificate signing request (.csr) with www.paypal.com\0 as the subdomain to a domain which we genuinely control.  Because of the automated nature of today’s domain (and subdomain) verification process, this will go unnoticed by most Certificate Authority signing processes.  Once we get the certificate back from the CA, we’re able to pose ourselves as a man-in-the-middle.  Until recently, most browsers would terminate the string at the null character, leaving “www.paypal.com” as the domain for which we’ve been authenticated.  Not only is this a theoretical possibility, but Moxie has released tools for it, available at <a href="http://www.thoughtcrime.org/">thoughtcrime.org</a>, which are probably still quite effective for unpatched systems.</p>
<p><strong>Round Two: The K.O.</strong></p>
<p>Whereas the null character vulnerability was an issue with web deployment of SSL and certificate chaining, the latest flaw (released on November 5th) seems to be a severe problem with the protocol itself.  While there’s been a fair degree of hype surrounding a number of supposed vulnerabilities in SSL, this seems to be the real deal.  Specifically, the flaw is in SSL 3.0/ TLS 1.0 – and has something to do with inserting unverified traffic into the renegotiation process of SSL sessions.  Marsh Ray of PhoneFactor discovered the vulnerability, which seems to be severe, and “In certain circumstances this flaw could be used in MITM attacks, allowing an attacker to inject attacker-chosen plain text prefix into a secure session of the victim.”  The bug has been being worked on for several months, and OpenSSL has released a patch to deal with the bug in its 0.9.8l release, available at <a href="http://www.openssl.org/">www.openssl.org</a>.  Again, this is not a problem with deployment, or (as with last year’s Debian SSL vulnerability) distribution-specific forking, it is a fundamental problem with the way SSL renegotiates sessions.  Also unlike last year’s Debian vulnerability, which can be <a href="http://www.cr0.org/progs/sshfun/">retroactively exploited</a>, this exploit requires foreknowledge of the vulnerability and situating oneself as a man-in-the-middle.  Exploits are in the wild as of this writing.  Kudos to OpenSSL for releasing a patch so quickly.</p>
<p>The post <a href="http://www.inputoutput.io/ssl-or-s-s-hell/">SSL or S-S-Hell?</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.inputoutput.io/ssl-or-s-s-hell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the android browser with tor or any socks proxy &amp; privoxy</title>
		<link>http://www.inputoutput.io/using-the-android-browser-with-tor-or-any-socks-proxy-privoxy/</link>
		<comments>http://www.inputoutput.io/using-the-android-browser-with-tor-or-any-socks-proxy-privoxy/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 21:27:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How-Tos]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[anonymity]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[privoxy]]></category>
		<category><![CDATA[tor]]></category>

		<guid isPermaLink="false">http://www.inputoutput.io/?p=50</guid>
		<description><![CDATA[<p>Update: If all  you&#8217;re looking to do is use TOR with android, please use this tutorial.  The below information is out of date for such uses. Prerequisites: A jailbroken android install. Debian Armel on android. SSHD running in the chrooted debian environment. Want to browse the web anonymously with your android device, without t-mobile recording [...]</p><p>The post <a href="http://www.inputoutput.io/using-the-android-browser-with-tor-or-any-socks-proxy-privoxy/">Using the android browser with tor or any socks proxy &#038; privoxy</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></description>
			<content:encoded><![CDATA[<p><strong>Update:</strong> If all  you&#8217;re looking to do is use TOR with android, please use <a title="TOR on Android" href="https://www.torproject.org/docs/android.html.en">this tutorial</a>.  The below information is out of date for such uses.</p>
<p><strong>Prerequisites:</strong></p>
<ol>
<li><a href="http://arstechnica.com/old/content/2008/11/android-liberation-t-mobile-g1-jailbroken.ars">A jailbroken android install.</a></li>
<li><a href="http://www.saurik.com/id/10">Debian Armel on android.</a></li>
<li>SSHD running in the chrooted debian environment.</li>
</ol>
<p>Want to browse the web anonymously with your android device, without t-mobile recording your every move? Look no further.</p>
<p>Few are aware that the default android browser actually allows you to use an http proxy to connect to the web. It is a rather obscure setting to trigger, and there are no provisions for you to connect through a socks proxy, such as an ssh tunnel or the tor network. Luckily, privoxy handles all this for us. Privoxy is an http proxy that is able to forward http requests through the encrypted socks tunnel, and out to its intended recipient. In this tutorial, I will show you how to set your android browser to use privoxy, and how to configure privoxy to forward to a socks proxy.</p>
<p>Lets jump right in.</p>
<p>Using connectbot (available from the android market), ssh into your chrooted debian on localhost. Run:</p>
<pre class="brush: bash; title: ; notranslate">apt-get install tor</pre>
<p>This will fetch both tor and privoxy for you. Now, you&#8217;ll need to configure privoxy to forward its http requests through tor, or whatever other tunnel you&#8217;ve created through ssh (see my previous post, http://www.inputoutput.io/how-to-subvert-deep-packet-inspection-the-right-way/). Append the following line to your /etc/privoxy/config file:</p>
<pre class="brush: plain; title: ; notranslate">forward-socks5 / localhost:9050 .</pre>
<p>Change 9050 to whatever port your tor or ssh tunnel is listening on. Default is 9050 for tor. Now, start tor and privoxy with:</p>
<pre class="brush: bash; title: ; notranslate">/etc/init.d/tor start
privoxy /etc/privoxy/config</pre>
<p>I had to make /dev/null world-writable for tor to stop complaining. You&#8217;ll have to run that last part every time you restart your android device. Now on to the annoying part. In terminal emulator (also available from the android market):</p>
<pre class="brush: bash; title: ; notranslate">su
sqlite3 /data/data/com.android.providers.settings/databases/settings.db
SQLite version 3.5.9
Enter &quot;.help&quot; for instructions
sqlite&gt; INSERT INTO system VALUES (99, 'http_proxy', 'localhost:8118');
sqlite&gt; .quit</pre>
<p>Change 8118 to whatever port privoxy is listening on, but that port is the default. Now the browser is configured to use privoxy as its http proxy. Privoxy, in turn, is configured to forward connections through tor or the ssh tunnel. This means your done, congratulations!</p>
<p>If you want to stop the browser from using the proxy at any point, in terminal emulator:</p>
<pre class="brush: bash; title: ; notranslate">su
sqlite3 /data/data/com.android.providers.settings/databases/settings.db
SQLite version 3.5.9
Enter &quot;.help&quot; for instructions
sqlite&gt; DELETE FROM system WHERE name='http_proxy';
sqlite&gt; .quit</pre>
<p>It&#8217;s quite frustrating to go through this process every time you want to switch between proxified and raw browsing, so I suggest installing a second browser such as &#8216;steel&#8217; for your raw connection, and only using the default browser for proxified connections.</p>
<p>The post <a href="http://www.inputoutput.io/using-the-android-browser-with-tor-or-any-socks-proxy-privoxy/">Using the android browser with tor or any socks proxy &#038; privoxy</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.inputoutput.io/using-the-android-browser-with-tor-or-any-socks-proxy-privoxy/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>VMWare Workstation in BackTrack {3, 4} Live</title>
		<link>http://www.inputoutput.io/vmware-workstation-in-backtrack-3-4-live/</link>
		<comments>http://www.inputoutput.io/vmware-workstation-in-backtrack-3-4-live/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 05:37:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How-Tos]]></category>
		<category><![CDATA[backtrack]]></category>
		<category><![CDATA[baktrack 4]]></category>
		<category><![CDATA[live distribution]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.inputoutput.io/?p=42</guid>
		<description><![CDATA[<p>Why? There&#8217;s been a number of situations in the past where, even though I&#8217;m perfectly happy running BackTrack as a host operating system, it would nonetheless be sweet to run any number of virtualized guest machines as well. For instance, if exploit code or a tool has been released in Windows (e.g. Ferret/Hamster) but is [...]</p><p>The post <a href="http://www.inputoutput.io/vmware-workstation-in-backtrack-3-4-live/">VMWare Workstation in BackTrack {3, 4} Live</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;"><img src="/files/bt4_logo_small.jpg" alt="BackTrack 4" /></div>
<p><strong>Why?</strong></p>
<p>There&#8217;s been a number of situations in the past where, even though I&#8217;m perfectly happy running BackTrack as a host operating system, it would nonetheless be sweet to run any number of virtualized guest machines as well.  For instance, if exploit code or a tool has been released in Windows (e.g. Ferret/Hamster) but is not yet, or will never be, released for Linux.  Or if you want to do research in a virtualized network environment.  And of course in general, it&#8217;s just a good idea to keep your options open, to sharpen your axe before you go out and chop some wood.  My virtualization software of choice is VMWare Workstation, especially the newer versions &gt;= 6.5.  I&#8217;m not going to go into why I favor VMWare over other options, but suffice to say that they are just the best choice for non-commercial virtualized environments (and, uhm, unity mode is kickass.)  So this will be a quick run-through for you to create a customized .lzm file for BackTrack Live with a full and functioning install of VMWare Workstation.</p>
<p><strong>How?</strong></p>
<p>While on the road to creating a customized .lzm file, I was steering for the path of least resistance.  Basically, I created a before- and after-install list of files across the entire file system.  I then compared the two &#8211; the difference being the new files that were created from the install.  Copy those files over to a subdirectory structure, and run dir2lzm.  Place .lzm file into the appropriate directory, uncompressed at boot time.  Done.  (Here I have to add a disclaimer: this method probably can be improved upon, since it doesn&#8217;t take into account those files which the install did not create, but may have only modified.  Perhaps checking modification timestamps would be better.)</p>
<p>Boot up to BackTrack Live, and lets get started:</p>
<pre class="brush: bash; title: ; notranslate">mkdir ~/vmware-install-tracking/
cd ~/vmware-install-tracking/
find / | sort &gt; before</pre>
<p>Now that we have a list of files before the install takes place, it&#8217;s time for us to install VMWare.  Once you&#8217;ve installed it, run it, customize your settings, enter your serial number, etc.  Open a few virtual machines.  Get your settings to a point where you&#8217;re comfortable with them &#8211; you won&#8217;t be able to modify them again after this point.  Close VMWare.</p>
<pre class="brush: bash; title: ; notranslate">find / | sort &gt; after
diff before after &gt; new_files
cat new_files | egrep -v &quot;^---$&quot; | egrep -v &quot;^[0-9]&quot; | egrep -v &quot;[&gt;&lt;] /dev&quot; | egrep -v &quot;[&gt;&lt;] /mnt/live&quot; | egrep -v &quot;[&gt;&lt;] /proc&quot; | egrep -v &quot;[&gt;&lt;] /sys&quot; | egrep -v &quot;[&gt;&lt;] /tmp&quot; | egrep -v &quot;[&gt;&lt;] /var/run&quot; | egrep -v &quot;[&gt;&lt;] /var/lock/subsys/vmware&quot; | egrep -v &quot;[&gt;&lt;] /root/vmware-install-tracking/&quot; | cut -d&quot; &quot; -f2 &gt; required_files
echo &quot;/lib/modules/2.6.28.1/modules.dep&quot; &gt;&gt; required_files # don't forget those modules!</pre>
<p>The directory in the last line will vary based on current kernel version.  At this point we have compiled a list of all the files and directories we need for the .lzm file.  But we need a script that will parse through required_files and create a file/directory structure from it.  I threw the following together in python, <a href="/files/create_filestructure_from_filelist.py">create_filestructure_from_filelist.py</a>:</p>
<pre class="brush: python; title: ; notranslate">#!/usr/bin/python

import subprocess, os, sys
if len(sys.argv) is not 3:
        print &quot;Usage: &quot; + sys.argv[0] + &quot; [file list to parse] [destination path]&quot;
        exit()

dest_path = sys.argv[2]
if dest_path[len(dest_path) - 1] is '/':
        dest_path = dest_path[0:len(dest_path) - 1]

try:
        fp = open(sys.argv[1],&quot;r&quot;)
except:
        print &quot;Error: Could not open file for reading!&quot;

x = fp.readline().strip()
file_list = []
dir_list = []
while x:
        if os.path.isdir(x):
                dir_list.append(x)
        if os.path.isfile(x):
                file_list.append(x)
        x = fp.readline().strip()

for dir in dir_list:
        if not os.path.isdir(dest_path + dir):
                subprocess.call('mkdir -p ' + dest_path + dir,shell=True)

for file in file_list:
        file_components = file.split('/')
        containing_dir = '/'.join(file_components[0:len(file_components) - 1])
        if not os.path.isdir(dest_path + containing_dir):
                subprocess.call('mkdir -p ' + dest_path + containing_dir,shell=True)
        subprocess.call('cp ' + file + ' ' + dest_path + file,shell=True)</pre>
<p>Now all thats left to do is call the script, create the .lzm, and put it in the loadtime modules directory.  Make sure the destination path in the script has enough storage space.</p>
<pre class="brush: bash; title: ; notranslate">./create_filestructure_from_filelist.py required_files vmware-tmp/
dir2lzm vmware-tmp/ vmware.lzm
mv vmware.lzm /mnt/sdb1/bt4/modules/</pre>
<p>Reboot to your live distribution.  You now have a working install of VMWare Workstation on your BackTrack Live.  Enjoy!</p>
<p>The post <a href="http://www.inputoutput.io/vmware-workstation-in-backtrack-3-4-live/">VMWare Workstation in BackTrack {3, 4} Live</a> appeared first on <a href="http://www.inputoutput.io">InputOutput.io</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.inputoutput.io/vmware-workstation-in-backtrack-3-4-live/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
