<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
	<channel>
		<title>Jack Hacks</title>
		<link>http://notany.net/blog/index.php</link>
		<description><![CDATA[No Footer]]></description>
		<copyright>Copyright 2008, Jack</copyright>
		<managingEditor>Jack</managingEditor>
		<language>en-US</language>
		<generator>SPHPBLOG 0.4.8</generator>
		<item>
			<title>List user open sockets on cPanel server</title>
			<link>http://notany.net/blog/index.php?entry=entry070317-004147</link>
			<description><![CDATA[As simple as this:<br /><b><br /><code><br />lsof -n -u^65534,^`cat /etc/passwd | awk -F&#039;:&#039; &#039;{if($3 &lt; 32000) print $3}&#039; | xargs | sed -e &#039;s/ /,\^/g&#039;` -i | awk &#039;{if ($2 ~ /[0-9]*/) print $3, $1}&#039; | sort | uniq -c | sort -n<br /></code><br /></b><br />The awk part is for excluding the system users ids &lt; 32000.]]></description>
			<category>Linux</category>
			<guid isPermaLink="true">http://notany.net/blog/index.php?entry=entry070317-004147</guid>
			<author>Jack</author>
			<pubDate>Fri, 16 Mar 2007 22:41:47 GMT</pubDate>
			<comments>http://notany.net/blog/comments.php?y=07&amp;m=03&amp;entry=entry070317-004147</comments>
		</item>
		<item>
			<title>How to extract SYN packets with tcpdump</title>
			<link>http://notany.net/blog/index.php?entry=entry070221-233617</link>
			<description><![CDATA[<b>tcpdump</b><br /><b><code><br /># tcpdump -ne dst port 80 and &#039;tcp[13] &amp; 2 == 2&#039;<br /></code></b><br />This way effectively filtering only SYN packets on port 80.<br /><br /><b><code><br /># tcpdump -c 30000 -ne dst port 80 and &#039;tcp[13] &amp; 2 == 2&#039; | awk &#039;{print $11}&#039; | cut -d. -f1|sort | uniq -c | sort -n<br /></code></b><br />Dumping 30K packets,cutting the first octet from the IPs and sorting by number of packets originating from this A class net.<br /><br />A bit more complicated:<br /><b><code><br /># for i in `tcpdump -c 30000 -ne dst port 80 and &#039;tcp[13] &amp; 2 == 2&#039; | awk &#039;{print $11} | cut -d. -f1|sort | uniq -c | awk &#039;{if ($1 &gt; 4000) print $2}&#039;`; do \<br />      iptables -I INPUT -s $i.0.0.0/8 -j DROP; \<br />done<br /></code></b><br />Dumping 30K packets and if more than 4000 packets originate from the same A class net - block the net via iptables.]]></description>
			<category>Linux</category>
			<guid isPermaLink="true">http://notany.net/blog/index.php?entry=entry070221-233617</guid>
			<author>Jack</author>
			<pubDate>Wed, 21 Feb 2007 21:36:17 GMT</pubDate>
			<comments>http://notany.net/blog/comments.php?y=07&amp;m=02&amp;entry=entry070221-233617</comments>
		</item>
		<item>
			<title>WPA for Ubuntu</title>
			<link>http://notany.net/blog/index.php?entry=entry070218-005903</link>
			<description><![CDATA[It is a bit tricky (took me almost two days :), but basically this is the procedure:<br /><br /><b>- configure your wireless card</b><br />(using ndiswrapper is described in another article)<br />in case your wifi card is identified as wlan0 add the following to <i>/etc/network/interfaces</i><br /><code><br />auto wlan0<br />iface wlan0 inet dhcp<br />pre-up wpa_supplicant -Bw -Dwext -iwlan0 -c/etc/wpa_supplicant.conf<br />post-down killall -q wpa_supplicant<br /></code><br /><br /><b>- install and configure <i>wpasupplicant</i></b><br /><code># apt-get install wpasupplicant</code><br /><br />create <i>/etc/wpa_supplicant.conf</i> with simular content <br /><code><br />network={<br />  ssid=&quot;testwlan&quot;<br />  psk=&quot;7cHBV294H_something_long_and complicate&quot;<br />  scan_ssid=1<br />  key_mgmt=WPA-PSK<br />  proto=WPA<br />  pairwise=CCMP TKIP<br />  group=CCMP TKIP<br />}<br /></code><br /><br />This would automatically engage/shutdown wpasupplicant on up/down of the wlan0 interface.<br />Works nice for me :)]]></description>
			<category>Linux</category>
			<guid isPermaLink="true">http://notany.net/blog/index.php?entry=entry070218-005903</guid>
			<author>Jack</author>
			<pubDate>Sat, 17 Feb 2007 22:59:03 GMT</pubDate>
			<comments>http://notany.net/blog/comments.php?y=07&amp;m=02&amp;entry=entry070218-005903</comments>
		</item>
		<item>
			<title>Make BASH update your terminal window title after logon</title>
			<link>http://notany.net/blog/index.php?entry=entry070218-004821</link>
			<description><![CDATA[<b>~/.bash_profile</b><br /><br />This code would do the trick:<br /><br /><pre><br />if [ &quot;$TERM&quot; = &quot;xterm&quot; ] ; then<br />    export PROMPT_COMMAND=&#039;echo -ne &quot;\033]0;${USER}@${HOSTNAME}\007&quot;&#039;<br />else<br />    unset PROMPT_COMMAND<br />fi<br /></pre><br /><br />After logon the terminal title would be updated in the form &#039;jack@server&#039; and after logout the old value will be restored.]]></description>
			<category>Linux</category>
			<guid isPermaLink="true">http://notany.net/blog/index.php?entry=entry070218-004821</guid>
			<author>Jack</author>
			<pubDate>Sat, 17 Feb 2007 22:48:21 GMT</pubDate>
			<comments>http://notany.net/blog/comments.php?y=07&amp;m=02&amp;entry=entry070218-004821</comments>
		</item>
		<item>
			<title>FreeBSD rc.firewall fix for blacklisted ip support</title>
			<link>http://notany.net/blog/index.php?entry=entry070218-002731</link>
			<description><![CDATA[<b>/etc/rc.firewall</b><br /><br />Add this code at the end of the set_loopback function:<br /><br /><pre><br />        if [ -f &quot;${banned_ips}&quot; ]; then<br />                for i in `cat ${banned_ips} | grep -vE &quot;^#&quot;`; do<br />                        echo ${fwcmd} add deny ip from ${i} to me<br />                done<br />        fi<br /></pre><br /><br />This expects a variable banned_ips to be defined in rc.conf and to point to a file containing list (one per line) of blacklisted IPs/NETs in the form:<br /><br /><pre><br />192.168.1.0/24<br />10.2.2.2<br /># This is a comment<br /></pre><br /><br />Firewall rules would be up on the next reboot or after running /etc/netstart. <br /><br />This is more a way to preserve blocked IPs/NETs across the reboots.]]></description>
			<category>FreeBSD</category>
			<guid isPermaLink="true">http://notany.net/blog/index.php?entry=entry070218-002731</guid>
			<author>Jack</author>
			<pubDate>Sat, 17 Feb 2007 22:27:31 GMT</pubDate>
			<comments>http://notany.net/blog/comments.php?y=07&amp;m=02&amp;entry=entry070218-002731</comments>
		</item>
	</channel>
</rss>

