<?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; python</title>
	<atom:link href="http://www.saiweb.co.uk/tag/python/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>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>Dissecting the hack &#8211; packed r57shell</title>
		<link>http://www.saiweb.co.uk/hacking/dissecting-the-hack-r57shell</link>
		<comments>http://www.saiweb.co.uk/hacking/dissecting-the-hack-r57shell#comments</comments>
		<pubDate>Wed, 26 May 2010 12:00:46 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[dissecting]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[r57]]></category>
		<category><![CDATA[r57shell]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=869</guid>
		<description><![CDATA[Before you read any further note, I will not be including the original hack file, simply due to peoples stupidity in putting this on a production environment to play with, if you use the code you do so at your own risk, and by reading this blog entry / using the code provided you agree [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;"><strong>Before you read any further note, I will not be including the original hack file, simply due to peoples stupidity in putting this on a production environment to play with, if you use the code you do so at your own risk, and by reading this blog entry / using the code provided you agree to accept all liability upon yourself for your own actions. Don&#8217;t be an idiot.</strong></span></p>
<p>Around 10 days ago I came across this seemingly innocuous little file.</p>
<p>What I am going to cover in this entry is dissecting the &#8216;payload&#8217; and not so much the web app in question or methods used to compromise it,</p>
<p>Whereas I will not at this time provide the original file, I will provide you with the md5 and sha1 hashes of the file so you can check it&#8217;s not lurking on your systems:</p>
<p>md5: 9ee3e6523d154114460d320477a8665a<br />
sha1: 9c64fecea5620d70a716bbd74f6e89612a4a79c7</p>
<p>The bit we are interested in is the last line of the file:</p>
<div class="codecolorer-container php 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="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/eval"><span style="color: #990000;">eval</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/gzinflate"><span style="color: #990000;">gzinflate</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/base64_decode"><span style="color: #990000;">base64_decode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DATA'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Were you to run this line you would get</p>
<div class="codecolorer-container php 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="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/eval"><span style="color: #990000;">eval</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/gzinflate"><span style="color: #990000;">gzinflate</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/base64_decode"><span style="color: #990000;">base64_decode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DATA2'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p><a href="http://cdn.saiweb.co.uk/wp-content/uploads/2010/05/sense-this-picture-makes-none.jpg"><img src="http://cdn.saiweb.co.uk/wp-content/uploads/2010/05/sense-this-picture-makes-none-240x300.jpg" alt="" title="sense-this-picture-makes-none" width="240" height="300" class="aligncenter size-medium wp-image-870" /></a></p>
<p>Confused yet? now I can appreciate the thinking behind packing a payload to avoid detection, but in this case the payload is packed 12 times, and no before you ask I did not manually run each returned statement to find this out. </p>
<p>Enter Python-Fu:</p>
<p><a href="http://cdn.saiweb.co.uk/wp-content/uploads/2010/05/getbritf.jpg"><img src="http://cdn.saiweb.co.uk/wp-content/uploads/2010/05/getbritf-236x300.jpg" alt="" title="getbritf" width="236" height="300" class="aligncenter size-medium wp-image-871" /></a></p>
<div class="codecolorer-container python 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 /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span><br />
<span style="color: #808080; font-style: italic;"># saiweb.co.uk payload unpack script 26/05/2010</span><br />
<span style="color: #808080; font-style: italic;"># copy the eval(gzinflate()) line to payload.raw, place in same directory as this file.</span><br />
<br />
<span style="color: #483d8b;">&quot;&quot;&quot;<br />
Copyright (C) 2010 Buzz saiweb.co.uk.co.uk<br />
<br />
&nbsp; &nbsp; This program is free software: you can redistribute it and/or modify<br />
&nbsp; &nbsp; it under the terms of the GNU General Public License as published by<br />
&nbsp; &nbsp; the Free Software Foundation, either version 3 of the License, or<br />
&nbsp; &nbsp; (at your option) any later version.<br />
<br />
&nbsp; &nbsp; This program is distributed in the hope that it will be useful,<br />
&nbsp; &nbsp; but WITHOUT ANY WARRANTY; without even the implied warranty of<br />
&nbsp; &nbsp; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &nbsp;See the<br />
&nbsp; &nbsp; GNU General Public License for more details.<br />
<br />
&nbsp; &nbsp; You should have received a copy of the GNU General Public License<br />
&nbsp; &nbsp; along with this program. &nbsp;If not, see &lt;http://www.gnu.org/licenses/&gt;.<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; Additional Terms as Per section 7<br />
<br />
&nbsp; &nbsp; Attribution:<br />
<br />
&nbsp; &nbsp; Redistribution/Reuse of this code is permitted under the GNU v3 license, as an additional term ALL code must carry the original Author(s) credit in comment form.<br />
&quot;&quot;&quot;</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">base64</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">zlib</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">re</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">sys</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Running ...'</span><br />
&nbsp; &nbsp; f <span style="color: #66cc66;">=</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'payload.raw'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; php <span style="color: #66cc66;">=</span> f.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; iteration <span style="color: #66cc66;">=</span> <span style="color: #ff4500;">0</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #dc143c;">re</span>.<span style="color: black;">search</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'eval<span style="color: #000099; font-weight: bold;">\(</span>gzinflate<span style="color: #000099; font-weight: bold;">\(</span>base64_decode<span style="color: #000099; font-weight: bold;">\(</span><span style="color: #000099; font-weight: bold;">\'</span>'</span><span style="color: #66cc66;">,</span>php<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; iteration +<span style="color: #66cc66;">=</span> <span style="color: #ff4500;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Iteration: %d'</span> % iteration<br />
&nbsp; &nbsp; &nbsp; &nbsp; raw <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">re</span>.<span style="color: black;">sub</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'eval<span style="color: #000099; font-weight: bold;">\(</span>gzinflate<span style="color: #000099; font-weight: bold;">\(</span>base64_decode<span style="color: #000099; font-weight: bold;">\(</span><span style="color: #000099; font-weight: bold;">\'</span>'</span><span style="color: #66cc66;">,</span><span style="color: #483d8b;">''</span><span style="color: #66cc66;">,</span>php<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; raw <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">re</span>.<span style="color: black;">sub</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\'</span><span style="color: #000099; font-weight: bold;">\)</span><span style="color: #000099; font-weight: bold;">\)</span><span style="color: #000099; font-weight: bold;">\)</span>;'</span><span style="color: #66cc66;">,</span><span style="color: #483d8b;">''</span><span style="color: #66cc66;">,</span>raw<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; gstring <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">base64</span>.<span style="color: black;">b64decode</span><span style="color: black;">&#40;</span>raw.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; php <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">zlib</span>.<span style="color: black;">decompressobj</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">decompress</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'x<span style="color: #000099; font-weight: bold;">\x</span>9c'</span> + gstring<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#print payload</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#sys.exit()</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> php<br />
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ <span style="color: #66cc66;">==</span> <span style="color: #483d8b;">'__main__'</span>:<br />
&nbsp; &nbsp; main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></td></tr></tbody></table></div>
<p>Copy the first payload lines into a file named payload.raw, take the above code and copy it into a file named dissect.py.</p>
<p>When dissect.py is run you will get the following output:</p>
<div class="codecolorer-container bash 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="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">python .<span style="color: #000000; font-weight: bold;">/</span>dissect.py<br />
Running ...<br />
Iteration: <span style="color: #000000;">1</span><br />
Iteration: <span style="color: #000000;">2</span><br />
Iteration: <span style="color: #000000;">3</span><br />
Iteration: <span style="color: #000000;">4</span><br />
Iteration: <span style="color: #000000;">5</span><br />
Iteration: <span style="color: #000000;">6</span><br />
Iteration: <span style="color: #000000;">7</span><br />
Iteration: <span style="color: #000000;">8</span><br />
Iteration: <span style="color: #000000;">9</span><br />
Iteration: <span style="color: #000000;">10</span><br />
Iteration: <span style="color: #000000;">11</span><br />
Iteration: <span style="color: #000000;">12</span><br />
<span style="color: #000000; font-weight: bold;">&lt;</span>?php<br />
...</div></td></tr></tbody></table></div>
<p>As such you may want to run it using the following command:</p>
<div class="codecolorer-container bash 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="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">python .<span style="color: #000000; font-weight: bold;">/</span>dissect.py <span style="color: #000000; font-weight: bold;">&gt;</span> r57.php</div></td></tr></tbody></table></div>
<p><a href="http://cdn.saiweb.co.uk/wp-content/uploads/2010/05/ggwit.jpg"><img src="http://cdn.saiweb.co.uk/wp-content/uploads/2010/05/ggwit-257x300.jpg" alt="" title="ggwit" width="257" height="300" class="aligncenter size-medium wp-image-872" /></a></p>
<p>And what you will find after unpacking 12 times in total, the &#8220;payload&#8221; is the r57shell, this script is an information gathering tool and pseudo shell, meaning it will run any command on the host server that php can, providing in most cases ssh esq access to the exploited host, allowing you to do pretty much anything you wanted at this point, some of the features also include /etc/passwd /etc/shadow dumping, aswell as searching for a tirade of common file *.sql* admin* etc, it&#8217;s a one stop script for information gathering on a LAMP/WAMP based host.</p>
<p><strong><br />
Defense: modify php.ini to disable eval(), exec, shell_exec and all none essential functions.<br />
</strong></p>
<p>And of course, ensure your web apps are patched and up to date as well as the host they are running on. </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/hacking/dissecting-the-hack-r57shell" data-text="Dissecting the hack &#8211; packed r57shell" 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%2Fdissecting-the-hack-r57shell&#038;text=Dissecting%20the%20hack%20%26%238211%3B%20packed%20r57shell" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/hacking/dissecting-the-hack-r57shell/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RedHat Cluster OID&#8217;s</title>
		<link>http://www.saiweb.co.uk/linux/redhat-cluster-oids</link>
		<comments>http://www.saiweb.co.uk/linux/redhat-cluster-oids#comments</comments>
		<pubDate>Wed, 03 Mar 2010 16:05:56 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[oid]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=836</guid>
		<description><![CDATA[Following on from the python bindings post I found myself with a real problem, the netsnmp bindings I could not for the life of me get to take the redhat cluste MIB files, so what did that leave me with, walking the entire parent cluster OID, manually matching the returned OID&#8217;s to their MIB names [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from the python bindings post I found myself with a real problem,</p>
<p>the netsnmp bindings I could not for the life of me get to take the redhat cluste MIB files, so what did that leave me with, walking the entire parent cluster OID, manually matching the returned OID&#8217;s to their MIB names based on the value returned as I couldn&#8217;t find a decent mib browser or script to convert them &#8230;</p>
<p>At any rate here is a subset of OID&#8217;s for polling the redhat cluster service using snmp, please note that are more OID&#8217;s but these vary on your cluster config.</p>
<p>Python code:</p>
<div class="codecolorer-container python 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 /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">rhc_oid <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'.1.3.6.1.4.1.2312.8'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; data_oids <span style="color: #66cc66;">=</span> <span style="color: black;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcMIBVersion'</span>:<span style="color: #483d8b;">'.1.1'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterName'</span>:<span style="color: #483d8b;">'.2.1'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterStatusCode'</span>:<span style="color: #483d8b;">'.2.2'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterStatusDesc'</span>:<span style="color: #483d8b;">'.2.3'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterVotesNeededForQuorum'</span>:<span style="color: #483d8b;">'.2.4'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterVotes'</span>:<span style="color: #483d8b;">'.2.5'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterQuorate'</span>:<span style="color: #483d8b;">'.2.6'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterNodesNum'</span>:<span style="color: #483d8b;">'.2.7'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterNodesNames'</span>:<span style="color: #483d8b;">'.2.8'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterAvailNodesNum'</span>:<span style="color: #483d8b;">'.2.9'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterAvailNodesNames'</span>:<span style="color: #483d8b;">'.2.10'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterUnavailNodesNum'</span>:<span style="color: #483d8b;">'.2.11'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterUnavailNodesNames'</span>:<span style="color: #483d8b;">'.2.12'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterServicesNum'</span>:<span style="color: #483d8b;">'.2.13'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterServicesNames'</span>:<span style="color: #483d8b;">'.2.14'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterRunningServicesNum'</span>:<span style="color: #483d8b;">'.2.15'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterRunningServicesNames'</span>:<span style="color: #483d8b;">'.2.16'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterStoppedServicesNum'</span>:<span style="color: #483d8b;">'.2.17'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterStoppedServicesNames'</span>:<span style="color: #483d8b;">'.2.18'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterFailedServicesNum'</span>:<span style="color: #483d8b;">'.2.19'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'rhcClusterFailedServicesNames'</span>:<span style="color: #483d8b;">'.2.20'</span><span style="color: black;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> item <span style="color: #ff7700;font-weight:bold;">in</span> data_oids:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oid <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'%s%s'</span> % <span style="color: black;">&#40;</span>rhc_oid<span style="color: #66cc66;">,</span>data_oids<span style="color: black;">&#91;</span>item<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> item<span style="color: #66cc66;">,</span>oid</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/linux/redhat-cluster-oids" data-text="RedHat Cluster OID&#8217;s" 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-cluster-oids&#038;text=RedHat%20Cluster%20OID%26%238217%3Bs" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/redhat-cluster-oids/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>net-snmp python bindings</title>
		<link>http://www.saiweb.co.uk/python/net-snmp-python-bindings</link>
		<comments>http://www.saiweb.co.uk/python/net-snmp-python-bindings#comments</comments>
		<pubDate>Wed, 03 Mar 2010 14:26:09 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[bindings]]></category>
		<category><![CDATA[net-snmp]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=833</guid>
		<description><![CDATA[UPDATE 28/06/10: added &#8211;libdir=/usr/lib64 &#8211;enable-shared otherwise shared libs are not built at all! Having spent a few hours trying to get this working on CentOS 5.4 x64 I am posting this blog entry for others to reference: Download and complie net-snmp >= 5.4.2.1 http://net-snmp.sourceforge.net/ 12345./configure --with-python-modules --libdir=/usr/lib64 --enable-shared make &#38;&#38; make install cd /path/to/net-snmp-src/python/ python [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE 28/06/10:</strong> added &#8211;libdir=/usr/lib64 &#8211;enable-shared otherwise shared libs are not built at all!</p>
<p>Having spent a few hours trying to get this working on CentOS 5.4 x64 I am posting this blog entry for others to reference:</p>
<p>Download and complie net-snmp >= 5.4.2.1 <a href="http://net-snmp.sourceforge.net/">http://net-snmp.sourceforge.net/</a></p>
<div class="codecolorer-container bash 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="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-python-modules</span> <span style="color: #660033;">--libdir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib64 <span style="color: #660033;">--enable-shared</span><br />
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span><br />
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>net-snmp-src<span style="color: #000000; font-weight: bold;">/</span>python<span style="color: #000000; font-weight: bold;">/</span><br />
python .<span style="color: #000000; font-weight: bold;">/</span>setup.py build<br />
python .<span style="color: #000000; font-weight: bold;">/</span>setup.py <span style="color: #7a0874; font-weight: bold;">test</span></div></td></tr></tbody></table></div>
<p>You may get ImportError: libnetsnmp.so.20, this is due to x64 build creating as /usr/lib64/libnetsnmp.so.10</p>
<div class="codecolorer-container bash 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="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libnetsnmp.so.10.0.3 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libnetsnmp.so.20<br />
python .<span style="color: #000000; font-weight: bold;">/</span>setup.py <span style="color: #c20cb9; font-weight: bold;">install</span></div></td></tr></tbody></table></div>
<p>And you are done, you can now use the netsnmp python bindings, I&#8217;d recomend seeing the examples here: <a href="http://www.ibm.com/developerworks/aix/library/au-netsnmpnipython/">http://www.ibm.com/developerworks/aix/library/au-netsnmpnipython/</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/python/net-snmp-python-bindings" data-text="net-snmp python bindings" 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%2Fnet-snmp-python-bindings&#038;text=net-snmp%20python%20bindings" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/python/net-snmp-python-bindings/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux – Generating file manifests and then checking them &#8211; Improved</title>
		<link>http://www.saiweb.co.uk/linux/linux-%e2%80%93-generating-file-manifests-and-then-checking-them-improved</link>
		<comments>http://www.saiweb.co.uk/linux/linux-%e2%80%93-generating-file-manifests-and-then-checking-them-improved#comments</comments>
		<pubDate>Tue, 29 Sep 2009 14:14:06 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[indication]]></category>
		<category><![CDATA[indicator]]></category>
		<category><![CDATA[manifest]]></category>
		<category><![CDATA[md5]]></category>
		<category><![CDATA[progress]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=788</guid>
		<description><![CDATA[Following on from Linux – Generating file manifests and then checking them I was always getting the same questions &#8230; How long left on the manifest Buzz ? How long left on the verification Buzz ? And I HATE having to turn around an say &#8230; I don&#8217;t know &#8230; The problem with the usual [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from <a href="http://www.saiweb.co.uk/linux/linux-generating-file-manifests-and-then-checking-them">Linux – Generating file manifests and then checking them</a> I was always getting the same questions &#8230;</p>
<p>How long left on the manifest Buzz ?<br />
How long left on the verification Buzz ?</p>
<p>And I <strong>HATE</strong> having to turn around an say &#8230; I don&#8217;t know &#8230;</p>
<p>The problem with the usual command line method is that it give no indication of progress, and by extension no indication that it was infact running and not &#8216;hung&#8217; &#8230;</p>
<p>As such I have now added the &#8216;manifest&#8217; command set to the <a href="http://www.saiweb.co.uk/sysadmin">Sysadmin toolset</a></p>
<p>The manifest command take two data types, the first is a folder path from which to build the file manifest from, the manifest itself is also compatible with the &#8220;md5sum &#8211;check&#8221; function.</p>
<p><div id="saiweb_6547f576a81738c46813e6e7386eb9f9" style="width:900px; height:300px;"></div><script language="Javascript" type="text/javascript">
	WPFP(document).ready(function() {
		//load player
		$f("saiweb_6547f576a81738c46813e6e7386eb9f9", "/wp-content/plugins/wordpress-flowplayer/flowplayer/gpl/flowplayer-3.1.5.swf", {
				plugins: {
  					 controls: {    					
      					
      					
      					
      					sliderGradient: 'none',
      					progressGradient: 'medium',
      					
      					
      					backgroundColor: '#141648',
      					
      					
      					backgroundGradient: 'none',
      					bufferGradient: 'none',
   						opacity:1.0
   						}
				},
			clip: {
					url:'http://content.screencast.com/users/D.Busby/folders/Jing/media/dd41bc92-17d3-4c34-8d46-80188f13aff2/00000337.mp4',
					autoPlay: false,
       				autoBuffering: false
				},
				canvas: {
					backgroundColor:''
				}})
			});</script>
				</p>
<p>The second is the path to the manifest itself, in this case the manifest command will verify each file against it&#8217;s entry in the manifest:</p>
<p><div id="saiweb_730f73be3a156f4813c7d50f16b4fb82" style="width:900px; height:300px;"></div><script language="Javascript" type="text/javascript">
	WPFP(document).ready(function() {
		//load player
		$f("saiweb_730f73be3a156f4813c7d50f16b4fb82", "/wp-content/plugins/wordpress-flowplayer/flowplayer/gpl/flowplayer-3.1.5.swf", {
				plugins: {
  					 controls: {    					
      					
      					
      					
      					sliderGradient: 'none',
      					progressGradient: 'medium',
      					
      					
      					backgroundColor: '#141648',
      					
      					
      					backgroundGradient: 'none',
      					bufferGradient: 'none',
   						opacity:1.0
   						}
				},
			clip: {
					url:'http://content.screencast.com/users/D.Busby/folders/Jing/media/2d3eb196-87ef-4464-982b-5b9481c000fe/00000338.mp4',
					autoPlay: false,
       				autoBuffering: false
				},
				canvas: {
					backgroundColor:''
				}})
			});</script>
				</p>
<p>At each point the command give you an indication of it&#8217;s current status, however this does come at a small cost, the script has no concept of the size of you console and as such will always render out the same number of character meaning if you console is not wide enough it will not render correctly, in the videos I have the console on a high resolution monitor as can be seen each video itself is 900 pixels wide.</p>
<p>This process is CPU intensive (20-45% on one core of a intel core2duo 2.8GHZ) and uses around 140KB of memory.<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-%e2%80%93-generating-file-manifests-and-then-checking-them-improved" data-text="Linux – Generating file manifests and then checking them &#8211; Improved" 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-%25e2%2580%2593-generating-file-manifests-and-then-checking-them-improved&#038;text=Linux%20%E2%80%93%20Generating%20file%20manifests%20and%20then%20checking%20them%20%26%238211%3B%20Improved" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/linux-%e2%80%93-generating-file-manifests-and-then-checking-them-improved/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://content.screencast.com/users/D.Busby/folders/Jing/media/dd41bc92-17d3-4c34-8d46-80188f13aff2/00000337.mp4" length="6951906" type="video/mp4" />
<enclosure url="http://content.screencast.com/users/D.Busby/folders/Jing/media/2d3eb196-87ef-4464-982b-5b9481c000fe/00000338.mp4" length="7847114" type="video/mp4" />
		</item>
		<item>
		<title>Sysamin &#8211; iconv update</title>
		<link>http://www.saiweb.co.uk/linux/sysamin-iconv-update</link>
		<comments>http://www.saiweb.co.uk/linux/sysamin-iconv-update#comments</comments>
		<pubDate>Thu, 10 Sep 2009 10:40:59 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[BOM]]></category>
		<category><![CDATA[charset]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[iconv]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=777</guid>
		<description><![CDATA[I had a major issue facing the iconv functionality of the sysadmin toolset namely due to rushed coding. When loading a file to be re-encoded the entire file was loaded into the buffer, encoded as whole and written out to the new file, this of course meant the  memory usage was roughly double the size [...]]]></description>
			<content:encoded><![CDATA[<p>I had a major issue facing the iconv functionality of the <a href="http://www.saiweb.co.uk/sysadmin">sysadmin toolset</a> namely due to rushed coding.</p>
<p>When loading a file to be re-encoded the entire file was loaded into the buffer, encoded as whole and written out to the new file, this of course meant the  memory usage was roughly double the size of the file to be converted plus any overheads to do with the encoding itself.</p>
<p>Today I had need to convert a 1.3GB sql file, needles to say the script was crashing out with a memory error.</p>
<p>As such I have now completely re-written the function it now processes the file in 1kb &#8216;chunks&#8217;, moving the load to the CPU, this process is now very cpu intensive the the memory overhead is minimal (during test processed the 1.3GB file using 113kb of memory!!!).</p>
<p><div id="saiweb_722cb0f3ea86def3e4a213044cf8f834" style="width:487px; height:417px;"></div><script language="Javascript" type="text/javascript">
	WPFP(document).ready(function() {
		//load player
		$f("saiweb_722cb0f3ea86def3e4a213044cf8f834", "/wp-content/plugins/wordpress-flowplayer/flowplayer/gpl/flowplayer-3.1.5.swf", {
				plugins: {
  					 controls: {    					
      					
      					
      					
      					sliderGradient: 'none',
      					progressGradient: 'medium',
      					
      					
      					backgroundColor: '#141648',
      					
      					
      					backgroundGradient: 'none',
      					bufferGradient: 'none',
   						opacity:1.0
   						}
				},
			clip: {
					url:'http://cdn.saiweb.co.uk/wp-content/uploads/2009/09/sysadmin-iconv.mp4',
					autoPlay: false,
       				autoBuffering: false
				},
				canvas: {
					backgroundColor:''
				}})
			});</script>
				</p>
<p>Also I have now added BOM (Byte order mark) detection:</p>
<p><div id="saiweb_7c25ceda276d077b537346147f454bff" style="width:515px; height:473px;"></div><script language="Javascript" type="text/javascript">
	WPFP(document).ready(function() {
		//load player
		$f("saiweb_7c25ceda276d077b537346147f454bff", "/wp-content/plugins/wordpress-flowplayer/flowplayer/gpl/flowplayer-3.1.5.swf", {
				plugins: {
  					 controls: {    					
      					
      					
      					
      					sliderGradient: 'none',
      					progressGradient: 'medium',
      					
      					
      					backgroundColor: '#141648',
      					
      					
      					backgroundGradient: 'none',
      					bufferGradient: 'none',
   						opacity:1.0
   						}
				},
			clip: {
					url:'http://cdn.saiweb.co.uk/wp-content/uploads/2009/09/sysadmin_oconv_bom.mp4',
					autoPlay: false,
       				autoBuffering: false
				},
				canvas: {
					backgroundColor:''
				}})
			});</script>
				<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/sysamin-iconv-update" data-text="Sysamin &#8211; iconv update" 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%2Fsysamin-iconv-update&#038;text=Sysamin%20%26%238211%3B%20iconv%20update" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/sysamin-iconv-update/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python urllib2, basic http authentication</title>
		<link>http://www.saiweb.co.uk/python/python-urllib2-basic-http-authentication</link>
		<comments>http://www.saiweb.co.uk/python/python-urllib2-basic-http-authentication#comments</comments>
		<pubDate>Wed, 03 Jun 2009 11:43:27 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[auth]]></category>
		<category><![CDATA[basic]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[urllib2]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=660</guid>
		<description><![CDATA[I meant to write this up over a week ago now, basically the need arose for one of my Python scripts to use HTTP Basic authentication when grabbing the output from a URL. An example script can be seen below: Quick description, the script will attempt to connect to a URL and read the data [...]]]></description>
			<content:encoded><![CDATA[<p>I meant to write this up over a week ago now, basically the need arose for one of my Python scripts to use HTTP Basic authentication when grabbing the output from a URL.</p>
<p>An example script can be seen below:</p>
<p>Quick description, the script will attempt to connect to a URL and read the data supplied by the webserver, if a HTTP 401 error is returned (Authentication required) the script will then go on to attempt to authenticate using the credentials supplied.</p>
<p>Printing out to the console at each point.</p>
<p>Subversion:<a href="http://svn.saiweb.co.uk/branches/python/urllib2_httpbasic_auth.py"> http://svn.saiweb.co.uk/branches/python/urllib2_httpbasic_auth.py</a></p>
<p>Highlighted source (at the time of writing)</p>
<div class="codecolorer-container python 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 /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span><br />
<span style="color: #483d8b;">&quot;&quot;&quot;<br />
&nbsp; &nbsp; Author: David Busby (http://saiweb.co.uk)<br />
&nbsp; &nbsp; Program: Python HTTP Basic Auth Exa<br />
&nbsp; &nbsp; Copyright: David Busby 2009. All rights reserved.<br />
&nbsp; &nbsp; License: http://creativecommons.org/licenses/by-sa/2.0/uk/<br />
&quot;&quot;&quot;</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib2</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">base64</span><br />
<br />
<span style="color: #483d8b;">&quot;&quot;&quot; URL List &quot;&quot;&quot;</span><br />
urls <span style="color: #66cc66;">=</span> <span style="color: black;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff4500;">0</span>:<span style="color: black;">&#123;</span><span style="color: #483d8b;">&quot;url&quot;</span>:<span style="color: #483d8b;">&quot;www.saiweb.co.uk/some/fictional/auth/area&quot;</span><span style="color: #66cc66;">,</span><span style="color: #483d8b;">&quot;user&quot;</span>:<span style="color: #483d8b;">&quot;someuser&quot;</span><span style="color: #66cc66;">,</span><span style="color: #483d8b;">&quot;pass&quot;</span>:<span style="color: #483d8b;">&quot;somepass&quot;</span><span style="color: black;">&#125;</span><br />
<span style="color: black;">&#125;</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp;ulen <span style="color: #66cc66;">=</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>urls<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span><span style="color: #66cc66;">,</span>ulen<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp;url <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;http://%s&quot;</span> % <span style="color: black;">&#40;</span>urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;url&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;req <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">Request</span><span style="color: black;">&#40;</span>url<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff7700;font-weight:bold;">try</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;res <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span>req<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;headers <span style="color: #66cc66;">=</span> res.<span style="color: black;">info</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">headers</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;data <span style="color: #66cc66;">=</span> res.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">IOError</span><span style="color: #66cc66;">,</span> e:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">hasattr</span><span style="color: black;">&#40;</span>e<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'reason'</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; err <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;%s ERROR(%s)&quot;</span> % <span style="color: black;">&#40;</span>urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;url&quot;</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span>e.<span style="color: black;">reason</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> err<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">elif</span> <span style="color: #008000;">hasattr</span><span style="color: black;">&#40;</span>e<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'code'</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> e.<span style="color: #dc143c;">code</span> <span style="color: #66cc66;">!=</span> <span style="color: #ff4500;">401</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; err <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;%s ERROR(%s)&quot;</span> % <span style="color: black;">&#40;</span>urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;url&quot;</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span>e.<span style="color: #dc143c;">code</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> err<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#401 = auth required error</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">elif</span> e.<span style="color: #dc143c;">code</span> <span style="color: #66cc66;">==</span> <span style="color: #ff4500;">401</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; base64string <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">base64</span>.<span style="color: black;">encodestring</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'%s:%s'</span> % <span style="color: black;">&#40;</span>urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;user&quot;</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span> urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;pass&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>:-<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; authheader <span style="color: #66cc66;">=</span> &nbsp;<span style="color: #483d8b;">&quot;Basic %s&quot;</span> % base64string<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; req.<span style="color: black;">add_header</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Authorization&quot;</span><span style="color: #66cc66;">,</span> authheader<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">try</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span>req<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; headers <span style="color: #66cc66;">=</span> res.<span style="color: black;">info</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">headers</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data <span style="color: #66cc66;">=</span> res.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">IOError</span><span style="color: #66cc66;">,</span> e:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">hasattr</span><span style="color: black;">&#40;</span>e<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'reason'</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; err <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;%s:%s@%s ERROR(%s)&quot;</span> % <span style="color: black;">&#40;</span>urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;user&quot;</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span>urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;pass&quot;</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span>urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;url&quot;</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span>e.<span style="color: black;">reason</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> err<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">elif</span> <span style="color: #008000;">hasattr</span><span style="color: black;">&#40;</span>e<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'code'</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; err <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;%s:%s@%s ERROR(%s)&quot;</span> % <span style="color: black;">&#40;</span>urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;user&quot;</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span>urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;pass&quot;</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span>urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;url&quot;</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span>e.<span style="color: #dc143c;">code</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> err<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; err <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;%s query complete&quot;</span> % <span style="color: black;">&#40;</span>urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;url&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> err<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; err <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;%s query complete&quot;</span> % <span style="color: black;">&#40;</span>urls<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;url&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> err<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ <span style="color: #66cc66;">==</span> <span style="color: #483d8b;">&quot;__main__&quot;</span>:<br />
&nbsp; &nbsp; main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></td></tr></tbody></table></div>
<p><strong>NOTES:</strong> This script does not check the authentication type, it always assumes it is HTTP BASIC, HTTP DIGEST for example is not compatible with this script, though there is no reason why you can not get the Auth type form the headers returned by the server and write in a Digest auth method.<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/python-urllib2-basic-http-authentication" data-text="Python urllib2, basic http authentication" 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%2Fpython-urllib2-basic-http-authentication&#038;text=Python%20urllib2%2C%20basic%20http%20authentication" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/python/python-urllib2-basic-http-authentication/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making the bird tweet using python</title>
		<link>http://www.saiweb.co.uk/python/making-the-bird-tweet-using-python</link>
		<comments>http://www.saiweb.co.uk/python/making-the-bird-tweet-using-python#comments</comments>
		<pubDate>Thu, 02 Apr 2009 16:56:35 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=630</guid>
		<description><![CDATA[After taking another look at Python I am quickly coming to love it, as an &#8220;exercise&#8221; in re-learning python I decided to write a very simple command line &#8220;tweeter&#8221; this uses the Twitter API to update your twitter status, extending from the &#8220;update twitter in a single line&#8221; You can grab a copy of the [...]]]></description>
			<content:encoded><![CDATA[<p>After taking another look at Python I am quickly coming to love it, as an &#8220;exercise&#8221; in re-learning python I decided to write a very simple command line &#8220;tweeter&#8221; this uses the Twitter API to update your twitter status, extending from the &#8220;<a href="http://www.saiweb.co.uk/linux/update-twitter-in-a-single-line">update twitter in a single line</a>&#8221;</p>
<p>You can grab a copy of the script from here: <a href="http://svn.saiweb.co.uk/branches/python/tweet.py">http://svn.saiweb.co.uk/branches/python/tweet.py</a></p>
<p><strong>UPDATE 24/03/2011:</strong>Oauth version <a href="https://github.com/Oneiroi/nagios_addons/blob/master/twitter/nagios_bot.py">here</a></p>
<p>Example usage:</p>
<div class="codecolorer-container bash 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="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.<span style="color: #000000; font-weight: bold;">/</span>tweet.py <span style="color: #660033;">-u</span> username <span style="color: #660033;">-p</span> password <span style="color: #660033;">-t</span> your tweet goes here</div></td></tr></tbody></table></div>
<p>If you want to parse the JSON data normally returned after submitting a new tweet simply add the -j flag.</p>
<p>If you are prompted for a username and password when running this script the username and password supplied using the -u and -p flags was incorrect.</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/python/making-the-bird-tweet-using-python" data-text="Making the bird tweet using python" 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%2Fmaking-the-bird-tweet-using-python&#038;text=Making%20the%20bird%20tweet%20using%20python" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/python/making-the-bird-tweet-using-python/feed</wfw:commentRss>
		<slash:comments>3</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 18/58 queries in 0.086 seconds using apc
Object Caching 1719/1837 objects using apc
Content Delivery Network via Rackspace Cloud Files: cdn.saiweb.co.uk

Served from: www.saiweb.co.uk @ 2012-02-08 13:50:38 -->
