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

<channel>
	<title>SuperHac.com</title>
	<atom:link href="http://www.superhac.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.superhac.com</link>
	<description>Hacking on a whole new level</description>
	<lastBuildDate>Thu, 30 Oct 2008 23:10:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Build files for gnome apps (configure.in &amp; makefile.am)</title>
		<link>http://www.superhac.com/?p=38</link>
		<comments>http://www.superhac.com/?p=38#comments</comments>
		<pubDate>Thu, 30 Oct 2008 23:01:13 +0000</pubDate>
		<dc:creator>SuperHac</dc:creator>
				<category><![CDATA[GTK]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[e500]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.superhac.com/?p=38</guid>
		<description><![CDATA[I just started to take the leap to autogen and after 2 days I finally got the configure.in and Makefile.am figured out for building gnome apps. This will allow you to build the latest Glade app&#8217;s using GtkBuilder. I really like the automated dependency checking. My system is running Ubuntu 8.04 (Hardy). configure.in AC_INIT(src) PACKAGE=YOURAPPNAME [...]]]></description>
			<content:encoded><![CDATA[<p>I just started to take the leap to autogen and after 2 days I finally got the configure.in and Makefile.am figured out for building gnome apps.   This will allow you to build the latest Glade app&#8217;s using GtkBuilder.  I really like the automated dependency checking.  My system is running Ubuntu 8.04 (Hardy).</p>
<p>configure.in</p>
<p>AC_INIT(src)</p>
<p>PACKAGE=YOURAPPNAME<br />
VERSION=0.1</p>
<p>AM_INIT_AUTOMAKE($PACKAGE,$VERSION)</p>
<p>AC_STDC_HEADERS<br />
AC_PROG_INSTALL<br />
AC_PROG_CXX</p>
<p>PKG_CHECK_MODULES(DEPS, gtk+-2.0 &gt;= 2.0 glib-2.0 &gt;= 2.2 gmodule-export-2.0 &gt;= 2.0)<br />
AC_SUBST(DEPS_CFLAGS)<br />
AC_SUBST(DEPS_LIBS)</p>
<p>AC_OUTPUT([<br />
Makefile<br />
src/Makefile<br />
])</p>
<p>Makefile.am (in your src directory)</p>
<p>bin_PROGRAMS = YOURAPPNAME</code></p>
<p>YOURAPPNAME_SOURCES = main.c<br />
LIBS = $(DEPS_LIBS)<br />
INCLUDES = $(DEPS_CFLAGS)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.superhac.com/?feed=rss2&amp;p=38</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LIBIPQ example Code</title>
		<link>http://www.superhac.com/?p=28</link>
		<comments>http://www.superhac.com/?p=28#comments</comments>
		<pubDate>Wed, 13 Feb 2008 14:15:40 +0000</pubDate>
		<dc:creator>SuperHac</dc:creator>
				<category><![CDATA[LIBIPQ]]></category>
		<category><![CDATA[Netfiliter]]></category>

		<guid isPermaLink="false">http://superhac.com/?p=28</guid>
		<description><![CDATA[I had a request for a working example of using libipq. It contains enough to get anyone started. Functions include: getting src/dst ip address, src/dst ports, identifing IP protocol(udp/tcp), get the payload, etc&#8230; There is a README in the archive on how to compile and run the example. Download]]></description>
			<content:encoded><![CDATA[<p>I had a request for a working example of using libipq.  It contains enough to get anyone started.  Functions include: getting src/dst ip address, src/dst ports, identifing IP protocol(udp/tcp), get the payload, etc&#8230;  There is a README in the archive on how to compile and run the example.</p>
<h3><a href="http://superhac.com/wp-content/uploads/2008/02/libipq_exampletar.gz" onclick="return false;" title="Direct link to file">Download</a></h3>
]]></content:encoded>
			<wfw:commentRss>http://www.superhac.com/?feed=rss2&amp;p=28</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JXBStreamer &#8211; Java based XBMSP Implementation</title>
		<link>http://www.superhac.com/?p=3</link>
		<comments>http://www.superhac.com/?p=3#comments</comments>
		<pubDate>Tue, 27 Nov 2007 20:59:34 +0000</pubDate>
		<dc:creator>SuperHac</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[xbox]]></category>

		<guid isPermaLink="false">http://superhac.com/?p=3</guid>
		<description><![CDATA[This was an app I wrote quite a long time ago to stream content to my Xbox using the XBMSP protocol. The purpose was to provide an easy/fast way to stream content using a flash drive. Plus I wanted to get some understanding of socket programming under Java. It&#8217;s written in java so it works [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://superhac.com/wp-content/uploads/2008/01/jxbstreamer.png" onclick="return false;" title="Direct link to file" rel="lightbox"><img src="http://superhac.com/wp-content/uploads/2008/01/jxbstreamer.thumbnail.png" alt="JXBStreamer screenshot" align="left" height="128" hspace="8" width="170" /></a>    This was an app I wrote quite a long time ago to stream content to my    Xbox using the XBMSP protocol. The purpose was to provide an easy/fast    way to stream content using a flash drive. Plus I wanted to get some    understanding of socket programming under Java. It&#8217;s written in java so    it works on both Linux and Windozes.</p>
<p><a href="http://superhac.com/wp-content/uploads/2008/01/jxbstreamer.jar" onclick="return false;" title="Direct link to file">JXBStreamer jar</a>(java -jar JXBStreamer.jar)</p>
<p><a href="http://superhac.com/wp-content/uploads/2008/01/jxbstreamer.jar" onclick="return false;" title="Direct link to file"></a><a href="http://superhac.com/wp-content/uploads/2008/01/jxbstreamer_sourcetar.gz" onclick="return false;" title="Direct link to file">JXBStreamer Source (Netbeans Project)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.superhac.com/?feed=rss2&amp;p=3</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A new Photography site dedicated to the Olympus E-500</title>
		<link>http://www.superhac.com/?p=7</link>
		<comments>http://www.superhac.com/?p=7#comments</comments>
		<pubDate>Tue, 20 Feb 2007 21:06:03 +0000</pubDate>
		<dc:creator>SuperHac</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[e500]]></category>

		<guid isPermaLink="false">http://superhac.com/?p=7</guid>
		<description><![CDATA[I have recently picked up the hobby of photography and have started a site dedicated to the Olympus E-500. The goal of this website is to provide as much information as possible on getting the most out of your E-500. Hopefully the site will get to the point of Howtos, tutorials, and answers. All the [...]]]></description>
			<content:encoded><![CDATA[<p>   I have recently picked up the hobby of photography and have started a    site dedicated to the Olympus E-500. The goal of this website is to    provide as much information as possible on getting the most out of your    E-500. Hopefully the site will get to the point of Howtos, tutorials,    and answers. All the information that will be contained within will be    based on my experience and information collected from books and    websites. The site is still under construction but theres enough    information to get it started.</p>
<p><a href="http://www.superhac.com/photos/index.html">The Olympus E-500 Experience</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.superhac.com/?feed=rss2&amp;p=7</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiling LIBIPQ Examples</title>
		<link>http://www.superhac.com/?p=10</link>
		<comments>http://www.superhac.com/?p=10#comments</comments>
		<pubDate>Thu, 12 May 2005 21:10:20 +0000</pubDate>
		<dc:creator>SuperHac</dc:creator>
				<category><![CDATA[LIBIPQ]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://superhac.com/?p=10</guid>
		<description><![CDATA[You need the following library headers to compile the LIPIPQ examples on this page: #include &#60;linux/netfilter.h&#62; #include &#60;libipq.h&#62; #include &#60;netinet/tcp.h&#62; #include &#60;netinet/ip.h&#62;]]></description>
			<content:encoded><![CDATA[<p>You need the following library headers to compile the LIPIPQ examples on this page:</p>
<p>#include &lt;linux/netfilter.h&gt;<br />
#include &lt;libipq.h&gt;<br />
#include &lt;netinet/tcp.h&gt;<br />
#include &lt;netinet/ip.h&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.superhac.com/?feed=rss2&amp;p=10</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Determining the IP protocol of a packet from LIBIPQ</title>
		<link>http://www.superhac.com/?p=11</link>
		<comments>http://www.superhac.com/?p=11#comments</comments>
		<pubDate>Thu, 03 Feb 2005 21:12:47 +0000</pubDate>
		<dc:creator>SuperHac</dc:creator>
				<category><![CDATA[LIBIPQ]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Netfiliter]]></category>

		<guid isPermaLink="false">http://superhac.com/?p=11</guid>
		<description><![CDATA[When you recieved the ipq_packet_msg structure from LIBIPQ you need to determine what IP protocol (TCP, UDP, etc) is contained after the IP header. Below is a simple fuction to determine what IP protocol is contained within the packet. int identify_ip_protocol (ipq_packet_msg_t *msg) { int protocol=0; /* 6 = TCP, 16 = UDP */ /* [...]]]></description>
			<content:encoded><![CDATA[<p>When you recieved the ipq_packet_msg structure from LIBIPQ you need to determine what IP protocol (TCP, UDP, etc) is contained after the IP header. Below is a simple fuction to determine what IP protocol is contained within the packet.</p>
<p class="code">  int identify_ip_protocol (ipq_packet_msg_t *msg)<br />
{<br />
int protocol=0;  /* 6 = TCP, 16 = UDP */</p>
<p>/* Cast the IP Header from the raw packet */<br />
struct iphdr *iph = ((struct iphdr *) msg-&gt;payload);</p>
<p>/* get the protocol identifier from the ip header */<br />
protocol = iph-&gt;protocol;</p>
<p>return(protocol);</p>
<p>}</p>
<p>Once you determine the protocol you can then cast out the next header. Like this for TCP:</p>
<p class="code">   /* Cast the TCP Header from the raw packet */<br />
struct tcphdr *tcp = (struct tcphdr *)(m-&gt;payload + (iph-&gt;ihl &lt;&lt; 2));</p>
<p>or like this for UDP:</p>
<p class="code"> /* Cast the UDP Header from the raw packet */<br />
struct udphdr *udp = (struct udphdr *) (msg-&gt;payload + (iph-&gt;ihl &lt;&lt; 2));</p>
]]></content:encoded>
			<wfw:commentRss>http://www.superhac.com/?feed=rss2&amp;p=11</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LIBIPQ udp packet parsing</title>
		<link>http://www.superhac.com/?p=12</link>
		<comments>http://www.superhac.com/?p=12#comments</comments>
		<pubDate>Mon, 31 Jan 2005 21:14:19 +0000</pubDate>
		<dc:creator>SuperHac</dc:creator>
				<category><![CDATA[LIBIPQ]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Netfiliter]]></category>

		<guid isPermaLink="false">http://superhac.com/?p=12</guid>
		<description><![CDATA[Here&#8217;s another snippet of code for calculating and parsing a UDP packet with LIBIPQ. This function gets the first two bytes of the UDP packet payload(data). &#62; &#62; __u16 get_udp_two_payload_bytes(ipq_packet_msg_t *msg) &#62; { &#62; &#62; unsigned int udp_header_size = 8; /* UDP always has an 8 byte header! */ &#62; __u16 fist_two_bytes; &#62; &#62; /* [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s another snippet of code for calculating and parsing a UDP packet      with LIBIPQ. This function gets the first two bytes of the UDP packet      payload(data).<br />
&gt;<br />
&gt;</p>
<p class="code">       __u16 get_udp_two_payload_bytes(ipq_packet_msg_t *msg)<br />
&gt; {<br />
&gt;<br />
&gt;        unsigned int udp_header_size = 8; /* UDP always has an 8 byte header! */<br />
&gt;        __u16 fist_two_bytes;<br />
&gt;<br />
&gt; /* Cast the IP Header from the raw        packet */<br />
&gt; struct iphdr *iph = ((struct iphdr *) msg-&gt;payload);<br />
&gt;<br />
&gt;        /* Cast the UDP Header from the raw packet */<br />
&gt; struct udphdr *udp =        (struct udphdr *) (msg-&gt;payload + (iph-&gt;ihl 2));<br />
&gt;<br />
&gt; /*        get the payload offset from within the raw packet */<br />
&gt; int unsigned        payload_offset = ( udp_header_size + (iph-&gt;ihl 2) );<br />
&gt;<br />
&gt; /*        calculate the length of the UDP payload */<br />
&gt; int unsigned        payload_length = ntohs(udp-&gt;len) &#8211; udp_header_size;</p>
<p class="code">&nbsp;</p>
<p class="code"> /*        get the first two bytes of the payload */<br />
if(payload_length)<br />
first_two_bytes = *(__u16 *) (msg-&gt;payload + payload_offset);<br />
else /* There was no payload&#8230; */<br />
printf(&#8220;ERROR: Payload is        zero&#8230;.\n&#8221;);<br />
return(first_two_bytes);<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.superhac.com/?feed=rss2&amp;p=12</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ipq_packet_msg structure</title>
		<link>http://www.superhac.com/?p=13</link>
		<comments>http://www.superhac.com/?p=13#comments</comments>
		<pubDate>Wed, 05 Jan 2005 21:15:50 +0000</pubDate>
		<dc:creator>SuperHac</dc:creator>
				<category><![CDATA[Kernel]]></category>
		<category><![CDATA[LIBIPQ]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://superhac.com/?p=13</guid>
		<description><![CDATA[Just a dump of the ipq_packet_msg structure. ipq_packet_msg structure defined in /usr/include/linux/netfilter_ipv4/ip_queue.h: typedef struct ipq_packet_msg { unsigned long packet_id; /* ID of queued packet */ unsigned long mark; /* Netfilter mark value */ long timestamp_sec; /* Packet arrival time (seconds) */ long timestamp_usec; /* Packet arrvial time (+useconds) */ unsigned int hook; /* Netfilter hook [...]]]></description>
			<content:encoded><![CDATA[<p>Just a dump of the ipq_packet_msg structure.</p>
<p>ipq_packet_msg structure defined in /usr/include/linux/netfilter_ipv4/ip_queue.h:</p>
<p class="code">  typedef struct ipq_packet_msg {<br />
unsigned long packet_id;	/* ID of queued packet */<br />
unsigned long mark;		/* Netfilter mark value */<br />
long timestamp_sec;		/* Packet arrival time (seconds) */<br />
long timestamp_usec;		/* Packet arrvial time (+useconds) */<br />
unsigned int hook;		/* Netfilter hook we rode in on */<br />
char indev_name[IFNAMSIZ];	/* Name of incoming interface */<br />
char outdev_name[IFNAMSIZ];	/* Name of outgoing interface */<br />
unsigned short hw_protocol;	/* Hardware protocol (network order) */<br />
unsigned short hw_type;		/* Hardware type */<br />
unsigned char hw_addrlen;	/* Hardware address length */<br />
unsigned char hw_addr[8];	/* Hardware address */<br />
size_t data_len;		/* Length of packet data */<br />
unsigned char payload[0];	/* Optional packet data */<br />
} ipq_packet_msg_t;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.superhac.com/?feed=rss2&amp;p=13</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netfilter hooks, and the skb structure (sk_buff.h)</title>
		<link>http://www.superhac.com/?p=8</link>
		<comments>http://www.superhac.com/?p=8#comments</comments>
		<pubDate>Fri, 24 Dec 2004 21:06:50 +0000</pubDate>
		<dc:creator>SuperHac</dc:creator>
				<category><![CDATA[Kernel]]></category>
		<category><![CDATA[LIBIPQ]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Netfiliter]]></category>

		<guid isPermaLink="false">http://superhac.com/?p=8</guid>
		<description><![CDATA[How to use Netfilter hooks written by Owen Klan, presents a general overview of Netfilter and covers the basics of kernel module development. I also found a resource on the sk_buff structure, which holds packets passing through the network stack. You can find it here: skb &#8211; Linux network buffers]]></description>
			<content:encoded><![CDATA[<p><a href="http://uqconnect.net/%7Ezzoklan/documents/netfilter.html">How to use Netfilter hooks</a>   written by Owen Klan, presents a general overview of Netfilter and covers the basics of kernel module development.</p>
<p>I also found a resource on the sk_buff structure, which holds packets passing through the network stack.  You can find it here: <a href="http://gnumonks.org/ftp/pub/doc/skb-doc.html">skb &#8211; Linux network buffers</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.superhac.com/?feed=rss2&amp;p=8</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LIBIPQ Packet Processing</title>
		<link>http://www.superhac.com/?p=14</link>
		<comments>http://www.superhac.com/?p=14#comments</comments>
		<pubDate>Thu, 16 Dec 2004 21:17:03 +0000</pubDate>
		<dc:creator>SuperHac</dc:creator>
				<category><![CDATA[Kernel]]></category>
		<category><![CDATA[LIBIPQ]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Netfiliter]]></category>

		<guid isPermaLink="false">http://superhac.com/?p=14</guid>
		<description><![CDATA[For those that are not familiar with LIBIPQ, it&#8217;s a library for receving packets from the Netfilter framework in user space applications. You can use this library to grab packets before they leave the stack, and make decisions on what to do with them. For instance you can Accept, Reject, or even mangle packets. It [...]]]></description>
			<content:encoded><![CDATA[<p>For those that are not familiar with LIBIPQ, it&#8217;s a library for receving packets from the Netfilter framework in user space applications. You can use this library to grab packets before they leave the stack, and make decisions on what to do with them. For instance you can Accept, Reject, or even mangle packets. It uses the IP_QUEUE module which you may have seen used with IPTABLES.</p>
<p>For example: <strong># iptables -A OUTPUT -j QUEUE </strong></p>
<p>This tells netfilter to route all out going packets orginating from your machine to the QUEUE.</p>
<p>Developing with LIBIPQ requires the iptables-devel package to be installed. You can then compile your programs by linking them to the LIBIPQ library as shown below:</p>
<p><strong># gcc yourapp.c -lipq</strong></p>
<p>You need to be root to run any program that uses LIBIPQ.  Also if you recieve an error like, <strong>&#8220;passer: Failed to send netlink message: Connection refused&#8221;</strong> you need to load the ip_queue module.  Just issue: <strong># modprobe ip_queue</strong>.</p>
<p>I would like to thank Ulysses, Srinivas, Henrik, Maarteen for all their help.  If I forgot anyone else thank you too!</p>
<p>Below is a code snippet for parsing out the raw packet found in the structure ipq_packet_msg_t(ipq_packet_msg_t-&gt;payload). This snippet fits into the example from <a href="http://www.crhc.uiuc.edu/%7Egrier/projects/libipq.html">Quick Intro to libipq</a>.  This is very useful for people just getting started with LIBIPQ since documentation on this is scarce.</p>
<p>case IPQM_PACKET:<br />
{<br />
ipq_packet_msg_t *m = ipq_get_packet(buf);</p>
<p>__u16 first_two_bytes = 0; /* hold the first two bytes from payload */</p>
<p>/* Cast the IP Header from the raw packet */<br />
struct iphdr *iph = ((struct iphdr *)m-&gt;payload);</p>
<p>/* Cast the TCP Header from the raw packet */<br />
struct tcphdr *tcp = (struct tcphdr *)(m-&gt;payload + (iph-&gt;ihl &lt;&lt; 2));</p>
<p>/* get the payload offset from with the raw packet */<br />
int unsigned payload_offset = ((iph-&gt;ihl &lt;&lt; 2) + (tcp-&gt;doff &lt;&lt; 2));</p>
<p>/* calculate the length of the payload */<br />
int unsigned payload_length = (unsigned int) ntohs(iph-&gt;tot_len) &#8211;  				((iph-&gt;ihl &lt;&lt; 2) + (tcp-&gt;doff &lt;&lt; 2));</p>
<p>/* Calculate the size of the IP  Header.  iph-&gt;ihl contains the number of 32 bit<br />
words that represent the header size.  Therfore to get the number of bytes<br />
multiple this number by 4 */<br />
int iphdr_size = (iph-&gt;ihl &lt;&lt; 2);</p>
<p>/* Calculate the size of the TCP Header.  tcp-&gt;doff contains the number of 32 bit<br />
words that represent the header size.  Therfore to get the number of bytes<br />
multiple this number by 4 */<br />
int tcphdr_size = (tcp-&gt;doff &lt;&lt; 2);</p>
<p>/* get the destination port of the packet */<br />
int port = ntohs(tcp-&gt;dest);</p>
<p>/* Get the first two bytes of the payload if a payload is present*/<br />
if(payload_length)<br />
first_two_bytes = *(__u16 *) (m-&gt;payload + payload_offset);</p>
<p>/* example code */<br />
if (port == 9555) /* Check for a port match */<br />
{<br />
printf(&#8220;Matched a packet\n&#8221;);</p>
<p>if(payload_length)<br />
printf(&#8220;First two bytes: 0x%x\n&#8221;, first_two_bytes); /* prints in HEX */</p>
<p>printf(&#8220;IP Header size: %d\n&#8221;, iphdr_size);<br />
printf(&#8220;TCP Header size: %d\n&#8221;, tcphdr_size);<br />
printf(&#8220;Payload Size : %d\n&#8221;, payload_length);<br />
printf(&#8220;TOTAL IP Packet size: %d\n&#8221;, ntohs(iph-&gt;tot_len));<br />
printf(&#8220;\n&#8221;);</p>
<p>status = ipq_set_verdict(h, m-&gt;packet_id, NF_ACCEPT, 0, NULL);</p>
<p>}<br />
else<br />
{<br />
status = ipq_set_verdict(h, m-&gt;packet_id, NF_ACCEPT, 0, NULL);<br />
if (status &lt; 0)<br />
die(h);<br />
}<br />
break;<br />
}<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.superhac.com/?feed=rss2&amp;p=14</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
