<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Stephen Reese</title><link>http://www.rsreese.com</link><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/rsreese" /><description>My Dark Cloud Kung Fu</description><language>en-US</language><lastBuildDate>Mon, 20 May 2013 10:45:48 PDT</lastBuildDate><generator>http://wordpress.org/?v=3.5.1</generator><sy:updatePeriod xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">hourly</sy:updatePeriod><sy:updateFrequency xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">1</sy:updateFrequency><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/rsreese" /><feedburner:info uri="rsreese" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>30.092346</geo:lat><geo:long>-81.60274</geo:long><feedburner:emailServiceId>rsreese</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><title>Passive DNS collection and analysis using YaF and Mediator</title><link>http://feedproxy.google.com/~r/rsreese/~3/8j_C3k672Eg/</link><category>security</category><category>analysis</category><category>netflow</category><category>passive dns</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen Reese</dc:creator><pubDate>Mon, 20 May 2013 04:12:14 PDT</pubDate><guid isPermaLink="false">http://www.rsreese.com/?p=1289</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Passive DNS is a useful tool for any analysts teams toolbox, I have noted several public sensors <a href="http://www.rsreese.com/online-information-security-analysis-tools-and-resources/">here</a> but they only see data (queries and responses) that transverse their sensors. I have been working on setting up passive DNS using Yet another Flowmeter (YaF) and Mediator (YaF to MySQL) to fill the gap where third-party sensors may not be providing the coverage I would like. Passive DNS can provide tremendous insight and analytics upon DNS queries that users and/or malware may be performing. A few items of interest:</p>
<ul>
<li>Hostnames that have a large number of IP addresses associated with them in a short time period and they have only been visited by very few hosts host on the network.</li>
<li>Tertiary name usage associated with a specific domain?</li>
<li>When was the domain first resolved on the network and further, how often is it being resolved and by whom?</li>
<li>A recently accessed/registered domain with short time to live (TTL&#8217;s) often associated with new IP addresses may indicate malicious activity, or a CDN.</li>
<li>Queries for TLD&#8217;s that you typically do not interact with may be worth looking into.</li>
<li>Users using non-approved DNS servers</li>
</ul>
<p>Passive DNS may be also helpful in tracking infections using Fast-flux which make blocking the C2 difficult as the attackers will create algorithms to rotate the IP addresses and even the hostnames in the case of double-flux. (<a href="http://www.cs.ucsb.edu/~kemm/courses/cs177/torpig.pdf">TorPig</a>) The list goes on but in a nutshell, I wanted to be able to perform this activity without having to rely on having all of the DNS server logs in a centralized location, especially since users may reconfigure their DNS settings to use non-approved servers, e.g. BYOD.</p>
<p>This entry demonstrates how to build and setup <a href="http://tools.netsa.cert.org/yaf/yaf.html">YaF</a> and <a href="https://tools.netsa.cert.org/confluence/pages/viewpage.action?pageId=15958035">Mediator</a> both of which are available from the CERT <a href="http://www.cert.org/netsa/">NetSA</a> <a href="http://tools.netsa.cert.org/">site</a> and should be considered complementary to the documentation the NetSA team have already provided for each of the respective tools. This setup was tested on CentOS 6.4 but most Linux distributions should work fine.</p>
<p>1. Have site reconfigure interfaces on all hosts. eth0 should be management interface and eth1 should be the tap OR whatever makes sense, this need to happen every time the host comes up, i.e.</p>
<pre style="overflow: auto;"><code>sudo ifconfig eth1 up promisc
</code></pre>
<p>2. Ensure development libraries/dependencies are installed. Some may require enabling the optional software channel</p>
<pre style="overflow: auto;"><code>sudo yum install glib2-devel lzo  gcc-c++ libpcap-devel pcre-devel
</code></pre>
<p>3. Install <a href="http://tools.netsa.cert.org/fixbuf/">libfixbuf</a></p>
<pre style="overflow: auto;"><code>cd libfixbuf-1.3.0
./configure
make
sudo make install
</code></pre>
<p>4. Install YaF</p>
<pre style="overflow: auto;"><code>cd yaf-2.3.3
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
./configure --with-libpcap --enable-applabel --enable-plugins
make
sudo make install
</code></pre>
<p>5. Edit ld</p>
<pre style="overflow: auto;"><code>sudo echo "/usr/local/lib" &gt;&gt; /etc/ld.so.conf
sudo /sbin/ldconfig
sudo /sbin/ldconfig -v | grep libzmq # should rebuild the cache including zmq too.
</code></pre>
<p>OR</p>
<pre style="overflow: auto;"><code>export PATH=$PATH:/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
</code></pre>
<p>6. Configure cmake</p>
<pre style="overflow: auto;"><code>cd cmake-2.8.10.2
./configure
gmake
</code></pre>
<p>6. Optionally, configure YaF to File output for testing purposes.</p>
<pre style="overflow: auto;"><code>export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
cd yaf_file_mediator-1.1.0/
./configure
../cmake-2.8.10.2/bin/cmake .
make
</code></pre>
<p>7. Configure YaF to MySQL</p>
<pre style="overflow: auto;"><code>export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
cd yaf_silk_mysql_mediator-1.4.0
../cmake-2.8.10.2/bin/cmake .
./configure --with-mysql
make
</code></pre>
<p>Next, populate create a database and respective tables:</p>
<pre style="overflow: auto;"><code>./yafMySQL -o localhost -n username -p password -d eflows
</code></pre>
<p>8. Setup YaF to start capturing. Here we are only capture DNS traffic and rotating the files written to disk after 5 minutes. Originally set to 10 minutes but yaf_silk_mysql_mediator would segmentation fault because MySQL would close the connection before all of the data would insert. We have a continuous method that works a little better which we should a little later. We lock the file so that another process cannot take the file that is currently being written to.</p>
<pre style="overflow: auto;"><code>sudo /usr/local/bin/yaf --live pcap --in eth1 --out /data/ipfix/ --rotate 600 --filter="port 53" --applabel --applabel-rules=/usr/local/etc/yafApplabelRules.conf --max-payload=1000 --plugin-name=/usr/local/lib/yaf/dpacketplugin.la --plugin-opts="53" --lock --become-user=nobody --become-group=nobody &amp;
</code></pre>
<p>9. Testing the output of a YaF</p>
<pre style="overflow: auto;"><code>yaf_file_mediator-1.1.0/yaf_file_mediator --input /data/ipfix/filename.yaf --output test.txt
</code></pre>
<p>After a few minutes, you should be able to parse the filename.yaf that was first written (in this case 5 minutes). The contents of test.txt should be similar to the following:</p>
<pre style="overflow: auto;"><code>-------------------------------
Template ID is 45841
Application Label: 53
Source IP: 192.168.0.5
Destination IP: 8.8.8.8
Source Port: 53855
Dest Port: 53
Flow Attributes: 1
Rev Flow Attributes: 0
flowStartTime: 2013-04-24 23:53:43
flowEndTime: 2013-04-24 23:58:02
flowEndReason: 1
Protocol: 17
Octet Total Count: 120
Rev Octet count: 244
Packet Total Count: 2
Rev Packet Total Count: 2
DNS ID: 32852 Type: 28 RR Section: 0 TTL: 0 Query: www.google.com.
DNS ID: 32852 Type: 28 RR Section: 1 TTL: 204 RRName: www.google.com. AAAA: 2607:f8b0:400c:0c04::0069

-------------------------------
Template ID is 45841
Application Label: 53
Source IP: 192.168.0.5
Destination IP: 8.8.8.8
Source Port: 50845
Dest Port: 53
flowStartTime: 2013-04-24 23:58:02
flowEndTime: 2013-04-24 23:58:02
flowEndReason: 1
Protocol: 17
Octet Total Count: 60
Rev Octet count: 156
Packet Total Count: 1
Rev Packet Total Count: 1
DNS ID: 21141 Type: 1 RR Section: 0 TTL: 0 Query: www.google.com.
DNS ID: 21141 Type: 1 RR Section: 1 TTL: 208 RRName: www.google.com. A: 74.125.26.103
DNS ID: 21141 Type: 1 RR Section: 1 TTL: 208 RRName: www.google.com. A: 74.125.26.99
DNS ID: 21141 Type: 1 RR Section: 1 TTL: 208 RRName: www.google.com. A: 74.125.26.105
DNS ID: 21141 Type: 1 RR Section: 1 TTL: 208 RRName: www.google.com. A: 74.125.26.104
DNS ID: 21141 Type: 1 RR Section: 1 TTL: 208 RRName: www.google.com. A: 74.125.26.106
DNS ID: 21141 Type: 1 RR Section: 1 TTL: 208 RRName: www.google.com. A: 74.125.26.147
</code></pre>
<p>10. After you have confirmed that your YaF entries contain records, add a little automation. This will scoop up the files in the directory where the YaF files are being written, place them in the MySQL DBMS and delete the file. Note, if you start seeing &#8220;Segmentation Fault&#8221; then MySQL may be closing the connection before all of the records from the YaF file could be written to the DBMS. You can try modifying MySQL parameters or reduce the the size of YaF files being written to disk in order to try mitigating this symptom if it occurs in your environment.</p>
<pre style="overflow: auto;"><code>for i in $( ls /data/ipfix/*.yaf ); do /home/user/silk-installs/yaf_silk_mysql_mediator-1.4.0/yaf_silk_mysql_mediator --in-file $i --mysql-host localhost --name username --pass password --database eflows &amp;&amp; sudo rm $i; done
</code></pre>
<p>Here is our first query, lets see who has recently made requests for www.google.com.</p>
<pre style="overflow: auto;"><code>mysql&gt; SELECT rrname,rrval,srcip4,dstip4,flowStartMilliseconds FROM dns d, flows f WHERE f.id = d.id AND rrname LIKE "www.google.com." GROUP by rrval ORDER BY f.id DESC LIMIT 50;
+-----------------+---------------------------+------------+-----------+-----------------------+
| rrname          | rrval                     | srcip4     | dstip4    | flowStartMilliseconds |
+-----------------+---------------------------+------------+-----------+-----------------------+
| www.google.com. | 2001:4860:4001:0802::1012 | 3232235525 | 134744072 | 2013-05-03 17:47:24   |
| www.google.com. | 2001:4860:4001:0801::1014 | 3232235525 | 134744072 | 2013-05-03 15:35:32   |
| www.google.com. | 2001:4860:4001:0802::1014 | 3232235525 | 134744072 | 2013-05-03 11:28:42   |
| www.google.com. | 2001:4860:4001:0801::1010 | 3232235525 | 134744072 | 2013-05-02 16:48:31   |
| www.google.com. | 2001:4860:4001:0802::1011 | 3232235525 | 134744072 | 2013-05-02 13:33:57   |
| www.google.com. | 2001:4860:4001:0803::1010 | 3232235525 | 134744072 | 2013-05-02 12:01:56   |
| www.google.com. | 2607:f8b0:4004:0801::1012 | 3232235525 | 134744072 | 2013-05-01 21:36:55   |
| www.google.com. | 2001:4860:4001:0802::1010 | 3232235525 | 134744072 | 2013-05-01 12:44:52   |
| www.google.com. | 74.125.239.80             | 3232235525 | 134744072 | 2013-05-01 10:45:04   |
| www.google.com. | 74.125.239.83             | 3232235525 | 134744072 | 2013-05-01 10:45:04   |
| www.google.com. | 74.125.239.82             | 3232235525 | 134744072 | 2013-05-01 10:45:04   |
| www.google.com. | 74.125.239.81             | 3232235525 | 134744072 | 2013-05-01 10:45:04   |
| www.google.com. | 74.125.239.84             | 3232235525 | 134744072 | 2013-05-01 10:45:04   |
| www.google.com. | 2607:f8b0:4004:0802::1010 | 3232235525 | 134744072 | 2013-04-29 19:54:00   |
| www.google.com. | 2607:f8b0:4005:0802::1010 | 3232235525 | 134744072 | 2013-04-28 15:52:00   |
| www.google.com. | 2607:f8b0:4004:0803::1013 | 3232235525 | 134744072 | 2013-04-28 15:05:53   |
| www.google.com. | 2607:f8b0:4005:0802::1011 | 3232235525 | 134744072 | 2013-04-27 14:45:35   |
| www.google.com. | 2607:f8b0:4004:0801::1013 | 3232235525 | 134744072 | 2013-04-26 18:53:45   |
| www.google.com. | 2607:f8b0:4005:0802::1012 | 3232235525 | 134744072 | 2013-04-26 13:55:51   |
| www.google.com. | 2607:f8b0:4005:0802::1013 | 3232235525 | 134744072 | 2013-04-26 12:35:18   |
| www.google.com. | 74.125.239.145            | 3232235525 | 134744072 | 2013-04-26 12:03:10   |
| www.google.com. | 74.125.239.148            | 3232235525 | 134744072 | 2013-04-26 12:03:10   |
| www.google.com. | 74.125.239.146            | 3232235525 | 134744072 | 2013-04-26 12:03:10   |
| www.google.com. | 74.125.239.147            | 3232235525 | 134744072 | 2013-04-26 12:03:10   |
| www.google.com. | 74.125.239.144            | 3232235525 | 134744072 | 2013-04-26 12:03:10   |
| www.google.com. | 2607:f8b0:4005:0802::1014 | 3232235525 | 134744072 | 2013-04-26 11:31:59   |
| www.google.com. | 74.125.228.112            | 3232235525 | 134744072 | 2013-04-25 16:25:39   |
| www.google.com. | 74.125.228.114            | 3232235525 | 134744072 | 2013-04-25 16:25:39   |
| www.google.com. | 74.125.228.113            | 3232235525 | 134744072 | 2013-04-25 16:25:39   |
| www.google.com. | 74.125.228.115            | 3232235525 | 134744072 | 2013-04-25 16:25:39   |
| www.google.com. | 74.125.228.116            | 3232235525 | 134744072 | 2013-04-25 16:25:39   |
| www.google.com. | 2607:f8b0:4004:0802::1012 | 3232235525 | 134744072 | 2013-04-25 11:29:45   |
| www.google.com. | 2607:f8b0:4004:0803::1014 | 3232235525 | 134744072 | 2013-04-24 20:33:42   |
| www.google.com. | 2607:f8b0:400e:0c04::006a | 3232235525 | 134744072 | 2013-04-24 18:04:19   |
| www.google.com. | 2607:f8b0:400e:0c02::006a | 3232235525 | 134744072 | 2013-04-24 15:26:22   |
| www.google.com. | 74.125.228.20             | 3232235525 | 134744072 | 2013-04-24 12:05:43   |
| www.google.com. | 74.125.228.16             | 3232235525 | 134744072 | 2013-04-24 12:05:43   |
| www.google.com. | 74.125.228.18             | 3232235525 | 134744072 | 2013-04-24 12:05:43   |
| www.google.com. | 74.125.228.19             | 3232235525 | 134744072 | 2013-04-24 12:05:43   |
| www.google.com. | 74.125.228.17             | 3232235525 | 134744072 | 2013-04-24 12:05:43   |
| www.google.com. | 2607:f8b0:4004:0801::1014 | 3232235525 | 134744072 | 2013-04-23 20:43:26   |
| www.google.com. | 74.125.228.50             | 3232235525 | 134744072 | 2013-04-23 20:38:43   |
| www.google.com. | 74.125.228.51             | 3232235525 | 134744072 | 2013-04-23 20:38:43   |
| www.google.com. | 74.125.228.52             | 3232235525 | 134744072 | 2013-04-23 20:38:43   |
| www.google.com. | 74.125.228.48             | 3232235525 | 134744072 | 2013-04-23 20:38:43   |
| www.google.com. | 74.125.228.49             | 3232235525 | 134744072 | 2013-04-23 20:38:43   |
| www.google.com. | 2607:f8b0:4004:0801::1011 | 3232235525 | 134744072 | 2013-04-23 18:38:52   |
| www.google.com. | 2607:f8b0:400e:0c01::0067 | 3232235525 | 134744072 | 2013-04-23 15:57:45   |
| www.google.com. | 2607:f8b0:4004:0801::1010 | 3232235525 | 134744072 | 2013-04-23 15:07:59   |
| www.google.com. | 2607:f8b0:400e:0c01::0069 | 3232235525 | 134744072 | 2013-04-23 12:30:28   |
+-----------------+---------------------------+------------+-----------+-----------------------+
</code></pre>
<p>Here is a similar query but we want to see any tertiary youtube.com domains and sort by the lookup returned.</p>
<pre style="overflow: auto;"><code>mysql&gt; SELECT qr,type,auth,nx,ttl,rrname,rrval from dns WHERE rrname LIKE "%.youtube.com." GROUP BY rrval LIMIT 50;
+------+------+------+------+------+--------------------------------+----------------+
| qr   | type | auth | nx   | ttl  | rrname                         | rrval          |
+------+------+------+------+------+--------------------------------+----------------+
|    0 |    1 |    0 |    0 |    0 | www.youtube.com.               |                |
|    1 |    1 |    0 |    0 |  300 | v17.lscache2.c.youtube.com.    | 12.216.80.12   |
|    1 |    1 |    0 |    0 | 1800 | r2.sn-5uu-vgqe.c.youtube.com.  | 12.216.80.13   |
|    1 |    1 |    0 |    0 | 1800 | r3.sn-5uu-vgqe.c.youtube.com.  | 12.216.80.14   |
|    1 |    1 |    0 |    0 | 1800 | r4.att-ord1.c.youtube.com.     | 12.216.80.15   |
|    1 |    1 |    0 |    0 | 1800 | r6.sn-5uu-vgqe.c.youtube.com.  | 12.216.80.17   |
|    1 |    1 |    0 |    0 | 1714 | r8.sn-5uu-vgqe.c.youtube.com.  | 12.216.80.19   |
|    1 |    1 |    0 |    0 | 1741 | r1.sn-5uu-vgql.c.youtube.com.  | 12.216.80.44   |
|    1 |    1 |    0 |    0 | 1800 | r2.sn-5uu-vgql.c.youtube.com.  | 12.216.80.45   |
|    1 |    1 |    0 |    0 | 1800 | r3.sn-5uu-vgql.c.youtube.com.  | 12.216.80.46   |
|    1 |    1 |    0 |    0 | 1279 | r4.sn-5uu-vgql.c.youtube.com.  | 12.216.80.47   |
|    1 |    1 |    0 |    0 | 1800 | r6.sn-5uu-vgql.c.youtube.com.  | 12.216.80.49   |
|    1 |    1 |    0 |    0 | 1800 | r7.sn-5uu-vgql.c.youtube.com.  | 12.216.80.50   |
|    1 |    1 |    0 |    0 | 1739 | r8.sn-5uu-vgql.c.youtube.com.  | 12.216.80.51   |
|    1 |    1 |    0 |    0 | 1800 | r12.sn-hp576nes.c.youtube.com. | 173.194.17.17  |
|    1 |    1 |    0 |    0 | 1800 | r20.sn-hp576nes.c.youtube.com. | 173.194.17.25  |
|    1 |    1 |    0 |    0 | 1800 | r6.sn-q4f7dnel.c.youtube.com.  | 173.194.24.11  |
|    1 |    1 |    0 |    0 | 1800 | r1.dfw06s08.c.youtube.com.     | 173.194.24.134 |
|    1 |    1 |    0 |    0 | 1800 | r15.sn-q4f7dn7r.c.youtube.com. | 173.194.24.148 |
|    1 |    1 |    0 |    0 | 1800 | r18.sn-hp576n7d.c.youtube.com. | 173.194.29.119 |
|    1 |    1 |    0 |    0 | 1800 | r9.sn-hp576n7z.c.youtube.com.  | 173.194.29.46  |
|    1 |    1 |    0 |    0 | 1800 | r5.sn-ab5e6ner.c.youtube.com.  | 173.194.31.10  |
|    1 |    1 |    0 |    0 | 1800 | r1.sn-ab5e6nle.c.youtube.com.  | 173.194.31.102 |
|    1 |    1 |    0 |    0 |  640 | r2.sn-ab5e6nle.c.youtube.com.  | 173.194.31.103 |
|    1 |    1 |    0 |    0 | 1800 | r3.sn-ab5e6nle.c.youtube.com.  | 173.194.31.104 |
|    1 |    1 |    0 |    0 | 1800 | r4.sn-ab5e6nle.c.youtube.com.  | 173.194.31.105 |
|    1 |    1 |    0 |    0 | 1800 | r5.sn-ab5e6nle.c.youtube.com.  | 173.194.31.106 |
|    1 |    1 |    0 |    0 | 1800 | r6.sn-ab5e6nle.c.youtube.com.  | 173.194.31.107 |
|    1 |    1 |    0 |    0 | 1800 | r7.sn-ab5e6nle.c.youtube.com.  | 173.194.31.108 |
|    1 |    1 |    0 |    0 | 1800 | r8.sn-ab5e6nle.c.youtube.com.  | 173.194.31.109 |
|    1 |    1 |    0 |    0 |  705 | r6.sn-ab5e6ner.c.youtube.com.  | 173.194.31.11  |
|    1 |    1 |    0 |    0 | 1800 | r9.sn-ab5e6nle.c.youtube.com.  | 173.194.31.110 |
|    1 |    1 |    0 |    0 | 1800 | r10.sn-ab5e6nle.c.youtube.com. | 173.194.31.111 |
|    1 |    1 |    0 |    0 |  292 | r11.sn-ab5e6nle.c.youtube.com. | 173.194.31.112 |
|    1 |    1 |    0 |    0 | 1800 | r12.sn-ab5e6nle.c.youtube.com. | 173.194.31.113 |
|    1 |    1 |    0 |    0 |  178 | r13.sn-ab5e6nle.c.youtube.com. | 173.194.31.114 |
|    1 |    1 |    0 |    0 | 1800 | r14.sn-ab5e6nle.c.youtube.com. | 173.194.31.115 |
|    1 |    1 |    0 |    0 | 1800 | r15.sn-ab5e6nle.c.youtube.com. | 173.194.31.116 |
|    1 |    1 |    0 |    0 | 1800 | r16.sn-ab5e6nle.c.youtube.com. | 173.194.31.117 |
|    1 |    1 |    0 |    0 | 1800 | r17.sn-ab5e6nle.c.youtube.com. | 173.194.31.118 |
|    1 |    1 |    0 |    0 | 1800 | r18.sn-ab5e6nle.c.youtube.com. | 173.194.31.119 |
|    1 |    1 |    0 |    0 | 1653 | r7.sn-ab5e6ner.c.youtube.com.  | 173.194.31.12  |
|    1 |    1 |    0 |    0 | 1800 | r19.sn-ab5e6nle.c.youtube.com. | 173.194.31.120 |
|    1 |    1 |    0 |    0 | 1800 | r20.sn-ab5e6nle.c.youtube.com. | 173.194.31.121 |
|    1 |    1 |    0 |    0 | 1800 | r8.sn-ab5e6ner.c.youtube.com.  | 173.194.31.13  |
|    1 |    1 |    0 |    0 |   81 | r1.sn-ab5e6nll.c.youtube.com.  | 173.194.31.134 |
|    1 |    1 |    0 |    0 | 1800 | r2.sn-ab5e6nll.c.youtube.com.  | 173.194.31.135 |
|    1 |    1 |    0 |    0 | 1800 | r3.sn-ab5e6nll.c.youtube.com.  | 173.194.31.136 |
|    1 |    1 |    0 |    0 | 1800 | r4.sn-ab5e6nll.c.youtube.com.  | 173.194.31.137 |
|    1 |    1 |    0 |    0 | 1800 | r5.lga15s22.c.youtube.com.     | 173.194.31.138 |
+------+------+------+------+------+--------------------------------+----------------+
50 rows in set (22.17 sec)
</code></pre>
<p>An alternative method is to write YaF records directly to mediator, and further the MySQL DBMS rather then writing files to disk although you can still do this with the appropriate toggles. Here is example usage to start the processes:</p>
<pre style="overflow: auto;"><code>$ ./silk-installs/yaf_silk_mysql_mediator-1.4.0/yaf_silk_mysql_mediator --in-host=127.0.0.1 --in-port=18000 --mysql-host=localhost --name=username --pass password --database eflows
$ sudo /usr/local/bin/yaf --live pcap --in eth1 --out 127.0.0.1 --ipfix-port=18000 --ipfix tcp --log=/var/log/yaf.log --filter="port 53" --applabel --applabel-rules=/usr/local/etc/yafApplabelRules.conf --max-payload=1000 --plugin-name=/usr/local/lib/yaf/dpacketplugin.la --plugin-opts="53" &amp;
</code></pre>
<p>Ensure YaF and mediator are connected:</p>
<pre style="overflow: auto;"><code>$ sudo netstat -tupan|grep yaf
tcp        0      0 127.0.0.1:18000             0.0.0.0:*                   LISTEN      6497/yaf_silk_mysql
tcp        0      0 127.0.0.1:47417             127.0.0.1:18000             ESTABLISHED 6513/yaf
tcp        0      0 127.0.0.1:18000             127.0.0.1:47417             ESTABLISHED 6497/yaf_silk_mysql
</code></pre>
<p>You may use the following MySQL query to see when the table was last updated to ensure records are being inserted on a regular basis:</p>
<pre style="overflow: auto;"><code>mysql&gt; SHOW TABLE STATUS in eflows;
</code></pre>
<p>After a few minutes of collection, query a domain that has been recently resolved and you should see it in the DBMS.</p>
<pre style="overflow: auto;"><code>mysql&gt; SELECT rrname,rrval from dns WHERE rrname LIKE "%rsreese.com." GROUP BY rrval LIMIT 10;
+--------------+--------------------------------+
| rrname       | rrval                          |
+--------------+--------------------------------+
| rsreese.com. |                                |
| rsreese.com. | 2600:3c02::f03c:91ff:fe96:f7bd |
| rsreese.com. | 74.207.234.79                  |
| rsreese.com. | ns1.linode.com.                |
| rsreese.com. | ns2.linode.com.                |
| rsreese.com. | ns3.linode.com.                |
| rsreese.com. | ns4.linode.com.                |
| rsreese.com. | ns5.linode.com.                |
+--------------+--------------------------------+
8 rows in set (18.26 sec)
</code></pre>
<p>There are a number of different fields available for query so I leave it to you to come up with whatever is most useful for you. Further, think of how you could write a shiny front-end for analysts to use rather then having to use the MySQL command line interface. Hope you found this useful and leave a comment if you did or have any questions.</p>
<img src="http://feeds.feedburner.com/~r/rsreese/~4/8j_C3k672Eg" height="1" width="1"/>]]></content:encoded><description>Passive DNS is a useful tool for any analysts teams toolbox, I have noted several public sensors here but they only see data (queries and responses) that transverse their sensors. I have been working on setting up passive DNS using &amp;#8230; &lt;a href="http://www.rsreese.com/passive-dns-collection-and-analysis-using-yaf-and-mediator/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.rsreese.com/passive-dns-collection-and-analysis-using-yaf-and-mediator/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.rsreese.com/passive-dns-collection-and-analysis-using-yaf-and-mediator/</feedburner:origLink></item><item><title>Online Information Security Analysis Tools and Resources</title><link>http://feedproxy.google.com/~r/rsreese/~3/BGenUSUKiWM/</link><category>security</category><category>analysis</category><category>defense</category><category>indicator</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen Reese</dc:creator><pubDate>Sun, 31 Mar 2013 07:17:30 PDT</pubDate><guid isPermaLink="false">http://www.rsreese.com/?p=1111</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div id="attachment_1277" class="wp-caption alignright" style="width: 210px"><img class="size-full wp-image-1277  " alt="Security_Panda" src="http://www.rsreese.com/wp-content/uploads/2013/03/Security_Panda.png" width="200" height="246" /><p class="wp-caption-text">Panda courtesy of <a href="http://www.xen.org">www.xen.org</a>.</p></div>
<p style="text-align: justify;">Here are a list of sites that analysts may find useful in their day-to-day analysis of indicators and threats. While verifying and searching for new sources, I came across <a href="http://contagiodump.blogspot.com/2010/11/links-and-resources-for-malware-samples.html">Links and resources for malware samples</a> and <a href="http://zeltser.com/combating-malicious-software/lookup-malicious-websites.html">Free Online Tools for Looking Up Potentially Malicious Websites</a> which may also be helpful. This page may be considered a work-in-progress but if you feel something is missing or broken, leave a comment or <a title="Contact" href="http://www.rsreese.com/contact/">contact me</a>. Entries with an asterisk (*) require an account.</p>
<p><strong>IP/ISP/Domain, and WHOIS look-ups</strong></p>
<ul>
<li><a href="http://www.robtex.com">http://www.robtex.com</a> &#8211; IP/DNS/WHOIS look-ups</li>
<li><a href="http://centralops.net/co/">http://centralops.net/co/</a> &#8211; IP/DNS/WHO-IS look-ups</li>
<li><a href="http://www.yougetsignal.com/tools/web-sites-on-web-server/">http://www.yougetsignal.com/tools/web-sites-on-web-server/</a>  &#8211; Reverse lookup</li>
<li><a href="http://www.dshield.org/ipinfo.html?ip=8.8.8.8">http://www.dshield.org/ipinfo.html?ip=8.8.8.8</a> &#8211; Internet Storm Center DShield</li>
<li><a href="http://www.ipchecking.com">http://www.ipchecking.com</a> &#8211; IP/DNS/WHO-IS GEOGRAPHIC IP look-up</li>
<li><a href="http://www.isup.me">http://www.isup.me</a> &#8211; Check to see if site is up</li>
<li><a href="https://isc.sans.edu/port.html?port=8080">https://isc.sans.edu/port.html?port=8080</a> &#8211; Port details and usage statistics</li>
<li><a href="http://news.netcraft.com">http://news.netcraft.com</a> &#8211; IP/DNS/WHO-IS Geographic IP look-up, phishing reports</li>
<li><a href="http://www.traceroute.org/#USA">http://www.traceroute.org/#USA</a></li>
<li><a href="http://www.net.princeton.edu/tools">http://www.net.princeton.edu/tools</a> &#8211; Traceroute</li>
<li><a href="http://www.projecthoneypot.org/list_of_ips.php">http://www.projecthoneypot.org/list_of_ips.php</a> &#8211; IPs obtained from honeypots</li>
<li><a href="http://whois.arin.net">http://whois.arin.net</a> &#8211; IP Whois lookup</li>
<li><a href="http://www.domaintools.com">http://www.domaintools.com</a> &#8211; Reverse Whois and Whois History</li>
<li><a href="http://www.webconfs.com/domain-age.php">http://www.webconfs.com/domain-age.php</a> &#8211; <span>Domain age<br />
</span></li>
<li><a href="http://www.dnsstuff.com/">http://www.dnsstuff.com</a> &#8211; IP/DNS/WHO-IS look-ups</li>
<li><a href="http://dnshistory.org">http://dnshistory.org</a> &#8211; The history of IP/DNS Records for domains</li>
<li><a href="http://www.dnsdigger.com">http://www.dnsdigger.com</a></li>
<li><a href="https://dnsdb.isc.org">https://dnsdb.isc.org</a> &#8211; IP/DNS/Passive look-ups*</li>
</ul>
<p><strong>IP and Domain analysis for malware or web-based threats<br />
</strong></p>
<ul>
<li><a href="http://www.mcafee.com/us/mcafee-labs/threat-intelligence.aspx">http://www.mcafee.com/us/mcafee-labs/threat-intelligence.aspx</a> &#8211; Real-time, cloud-based Global threat intel</li>
<li><a href="https://www.virustotal.com/#url">https://www.virustotal.com/#url</a> &#8211; Analyzes suspicious files and URLs/detects malware</li>
<li><a href="http://www.projecthoneypot.org/search_ip.php">http://www.projecthoneypot.org/search_ip.php</a> &#8211; Inspect an IP by Project Honey Pot</li>
<li><a href="http://urlquery.net">http://urlquery.net</a> &#8211; Provides detailed information about the actions a browser takes while visiting a site for malware</li>
<li><a href="http://www.dtrackr.com">http://www.dtrackr.com</a> &#8211; Domain activity tracking</li>
<li><a href="http://www.ipvoid.com">http://www.ipvoid.com</a> &#8211; Scans an IP address against IP blacklists</li>
<li><a href="http://www.urlvoid.com">http://www.urlvoid.com</a> &#8211; Scans a domain address for its reputation</li>
<li><a href="http://minotauranalysis.com/tools/dnscheck.aspx">http://minotauranalysis.com/tools/dnscheck.aspx</a> &#8211; This tool will check against secure DNS providers and determine whether they block/redirect a specific hostname</li>
<li><a href="http://www.malwareurl.com/listing-urls.php">http://www.malwareurl.com/listing-urls.php</a> &#8211; Hosted out of Netherlands. Service that scans a domain address for its reputation</li>
<li><a href="http://www.webmaster-a.com/link-extractor-internal.php">http://www.webmaster-a.com/link-extractor-internal.php</a> &#8211; link extractor utility to create list of redirects</li>
<li><a href="http://sitecheck.sucuri.net/scanner/">http://sitecheck.sucuri.net/scanner/</a> &#8211; Check the site for malware, blacklisting status, and out-of-date software.</li>
<li><a href="http://www.avg.com.au/resources/web-page-scanner/">http://www.avg.com.au/resources/web-page-scanner/</a> &#8211; Check the safety of a URL or web page by scanning it for threats, drive-by downloads and web exploits with the AVG</li>
<li>http://ipabuse.zscaler.com/ipcheck.php &#8211; IP abuse Checker</li>
<li><a href="http://browsingprotection.f-secure.com/swp/">http://browsingprotection.f-secure.com/swp/</a> &#8211; F-Secure Browsing Protection Portal</li>
<li><a href="http://global.sitesafety.trendmicro.com">http://global.sitesafety.trendmicro.com</a>  &#8211; Trend Micro URL Safety. The latest tests indicate that this website contains no malicious software and shows no signs of fraud</li>
<li><a href="http://urlblacklist.com/?sec=search">http://urlblacklist.com/?sec=search</a> &#8211; Search Blacklist Use this form to find out if a list of sites or URL are in the blacklist and in which categories all in one</li>
<li><a href="http://www.senderbase.org">http://www.senderbase.org</a> &#8211; Cisco IronPort SenderBase Security Network. Threat Activity Source. Email Traffic Black Location Marker Spam Red Location</li>
<li><a href="http://www.maliciousnetworks.org/info.php">http://maliciousnetworks.org</a> (defunct)- FIRE (FInding RoguE Networks)</li>
</ul>
<p><strong>Open-source Threat Reports, IP and Domain Blacklists</strong></p>
<ul>
<li><a href="http://www.sophos.com/en-us/threat-center.aspx">http://www.sophos.com/en-us/threat-center.aspx</a> &#8211; Malware reports</li>
<li><a href="http://exposure.iseclab.org">http://exposure.iseclab.org</a> &#8211; Large-scale passive DNS analysis.</li>
<li><a href="http://www.symantec.com/security_response/">http://www.symantec.com/security_response/</a> - Threats, risks, and vulnerabilities</li>
<li><a href="http://www.spamhaus.org/lookup/">http://www.spamhaus.org/lookup/</a> &#8211; Database of IPs reporting email spam abuse</li>
<li><a href="http://hosts-file.net">http://hosts-file.net</a> &#8211; Community managed host file to protect against malicious.</li>
<li><a href="http://www.phishtank.com">http://www.phishtank.com</a> &#8211; PhishTank</li>
<li><a href="http://www.malwaredomainlist.com/mdl.php">http://www.malwaredomainlist.com/mdl.php</a> &#8211; Malicious domains/IPs and malware</li>
<li><a href="http://malc0de.com/database/">http://malc0de.com/database/</a> &#8211; Database of malicious domains/IPs and malware</li>
<li><a href="http://www.malwaregroup.com">http://www.malwaregroup.com</a> &#8211; Feed of malware reports from multiple sites</li>
<li><a href="http://www.mywot.com">http://www.mywot.com</a> &#8211; Tells you reputation of a website from public reports</li>
<li><a href="http://www.malwaredomains.com">http://www.malwaredomains.com</a> &#8211; Malware Prevention through Domain Blocking</li>
<li><a href="http://multirbl.valli.org">http://multirbl.valli.org</a> &#8211; Free multiple DNSBL/RBL lookup and FCrDNS check tool</li>
<li><a href="http://www.ostamyy.com/ISPs/">http://www.ostamyy.com/ISPs/</a> &#8211; Index of ISPs</li>
<li><a href="http://toolbar.netcraft.com/stats/countries">http://toolbar.netcraft.com/stats/countries</a> &#8211; Phishiest hosting countries</li>
<li><a href="http://news.netcraft.com/ssl-survey/">http://news.netcraft.com/ssl-survey/</a> &#8211; Netcraft list of SSL cert sites</li>
<li><a href="http://www.dcwg.org/detect/">http://www.dcwg.org/detect/</a> - Detect DNS Changer infection</li>
<li><a href="http://stopmalvertising.com">http://stopmalvertising.com</a> &#8211; Investigates and reports about the distribution of malware exploits through online advertising networks.</li>
<li><a href="http://www.lookstoogoodtobetrue.com">http://www.lookstoogoodtobetrue.com</a> &#8211; Review to avoid being frauded in life.</li>
</ul>
<p><strong>Malware Binary Analysis<br />
</strong></p>
<ul>
<li><a href="https://www.virustotal.com/en/">https://www.virustotal.com/en/</a> &#8211; Analyze suspicious binaries</li>
<li><a href="http://anubis.iseclab.org">http://anubis.iseclab.org</a> &#8211; ANUBIS ANalyzing Unknown BInarieS</li>
<li><a href="http://wepawet.iseclab.org">http://wepawet.iseclab.org</a> - Analyze Flash, JavaScript, and PDF&#8217;s</li>
<li><a href="http://jsunpack.jeek.org">http://jsunpack.jeek.org</a> &#8211; JavaScript Unpacker/ Decode De-Obfuscated JavaScript</li>
<li><a href="http://minotauranalysis.com">http://minotauranalysis.com</a> &#8211; Hash value search</li>
<li><a href="http://www.threatexpert.com/filescan.aspx">http://www.threatexpert.com/filescan.aspx</a> &#8211; Analyze suspicious binaries</li>
<li><a href="http://www.threattracksecurity.com/resources/sandbox-malware-analysis.aspx">http://www.threattracksecurity.com/resources/sandbox-malware-analysis.aspx</a></li>
<li><a href="https://mwanalysis.org/?page=submit">https://mwanalysis.org/?page=submit</a> &#8211; CWSandbox</li>
</ul>
<p><strong>Malware Samples<br />
</strong></p>
<ul>
<li><a href="http://contagiodump.blogspot.com">http://contagiodump.blogspot.com</a></li>
<li><a href="http://contagioexchange.blogspot.com">http://contagioexchange.blogspot.com</a></li>
<li><a href="http://malware.lu/list_hashes.txt">http://malware.lu/list_hashes.txt</a> &#8211; Hash listing does not require signup. (large file)*</li>
<li><a href="http://virusshare.com">http://virusshare.com</a></li>
<li><a href="http://www.offensivecomputing.net">http://www.offensivecomputing.net</a> &#8211; Open Malware</li>
</ul>
<p><strong>HTTP Agent sniffers, Decode De-Obfuscate JavaScript and Base 64</strong></p>
<ul>
<li><a href="http://web-sniffer.net">http://web-sniffer.net</a> &#8211; Analysis of HTTP Request and Response Header*</li>
<li><a href="http://underthesite.com">http://underthesite.com</a> &#8211; Determine services running on target</li>
<li><a href="http://www.rexswain.com/httpview.html">http://www.rexswain.com/httpview.html</a> &#8211; HTTP Viewer &#8211; See <i>exactly</i> what an HTTP request returns to your browser</li>
<li><a href="http://gsitecrawler.com/tools/Server-Status.aspx">http://gsitecrawler.com/tools/Server-Status.aspx</a>    Sever redirect checker</li>
<li><a href="http://www.unmaskcontent.com">http://www.unmaskcontent.com</a> &#8211; Unmask Content</li>
<li><a href="http://www.yellowpipe.com/yis/tools/encrypter">http://www.yellowpipe.com/yis/tools/encrypter</a> &#8211; encode/decode or encrypt/decrypt your documents in various formats such as: ASCSII, Binary, Base 64,HTML/text/JavaScript Escaping</li>
<li><a href="http://scriptasylum.com/tutorials/encode-decode.html">http://scriptasylum.com/tutorials/encode-decode.html</a> &#8211; HTML/text/JavaSript Escaping/Encoding Script</li>
<li><a href="http://www.greymagic.com/security/tools/decoder/">http://www.greymagic.com/security/tools/decoder/</a> &#8211; Decodes scripts that were encoded with the Microsoft Script Encoder (screnc.exe).</li>
<li><a href="http://ln.hixie.ch/?start=1073090889&amp;count=1">http://ln.hixie.ch/?start=1073090889&amp;count=1</a> &#8211; Unicode decoder tools</li>
<li><a href="http://www.crypo.com">http://www.crypo.com</a> &#8211; Encode or Decode strings, email and other messages</li>
<li><a href="http://spyonweb.com">http://spyonweb.com</a> &#8211; Determine what sites are sharing Google analytic code</li>
<li><a href="http://packet.dn.ua">http://packet.dn.ua</a> &#8211; JavaScript compress/decompress</li>
<li><a href="http://www.netdemon.net/decode.html">http://www.netdemon.net/decode.html</a> &#8211; obfuscated URL Decoder</li>
</ul>
<p><strong>BotNet Tracking<br />
</strong></p>
<ul>
<li><a href="http://botlab.org">http://botlab.org</a> &#8211; Spam ranking, botnet &amp; C2 tracking</li>
<li><a href="https://palevotracker.abuse.ch">https://palevotracker.abuse.ch</a> &#8211; Palevo Tracker</li>
<li><a href="https://zeustracker.abuse.ch/">https://zeustracker.abuse.ch</a> &#8211; ZeuS Tracker</li>
<li><a href="https://zeustracker.abuse.ch">https://spyeyetracker.abuse.ch</a> &#8211; SpyEye Tracker</li>
<li><a href="http://atlas.arbor.net/summary/fastflux">http://atlas.arbor.net/summary/fastflux</a> &#8211; ATLAS Summary Report</li>
<li><a href="http://www.cert.pl/news/4711/langswitch_lang/en">http://www.cert.pl/news/4711/langswitch_lang/en</a> &#8211; ZeuS – P2P+DGA variant</li>
<li><a href="http://fastfluxmonitor.com">http://fastfluxmonitor.com</a> &#8211; Monitoring and real-time detection of fastflux</li>
</ul>
<p><strong>Site History<br />
</strong></p>
<ul>
<li><a href="http://www.archive.org">http://www.archive.org</a> &#8211; Wayback Machine Internet Archive</li>
<li><a href="http://www.binarypool.com/spiderfoot/">http://www.binarypool.com/spiderfoot/</a> - Spider Indexing</li>
</ul>
<p><strong>Google Hacking</strong></p>
<ul>
<li><a href="http://www.exploit-db.com/google-dorks/">http://www.exploit-db.com/google-dorks/</a> - Google Hacking Database (GHDB) by <a href="http://www.hackersforcharity.org/">HfC</a></li>
<li><a href="http://ghh.sourceforge.net">http://ghh.sourceforge.net</a> &#8211; Google Hack Honeynet</li>
<li><a href="http://www.edge-security.com">http://www.edge-security.com</a></li>
</ul>
<img src="http://feeds.feedburner.com/~r/rsreese/~4/BGenUSUKiWM" height="1" width="1"/>]]></content:encoded><description>Here are a list of sites that analysts may find useful in their day-to-day analysis of indicators and threats. While verifying and searching for new sources, I came across Links and resources for malware samples and Free Online Tools for Looking &amp;#8230; &lt;a href="http://www.rsreese.com/online-information-security-analysis-tools-and-resources/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.rsreese.com/online-information-security-analysis-tools-and-resources/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">4</slash:comments><feedburner:origLink>http://www.rsreese.com/online-information-security-analysis-tools-and-resources/</feedburner:origLink></item><item><title>Running Moloch</title><link>http://feedproxy.google.com/~r/rsreese/~3/--6lkpYOHg0/</link><category>network</category><category>security</category><category>java</category><category>moloch</category><category>network defense</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen Reese</dc:creator><pubDate>Sat, 16 Mar 2013 11:19:30 PDT</pubDate><guid isPermaLink="false">http://www.rsreese.com/?p=1150</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>This is an overview of installing and running <a href="https://github.com/aol/moloch#what-is-moloch">Moloch</a> on a single host. After seeing the 2013 ShmooCon <a href="http://www.shmoocon.org/speakers#moloch">presentation</a>, I have been looking forward to giving the tool a test-drive. Per the documentation, &#8220;Moloch is a open source large scale IPv4 full PCAP capturing, indexing and database system&#8221;. It is fast and has a pretty nice interface to boot. Although it does not contain the same feature-set as some commercial over the shelf (COTS) products, I see Moloch fitting into a similar space where COTS products such might sit. When analysts are made aware of anomaly-based alerts from signature/misuse based intrusion detection systems (IDS), e.g. Snort, or anomalous activity from network flow, e.g. SiLK, the analyst can obtain packet capture (PCAP) for further investigation. The existing commercial tool suites are expensive PCAP indexing tools if that is all they are being used for, especially if you are locked into their storage mechanism. A budget conscious security operation center (SOC) can setup Moloch for a fraction of the maintenance cost of commercial offerings and instead use the funds for additional hardware (longer retention), maintenance, and even some Moloch development contribution.</p>
<p>Although the developers have provided a script to get Moloch going, I had a few hiccups so I figured I would document them in the event they help someone else out. I used a CentOS release 6.4 (Final) x86_64 base bare-metal install. I imagine you could run it in a virtual environment for testing purposes. After you get the operating system (OS) installed and patched, pull down the latest Oracle Java for your distribution. Untar the package and create a symbolic in a directory that Moloch will be able to find.</p>
<pre style="overflow: auto;"><code>$ sudo cp -R jre1.7.0_17/ /usr/bin/
$ sudo  ln -s /usr/bin/jre1.7.0_17/bin/java /usr/bin/java</code></pre>
<p>Next, pull down the latest moloch build. I just grabbed the ZIP but it&#8217;s hosted on GitHub. You might want to take a look at the install script to see if everything is ideal for you. Run the easy installer which should pull down the prerequisites needed, build and install.</p>
<pre style="overflow: auto;"><code>$ cd moloch-master/
$ sudo ./easybutton-singlehost.sh</code></pre>
<p>If everything went smoothly, the script will try starting the three Moloch components being elasticsearch, capture, and viewer. The latter process did not start and this was probably for the better as I required me to take a closer look at what the install script was doing and the default configuration files (<em>config.ini</em> and <em>elaseticsearch.yml</em>). The configuration files are located in:</p>
<pre style="overflow: auto;"><code># ls -l /data/moloch/etc/
total 4680
-rw-r--r--. 1 root root    6766 Mar 14 17:21 config.ini
-rw-r--r--. 1 root root    6551 Mar 13 22:30 config.ini.template
-rw-r--r--. 1 root root   12545 Mar 14 22:54 elasticsearch.yml
-rw-r--r--. 1 root root 3360134 Mar  6 15:10 GeoIPASNum.dat
-rw-r--r--. 1 root root 1358092 Mar  5 21:48 GeoIP.dat
-rw-r--r--. 1 root root    1249 Mar 13 22:31 moloch.crt
-rw-r--r--. 1 root root    1029 Mar 13 22:31 moloch.csr
-rw-r--r--. 1 root root    1704 Mar 13 22:31 moloch.key
-rw-r--r--. 1 root root   10875 Mar 13 22:31 openssl.cnf
-rw-r--r--. 1 root root   10909 Mar 13 22:30 openssl.cnf.template</code></pre>
<p>First, I had to sort out what was preventing the viewer from starting so I took a look at the viewer.log. </p>
<pre style="overflow: auto;"><code>Mar 13 23:13:04 http.c:245 moloch_http_connect(): Connecting 0x7f6e0d19b010
Mar 13 23:13:04 http.c:276 moloch_http_connect(): 0x7f6e0d19b010: Error: Error connecting: Address family not supported by protocol
Couldn't connect to elastic search at 'localhost:9200'</code></pre>
<p>Log files are located in:</p>
<pre style="overflow: auto;"><code># ls -l /data/moloch/logs/
total 6047776
-rw-r--r--. 1 root root 6180585472 Mar 15 23:44 capture.log
-rw-r--r--. 1 root root   12062720 Mar 14 17:22 capture.log.old
-rw-r--r--. 1 root root          0 Mar 13 22:31 Moloch_index_indexing_slowlog.log
-rw-r--r--. 1 root root          0 Mar 13 22:31 Moloch_index_search_slowlog.log
-rw-r--r--. 1 root root        163 Mar 15 20:00 Moloch.log
-rw-r--r--. 1 root root       2943 Mar 13 23:27 Moloch.log.2013-03-13
-rw-r--r--. 1 root root      35410 Mar 14 23:34 Moloch.log.2013-03-14
-rw-r--r--. 1 root root     208487 Mar 15 23:06 viewer.log
-rw-r--r--. 1 root root       1668 Mar 15 09:06 viewer.log.old</code></pre>
<p>I had to change the directive in the config.ini from localhost to 127.0.0.1, otherwise the viewer would not connect to the elasticsearch instance in CentOS. Probably due to the initial IPv6 look-up, just a guess. Also added a Berkley packet filter (BPF) to prevent the capture and indexing of internal-to-internal traffic.</p>
<pre style="overflow: auto;"><code>elasticsearch=127.0.0.1:9200
bpf=not src net (10.0.0.0/8) and dst net (10.0.0.0/8)</code></pre>
<p>While I was adjusting the configuration, I decided to adjust the elasticsearch memory usage from what I originally specified in the installer script. You might want to take a look at their <a href="https://github.com/aol/moloch#hardware-requirements">hardware requirements</a> but I was able to run with a less powerful node:</p>
<p><em>$ sudo vim /data/moloch/bin/run_es.sh</em></p>
<pre style="overflow: auto;"><code>ES_HEAP_SIZE=2G bin/elasticsearch -Des.config=${TDIR}/etc/elasticsearch.yml</code></pre>
<p>The viewer would now start (the capture and viewer process were already running but had gracefully killed them). Here are the commands to start each process based on the default installation criteria.</p>
<pre style="overflow: auto;"><code>$ sudo nohup /data/moloch/bin/run_es.sh
$ sudo nohup /data/moloch/bin/run_capture.sh &#038;
$ sudo nohup /data/moloch/bin/run_viewer.sh &#038;</code></pre>
<p>Sessions page screen-shot after capturing some traffic, not including session listing:</p>
<p><a href="http://www.rsreese.com/wp-content/uploads/2013/03/moloch-graph.png"><img src="http://www.rsreese.com/wp-content/uploads/2013/03/moloch-graph-thumb.jpg" alt="moloch-graph-thumb" width="640" height="212" class="alignnone size-full wp-image-1162" /></a></p>
<p>Stats page screen-shot:</p>
<p><a href="http://www.rsreese.com/wp-content/uploads/2013/03/moloch-stats.png"><img src="http://www.rsreese.com/wp-content/uploads/2013/03/moloch-stats-thumb.jpg" alt="moloch-stats-thumb" width="640" height="250" class="alignnone size-full wp-image-1165" /></a></p>
<p>I noticed the mention of two plugins to keep tabs on the elasticsearch memory usage and to maintain session data. This is pretty important as I determined if you remove PCAP and the session data remained, think metadata, users that attempted to drill-down on the aforementioned session data for the missing PCAP would cause the viewer process to die. In my case, I setup Putty to tunnel my connection to the locally listening plug-in interfaces and delete the offending session data:</p>
<p><a href="http://www.rsreese.com/wp-content/uploads/2013/03/moloch-putty.png"><img src="http://www.rsreese.com/wp-content/uploads/2013/03/moloch-putty.png" alt="moloch-putty" width="449" height="429" class="alignnone size-full wp-image-1159" /></a></p>
<p>ElasticSearch maintenance screenshot located at http://127.0.0.1:9200/_plugin/head/ after tunneling via Putty. I was able to drop the session via this interface.</p>
<p><a href="http://www.rsreese.com/wp-content/uploads/2013/03/moloch-head.png"><img src="http://www.rsreese.com/wp-content/uploads/2013/03/moloch-head-thumb.jpg" alt="moloch-head-thumb" width="640" height="224" class="alignnone size-full wp-image-1163" /></a></p>
<p>Node statistics screen-shot accessed at http://127.0.0.1:9200/_plugin/bigdesk/ after correctly configuring Putty. Note that we want to keep an eye on the heap memory to ensure it does not approach the maximum specified value. There are many more statistics not shown in this screen-shot.</p>
<p><a href="http://www.rsreese.com/wp-content/uploads/2013/03/moloch-bigdesk.png"><img src="http://www.rsreese.com/wp-content/uploads/2013/03/moloch-bigdesk-thumb.jpg" alt="moloch-bigdesk-thumb" width="640" height="185" class="alignnone size-full wp-image-1161" /></a></p>
<p>Here&#8217;s a Youtube <a href="http://www.youtube.com/watch?v=BWxrXJz_Ay0">video</a> featuring Moloch in actions. As usual, if you have trouble installing or running Moloch, please leave a comment below, and do not forget to check out the Moloch <a href="https://github.com/aol/moloch/wiki/FAQ">FAQ</a>.</p>
<img src="http://feeds.feedburner.com/~r/rsreese/~4/--6lkpYOHg0" height="1" width="1"/>]]></content:encoded><description>This is an overview of installing and running Moloch on a single host. After seeing the 2013 ShmooCon presentation, I have been looking forward to giving the tool a test-drive. Per the documentation, &amp;#8220;Moloch is a open source large scale &amp;#8230; &lt;a href="http://www.rsreese.com/running-moloch/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.rsreese.com/running-moloch/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.rsreese.com/running-moloch/</feedburner:origLink></item><item><title>Increment IP packet timestamp</title><link>http://feedproxy.google.com/~r/rsreese/~3/mpwfXxcB0H0/</link><category>network</category><category>python</category><category>scapy</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen Reese</dc:creator><pubDate>Tue, 12 Mar 2013 19:48:35 PDT</pubDate><guid isPermaLink="false">http://www.rsreese.com/?p=1143</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>I recently had a need to specify and increment the IP timestamp values of packets in a PCAP. In this example, the starting second value is specified and we increment the microsecond value. This requires the use of <a href="http://www.secdev.org/projects/scapy/">Scapy</a>. If you have any questions or recommendations for improvement, please leave a comment below.</p>
<pre style="overflow: auto;"><code>#! /usr/bin/python

# Script to parse a PCAP and modify timestamps
# Requires Scapy
# 0.1 - 03012012
# Stephen Reese

from scapy.all import *
import sys

# Get input and output files from command line
if len(sys.argv) < 2:
        print "Usage: rewritetimestamp.py inputpcapfile"
        sys.exit(1)

# Assign variable names for input and output files
infile = sys.argv[1]

def process_packets():
    pkts = rdpcap(infile)
    cooked=[]
    timestamp = 1234567890.000000
    for p in pkts:
        p.time = timestamp
        timestamp += 0.000001
        pmod=p
        p.time
        cooked.append(pmod)

    wrpcap("out.pcap", cooked)

process_packets()
</code></pre>
<img src="http://feeds.feedburner.com/~r/rsreese/~4/mpwfXxcB0H0" height="1" width="1"/>]]></content:encoded><description>I recently had a need to specify and increment the IP timestamp values of packets in a PCAP. In this example, the starting second value is specified and we increment the microsecond value. This requires the use of Scapy. If &amp;#8230; &lt;a href="http://www.rsreese.com/increment-ip-packet-timestamp/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.rsreese.com/increment-ip-packet-timestamp/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.rsreese.com/increment-ip-packet-timestamp/</feedburner:origLink></item><item><title>Running SnortAD</title><link>http://feedproxy.google.com/~r/rsreese/~3/Jj1ZwzkvsN0/</link><category>network</category><category>security</category><category>anomaly detection</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen Reese</dc:creator><pubDate>Wed, 09 Jan 2013 19:00:46 PST</pubDate><guid isPermaLink="false">http://www.rsreese.com/?p=1063</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>I recently fired up a Snort Anomaly Detection instance provided by the <a href="http://anomalydetection.info/">SnortAD</a> project and wanted to share my experience for those who might be interested in trying it on your network. SnortAD is the third generation anomaly detection preprocessor for Snort and is a little different than its predecessors but don&#8217;t take my word for it, check out their <a href="http://anomalydetection.info/">site</a>.</p>
<p>First you need to create a log file based on your network, the log file will contain a profile of your network traffics characteristics. Although a log file has been provided with the SnortAD virtual machine (VM) that contains null entries it will not do you much good aside from alerting on everything. In order to characterize your network, you will need to create a log file with enough data to be statistically relevant. For the impatient, you can create a day or two worth of data and duplicate the data. Duplicating the data will have adverse effects though. Think about a university in which a majority of classes occur on Monday and Wednesday. If you only create a profile for Monday and duplicate it for the rest of the week, you can quickly understand how your results might be skewed.</p>
<p>To get going, use the snort.conf included on SnortAD VM and begin creating a log file but remember to backup or remove the original log file in the event you need it for reference. Also, always backup your configuration files before making changes for good measure.</p>
<p>Configure the snort.conf file to log. Something like the following should work fine:</p>
<pre style="overflow: auto;"><code>preprocessor AnomalyDetection: LogPath /var/log/snort log time 60
</pre>
<p></code></p>
<p>Next, run Snort to generate log data. As mentioned, you should create enough data to make it statistically relevant. The evaluator script expects three weeks. As an alternate, you might be able to use tcpreplay to replay existing PCAP if you have enough data.</p>
<pre style="overflow: auto;"><code>$ sudo /usr/local/bin/snort -c /etc/snort.conf -i eth0
</code></pre>
<p>You should start seeing messages to stdout that look like the following:</p>
<pre style="overflow: auto;"><code>Loged transfer between 06-01-13 15:33:52 - 06-01-13 15:34:52
Loged transfer between 06-01-13 15:34:52 - 06-01-13 15:35:52
</code></pre>
<p>Now you should have a log with a number of entries saved in /var/log/snort. The profile generation script is next run. In this example we specify a week rather than opt for the three week default but again, YMMV and you made need to adjust these values. Also, make sure you check the help of the profile generator as there are other algorithms, five to be specific: Moving average (default), Naive method, Autoregressive time series model, Holt-Winters model, and HW model with Brutlag's confidence band.</p>
<pre style="overflow: auto;"><code>/usr/local/src/profilegenerator/ad_profilegenerator.r -m AVG --avg 'WEEKLY,1' -l Log_Data.txt -p profile.txt -e evaluator.txt -P pattern.txt
</code></pre>
<p>The previous command creates the profile.txt file which is a CSV file, i.e. you could respectively name it profile.csv. The CSV file will be used by your updated snort.conf file. In order to enable anomaly detection, we need to download or create a few Snort configuration files:</p>
<pre style="overflow: auto;"><code>$ ls -l /etc/snort
total 4200
-rw-r--r--. 1 root root    3621 Jan  5 15:35 classification.config
-rw-r--r--. 1 root root   29596 Jan  5 15:35 gen-msg.map
-rw-r--r--. 1 root root    7897 Jan  5 15:35 preprocessor.rules
-rw-r--r--. 1 root root 1484013 Jan  5 15:35 profile.csv
-rw-r--r--. 1 root root     746 Jan  5 15:35 reference.config
-rw-r--r--. 1 root root 2696705 Jan  5 15:35 sid-msg.map
-rw-r--r--. 1 root root     255 Jan  5 15:35 snort.conf
-rw-r--r--. 1 root root    2556 Jan  5 15:35 threshold.conf
-rw-r--r--. 1 root root   53841 Jan  5 15:35 unicode.map
</code></pre>
<p>I found it simplest to pull down the latest Snort signature as they have the additional required files that are not included in the provide SnortAD build. You can pull down the needed preprocessor.rules from one of the authors <a href="https://bitbucket.org/AnomalyDetection/preprocessor/src/2aaea35a15b0a3dcb7f627cc428e4a136420c9d3/preproc_rules/preprocessor.rules?at=default">bitbucket</a>. The snort.conf was populated with the following contents:</p>
<pre style="overflow: auto;"><code>include classification.config
include reference.config
include preprocessor.rules
preprocessor AnomalyDetection: ProfilePath /etc/snort/profile.csv LogPath /var/log/snort alert log time 60
</code></pre>
<p>If you have everything in the /etc/snort directory, you should be able to run Snort and see alerts when anomalies are detected:</p>
<pre style="overflow: auto;"><code>$ sudo /usr/local/bin/snort -c /etc/snort/snort.conf -i eth0
</code></pre>
<p>Here are some sample alerts from some early testing. It will probably take some tuning to begin seeing useful alerts:</p>
<pre style="overflow: auto;"><code>[**] [1000100:1000101:1] AD_UNUSUALLY_HIGH_TCP_TRAFFIC [**]
[Classification: Potentially Bad Traffic] [Priority: 2]
01/06-20:59:04.308505 10.0.0.116 -&gt; 8.8.8.8
ICMP TTL:64 TOS:0x0 ID:0 IpLen:20 DgmLen:84 DF
Type:8  Code:0  ID:30537   Seq:1  ECHO

[**] [1000100:1000107:1] AD_HIGH_LAN_TCP_TRAFFIC [**]
[Classification: Potentially Bad Traffic] [Priority: 2]
01/06-20:59:04.308505 10.0.0.116 -&gt; 8.8.8.8
ICMP TTL:64 TOS:0x0 ID:0 IpLen:20 DgmLen:84 DF
Type:8  Code:0  ID:30537   Seq:1  ECHO

[**] [1000100:1000108:1] AD_UNUSUALLY_LOW_UDP_TRAFFIC [**]
[Classification: Potentially Bad Traffic] [Priority: 2]
01/06-20:59:04.308505 10.0.0.116 -&gt; 8.8.8.8
ICMP TTL:64 TOS:0x0 ID:0 IpLen:20 DgmLen:84 DF
Type:8  Code:0  ID:30537   Seq:1  ECHO

[**] [1000100:1000114:1] AD_LOW_LAN_UDP_TRAFFIC [**]
[Classification: Potentially Bad Traffic] [Priority: 2]
01/06-20:59:04.308505 10.0.0.116 -&gt; 8.8.8.8
ICMP TTL:64 TOS:0x0 ID:0 IpLen:20 DgmLen:84 DF
Type:8  Code:0  ID:30537   Seq:1  ECHO

[**] [1000100:1000134:1] AD_LOW_ARP_REQUEST_NUMBER [**]
[Classification: Potentially Bad Traffic] [Priority: 2]
01/06-20:59:04.308505 10.0.0.116 -&gt; 8.8.8.8
ICMP TTL:64 TOS:0x0 ID:0 IpLen:20 DgmLen:84 DF
Type:8  Code:0  ID:30537   Seq:1  ECHO

[**] [1000100:1000138:1] AD_LOW_NOT_TCP_IP_TRAFFIC [**]
[Classification: Potentially Bad Traffic] [Priority: 2]
01/06-20:59:04.308505 10.0.0.116 -&gt; 8.8.8.8
ICMP TTL:64 TOS:0x0 ID:0 IpLen:20 DgmLen:84 DF
Type:8  Code:0  ID:30537   Seq:1  ECHO

[**] [1000100:1000140:1] AD_LOW_OVERALL_PACKET_NUMBER [**]
[Classification: Potentially Bad Traffic] [Priority: 2]
01/06-20:59:04.308505 10.0.0.116 -&gt; 8.8.8.8
ICMP TTL:64 TOS:0x0 ID:0 IpLen:20 DgmLen:84 DF
Type:8  Code:0  ID:30537   Seq:1  ECHO
</code></pre>
<p>If you have any questions, leave a comment and/or check out the authors <a href="https://bitbucket.org/AnomalyDetection/preprocessor/raw/2aaea35a15b0a3dcb7f627cc428e4a136420c9d3/ReadMe.txt">Readme.txt</a> for some additional usage insight.</p>
<img src="http://feeds.feedburner.com/~r/rsreese/~4/Jj1ZwzkvsN0" height="1" width="1"/>]]></content:encoded><description>I recently fired up a Snort Anomaly Detection instance provided by the SnortAD project and wanted to share my experience for those who might be interested in trying it on your network. SnortAD is the third generation anomaly detection preprocessor &amp;#8230; &lt;a href="http://www.rsreese.com/running-snortad/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.rsreese.com/running-snortad/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">4</slash:comments><feedburner:origLink>http://www.rsreese.com/running-snortad/</feedburner:origLink></item><item><title>Mailing Lists</title><link>http://feedproxy.google.com/~r/rsreese/~3/W6avuJrMjKQ/</link><category>network</category><category>security</category><category>mailing lists</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen Reese</dc:creator><pubDate>Fri, 09 Nov 2012 20:27:11 PST</pubDate><guid isPermaLink="false">http://www.rsreese.com/?p=1100</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Here are a few technology and information security related mailing-lists that I subscribe to in no particular order. Leave a comment if you think I missed one.</p>
<p><em>asterisk-users.lists.digium.com</em><br />
<em>beginners.perl.org</em><br />
<em>snort-users.lists.sourceforge.net</em><br />
<em>nessus.list.nessus.org</em><br />
<em>pauldotcom.mail.pauldotcom.com</em><br />
<em>samurai-devel.lists.sourceforge.net</em><br />
<em>ptk-forensics-mail.lists.sourceforge.net</em><br />
<em>gcfa.lists.sans.org</em><br />
<em>framework-hackers.spool.metasploit.com</em><br />
<em>framework.spool.metasploit.com</em><br />
<em>secureideas-base-user.lists.sourceforge.net</em><br />
<em>python-list.python.org</em><br />
<em>nexpose-users.lists.rapid7.com</em><br />
<em>winquisitor-beta.googlegroups.com</em><br />
<em>securitybsides.googlegroups.com</em><br />
<em>datarecoverycertification.googlegroups.com</em><br />
<em>full-disclosure.lists.grok.org.uk</em><br />
<em>scap_interest.ietf.org</em><br />
<em>cipp.news.infracritical.com</em><br />
<em>scadasec.news.infracritical.com</em><br />
<em>debian-security-announce.lists.debian.org</em><br />
<em>bugtraq.list-id.securityfocus.com</em><br />
<em>ietf.ietf.org</em><br />
<em>dfir.lists.sans.org</em><br />
<em>webappsec.list-id.securityfocus.com</em><br />
<em>sleuthkit-users.lists.sourceforge.net</em><br />
<em>vol-users.volatilesystems.com</em><br />
<em>emerging-sigs.emergingthreats.net</em></p>
<img src="http://feeds.feedburner.com/~r/rsreese/~4/W6avuJrMjKQ" height="1" width="1"/>]]></content:encoded><description>Here are a few technology and information security related mailing-lists that I subscribe to in no particular order. Leave a comment if you think I missed one. asterisk-users.lists.digium.com beginners.perl.org snort-users.lists.sourceforge.net nessus.list.nessus.org pauldotcom.mail.pauldotcom.com samurai-devel.lists.sourceforge.net ptk-forensics-mail.lists.sourceforge.net gcfa.lists.sans.org framework-hackers.spool.metasploit.com framework.spool.metasploit.com secureideas-base-user.lists.sourceforge.net python-list.python.org nexpose-users.lists.rapid7.com &amp;#8230; &lt;a href="http://www.rsreese.com/mailing-lists/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.rsreese.com/mailing-lists/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.rsreese.com/mailing-lists/</feedburner:origLink></item><item><title>Podcasts</title><link>http://feedproxy.google.com/~r/rsreese/~3/mIaZhmTrReA/</link><category>network</category><category>security</category><category>podcast</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen Reese</dc:creator><pubDate>Sun, 09 Sep 2012 21:29:24 PDT</pubDate><guid isPermaLink="false">http://www.rsreese.com/?p=1103</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Here&#8217;s a list of information technology and security podcasts. Some are technical, others are higher level so YMMV. Essentially a source of information to keep me up to date on what&#8217;s going on in the information technology realm.  If you think of something I have missed, leave a commment. *Note some of these may be explicit so please use discretion and they are in no particular order.</p>
<p><a title="http://www.wired.com" href="http://downloads.wired.com/podcasts/xml/features.xml?_kip_ipx=1854665749-1310493405">Wired Features</a><br />
<a title="http://www.arcsight.com" href="http://www.arcsight.com/podcasts/itunes/">ArcSight Podcasts</a><br />
<a title="http://www.thecyberjungle.com" href="http://dataclonelabs.com/security_talkworkshop/datasecurity.xml">The CyberJungle</a><br />
<a title="http://www.cbsradionewsfeed.com/rss.php?id=112" href="http://www.cbsnews.com/common/includes/podcast/podcast_larry_magid_1.rss">Tech Talk</a><br />
<a title="http://threatpost.com/en_us/feeds/blog/hearsay/digitalunderground.xml" href="http://feeds2.feedburner.com/Threatpost-DigitalUnderground">The Digita<br />
l Underground Podcast</a><br />
<a title="http://www.forensic4cast.com" href="http://www.forensic4cast.com/?feed=podcast">Forensic 4cast Â» Forensic 4cast</a><br />
<a title="http://www.imperva.com/resources/podcasts.asp" href="http://www.imperva.com/docs/podcasts/podcasts.xml">Imperva Data Security Podcast</a><br />
<a title="http://www.jupiterbroadcasting.com" href="http://feeds.feedburner.com/TheLinuxActionShow">The Linux Action Show! MP3</a><br />
<a title="http://podcasts.mcafee.com/audioparasitics/" href="http://podcasts.mcafee.com/audioparasitics/rss.xml">AudioParasitics &#8211; The Official Podcast of Mc<br />
Afee Labs</a><br />
<a title="http://www.mfesaas.com/securitybuzz" href="http://www.mxlogic.com/securitybuzz/securitybuzz.xml">McAfee SaaS Security Buzz</a><br />
<a title="http://packetpushers.net" href="http://feeds.packetpushers.net/PacketPushersPodcast">Packet Pushers Podcast</a><br />
<a title="http://www.cigital.com/silverbullet" href="http://www.cigital.com/silverbullet/feed/">The Silver Bullet Security Podcast</a><br />
<a title="http://socialengineer.podbean.com" href="http://feeds.feedburner.com/Social-engineeringorgPodcast">Social-Engineer.Org PodCast</a><br />
<a title="http://www.southernfriedsecurity.com" href="http://sfspodcast.libsyn.com/rss">The Southern Fried Security Podcast</a><br />
<a title="http://isc.sans.edu/" href="http://isc.sans.edu/podcast.xml">Internet Storm Center Threat Update</a><br />
<a title="http://risky.biz/feeds/rb2" href="http://risky.biz/feeds/rb2">RB2</a><br />
<a title="http://grc.com/securitynow.htm" href="http://leoville.tv/podcasts/sn.xml">Security Now!</a><br />
<a title="http://www.npr.org/templates/topics/topic.php?topicId= 1019" href="http://www.npr.org/rss/podcast.php?id=1019&amp;uid=n1qe4e85742c986fdb81d2d38ffa0d5d53">NPR Topics: Technology Podcast</a><br />
<a title="http://netsecpodcast.com" href="http://feeds.feedburner.com/NetworkSecurityPodcast">Network Security Podcast</a><br />
<a title="http://pauldotcom.com/" href="http://pauldotcom.com/podcast/psw.xml">PaulDotCom Security Weekly</a><br />
<a title="http://feeds.sophos.com/en/rss2_0-sophos-podcasts.xml" href="http://feeds.sophos.com/en/rss2_0-sophos-podcasts.xml">Sophos Podcasts</a><br />
<a title="http://blog.tenablesecurity.com" href="http://www.tenable.com/TenablePodcast.xml">Tenable Network Security Podcast</a><br />
<a title="http://risky.biz/feeds/risky-business" href="http://risky.biz/feeds/risky-business">Risky Business</a><br />
<a title="http://exoticliability.libsyn.com" href="http://exoticliability.libsyn.com/rss">Exotic Liability</a><br />
<a title="http://www.eurotrashsecurity.eu" href="http://www.eurotrashsecurity.eu/episodes/eurotrash.xml">Eurotrash Security Podcast: Security with funny accents</a><br />
<a title="http://www.securabit.com" href="http://securabit.libsyn.com/rss">SecuraBit</a><br />
<a title="http://securityjustice.com" href="http://feeds.feedburner.com/SecurityJustice">Security Justice</a><br />
<a title="http://www.securitycatalyst.com" href="http://www.securitycatalyst.com/feed/">The Security Catalyst</a><br />
<a title="http://www.cert.org/podcast" href="http://www.cert.org/podcast/exec_podcast.rss">CERT&#8217;s Podcast Series: Security for Business Leaders</a><br />
<a title="http://podnutz.com/mhdd/feed" href="http://feeds2.feedburner.com/myharddrivedied">My Hard Drive Died &#8211; w/Scott Moulton</a><br />
<a title="http://cyberspeak.libsyn.com" href="http://feeds.feedburner.com/Cyberspeak">CyberSpeak&#8217;s Podcast</a><br />
<a title="https://www.owasp.org/index.php/OWASP_Podcast" href="https://www.owasp.org/download/jmanico/podcast.xml">OWASP Security Podcast</a><br />
<a title="http://crypto-gram.libsyn.com" href="http://crypto-gram.libsyn.com/rss">Crypto-Gram Security Podcast</a><br />
<a title="http://www.cisco.com/en/US/solutions/ns170/tac/ security_tac_podcasts.html" href="http://www.cisco.com/assets/cdc_content_elements/rss/security_podcast/security_tac_pcast.xml">Cisco TAC Security Podcast Series</a><br />
<a title="http://www.2600.com/offthehook/" href="http://www.2600.com/oth-broadband.xml">Off The Hook: high-bitrate MP3 feed</a><br />
<a title="http://itknowledgeexchange.techtarget.com/security-wire-weekly" href="http://feeds.pheedo.com/techtarget/fHup">Security Wire Weekly</a><br />
<a title="http://www.isdpodcast.com" href="http://www.isdpodcast.com/podcasts/podcast.xml">InfoSec Daily Podcast</a><br />
<a title="http://infosecplacepodcast.com" href="http://infosecplacepodcast.com/?feed=podcast">An Information Security Place Podcast</a><br />
<a title="http://www.townsendsecurity.com" href="http://feeds.feedburner.com/townsendsecurity">Security Insider &#8211; Podcast Edition</a><br />
<a title="http://online.wsj.com/page/audio.html" href="http://feeds.wsjonline.com/wsj/podcast_wall_street_journal_tech_news_briefing?format=xml">Wall Street<br />
Journal Tech News Briefing</a><br />
<a title="http://www.cnet.com/8300-13952_1-81.html" href="http://feeds.feedburner.com/The404?format=xml">The 404 (MP3)</a><br />
<a title="http://www.bbc.co.uk/click" href="http://downloads.bbc.co.uk/podcasts/worldservice/digitalp/rss.xml">Click</a><br />
<a title="http://ashimmy.podomatic.com" href="http://ashimmy.podomatic.com/rss2.xml">Security.Exe powered by The CISO Group with Alan Shimel</a><br />
<a title="http://twit.tv" href="http://leoville.tv/podcasts/floss.xml">FLOSS Weekly</a><br />
<a title="http://blog.stackoverflow.com" href="http://blog.stackoverflow.com/?feed=podcast">The Stack Exchange Podcast</a><br />
<a title="http://hp.com/go/white-rabbit" href="http://podcast.wh1t3rabbit.net/rss">Down the Security Rabbithole</a><br />
<a title="http://auditcasts.com/" href="http://auditcasts.com/screencasts/feed.rss">AuditCasts with David Hoelzer</a><br />
<a title="http://www.cerias.purdue.edu/security_seminar" href="http://feeds.feedburner.com/CeriasSecuritySeminarPodcast">CERIAS Security Seminar Podcast</a></p>
<img src="http://feeds.feedburner.com/~r/rsreese/~4/mIaZhmTrReA" height="1" width="1"/>]]></content:encoded><description>Here&amp;#8217;s a list of information technology and security podcasts. Some are technical, others are higher level so YMMV. Essentially a source of information to keep me up to date on what&amp;#8217;s going on in the information technology realm. If you &amp;#8230; &lt;a href="http://www.rsreese.com/podcasts/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.rsreese.com/podcasts/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.rsreese.com/podcasts/</feedburner:origLink></item><item><title>Decoding XOR payload using first few bytes as key</title><link>http://feedproxy.google.com/~r/rsreese/~3/fVmTSvsbmmA/</link><category>network</category><category>security</category><category>obfuscation</category><category>python</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen Reese</dc:creator><pubDate>Mon, 23 Jul 2012 21:07:20 PDT</pubDate><guid isPermaLink="false">http://www.rsreese.com/?p=973</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>I recently came across the need to decode an exclusive or (XOR) payload. In my case, the key to de-obfuscating the traffic was the first three bytes of each packets payload. While it is trivial to decode each payload, it was not reasonable for a large number of packets.</p>
<p>For testing purposes, create a packet:</p>
<pre style="overflow: auto;"><code>$ scapy
Welcome to Scapy (2.1.0)
>>> p = (IP(ttl=10)/TCP(sport=1024,dport=443,flags="S")/"   WHATSTHESECRET0000ABCD0000ABCD0000ABCD")
>>> wrpcap("p.pcap", p)
>>> quit()
</code></pre>
<p>Should see something similar to this:</p>
<pre style="overflow: auto;"><code>04:29:31.255470 IP 127.0.0.1.1024 > 127.0.0.1.443: Flags [S], seq 0:41, win 8192, length 41
        0x0000:  4500 0051 0001 0000 0a06 b2a4 7f00 0001  E..Q............
        0x0010:  7f00 0001 0400 01bb 0000 0000 0000 0000  ................
        0x0020:  5002 2000 751d 0000 2020 2057 4841 5453  P...u......WHATS
        0x0030:  5448 4553 4543 5245 5430 3030 3041 4243  THESECRET0000ABC
        0x0040:  4430 3030 3041 4243 4430 3030 3041 4243  D0000ABCD0000ABC
        0x0050:  44                                       D
</code></pre>
<p><a href="http://www.rsreese.com/wp-content/uploads/2012/07/Screen-Shot-2012-07-23-at-10.37.49-PM.png"><img src="http://www.rsreese.com/wp-content/uploads/2012/07/Screen-Shot-2012-07-23-at-10.37.49-PM.png" alt="" title="Screen Shot 2012-07-23 at 10.37.49 PM" width="603" height="165" class="alignnone size-full wp-image-991" /></a></p>
<p>Next, the payload is XOR&#8217;d using the first three bytes of the payload for the entire payload. If you note the first tcpdump, the three bytes of the payload were left empty, here I am placing the key that will be used to XOR the rest of the payload within the first three bytes of the payload.</p>
<p><a href="http://www.rsreese.com/wp-content/uploads/2012/07/Screen-Shot-2012-07-23-at-10.39.30-PM.png"><img src="http://www.rsreese.com/wp-content/uploads/2012/07/Screen-Shot-2012-07-23-at-10.39.30-PM.png" alt="" title="Screen Shot 2012-07-23 at 10.39.30 PM" width="602" height="310" class="alignnone size-full wp-image-993" /></a></p>
<p>The payload has been obfuscated using the key &#8216;the&#8217;.</p>
<p>Next we can use the <a href="https://code.google.com/p/reese/source/browse/trunk/decodexorpayload.py">script</a> below or <a href="https://code.google.com/p/reese/source/browse/trunk/decodexorpayload.py">here</a> to decode all of the packets. The script is not intelligent enough to know which need to be de-obfuscated so it is best to probably filter these into a new PCAP. Secondly, the script requires <a href="http://www.secdev.org/projects/scapy/">Scapy</a> to be installed.</p>
<pre style="overflow: auto;"><code>#! /usr/bin/python

# Script to parse a PCAP and XOR data based on a byte offset
# Requires Scapy
# 0.1 - 07172012
# Default is two bytes, change at line 35
# Stephen Reese and Chris Gragsone
#
# todo: add two more args, offset length and static offset option

from scapy.all import *
import sys

# Get input and output files from command line
if len(sys.argv) < 2:
        print "Usage: decodexorpayload.py [input pcap file]"
        sys.exit(1)

# Assign variable names for input and output files
infile = sys.argv[1]

def many_byte_xor(buf, key):
    buf = bytearray(buf)
    key = bytearray(key)
    key_len = len(key)
    for i, bufbyte in enumerate(buf):
        buf[i] = bufbyte ^ key[i % key_len]
    return str(buf)

def process_packets():
    pkts = rdpcap(infile)
    cooked=[]
    for p in pkts:
        # You may have to adjust the payload depth here:
        # i.e. p.payload.payload.payload
        pkt_payload = str(p.payload.payload)
        pkt_offset = str(p.payload.payload)[:3]
        if pkt_payload and pkt_offset:
              pmod=p
              # You may have to adjust the payload depth here:
              p.payload.payload=many_byte_xor(pkt_payload, pkt_offset)
              cooked.append(pmod)

    wrpcap("dump.pcap", cooked)

process_packets()
</code></pre>
<p>After script completion, viewing the packet does indeed show the de-obfuscated packet:</p>
<pre style="overflow: auto;"><code>reading from file dump.pcap, link-type RAW (Raw IP)
04:24:44.415262 IP 127.0.0.1.1024 > 127.0.0.1.443: Flags [S], seq 0:41, win 8192, length 41
        0x0000:  4500 0051 0001 0000 0a06 b2a4 7f00 0001  E..Q............
        0x0010:  7f00 0001 0400 01bb 0000 0000 0000 0000  ................
        0x0020:  5002 2000 751d 0000 0000 0057 4841 5453  P...u......WHATS
        0x0030:  5448 4553 4543 5245 5430 3030 3041 4243  THESECRET0000ABC
        0x0040:  4430 3030 3041 4243 4430 3030 3041 4243  D0000ABCD0000ABC
        0x0050:  44                                       D
</code></pre>
<p>There are a number of features that could be added and of course the code can probably be improved upon. Have some ideas? Leave a comment below.</p>
<img src="http://feeds.feedburner.com/~r/rsreese/~4/fVmTSvsbmmA" height="1" width="1"/>]]></content:encoded><description>I recently came across the need to decode an exclusive or (XOR) payload. In my case, the key to de-obfuscating the traffic was the first three bytes of each packets payload. While it is trivial to decode each payload, it &amp;#8230; &lt;a href="http://www.rsreese.com/decoding-xor-payload-using-first-few-bytes-as-key/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.rsreese.com/decoding-xor-payload-using-first-few-bytes-as-key/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">4</slash:comments><feedburner:origLink>http://www.rsreese.com/decoding-xor-payload-using-first-few-bytes-as-key/</feedburner:origLink></item><item><title>World IPv6 Day</title><link>http://feedproxy.google.com/~r/rsreese/~3/Sh1KnwYkaog/</link><category>network</category><category>ipv6</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen Reese</dc:creator><pubDate>Wed, 06 Jun 2012 18:29:09 PDT</pubDate><guid isPermaLink="false">http://www.rsreese.com/?p=957</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p style="text-align: justify;"><a href="http://www.rsreese.com/wp-content/uploads/2012/06/IPv6-wordmark-256-trans.png"><img class="size-full wp-image-958 alignright" title="IPv6-wordmark-256-trans" src="http://www.rsreese.com/wp-content/uploads/2012/06/IPv6-wordmark-256-trans.png" alt="" width="256" height="256" /></a><a href="http://www.worldipv6day.org/">World IPv6 Day</a> (June 8th 2012) is rapidly approaching. It is an exciting and scary reality. For my personal assets, there was a small investment on my part to get everything up to par. My internet provider Comcast is dual-stack ready which is nice because I experienced some serious latency from time to time when using a tunnel-broker (note that other factors probably contributed). You can see more information about the Comcast IPv6 trial and preparation <a href="http://www.comcast6.net/">here</a>. First, I had to invest in a new cable-modem as my old Motorola SB1000 was not up to the task. Comcast has created a hardware compatibility <a href="http://mydeviceinfo.comcast.net/">list</a>. From the list I decided to go with the Motorola SB6121 as I have had pretty good success with their modems in the past. Secondly you need a device that is capable of filtering and distributing addresses to your internal devices. I am not going into details here, but a Cisco ASA5500 or a home-brew Linux device usually will work quite nicely. The most important part to read into is that you are also filtering v6 IP traffic along with the v4 so you do not have evil-doers sneaker-netting into your network. Your network devices will not hide behind network address translation (NAT). Lastly, keep the images, firmware, or distributions patched and monitor your traffic from time to time. Kind of like a cavity, you usually do not know you have one until it is too late.</p>
<p style="text-align: justify;">My blog has also moved to a dual-stack (<a href="http://www.linode.com/?r=6579d0b21f581ea769a6ca4af46de0dad6f88df8">Linode</a> awesome service and support) from a tunnel-broker! This was really straightforward to implement as Linode provides some great documentation in their <a href="https://library.linode.com/networking/ipv6">library</a>. As with any setup, you need to filter unwanted traffic from entering/exiting your node(s), Iptables makes quick work of this. In this scenario, I am going with a deny-by-default posture and log everything that is dropped. This is by no means definitive but just a place to get started.</p>
<pre style="overflow: auto;"><code>*filter
# Drop everything
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]

# Allow the loopback
-A INPUT -i lo -j ACCEPT
-A INPUT -d ::1/128 ! -i lo -j REJECT --reject-with icmp6-port-unreachable

# All returning connections
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

# Let the web server respond
-A INPUT -p tcp --sport 1024:65535 --dport 80 -m state --state NEW -j ACCEPT
-A INPUT -p tcp --sport 1024:65535 --dport 443 -m state --state NEW -j ACCEPT

# All SSH session but limit attempt, also see fail2ban
-A INPUT -p tcp --sport 1024:65535 --dport 22 --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -m limit --limit 1/min --limit-burst 3 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 --tcp-flags FIN,SYN,RST,ACK SYN -j DROP

# Allow ICMP but need to restrict based on type
-A INPUT -p ipv6-icmp -j ACCEPT

# Drop everything else and log it
-A INPUT -m limit --limit 3/min -j LOG --log-prefix "ipv6 input denied: " --log-level 7

# Respective outbound rules
-A OUTPUT -p ipv6-icmp -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -m limit --limit 3/min -j LOG --log-prefix "ipv6 output denied: " --log-level 7
COMMIT
</code></pre>
<img src="http://feeds.feedburner.com/~r/rsreese/~4/Sh1KnwYkaog" height="1" width="1"/>]]></content:encoded><description>World IPv6 Day (June 8th 2012) is rapidly approaching. It is an exciting and scary reality. For my personal assets, there was a small investment on my part to get everything up to par. My internet provider Comcast is dual-stack &amp;#8230; &lt;a href="http://www.rsreese.com/world-ipv6-day/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.rsreese.com/world-ipv6-day/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">3</slash:comments><feedburner:origLink>http://www.rsreese.com/world-ipv6-day/</feedburner:origLink></item><item><title>How-to setup an Upside-Down-Ternet</title><link>http://feedproxy.google.com/~r/rsreese/~3/fraHjIDbMQE/</link><category>internet</category><category>debian</category><category>iptables</category><category>squid proxy</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen Reese</dc:creator><pubDate>Fri, 10 Feb 2012 19:07:15 PST</pubDate><guid isPermaLink="false">http://www.rsreese.com/?p=901</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>In an effort to replicate the amusing idea of a transparent proxy that manipulates traffic in a fun way found <a href="http://www.ex-parrot.com/pete/upside-down-ternet.html">here</a> and made even better with some great scripts that you can pull down from <a href="https://code.google.com/p/g0tmi1k/source/browse/trunk#trunk%2FsquidScripts">here</a>. A Debian box was stood up with two network cards; one connects to the internal LAN and the other connected to an access-point which your guests connect to. I chose to post this how-to as the initial idea did not provide a complete reference on how to setup the needed components.</p>
<p>First, we are using an access-point we take care of the DHCP and DNS duties but the access-point or another host could perform these duties if they support said services. I choose to install the following DHCP service:</p>
<pre style="overflow: auto;"><code>$ sudo apt-get install isc-dhcp-server</code></pre>
<p>The following configuration provides the scope for the clients. We only define a scope for the client side which will use a 192.168.0.0 network for the example purposes.</p>
<pre style="overflow: auto;"><code>$ grep ^[^#] /etc/dhcp/dhcpd.conf
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.0.0 netmask 255.255.255.0 {
  range 192.168.0.100 192.168.0.200;
  option domain-name-servers 192.168.0.1;
  option domain-name "kittenwar.com";
  option routers 192.168.0.1;
  option broadcast-address 192.168.0.255;
  default-lease-time 600;
  max-lease-time 7200;
}</code></pre>
<p>Secondly, the guests are going to need some resolution, rather than have their queries pass through the network, lets setup a simple resolver for them using BIND:</p>
<pre style="overflow: auto;"><code>$ sudo apt-get install bind9</code></pre>
<p>Setup some forwarders and the interface we want to listen on, for example sake, the same subnet servicing the clients:</p>
<pre style="overflow: auto;"><code>$ grep ^[^#] /etc/bind/named.conf.options
options {
        directory "/var/cache/bind";
        version "tbd";
        forwarders { 8.8.8.8; 8.8.4.4; };
        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { none; };
        listen-on { 192.168.0.1; 127.0.0.1; };
};</code></pre>
<p>Some of the fun scripts require a HTTP service to serve up flipped images and all sorts of other goodness so Apache and ImageMagick are needed:</p>
<pre style="overflow: auto;"><code>$ sudo apt-get install apache2
$sudo apt-get -y install imagemagick</code></pre>
<p>The last service is Squid caching proxy. Install version 3 was installed from the repositories:</p>
<pre style="overflow: auto;"><code>$ sudo apt-get install squid3</code></pre>
<p>Edit the Squid configuration, this is a default configuration but the <strong>acl</strong> for the clients has been enabled along with <strong>interception</strong> mode (read transparent) and finally call the script via <strong>url_rewrite_program</strong>:</p>
<pre style="overflow: auto;"><code>$ grep ^[^#] /etc/squid3/squid.conf
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access deny all
http_port 3128 intercept
hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid3
url_rewrite_program /home/us3r/squidScripts/flipImages.pl
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320</code></pre>
<p>Execute the following to create some protection from the subnet being advertised and furthermore forces all of the web request to use the Squid cache. The rule-set is by no means perfect or definitive, feel free to tailor to your needs and provide feedback.</p>
<pre style="overflow: auto;"><code>$ grep ^[^#] fw-script
PATH=/sbin
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables --policy INPUT DROP
iptables --policy OUTPUT DROP
iptables --policy FORWARD DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A INPUT -i eth2 -p tcp --dport 3128 -j ACCEPT
iptables -A INPUT -i eth2 -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -i eth2 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -i eth2 -p udp --dport 53 -j ACCEPT
iptables -A INPUT -i eth2 -p udp --dport 67 -j ACCEPT
iptables -A OUTPUT -o eth2 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 8000 -j ACCEPT
iptables -A INPUT -i eth1 -p udp --dport 68 -j ACCEPT
iptables -A INPUT -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp --dport 80 -j ACCEPT
iptables -A OUTPUT -o eth1 -p udp --dport 67 -j ACCEPT
iptables -A OUTPUT -o eth1 -p udp --dport 53 -j ACCEPT
iptables -A OUTPUT -o eth1 -p udp --dport 443 -j ACCEPT
iptables -A OUTPUT -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -I INPUT -j LOG --log-prefix "iptables denied: " --log-level 7
iptables -I OUTPUT -j LOG --log-prefix "iptables denied: " --log-level 7
iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 80 -j DNAT --to-destination 192.168.0.1:3128
iptables -t nat -A POSTROUTING -o eth2 -s 192.168.0.0/24 -d 192.168.0.1 -j SNAT --to 192.168.0.1
iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 80 -j REDIRECT --to-port 3128</code></pre>
<p>You can down pull down a script from the Google code repository mentioned above which you have referenced in the Squid configuration. There are variables in the top of the scripts that you downloaded earlier. The variables need to be updated to reflect your system. A few Perl module prerequisites are also listed in the top of said scripts, access CPAN and install them:</p>
<pre style="overflow: auto;"><code>$ sudo perl -MCPAN -e shell</code></pre>
<p>After the required Perl modules are installed, you should be able to place a client on the guest network and they will retrieve sites, although it will not take long for to notice that in this case all of the images are inverted. Do not forget to checkout the other scripts.</p>
<p><a title="How-to setup an Upside-Down-Ternet" href="http://www.rsreese.com/wp-content/uploads/2012/02/ternet-pinterest.png"><img class="alignnone size-full wp-image-1134" alt="ternet-pinterest-scaled" src="http://www.rsreese.com/wp-content/uploads/2012/02/ternet-pinterest-scaled.png" width="640" height="385" /></a></p>
<p>Lots of fun! If I missed something or you have some feedback, use the comment form below.</p>
<img src="http://feeds.feedburner.com/~r/rsreese/~4/fraHjIDbMQE" height="1" width="1"/>]]></content:encoded><description>In an effort to replicate the amusing idea of a transparent proxy that manipulates traffic in a fun way found here and made even better with some great scripts that you can pull down from here. A Debian box was &amp;#8230; &lt;a href="http://www.rsreese.com/how-to-setup-an-upside-down-ternet/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.rsreese.com/how-to-setup-an-upside-down-ternet/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.rsreese.com/how-to-setup-an-upside-down-ternet/</feedburner:origLink></item></channel></rss>
