<?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>Saiweb &#187; Buzz</title>
	<atom:link href="http://www.saiweb.co.uk/author/admin/feed" rel="self" type="application/rss+xml" />
	<link>http://www.saiweb.co.uk</link>
	<description>Ramblings of a Sys admin</description>
	<lastBuildDate>Mon, 06 Feb 2012 14:57:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>RedHat mock your SCM</title>
		<link>http://www.saiweb.co.uk/linux/redhat-mock-your-scm</link>
		<comments>http://www.saiweb.co.uk/linux/redhat-mock-your-scm#comments</comments>
		<pubDate>Fri, 03 Feb 2012 16:33:19 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[enable-scm]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[mock]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[scientific linux]]></category>
		<category><![CDATA[scm-option]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1169</guid>
		<description><![CDATA[The mock tool can be a wonderful thing, allowing you to produce rpm packages for any rpm based system (assuming your have the written .cfg for it). What I did find a little lacking on the documentation side was the SCM integration (read: Source Control Management), git/svn etc &#8230; In short so long as your [...]]]></description>
			<content:encoded><![CDATA[<p>The mock tool can be a wonderful thing, allowing you to produce rpm packages for any rpm based system (assuming your have the written .cfg for it).</p>
<p>What I did find a little lacking on the documentation side was the SCM integration (read: Source Control Management), git/svn etc &#8230;</p>
<p>In short so long as your rpm spec file is in your SCM (and it should be), moc will build your rpm from your sources in scm, which can be used for.</p>
<p>1. bleeding edge builds for testing<br />
2. builds from &#8220;stable tags&#8221;</p>
<p>Yes yes yes &#8230; obvious I know &#8230;</p>
<p>So with no futher ado here is the syntax:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mock -r your_target --scm-enable --scm-option method=git --scm-option package=git_project --scm-option git_get='git clone git@git_ip_address:SCM_PKG.git SCM_PKG' --scm-option spec='SCM_PKG.spec' --scm-option branch=1-2 --scm-option write_tar=True -v</div></td></tr></tbody></table></div>
<ol>
<li>scm-enable &#8211; turns on the use of scm</li>
<li>scm-option &#8211; set an option for the scm in use</li>
</ol>
<p>The above worked for me, you will need to adjust it acordingly, i.e. if your spec file is not named identically to that of your git project: &#8211;scm-option spec=&#8217;specfile_name.spec&#8217;</p>
<p>This will tie me over untill I get chance to play with my <a href="https://github.com/rackspace/monkeyfarm">monkey farm</a><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/linux/redhat-mock-your-scm" data-text="RedHat mock your SCM" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Flinux%2Fredhat-mock-your-scm&#038;text=RedHat%20mock%20your%20SCM" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/redhat-mock-your-scm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gluster resolving a split brain in a replicated setup</title>
		<link>http://www.saiweb.co.uk/linux/gluster-resolving-a-split-brain-in-a-replicated-setup</link>
		<comments>http://www.saiweb.co.uk/linux/gluster-resolving-a-split-brain-in-a-replicated-setup#comments</comments>
		<pubDate>Tue, 20 Dec 2011 12:29:08 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[brain]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[gluster]]></category>
		<category><![CDATA[split]]></category>
		<category><![CDATA[split-brain]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1160</guid>
		<description><![CDATA[Initially this took about ~7hours to diagnose and fix, with what I have learned about the inner workings of gluster and the tools I am providing opensource this should cut resolution time down to ~5minutes. Firs you must meet the following conditions: You are running gluster >= 3.0]]></description>
			<content:encoded><![CDATA[<p>Initially this took about ~7hours to diagnose and fix, with what I have learned about the inner workings of gluster and the tools I am providing opensource this should cut resolution time down to ~5minutes.</p>
<p>Firs you must meet the following conditions:</p>
<ol>
<li>You are running gluster >= 3.0 <= 3.2 (May also work on 2.x I have not tested, and will not work with future versions if gluster change their use of xattrs)</li>
<li>You are running a replicated volume (Again I have not tested distributed volumes, in theory remove, re-add and rebalance will fix these) </li>
<li>You have a &#8220;good&#8221; copy of you data (This is essential this assume you have at least 1 brick with a good copy of the file system</li>
</ol>
<p><strong>Restrain and restore the &#8220;bad&#8221; brick</strong></p>
<ol>
<li>Shutdown all services that are using the mounted filesystem (i.e. httpd / nginx / *ftpd)</li>
<li>Unmount all the file systems on the node (glusterfs / nfs / etc &#8230;)</li>
<li>Grab a copy of <a href="https://github.com/Oneiroi/sysadmin/tree/master/gluster">stripxattr.py</a> make sure you READ the README for installation requirements and usage</li>
<li>Run stripxattr.py against the backing filesystem on the &#8220;bad&#8221; node ONLY <strong>NOT AGAINST A GLUSTER MOUNT</strong></li>
<li>From the &#8220;good&#8221; node, not rsync the data: rsync -gioprtv &#8211;progress /path/to/filesystem root@<bad_node>:/path/to</li>
<li>From the &#8220;good&#8221; node, trigger an &#8220;<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Storage_Software_Appliance/3.2/html/User_Guide/sect-User_Guide-Managing_Volumes-Self_heal.html">auto heal</a>&#8221; this will re-populate the xattr data (this must be done on a glusterfs mount not nfs/cifs/etc&#8230;)</li>
<li>Download <a href="https://github.com/Oneiroi/sysadmin/tree/master/gluster">listxattr.py</a> once the self heal has completed see the README file for a &#8220;quick and dirty&#8221; consistency check</li>
<li>All being well you have now resolved a split-brain and can return your node to service</li>
</ol>
<p><strong>Current known gluster issues</strong></p>
<ol>
<li>NFS is much (48x in tests) faster for small files i.e. php webapps, but does not support distributed locking meaning: all nodes can write to the same file at the same time, this is what cause our original split brain</li>
</ol>
<p>So what is the resolution int his case? </p>
<p>Selective use, use glusterfs for filesystems that you need distributed locking, often in large production deploys php files will not change often, in this case NFS is perfect.</p>
<p>If you are still writing php sessions to a file system then <a href="http://www.saiweb.co.uk/php/high-availability-joomla-wordpress-load-balance-persistant-php-database-sessions">STOP IT</a> and use a database! (Better yet use memcache).</p>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/linux/gluster-resolving-a-split-brain-in-a-replicated-setup" data-text="Gluster resolving a split brain in a replicated setup" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Flinux%2Fgluster-resolving-a-split-brain-in-a-replicated-setup&#038;text=Gluster%20resolving%20a%20split%20brain%20in%20a%20replicated%20setup" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/gluster-resolving-a-split-brain-in-a-replicated-setup/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>An update. I know I haven&#8217;t been updating&#8230;</title>
		<link>http://www.saiweb.co.uk/googleplus/an-update-i-know-i-havent-been-updating</link>
		<comments>http://www.saiweb.co.uk/googleplus/an-update-i-know-i-havent-been-updating#comments</comments>
		<pubDate>Sun, 13 Nov 2011 13:53:37 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[via Google+]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1156</guid>
		<description><![CDATA[I know I haven&#8217;t been updating a lot lately, esp on my poor blog (http://saiweb.co.uk), still I think I have things tied together enough to allow me to update once to everywhere (this post should appear on my blog, twitter, facebook, linkedin etc. There&#8217;s been a lot developing over the last few months, Openstack being one of [...]]]></description>
			<content:encoded><![CDATA[<p>I know I haven&#8217;t been updating a lot lately, esp on my poor blog (<a href="http://saiweb.co.uk/">http://saiweb.co.uk</a>), still I think I have things tied together enough to allow me to update once to everywhere (this post <em>should</em> appear on my blog, twitter, facebook, linkedin etc.</p>
<p>There&#8217;s been a lot developing over the last few months, Openstack being one of my main focuses along with overhauling and provision new internal systems for Openstack to run upon, I have a plan so to speak &#8230;</p>
<p>I have some Openstack posts coming I just need to ensure that all parties are happy with me posting the information &#8220;in the clear&#8221; so to speak.<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/googleplus/an-update-i-know-i-havent-been-updating" data-text="An update. I know I haven&#8217;t been updating&#8230;" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fgoogleplus%2Fan-update-i-know-i-havent-been-updating&#038;text=An%20update.%20I%20know%20I%20haven%26%238217%3Bt%20been%20updating%26%238230%3B" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/googleplus/an-update-i-know-i-havent-been-updating/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pivoting ssh reverse tunnel gateway</title>
		<link>http://www.saiweb.co.uk/linux/pivoting-ssh-reverse-tunnel-gateway</link>
		<comments>http://www.saiweb.co.uk/linux/pivoting-ssh-reverse-tunnel-gateway#comments</comments>
		<pubDate>Thu, 06 Oct 2011 14:43:02 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[epic]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[pivot]]></category>
		<category><![CDATA[reverse]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tunnel]]></category>
		<category><![CDATA[win]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1137</guid>
		<description><![CDATA[They say necessity is the mother of invention, if this is true then surely the mother of all fuck ups is shoddy customer service, say an isp that will randomly shut down a port because it has high bandwidth usage without asking the customer about it first, and flat out refusing to do anything for [...]]]></description>
			<content:encoded><![CDATA[<p>They say necessity is the mother of invention, if this is true then surely the mother of all fuck ups is shoddy customer service, say an isp that will randomly shut down a port because it has high bandwidth usage without asking the customer about it first, and flat out refusing to do anything for 24hrs &#8230;</p>
<p>In one of the worst customer service experiences I&#8217;ve ever had the miss fortune to have been a part of all access was closed to our in office version control systems due to &#8220;high usage&#8221;, now this is a pretty essential service as you might imagine, how then to restore access, when the restrictions are beyond your control? (And I mean EVERY inbound port was dead &#8230;)</p>
<p>Fortunately it would seem outbound SSH was not affected, so after much vocal drawing and re-drawing many times over on the whiteboard I had a cunning plan &#8230;</p>
<p>Using 3 linux devices I would create the following.</p>
<p>1. A device through which using host entries / dns changes the version control would be available whilst not actually running on the box itself.</p>
<p>2. An in house device which would be the device on which the tunnels are created in the first place.</p>
<p>3. The device(s) on which the version control systems reside.</p>
<p><strong>Gateway device</strong></p>
<p>On the gateway device sshd_config needs to be updated with:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">GatewayPorts yes</div></td></tr></tbody></table></div>
<p>And sshd reloaded.</p>
<p>Also if you are using a local firewall (i.e. iptables) you will need to setup the appropriate rules as if the service were running natively on the device</p>
<p><strong>Pivot Device</strong></p>
<p>Generate rsa ssh keys and deploy your id_rsa.pub to the gateway device, (update sshd_config to enable RSA Auth if required)</p>
<p>The tunnel.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ssh &lt;Gateway Device&gt; -l root -g -N -R 0.0.0.0:&lt;Service Port&gt;:10.0.0.1:&lt;Service Port&gt; &nbsp;-vvv</div></td></tr></tbody></table></div>
<p>Now you only really need to use root if the port you need to gateway is a  privileged port (<1024).</p>
<p>Here 10.0.0.1 is the internal address of the device the connection should "pivot" onto.</p>
<p>Once the tunnel was in place the services could be reached via the gateway device, this was essentially a "poor mans" NAT in a time of need, I really do not suggest this for long term use.</p>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/linux/pivoting-ssh-reverse-tunnel-gateway" data-text="Pivoting ssh reverse tunnel gateway" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Flinux%2Fpivoting-ssh-reverse-tunnel-gateway&#038;text=Pivoting%20ssh%20reverse%20tunnel%20gateway" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/pivoting-ssh-reverse-tunnel-gateway/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux collection of handy scripts and one liners – Volume 2 (Warning: contains shortcuts)</title>
		<link>http://www.saiweb.co.uk/linux/linux-collection-of-handy-scripts-and-one-liners-%e2%80%93-volume-2-warning-contains-shortcuts</link>
		<comments>http://www.saiweb.co.uk/linux/linux-collection-of-handy-scripts-and-one-liners-%e2%80%93-volume-2-warning-contains-shortcuts#comments</comments>
		<pubDate>Mon, 26 Sep 2011 15:43:34 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[lhol]]></category>
		<category><![CDATA[liners]]></category>
		<category><![CDATA[one]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1129</guid>
		<description><![CDATA[See if hosts are up using ping in range 60 -> 200 12345for i in {60..200}; do ping -c 1 -W 1 192.168.1.$i &#62; /dev/null; ([[ $? == 0 ]] &#38;&#38; echo &#34;$i UP&#34; &#124;&#124; echo &#34;$i DOWN&#34;); &#160;done 1 UP 2 DOWN 3 UP ... Note: for OSX use &#8220;ping -c 1 -t 1&#8243; [...]]]></description>
			<content:encoded><![CDATA[<p><strong>See if hosts are up using ping in range 60 -> 200</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">for i in {60..200}; do ping -c 1 -W 1 192.168.1.$i &gt; /dev/null; ([[ $? == 0 ]] &amp;&amp; echo &quot;$i UP&quot; || echo &quot;$i DOWN&quot;); &nbsp;done<br />
1 UP<br />
2 DOWN<br />
3 UP<br />
...</div></td></tr></tbody></table></div>
<p>Note: for OSX use &#8220;ping -c 1 -t 1&#8243;</p>
<p><strong>Chaining &#8220;UP&#8221; hosts for a quick (syn) port scan</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">for i in {60..200}; do ping -c 1 -W 1 192.168.1.$i &gt; /dev/null; ({{ $? == 0 ]] &amp;&amp; nc -v -n -z -w1 192.168.1.$i 20-22); done<br />
(UNKNOWN) [192.168.1.1] 22 (ssh) open<br />
(UNKNOWN) [192.168.1.3] 22 (ssh) open</div></td></tr></tbody></table></div>
<p><strong>Recover from a bad mysql password set (Update mysql.users set password=&#8217;Iforgotawherestatemenlulz&#8217;)</strong></p>
<p>Assumes for every user there is an @localhost host, grabs the in memory password hash and resets</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysql -Bse 'Select distinct(user) from mysql.user;' | while read uname; do mysql -Bse &quot;show grants for '$uname'@'localhost';&quot; 2&gt;&amp;1 | grep IDENTIFIED | grep -v 'root' | grep -v 'ERROR' | sed 's|GRANT USAGE ON *.* TO ||g' | sed &quot;s|@'localhost' IDENTIFIED BY PASSWORD||g&quot; | awk '{print &quot;Update user set Password=&quot;$2&quot; where User=&quot;$1&quot;;&quot;}' | mysql mysql; done</div></td></tr></tbody></table></div>
<p>If you&#8217;ve run FLUSH PRIVILEGES; however you == b0ned.</p>
<p><strong>Quick substitute and run</strong></p>
<p>Command1:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ping -c 1 -t 1 192.168.1.1</div></td></tr></tbody></table></div>
<p>Opps that&#8217;s OSX synatx </p>
<p>Command2:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">^-t 1^-W 1</div></td></tr></tbody></table></div>
<p>et voila corrected syntax.</p>
<p><strong>Shortcuts</strong></p>
<p>!! &#8211; Execute last command<br />
!ping &#8211; Execute last ping command, can be used to !any command just be careful.<br />
ctrl+r &#8211; reverse search, just start typing the cmd for it to search your history, hit tab to complete<br />
ctrl+a &#8211; jump to beginning of line<br />
ctrl+e &#8211; jump to end of the line</p>
<p><strong>cURL FU</strong></p>
<p>curl -I -L blahblah.tld &#8211; Run a HEAD and follow redirects (very handy for quicklooking @ bit.ly short URLS before hitting them in a browser).</p>
<p><strong>python FU</strong></p>
<p>python -m SimpleHTTPServer &#8211; serves the current `pwd` as a browseable directory (Very cool but VERY insecure)<br />
python -m cProfile script.py &#8211; generate trace stats for a script execution (Very handy for finding excessive loops)</p>
<p><strong>DNS Fu</strong></p>
<p>Wikipedia over DNS:</p>
<p>host -t txt fu.wp.dg.cx</p>
<p>fu.wp.dg.cx descriptive text &#8220;Fu may refer to: Fu (Technology, especially computer related) (used as a suffix) &#8211; relating to a person &#8211; Possessing superior skills in an art\; relating to an artifact &#8211; representing an expression of high art. code-fu, Perl-fu, C-fu, etc, Fu (literature),&#8221; &#8221; a Chinese genre of rhymed prose, Fu (kana), a symbol in Japanese syllabaries, Fu County, in Shaanxi, China, Fu Foundation&#8230; http://a.vu/w:Fu&#8221;</p>
<p>Useful on _some_ public wifi connections if you just want to look something up quick (dns is not always re-written).</p>
<p>Get all MX servers for a domain:</p>
<p>dig google.co.uk MX</p>
<p>; <<>> DiG 9.6.0-APPLE-P2 <<>> google.co.uk MX<br />
;; global options: +cmd<br />
;; Got answer:<br />
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64165<br />
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 4, ADDITIONAL: 4</p>
<p>;; QUESTION SECTION:<br />
;google.co.uk.			IN	MX</p>
<p>;; ANSWER SECTION:<br />
google.co.uk.		10800	IN	MX	10 google.com.s9a1.psmtp.com.<br />
google.co.uk.		10800	IN	MX	10 google.com.s9a2.psmtp.com.<br />
google.co.uk.		10800	IN	MX	10 google.com.s9b1.psmtp.com.<br />
google.co.uk.		10800	IN	MX	10 google.com.s9b2.psmtp.com.</p>
<p>;; AUTHORITY SECTION:<br />
google.co.uk.		59925	IN	NS	ns2.google.com.<br />
google.co.uk.		59925	IN	NS	ns3.google.com.<br />
google.co.uk.		59925	IN	NS	ns4.google.com.<br />
google.co.uk.		59925	IN	NS	ns1.google.com.</p>
<p>;; ADDITIONAL SECTION:<br />
ns1.google.com.		158334	IN	A	216.239.32.10<br />
ns2.google.com.		158334	IN	A	216.239.34.10<br />
ns3.google.com.		158741	IN	A	216.239.36.10<br />
ns4.google.com.		158334	IN	A	216.239.38.10</p>
<p>;; Query time: 68 msec<br />
;; SERVER:<br />
;; WHEN: Mon Sep 26 16:41:26 2011<br />
;; MSG SIZE  rcvd: 310</p>
<p><strong>mySQL FU</strong></p>
<p>in one line, take a database, in stream replace content and stream into another db.</p>
<p>mysqldump original_db | sed &#8216;s/content_or_regex_to_replace/content_or_backref_replacement/g&#8217; | mysql destination_db<br />
<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/linux/linux-collection-of-handy-scripts-and-one-liners-%e2%80%93-volume-2-warning-contains-shortcuts" data-text="Linux collection of handy scripts and one liners – Volume 2 (Warning: contains shortcuts)" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Flinux%2Flinux-collection-of-handy-scripts-and-one-liners-%25e2%2580%2593-volume-2-warning-contains-shortcuts&#038;text=Linux%20collection%20of%20handy%20scripts%20and%20one%20liners%20%E2%80%93%20Volume%202%20%28Warning%3A%20contains%20shortcuts%29" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/linux-collection-of-handy-scripts-and-one-liners-%e2%80%93-volume-2-warning-contains-shortcuts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WiFi recon using OSX native tools</title>
		<link>http://www.saiweb.co.uk/hacking/wifi-recon-using-osx-native-tools</link>
		<comments>http://www.saiweb.co.uk/hacking/wifi-recon-using-osx-native-tools#comments</comments>
		<pubDate>Fri, 23 Sep 2011 10:13:12 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[airport]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[pcap]]></category>
		<category><![CDATA[pentesting]]></category>
		<category><![CDATA[wifi]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1122</guid>
		<description><![CDATA[So you wanted to get your aircrak suite on under OSX, getting airodump etc to work I can tell you will be a nightmare (infact just dont use a VM with a USB wifi for that, however there is an alternative &#8230;), after a lot of searching there is a native tool under OSX that [...]]]></description>
			<content:encoded><![CDATA[<p>So you wanted to get your aircrak suite on under OSX, getting airodump etc to work I can tell you will be a nightmare (infact just dont use a VM with a USB wifi for that, however there is an alternative &#8230;), after a lot of searching there is a native tool under OSX that will let you cap packets, list networks etc.</p>
<p>Credit goes to <a href="http://forum.aircrack-ng.org/index.php?topic=293.msg34031#msg34031">d3in0s</a> for his awesome forum post.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br />106<br />107<br />108<br />109<br />110<br />111<br />112<br />113<br />114<br />115<br />116<br />117<br />118<br />119<br />120<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport<br />
Usage: airport &lt;interface&gt; &lt;verb&gt; &lt;options&gt;<br />
<br />
&nbsp; &nbsp; &lt;interface&gt;<br />
&nbsp; &nbsp; If an interface is not specified, airport will use the first AirPort interface on the system.<br />
<br />
&nbsp; &nbsp; &lt;verb is one of the following:<br />
&nbsp; &nbsp; prefs &nbsp; If specified with no key value pairs, displays a subset of AirPort preferences for<br />
&nbsp; &nbsp; &nbsp; &nbsp; the specified interface.<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Preferences may be configured using key=value syntax. Keys and possible values are specified below.<br />
&nbsp; &nbsp; &nbsp; &nbsp; Boolean settings may be configured using 'YES' and 'NO'.<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; DisconnectOnLogout (Boolean)<br />
&nbsp; &nbsp; &nbsp; &nbsp; JoinMode (String)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Automatic<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Preferred<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Ranked<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Recent<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Strongest<br />
&nbsp; &nbsp; &nbsp; &nbsp; JoinModeFallback (String)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Prompt<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JoinOpen<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KeepLooking<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DoNothing<br />
&nbsp; &nbsp; &nbsp; &nbsp; RememberRecentNetworks (Boolean)<br />
&nbsp; &nbsp; &nbsp; &nbsp; RequireAdmin (Boolean)<br />
&nbsp; &nbsp; &nbsp; &nbsp; RequireAdminIBSS (Boolean)<br />
&nbsp; &nbsp; &nbsp; &nbsp; RequireAdminNetworkChange (Boolean)<br />
&nbsp; &nbsp; &nbsp; &nbsp; RequireAdminPowerToggle (Boolean)<br />
&nbsp; &nbsp; &nbsp; &nbsp; WoWEnabled (Boolean)<br />
<br />
&nbsp; &nbsp; logger&nbsp; Monitor the driver's logging facility.<br />
<br />
&nbsp; &nbsp; sniff &nbsp; If a channel number is specified, airportd will attempt to configure the interface<br />
&nbsp; &nbsp; &nbsp; &nbsp; to use that channel before it begins sniffing 802.11 frames. Captures files are saved to /tmp.<br />
&nbsp; &nbsp; &nbsp; &nbsp; Requires super user privileges.<br />
<br />
&nbsp; &nbsp; debug &nbsp; Enable debug logging. A debug log setting may be enabled by prefixing it with a '+', and disabled<br />
&nbsp; &nbsp; &nbsp; &nbsp; by prefixing it with a '-'.<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; AirPort Userland Debug Flags<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DriverDiscovery<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DriverEvent<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Info<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SystemConfiguration<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UserEvent<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PreferredNetworks<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AutoJoin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IPC<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scan<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 802.1x<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assoc<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Keychain<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RSNAuth<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WoW<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AllUserland - Enable/Disable all userland debug flags<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; AirPort Driver Common Flags<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DriverInfo<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DriverError<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DriverWPA<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DriverScan<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AllDriver - Enable/Disable all driver debug flags<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; AirPort Driver Vendor Flags<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VendorAssoc<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VendorConnection<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AllVendor - Enable/Disable all vendor debug flags<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; AirPort Global Flags<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LogFile - Save all AirPort logs to /var/log/airport.log<br />
<br />
&lt;options&gt; is one of the following:<br />
&nbsp; &nbsp; No options currently defined.<br />
<br />
Examples:<br />
<br />
Configuring preferences (requires admin privileges)<br />
&nbsp; &nbsp; sudo airport en1 prefs JoinMode=Preferred RememberRecentNetworks=NO RequireAdmin=YES<br />
<br />
Sniffing on channel 1:<br />
&nbsp; &nbsp; airport en1 sniff 1<br />
<br />
<br />
LEGACY COMMANDS:<br />
Supported arguments:<br />
&nbsp;-c[&lt;arg&gt;] --channel=[&lt;arg&gt;] &nbsp; &nbsp;Set arbitrary channel on the card<br />
&nbsp;-z &nbsp; &nbsp; &nbsp; &nbsp;--disassociate &nbsp; &nbsp; &nbsp; Disassociate from any network<br />
&nbsp;-I &nbsp; &nbsp; &nbsp; &nbsp;--getinfo &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print current wireless status, e.g. signal info, BSSID, port type etc.<br />
&nbsp;-s[&lt;arg&gt;] --scan=[&lt;arg&gt;] &nbsp; &nbsp; &nbsp; Perform a wireless broadcast scan.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Will perform a directed scan if the optional &lt;arg&gt; is provided<br />
&nbsp;-x &nbsp; &nbsp; &nbsp; &nbsp;--xml &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print info as XML<br />
&nbsp;-P &nbsp; &nbsp; &nbsp; &nbsp;--psk &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Create PSK from specified pass phrase and SSID.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;The following additional arguments must be specified with this command:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --password=&lt;arg&gt; &nbsp;Specify a WPA password<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --ssid=&lt;arg&gt; &nbsp; &nbsp; &nbsp;Specify SSID when creating a PSK<br />
&nbsp;-h &nbsp; &nbsp; &nbsp; &nbsp;--help &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Show this help<br />
Credit goes to &lt;a href=&quot;http://forum.aircrack-ng.org/index.php?PHPSESSID=osr5e11icl40hib1f57qkh0u35&amp;topic=293.msg34031#msg34031&quot;&gt;d3in0s post&lt;/a&gt; showing true forum awesomeness. <br />
<br />
&lt;code&gt;<br />
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I<br />
&nbsp; &nbsp; &nbsp;agrCtlRSSI: -40<br />
&nbsp; &nbsp; &nbsp;agrExtRSSI: 0<br />
&nbsp; &nbsp; agrCtlNoise: -92<br />
&nbsp; &nbsp; agrExtNoise: 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; state: running<br />
&nbsp; &nbsp; &nbsp; &nbsp; op mode: station <br />
&nbsp; &nbsp; &nbsp;lastTxRate: 54<br />
&nbsp; &nbsp; &nbsp; &nbsp; maxRate: 54<br />
lastAssocStatus: 0<br />
&nbsp; &nbsp; 802.11 auth: open<br />
&nbsp; &nbsp; &nbsp; link auth: wpa2-psk<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BSSID: &lt;removed&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SSID: &lt;removed&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MCS: -1<br />
&nbsp; &nbsp; &nbsp; &nbsp; channel: 6<br />
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SSID BSSID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RSSI CHANNEL HT CC SECURITY (auth/unicast/group)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;removed&gt; &lt;removed&gt; -41 &nbsp;6 &nbsp; &nbsp; &nbsp; N &nbsp;-- WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)</div></td></tr></tbody></table></div>
<p>Doing a frame cap.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport en1 sniff 6<br />
Capturing 802.11 frames on en1.</div></td></tr></tbody></table></div>
<p>You will see your airport icon changes to <a href="http://cdn.saiweb.co.uk/wp-content/uploads/2011/09/Screen-shot-2011-09-23-at-11.20.28.png"><img src="http://cdn.saiweb.co.uk/wp-content/uploads/2011/09/Screen-shot-2011-09-23-at-11.20.28.png" alt="" title="Screen shot 2011-09-23 at 11.20.28" width="45" height="24" class="aligncenter size-full wp-image-1126" /></a> now hit ctrl+c to stop the cap</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">^CSession saved to /tmp/airportSniff813ZrA.cap.</div></td></tr></tbody></table></div>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/hacking/wifi-recon-using-osx-native-tools" data-text="WiFi recon using OSX native tools" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fhacking%2Fwifi-recon-using-osx-native-tools&#038;text=WiFi%20recon%20using%20OSX%20native%20tools" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/hacking/wifi-recon-using-osx-native-tools/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>easy_install for python 3</title>
		<link>http://www.saiweb.co.uk/python/easy_install-for-python-3</link>
		<comments>http://www.saiweb.co.uk/python/easy_install-for-python-3#comments</comments>
		<pubDate>Mon, 19 Sep 2011 20:47:05 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[easy_install]]></category>
		<category><![CDATA[python3]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1120</guid>
		<description><![CDATA[easy_install for python3 simple 12curl -O http://python-distribute.org/distribute_setup.py python3 distribute_setup.py Enjoy!Tweet]]></description>
			<content:encoded><![CDATA[<p>easy_install for python3 simple</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">curl -O http://python-distribute.org/distribute_setup.py<br />
python3 distribute_setup.py</div></td></tr></tbody></table></div>
<p>Enjoy!<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/python/easy_install-for-python-3" data-text="easy_install for python 3" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fpython%2Feasy_install-for-python-3&#038;text=easy_install%20for%20python%203" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/python/easy_install-for-python-3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php mail() &#8211; Making it not suck using sendmail</title>
		<link>http://www.saiweb.co.uk/linux/php-mail-making-it-not-suck-using-sendmail</link>
		<comments>http://www.saiweb.co.uk/linux/php-mail-making-it-not-suck-using-sendmail#comments</comments>
		<pubDate>Sun, 18 Sep 2011 12:22:46 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[sendmail]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1118</guid>
		<description><![CDATA[Ok ok &#8230; as some of the people work with are aware, I did this months ago fro one project, ment to blog and document it then in fact I have a draft post last modified 06/05/2011 covering full spam score reduction, and half finished instructions on setting up a mail relay &#8230; so in [...]]]></description>
			<content:encoded><![CDATA[<p>Ok ok &#8230; as some of the people work with are aware, I did this months ago fro one project, ment to blog and document it then in fact I have a draft post last modified 06/05/2011 covering full spam score reduction, and half finished instructions on setting up a mail relay &#8230; so in the interim of finishing that post I&#8217;m going to cover improving user experience through proper php configuration.</p>
<p>Out of the box, php will use sendmail, and it will do so as follows.</p>
<ol>
<li>mail() forks sendmail process</li>
<li>sendmail attempts to send email to destination server</li>
<li>sendmail returns on send complete</li>
</ol>
<div>Generally this isn&#8217;t a problem but what if at point 2. there is an issue with the destination MTA ? well in that case php will infact sit around waiting fot sendmail to complete, leaving your user with a hung screen / hung ajax call.</div>
<div>So what to do?</div>
<div>Simply put you want to offset the sending email process you do not want the end user sat around waiting for sendmail to finish sending the email, but you do want the email to send &#8230; decisions &#8230; decisions.</div>
<div>So edit yout php.ini .</div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sendmail_path = /usr/sbin/sendmail -t -i -O DeliveryMode=b</div></td></tr></tbody></table></div>
<p>This sets the delivery mode to background, sendmail will return to php near instantly and send the email in the background by placing in into a queue.</p>
<p>TL;DR</p>
<p>Put the above in your php.ini to not hang around to sendmail, and hav it return instantly.<br />
<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/linux/php-mail-making-it-not-suck-using-sendmail" data-text="php mail() &#8211; Making it not suck using sendmail" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Flinux%2Fphp-mail-making-it-not-suck-using-sendmail&#038;text=php%20mail%28%29%20%26%238211%3B%20Making%20it%20not%20suck%20using%20sendmail" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/php-mail-making-it-not-suck-using-sendmail/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PenTesting &#8211; mySQL password hash generation and lookup</title>
		<link>http://www.saiweb.co.uk/security/pentesting-mysql-password-hash-generation-and-lookup</link>
		<comments>http://www.saiweb.co.uk/security/pentesting-mysql-password-hash-generation-and-lookup#comments</comments>
		<pubDate>Wed, 17 Aug 2011 12:20:04 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[hashdump]]></category>
		<category><![CDATA[hashing]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[old_passwords]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1104</guid>
		<description><![CDATA[One of the worst things you can have in any secure system is a user with a simple password, no matter what steps you take to protect your data, if a privileged user is using a simple password, it&#8217;s akin to having a safe door that&#8217;s glass window. First off we need to take a [...]]]></description>
			<content:encoded><![CDATA[<p>One of the worst things you can have in any secure system is a user with a simple password, no matter what steps you take to protect your data, if a privileged user is using a simple password, it&#8217;s akin to having a safe door that&#8217;s glass window.</p>
<p>First off we need to take a hash dump:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysql -Bse 'select distinct(password),user from mysql.user;' &gt; hashdump.txt</div></td></tr></tbody></table></div>
<p>Now of course you can do the same using SQL Injection etc (WHY when you have SQLi already? duh privilege escalation!) , I&#8217;m going to cover this from the perspective that you are the administrator looking to strengthen your security &#8230;</p>
<p>Now you have your hashdump you need a hash table with the equivelent passwords within it, for this you will need 2 things</p>
<p>1. A dictionary file<br />
2. <a href="https://github.com/Oneiroi/PenTesting/blob/master/crypto/generators/mysql/csv_gen.py">https://github.com/Oneiroi/PenTesting/blob/master/crypto/generators/mysql/csv_gen.py</a></p>
<p>The python script above I wrote to use multiprocessing to map words onto the hash function, and I have had it grind through mySQL hashes at a rate of ~98k per second, there is no &#8220;lookup&#8221; script at this time though one is currently being written.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">./csv_gen.py -f /path/to/wordlist.txt -o /output/path/to/output.csv -t &lt;max threads, default 1&gt; [-l optional use legacy hash]</div></td></tr></tbody></table></div>
<p>once this has ground through your wordlist you will have a CSV file, which will be in the format <hash>,
<password>
the script defaults to the new PASSWORD() function, if you are using old_password=1 in your configuration then pass the -l flag to use legacy hashing instead.</p>
<p>ok let&#8217;s assume the following fictional scenario </p>
<p>1. old_passwords is in use, and we want chip&#8217;s password<br />
2. 077b91e3491e2fdd	chip<br />
3.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">grep 077b91e3491e2fdd output.txt<br />
077b91e3491e2fdd,a</div></td></tr></tbody></table></div>
<p>4. Chip has a password that is just he letter &#8220;a&#8221; which he will tell you is the best password ever &#8230;</p>
<p>And that&#8217;s about a simple as it gets you generate a set of hashes and you compare known hashes to your generate set to see if you can discern simple passwords, hopefully going on then to chastise the user and instructing them on proper password etiquette, there are more complicated methods of getting the password from the hash, in the case of old_passwords I believe it is possible to reverse the hash to get the original string for one (so don&#8217;t use old_passwords!)</p>
<p>If you go on to use my python scripts, please let me know how they perform, my test were carried out using an intel i5, I&#8217;d love to know how they perform on other CPUs.</p>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/security/pentesting-mysql-password-hash-generation-and-lookup" data-text="PenTesting &#8211; mySQL password hash generation and lookup" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fsecurity%2Fpentesting-mysql-password-hash-generation-and-lookup&#038;text=PenTesting%20%26%238211%3B%20mySQL%20password%20hash%20generation%20and%20lookup" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/security/pentesting-mysql-password-hash-generation-and-lookup/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Boxgrinder &#8211; setting up a simple CentOS LAMP stack, and deploying it to KVM</title>
		<link>http://www.saiweb.co.uk/linux/boxgrinder-setting-up-a-simple-centos-lamp-stack-and-deploying-it-to-kvm</link>
		<comments>http://www.saiweb.co.uk/linux/boxgrinder-setting-up-a-simple-centos-lamp-stack-and-deploying-it-to-kvm#comments</comments>
		<pubDate>Tue, 16 Aug 2011 11:35:54 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[boxgrinder]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[SaaS]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1054</guid>
		<description><![CDATA[If you haven&#8217;t tried boxgrinder then you are missing out, it makes it extremely easy to script the generation of a virtual machine for output to Rackspace (Well not yet), ec2, vmware, virtualbox, KVM etc. In this post I will cover the basic generation of a LAMP (Linux Apache MySQL PHP) stack CentOS appliance, nothing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cdn.saiweb.co.uk/wp-content/uploads/2011/08/boxgrinder_logo_450px.gif"><img class="aligncenter size-full wp-image-1093" title="boxgrinder_logo_450px" src="http://cdn.saiweb.co.uk/wp-content/uploads/2011/08/boxgrinder_logo_450px.gif" alt="" width="450" height="110" /></a> If you haven&#8217;t tried <a href="http://boxgrinder.org">boxgrinder</a> then you are missing out, it makes it extremely easy to script the generation of a virtual machine for output to Rackspace (<a href="http://www.saiweb.co.uk/linux/boxgrinder-setting-up-a-simple-centos-lamp-stack-and-deploying-it-to-kvm/comment-page-1#comment-49065">Well not yet</a>), ec2, vmware, virtualbox, KVM etc.</p>
<p>In this post I will cover the basic generation of a LAMP (Linux Apache MySQL PHP) stack CentOS appliance, nothing to complicated I assure you, and no magic like auto deployment spin up etc &#8230; that&#8217;s for later &#8230; no skipping ahead!</p>
<p>First of all you&#8217;re going to need <a href="http://boxgrinder.org">boxgrinder</a> I recommend downloading the <a href="http://boxgrinder.org/download/boxgrinder-build-meta-appliance/">Meta appliance</a>, as it has all the tools you need already.</p>
<p>Now I am covering the following.</p>
<ol>
<li>basic use of boxgrinder-build on the meta appliance</li>
<li>creation of centos lampstack basic</li>
<li>deploying the image to KVM</li>
</ol>
<p>I&#8217;m going to have to assume that you are capable of downloading and starting up the meta appliance yourself, and focus more on the stack setup.</p>
<p><strong>Grinding your VM</strong></p>
<p>Ok so you are going to need a YAML file defining the CentOS lamp stack, save this on your meta appliance as <a href="https://github.com/Oneiroi/boxgrinder-appliances/blob/master/CentOS/CentOS-lamp.appl">CentOS-lamp.yaml</a></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">name: CentOS-lamp<br />
summary: Generic CentOS 5.6 LAMP stack, with some apache &amp;amp; php tuning<br />
version: 1<br />
release: 0<br />
hardware:<br />
cpus: 2<br />
memory: 1024<br />
partitions:<br />
&quot;/&quot;:<br />
size: 5<br />
&quot;/var/www&quot;:<br />
size: 15<br />
os:<br />
name: centos<br />
version: 5<br />
password: changeme</div></td></tr></tbody></table></div>
<p>On your <a href="http://boxgrinder.org/download/boxgrinder-build-meta-appliance/">Meta appliance</a> run.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">boxgrinder-build -d CentOS-lamp.appl</div></td></tr></tbody></table></div>
<p>This process will take a while, so go and get a coffee, this will produce ./build/appliances/x86_64/centos/5/CentOS-lamp/CentOS-lamp-sda.raw once complete, if you run into issues the -d flag is &#8220;debug&#8221; paste your log output int the comments and I will do my best to diagnose and fix your issue.</p>
<p><strong>Deploying to KVM</strong></p>
<p>boxgrinder has SFTP support for pushing to remote servers, you can use this if you like to automate the &#8220;push&#8221; of the image to your KVM server, at the moment automated deployment to KVM is not support but may be <a href="https://issues.jboss.org/browse/BGBUILD-211">coming soon</a>.</p>
<p>Assuming you have placed you image in /var/lib/libvirt/images/</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">virt-install -n &quot;Saiweb - CentOS-lamp Demo&quot; -r 1024 --arch=x86_64 --vcpus=1 --os-type=linux --os-variant=rhel5.4 --disk path=/var/lib/libvirt/images/CentOS-lamp.raw,size=20,cache=none,device=disk --accelerate --network=bridge:br0 --vnc --import</div></td></tr></tbody></table></div>
<p><strong>Post startup</strong></p>
<p>this is a VERY basic setup I have not covered any of the post install options in this post (but I will in future posts), so.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">chkconfig httpd on &amp;amp;&amp;amp; service httpd start<br />
chkconfig mysqld on &amp;amp;&amp;amp; service mysqld start</div></td></tr></tbody></table></div>
<p>This will set your services to automatically start at startup, and start them.<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/linux/boxgrinder-setting-up-a-simple-centos-lamp-stack-and-deploying-it-to-kvm" data-text="Boxgrinder &#8211; setting up a simple CentOS LAMP stack, and deploying it to KVM" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Flinux%2Fboxgrinder-setting-up-a-simple-centos-lamp-stack-and-deploying-it-to-kvm&#038;text=Boxgrinder%20%26%238211%3B%20setting%20up%20a%20simple%20CentOS%20LAMP%20stack%2C%20and%20deploying%20it%20to%20KVM" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/boxgrinder-setting-up-a-simple-centos-lamp-stack-and-deploying-it-to-kvm/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching 19/69 queries in 0.210 seconds using apc
Object Caching 1993/2157 objects using apc
Content Delivery Network via Rackspace Cloud Files: cdn.saiweb.co.uk

Served from: www.saiweb.co.uk @ 2012-02-08 15:43:01 -->
