<?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>Edwin Castillo</title>
	<atom:link href="http://edwincastillo.com/feed" rel="self" type="application/rss+xml" />
	<link>http://edwincastillo.com</link>
	<description>The life of a Systems Engineer</description>
	<lastBuildDate>Wed, 07 Dec 2011 05:24:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Give a man a fish&#8230;</title>
		<link>http://edwincastillo.com/archives/275</link>
		<comments>http://edwincastillo.com/archives/275#comments</comments>
		<pubDate>Wed, 07 Dec 2011 05:24:21 +0000</pubDate>
		<dc:creator>Edwin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://edwincastillo.com/?p=275</guid>
		<description><![CDATA[It&#8217;s amazing to me how many veteran IT gurus are unwilling to teach people new to the industry. I remember logging onto IRC chat rooms and seeing one person after another being degraded or insulted for asking valid legitimate questions. I was shocked to find that this was NOT the norm in the amateur (ham) [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>It&#8217;s amazing to me how many veteran IT gurus are unwilling to teach people new to the industry. I remember logging onto IRC chat rooms and seeing one person after another being degraded or insulted for asking valid legitimate questions. I was shocked to find that this was NOT the norm in the amateur (ham) radio hobby. In amateur radio culture, an <em>Elmer</em> is a person who teaches and nurtures the neophyte amateur radio operator. We NEED Elmers in IT.</p>
<p>I understand that there is a big difference between a &#8220;hobby&#8221; and an actual business profession. I also understand that some of these IT veterans see their job as just that, a job. For me, it is not just a job, my job IS MY HOBBY. Imagine that, a job that is so enjoyable that you actually WANT to do it. I feel that those who feel like me are the same people who are not opposed to teaching a newbie to my &#8220;hobby&#8221;.</p>
<p>So what can we do for these individuals who are not thrilled to be in the trenches with us? I tend to agree with books like <a title="Drive: The Surprising Truth About What Motivates Us" href="http://www.barnesandnoble.com/w/drive-daniel-h-pink/1100819915?ean=9781594484803&amp;itm=1&amp;usri=drive" target="_blank">Drive</a> and the <a title="Strengths Homepage" href="http://strengths.gallup.com/default.aspx" target="_blank">Strength Finder series</a>; we need to let everyone do what they love. Telling a &#8220;it&#8217;s just a job&#8221; individual to teach a neophyte can be very challenging. The goal becomes finding what part of the &#8220;job&#8221; this individual actually enjoys. It will take some detective work to find the answer but with enough prodding you can find some passion in this individual. Please note, this will not always be a tech related skill. I had one individual who REALLY loved PowerPoint. Let me tell you, the 1 hour presentation this person gave was amazing. He was extremely well versed and even PowerPoint haters were upping their presentations after that presentation.</p>
<p>I think setting up a regularly scheduled teach a topic session can have many benefits for any IT department. It gives individuals a forum to talk about what they like, gives management an inexpensive training resource and helps enhance the skill of those attending. I recommend it as a topic of conversation at your next team meeting.</p>
<p><em>Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. &#8211;Chinese Proverb</em></p>
<div class="shr-publisher-275"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://edwincastillo.com/archives/275/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Go with the flow&#8230;</title>
		<link>http://edwincastillo.com/archives/270</link>
		<comments>http://edwincastillo.com/archives/270#comments</comments>
		<pubDate>Tue, 29 Nov 2011 03:20:22 +0000</pubDate>
		<dc:creator>Edwin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://edwincastillo.com/?p=270</guid>
		<description><![CDATA[Working in IT can be stressful. Many technologists go unappreciated and are only noticed when something is not to the user&#8217;s liking. This creates a feeling of being undervalued. What can you do? Here is a small list of tasks that may help. Create a daily log where you write at least ONE way you [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Working in IT can be stressful. Many technologists go unappreciated and are only noticed when something is not to the user&#8217;s liking. This creates a feeling of being undervalued. What can you do? Here is a small list of tasks that may help.</p>
<ol>
<li>Create a daily log where you write at least <strong>ONE way you contributed to the success of the company</strong>. This is great for review time. It&#8217;s OK to repeat on several tasks since you can mention examples like &#8220;restored accidentally deleted files 60 times this year&#8221;.</li>
<li>Have a <strong>GREAT task list</strong>. This will work for this &#8220;what are you doing all day&#8221; questions? I recommend a ticket system like RT or some other type of sharable task list. My recommendation would be to read up on Thomas Limoncelli&#8217;s system in his book &#8220;<a title="Time Management for System Administrators" href="http://click.linksynergy.com/fs-bin/click?id=YhW6ZfIzk0o&amp;subid=&amp;offerid=239662.1&amp;type=10&amp;tmpid=8432&amp;RD_PARM1=http%253A%252F%252Fwww.barnesandnoble.com%252Fw%252Ftime-management-for-system-administrators-thomas-a-limoncelli%252F1100156307%253Fean%253D9780596007836%2526itm%253D1%2526usri%253Dtime%252Bmanagement%252Bfor%252Bsystem%252Badministrators" target="_blank">Time Management for System Administrators</a>&#8220;. It&#8217;s a must have for any tech trying to organize their to-do list.</li>
<li><strong>Schedule a daily outage</strong>. What? Yes, schedule a daily ONE Hour outage. Why? It WILL HAPPEN, might as well schedule for it. If there isn&#8217;t an outage, make sure you have some task that will benefit the organization (e.g. study for certification).</li>
<li><strong>Create a PANIC ROOM</strong>. This is the place where all employees know NOT TO bother you. For me, its normally been the 65 degree server room with its loud fans. Make sure to get a NICE, comfy chair in there and a computer you can use as a client. The PANIC ROOM is not just a place to run to in an outage but it can also serve as a small getaway when humans get antsy and annoying.</li>
<li>Grab a notebook during an outage. <strong>Start writing</strong> about the issue at hand. If it doesn&#8217;t help you flesh out a solution it will at least give you a moment to breathe and analyze the situation at hand. You are able to think clearly if you are more at peace. Taking these few moments may actually help you solve the issue faster.</li>
<li>Create a backup team. <strong>Who has your back?</strong> I once had a manager who was great at pushing users away from me. Since then I have always explained to my managers that I may need to call upon them to begin a buffer between me and the disgruntled users. Users respond better to upper management but if you only have a peer as a buffer, that may work as well. You would be surprised how grateful your peers will be if you volunteer to be a buffer for them. They are amazingly cooperative when you are deep in the hole.</li>
</ol>
<p>These are just some of the tips that have worked for me. My goal is always to take a step back, breathe and attack the issues systematically. Having a plan helps a lot and I recommend you take a minute to hash one out that works for you. If you do so, everyone will think that you are a &#8220;go with the flow&#8221; kind of guy.</p>
<div class="shr-publisher-270"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://edwincastillo.com/archives/270/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Obfuscation</title>
		<link>http://edwincastillo.com/archives/254</link>
		<comments>http://edwincastillo.com/archives/254#comments</comments>
		<pubDate>Fri, 28 Jan 2011 16:19:27 +0000</pubDate>
		<dc:creator>Edwin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://edwincastillo.com/?p=254</guid>
		<description><![CDATA[The boy looked at the digital horizon. Squinting; not with his eyes but with his mind. He was trying to make sense of it all. It’s almost in focus but not enough to make sense of it all. “Why can’t I see it?” Take a step backwards; no that makes it blurry. Take two steps [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p style="text-align: left"><a href="http://edwincastillo.com/archives/254"><img class="aligncenter size-full wp-image-261" src="http://edwincastillo.com/wp-content/uploads/2011/01/obfuscation.png" alt="" width="610" height="160" /></a>The boy looked at the digital horizon. Squinting; not with his eyes but with his mind. He was trying to make sense of it all. It’s almost in focus but not enough to make sense of it all. “Why can’t I see it?” Take a step backwards; no that makes it blurry. Take two steps forward, worse still. “Dammit, what the hell…?” Work it out. “It’s because I’m a kid, isn’t it?” In 10 years, maybe he’ll get it. No, maybe 5 considering he is top of his class. Ah, whatever; give it two years, he’s a genius.</p>
<p>He blinks and holds it hoping that it will give him some fresh new insight. He slowly opens his eyes. CRAP! The code looks more obfuscated than before.</p>
<p><a href="http://en.wikipedia.org/wiki/Obfuscation" target="_blank">http://en.wikipedia.org/wiki/Obfuscation</a></p>
<div class="shr-publisher-254"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://edwincastillo.com/archives/254/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing THC-Hydra 5.9 on Ubuntu 10.10 (Maverick Meerkat) with SSL support</title>
		<link>http://edwincastillo.com/archives/242</link>
		<comments>http://edwincastillo.com/archives/242#comments</comments>
		<pubDate>Fri, 24 Dec 2010 08:07:37 +0000</pubDate>
		<dc:creator>Edwin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://edwincastillo.com/?p=242</guid>
		<description><![CDATA[UPDATE: 5.9.1 seems to work without the need to manually compile libssh. Simply replace the libssh part below with sudo apt-get install libssh-dev Also, grab 5.9.1 using wget -c http://freeworld.thc.org/releases/hydra-5.9.1-src.tar.gz Wikipedia describes THC-Hydra as &#8220;&#8230; software &#8230; that uses a dictionary attack to test for weak or simple passwords on one or many remote hosts [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://freeworld.thc.org/thc-hydra/"><img class="alignnone size-full wp-image-200" title="xhydra" src="http://edwincastillo.com/wp-content/uploads/2010/08/xhydra.png" alt="" width="610" height="320" /></a><strong>UPDATE: 5.9.1 seems to work without the need to manually compile libssh. Simply replace the libssh part below with<br />
</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libssh-dev</pre></div></div>

<p><strong>Also, grab 5.9.1 using</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-c</span> http:<span style="color: #000000; font-weight: bold;">//</span>freeworld.thc.org<span style="color: #000000; font-weight: bold;">/</span>releases<span style="color: #000000; font-weight: bold;">/</span>hydra-5.9.1-src.tar.gz</pre></div></div>

<p>Wikipedia describes THC-Hydra as &#8220;&#8230; software &#8230; that uses a dictionary attack to test for weak or simple passwords on one or many remote hosts running a variety of different services.&#8221; Its useful for doing quick tests against your servers to make sure that your users are not using simple passwords. In pen tester speak, this is called a brute-force attack.</p>
<p>Here are the steps needed for installing it on the 32-bit version of Ubuntu 10.10 (Maverick Meerkat).<span id="more-242"></span></p>
<p>Make sure you have all the necessary development tools (i.e. libraries, compilers, headers) and the source files for GTK:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential linux-headers-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">uname</span> -r<span style="color: #7a0874; font-weight: bold;">&#41;</span> libgtk2.0-dev libssl-dev cmake</pre></div></div>

<p>Before we compile Hydra, we need to install libssh. For some odd reason, hydra does not like the libssh-dev package that comes with Ubuntu.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-c</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.libssh.org<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0.4</span><span style="color: #000000; font-weight: bold;">/</span>libssh-0.4.6.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> libssh-0.4.6.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> libssh-0.4.6
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> build
<span style="color: #7a0874; font-weight: bold;">cd</span> build
cmake -DCMAKE_INSTALL_PREFIX=<span style="color: #000000; font-weight: bold;">/</span>usr -DCMAKE_BUILD_TYPE=Debug ..
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>..</pre></div></div>

<p>Download and extract the THC-Hydra tarball</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-c</span> http:<span style="color: #000000; font-weight: bold;">//</span>edwincastillo.com<span style="color: #000000; font-weight: bold;">/</span>wp-content<span style="color: #000000; font-weight: bold;">/</span>uploads<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">12</span><span style="color: #000000; font-weight: bold;">/</span>hydra-<span style="color: #000000;">5.9</span>-src.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> hydra-<span style="color: #000000;">5.9</span>-src.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> hydra-<span style="color: #000000;">5.9</span>-src</pre></div></div>

<p>Now you are ready to compile:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>You are now ready to use Hydra. Type ./hydra -h to get syntax help. The GUI version can be started by running xhydra.</p>
<p>If you have a GMail account with IMAP enabled, you can use the following example to test hydra:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">hydra <span style="color: #660033;">-S</span> <span style="color: #660033;">-l</span> email<span style="color: #000000; font-weight: bold;">@</span>gmail.com <span style="color: #660033;">-p</span> your_password <span style="color: #660033;">-V</span> imap.gmail.com imap</pre></div></div>

<p><em>I believe that I am only at a beginning, only knocking at a door, and I believe that the best is yet to come.</em> &#8211;Pat Buckley</p>
<div class="shr-publisher-242"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://edwincastillo.com/archives/242/feed</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Parsing XML with XMLStarlet</title>
		<link>http://edwincastillo.com/archives/218</link>
		<comments>http://edwincastillo.com/archives/218#comments</comments>
		<pubDate>Sat, 11 Dec 2010 04:01:06 +0000</pubDate>
		<dc:creator>maxwave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://edwincastillo.com/?p=218</guid>
		<description><![CDATA[This week I learned to use a command line XML Toolkit called XMLStarlet. It&#8217;s pretty easy to use considering I was trying to create the same process in Java using XOM. I&#8217;m a bit familiar with SQL Select statements and wanted something similar to that. XMLStarlet can use XPath statements which aren&#8217;t as powerful as [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p style="text-align: center;"><a rel="attachment wp-att-219" href="http://edwincastillo.com/archives/218/xmllogo"><img class="size-full wp-image-219 aligncenter" title="xmlLogo" src="http://edwincastillo.com/wp-content/uploads/2010/12/xmlLogo.png" alt="" width="500" height="127" /></a></p>
<p>This week I learned to use a command line XML Toolkit called <a title="XMLStarlet Command Line XML Toolkit: News" href="http://xmlstar.sourceforge.net/" target="_blank">XMLStarlet</a>. It&#8217;s pretty easy to use considering I was trying to create the same process in Java using <a title="XOM" href="http://xom.nu/" target="_blank">XOM</a>.</p>
<p>I&#8217;m a bit familiar with <a title="SQL SELECT Statement" href="http://www.w3schools.com/sql/sql_select.asp" target="_blank">SQL Select statements</a> and wanted something similar to that. XMLStarlet can use XPath statements which aren&#8217;t as powerful as SQL queries but was sufficient for my needs. It was a bit of a stretch but an hour or so at <a title="XPath Tutorial" href="http://www.w3schools.com/xpath/default.asp" target="_blank">w3schools.com</a> and I figured out the queries I needed.</p>
<p>Besides the XPath expressions, the general syntax is pretty simple.</p>
<p>I used the <code>sel</code> command to initiate a query. My XML data came from a series of web queries so I used the <code>--net</code> global option which allowed me to fetch  entities over network. </p>
<p>I wanted the output to be a CSV file, so I opted for the <code>-T</code> global option which changes the output to text. I simply added commas by using <code>-o ,</code>.</p>
<p>XPath and XML queries seem to work by selecting a set and than calling the value of an element. The selecting was done using the -m option for &#8220;match&#8221; and the -v option for &#8220;print value&#8221;. </p>
<p>Here is what my command line options looked like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">xml sel <span style="color: #660033;">--net</span> <span style="color: #660033;">-T</span> <span style="color: #660033;">-N</span> <span style="color: #007800;">wp</span>=<span style="color: #ff0000;">&quot;http://api.whitepages.com/schema/&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #660033;">-m</span> <span style="color: #000000; font-weight: bold;">/</span>wp:wp<span style="color: #000000; font-weight: bold;">/</span>wp:listings<span style="color: #000000; font-weight: bold;">/</span>wp:listing <span style="color: #660033;">-v</span> wp:displayname <span style="color: #660033;">-o</span> , <span style="color: #660033;">-v</span> child::wp:phonenumbers<span style="color: #000000; font-weight: bold;">/</span>child::wp:phone<span style="color: #000000; font-weight: bold;">/</span>child::wp:fullphone <span style="color: #660033;">-o</span> , <span style="color: #660033;">-v</span> child::wp:address<span style="color: #000000; font-weight: bold;">/</span>child::wp:fullstreet  <span style="color: #660033;">-n</span> http:\\api.whitepages.com\enter_api_query_here</pre></div></div>

<p>I ended up using some of my Java code and XMLStarlet together to meet the needs of this project. My next task is to incorporate my new found knowledge of XPath into the Java code I wrote. Let&#8217;s see what I learn next.</p>
<div class="shr-publisher-218"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://edwincastillo.com/archives/218/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New school, new PTA website</title>
		<link>http://edwincastillo.com/archives/210</link>
		<comments>http://edwincastillo.com/archives/210#comments</comments>
		<pubDate>Tue, 07 Dec 2010 16:28:53 +0000</pubDate>
		<dc:creator>Edwin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://edwincastillo.com/?p=210</guid>
		<description><![CDATA[This is my second year in my son&#8217;s school PTA and I decided to make more of an effort this year. I was happy to be elected the acting CIO of this small group and decided that they need their own website. Here is my contribution to my son&#8217;s education. Spring Valley Elementary School PTA [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://edwincastillo.com/archives/210/pta_screenshot" rel="attachment wp-att-211"><img src="http://edwincastillo.com/wp-content/uploads/2010/12/PTA_screenshot.png" alt="" width="610" height="376" class="alignnone size-full wp-image-211" /></a><br />
This is my second year in my son&#8217;s school PTA and I decided to make more of an effort this year. I was happy to be elected the acting CIO of this small group and decided that they need their own website. Here is my contribution to my son&#8217;s education.<br />
<a href="http://springvalley.ptalounge.org">Spring Valley Elementary School PTA Website</a></p>
<div class="shr-publisher-210"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://edwincastillo.com/archives/210/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RegEx: Match text between two parenthesis</title>
		<link>http://edwincastillo.com/archives/162</link>
		<comments>http://edwincastillo.com/archives/162#comments</comments>
		<pubDate>Tue, 09 Nov 2010 20:16:10 +0000</pubDate>
		<dc:creator>Edwin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://edwincastillo.com/?p=162</guid>
		<description><![CDATA[I recently needed to retrieve Biblical texts out of a few paragraphs. My original text was something like this: (John 14:30; Luke 4:6) ... “the entire inhabited earth.” (Revelation 12:9) I jumped over to my text-editor&#8217;s Search feature to see if I can find a way to do this. I noticed it had a Search [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://xkcd.com/208/"><img class="alignnone size-full wp-image-188" title="xkcd: Regular Expressions" src="http://edwincastillo.com/wp-content/uploads/2010/11/xkcd1.png" alt="xkcd: Regular Expressions" width="610" height="320" /></a>I recently needed to retrieve Biblical texts out of a few paragraphs.</p>
<p>My original text was something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">(John 14:30; Luke 4:6) ... “the entire inhabited earth.” (Revelation 12:9)</pre></div></div>

<p>I jumped over to my text-editor&#8217;s Search feature to see if I can find a way to do this. I noticed it had a Search mode setting of &#8220;Regular Expression&#8221;. I immediately thought of <a title="xkcd: Regular Expressions" href="http://xkcd.com/208/" target="_blank">XKCD</a> and said &#8220;Everybody stand back. I Know Regular Expressions!&#8221;</p>
<p>OK, so I really don&#8217;t know regular expressions but let me tell you how I figured it out.<br />
<span id="more-162"></span></p>
<p>There are a lot of online RegEx testing tools but I normally use <a title="RegExr: Free Online RegEx Testing Tool" href="http://gskinner.com/RegExr/" target="_blank">RegExr</a> simply because its one of the ones I first bookmarked and has samples with descriptions. Using the samples on the left of the screen, I was able to learn that matching the open parenthesis required that it be escaped.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">\(</pre></div></div>

<p>I also knew about the infamous .* which matches any number of characters. So I just added the closing parenthesis \) and thought that would be all.</p>

<div class="wp_syntax"><div class="code"><pre class="reg" style="font-family:monospace;">\<span style="color: #000000;">&#40;</span>.*\<span style="color: #000000;">&#41;</span></pre></div></div>

<p>I was WRONG!! It worked well for any sentence that had one set of parenthesis, but not for those that had two like the example I showed above. It matched everything between the first open parenthesis and the last closed parenthesis.</p>
<p>OK, so like I said, I don&#8217;t know RegEx but I do know Google. I knew that the web is full of examples but I knew that not everyone would be looking to match parenthesis. So what is the most common character with text between it? Answer: Quotes!. After digging around, I found this page:<br />
<a title="Regex Tutorial - The Dot Matches (Almost) Any Character" href="http://www.regular-expressions.info/dot.html" target="_self"> Regex Tutorial &#8211; The Dot Matches (Almost) Any Character</a><br />
It help me understand why the dot was catching everything in between. I love the fact that they use the word &#8220;GREEDY&#8221; to describe this behavior.</p>
<p>To explain the solution using the websites terms, I did not want any number of any character between the parenthesis. What I really wanted was any number of characters that are not parenthesis or newlines between the parenthesis.</p>
<p>So, the corrected RegEx ended up being the following:</p>

<div class="wp_syntax"><div class="code"><pre class="reg" style="font-family:monospace;">\<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>^\<span style="color: #000000;">&#40;</span>\r\n<span style="color: #000000;">&#93;</span>*\<span style="color: #000000;">&#41;</span></pre></div></div>

<div class="shr-publisher-162"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://edwincastillo.com/archives/162/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I read your email! Access your GMail IMAP Account.</title>
		<link>http://edwincastillo.com/archives/111</link>
		<comments>http://edwincastillo.com/archives/111#comments</comments>
		<pubDate>Tue, 24 Aug 2010 18:33:22 +0000</pubDate>
		<dc:creator>Edwin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://edwincastillo.com/?p=111</guid>
		<description><![CDATA[Users are still known to use simple passwords. If you need to help convince someone of the importance of strong passwords, you can use a brute force tool to demonstrate what a good password list can do. The first brute-force tool I ever picked up was THC-Hydra which supports all kinds of protocols like HTTP, [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://www.thinkgeek.com/tshirts-apparel/unisex/frustrations/31fb/"><img class="alignnone size-full wp-image-197" title="lg-i-read-your-email" src="http://edwincastillo.com/wp-content/uploads/2010/08/lg-i-read-your-email.png" alt="lg-i-read-your-email" width="610" height="320" /></a>Users are still known to use simple passwords. If you need to help convince someone of the importance of strong passwords, you can use a brute force tool to demonstrate what a good password list can do.</p>
<p>The first brute-force tool I ever picked up was THC-Hydra which supports all kinds of protocols like HTTP, HTTPS, VNC and IMAP to name <a title="THC-HYDRA  - fast and flexible network login hacker" href="http://freeworld.thc.org/thc-hydra/" target="_blank">a few</a>. GMail is very popular in my circle of friends. Brute forcing a GMail account tends to be a very impressive parlor trick. The only issue is that GMail actually uses SSL IMAP and Hydra only supports clear-text IMAP. The solution: stunnel. Stunnel will encrypt your TCP connection inside SSL. Stunnel takes care of the encryption and Hydra takes care of the IMAP login attempts.</p>
<p>Read on to see a step by step how-to on setting this up on Ubuntu LUcid Lynx 10.04.<span id="more-111"></span>First, you need to compile THC-Hydra. Follow the instructions <a title="Installing THC-Hydra 5.7 on Ubuntu Lucid Lynx 10.04" href="http://edwincastillo.com/archives/95" target="_blank">here</a>.</p>
<p>Installing STUNNEL is a bit simpler.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> stunnel</pre></div></div>

<p>Edit /etc/default/stunnel4, change <strong>ENABLED=<span style="color: #ff0000;">0</span></strong> to <strong>ENABLED=<span style="color: #ff0000;">1</span></strong>.</p>
<p>Edit the /etc/stunnel/stunnel.conf and set it up for client mode. The configuration for IMAP will accept connections on the standard IMAP TCP port &#8220;143&#8243; and redirect the traffic to imap.gmail.com on the standard SSL IMAP port &#8220;993&#8243;.</p>
<p>Below is the stunnel.conf file I use.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">; Sample stunnel configuration file by Michal Trojnara 2002-2009
; Some options used here may not be adequate for your particular configuration
; Please make sure you understand them (especially the effect of the chroot jail
)
&nbsp;
; Certificate/key is needed in server mode and optional in client mode
;cert = /etc/ssl/certs/stunnel.pem
;key = /etc/ssl/certs/stunnel.pem
&nbsp;
; Protocol version (all, SSLv2, SSLv3, TLSv1)
sslVersion = SSLv3
&nbsp;
; Some security enhancements for UNIX systems - comment them out on Win32
chroot = /var/lib/stunnel4/
setuid = stunnel4
setgid = stunnel4
; PID is created inside the chroot jail
pid = /stunnel4.pid
&nbsp;
; Some performance tunings
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
;compression = zlib
&nbsp;
; Workaround for Eudora bug
;options = DONT_INSERT_EMPTY_FRAGMENTS
&nbsp;
; Authentication stuff
;verify = 2
; Don't forget to c_rehash CApath
; CApath is located inside chroot jail
;CApath = /certs
; It's often easier to use CAfile
;CAfile = /etc/stunnel/certs.pem
; Don't forget to c_rehash CRLpath
; CRLpath is located inside chroot jail
;CRLpath = /crls
; Alternatively you can use CRLfile
;CRLfile = /etc/stunnel/crls.pem
&nbsp;
; Some debugging stuff useful for troubleshooting
debug = 7
output = /var/log/stunnel4/stunnel.log
&nbsp;
; Use it for client mode
client = yes
&nbsp;
; Service-level configuration
&nbsp;
;[pop3s]
;accept  = 995
;connect = 110
&nbsp;
[imaps]
accept = 143
connect = imap.gmail.com:993
&nbsp;
;[ssmtp]
;accept  = 465
;connect = 25
&nbsp;
;[https]
;accept  = 443
;connect = 80
;TIMEOUTclose = 0
&nbsp;
; vim:ft=dosini</pre></div></div>

<p>Start up the stunnel daemon.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>stunnel4 start</pre></div></div>

<p>You can verify that the IMAP port is listening on your local server.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">netstat</span> <span style="color: #660033;">-an</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-iw</span> LISTEN</pre></div></div>

<p>Look for the following line in the output:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN</pre></div></div>

<p>Now, before you can brute-force your GMail account, you must enable IMAP. Log on to your GMail account and click on <strong>Settings</strong> &gt; <strong>Forwarding and POP/IMAP</strong>. Locate the <strong>IMAP Access:</strong> section and select <strong>Enable IMAP</strong>. Click on the <strong>Save Changes</strong> button to complete this step.</p>
<p>Let&#8217;s pull out our 1970&#8242;s toolbox and use TELNET to test our STUNNEL configuration and our GMail access. We will telnet to localhost&#8217;s port 143. We should see the Gmail banner &#8220;* OK Gimap ready for requests from &#8230;&#8221;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">telnet localhost <span style="color: #000000;">143</span>
Trying 127.0.0.1...
Connected to localhost.
Escape character is <span style="color: #ff0000;">'^]'</span>.
<span style="color: #000000; font-weight: bold;">*</span> OK Gimap ready <span style="color: #000000; font-weight: bold;">for</span> requests from 5.5.5.5 c5if2789008nfi.67</pre></div></div>

<p>Now that we are connected to the GMail IMAP server, we can test communication by using some IMAP commands like LOGIN. In the example below, change username@gmail.com to your GMail username, and change password to your actual password.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">01 LOGIN username<span style="color: #000000; font-weight: bold;">@</span>gmail.com password
01 OK username<span style="color: #000000; font-weight: bold;">@</span>gmail.com authenticated <span style="color: #7a0874; font-weight: bold;">&#40;</span>Success<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>You are now successfully logged into your GMail account. Use the LOGOUT command to end the session.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">02 LOGOUT
<span style="color: #000000; font-weight: bold;">*</span> BYE LOGOUT Requested
02 OK <span style="color: #000000;">73</span> good day <span style="color: #7a0874; font-weight: bold;">&#40;</span>Success<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Connection closed by foreign host.</pre></div></div>

<p>OK, now we know we have our set up ready to go. This is were we start using Hydra to brute-force its way into the GMail account.</p>
<p>To start you will need a text file with common passwords. This is known as a wordlist. You can google for lists or pick some up from <a title="Password Cracking Wordlists and Tools for Brute Forcing" href="http://www.darknet.org.uk/2008/02/password-cracking-wordlists-and-tools-for-brute-forcing/" target="_blank">here</a>. For my demonstration, I have a small list that I normally use which you can grab <a title="My Wordlist" href="http://edwincastillo.com/wp-content/uploads/2010/08/wordlist.txt" target="_blank">here</a>. For testing you can add your real password to the list.</p>
<p>Now you are ready to use Hydra. You can use the GUI version by running xhydra but I prefer the command line.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">hydra <span style="color: #660033;">-l</span> username<span style="color: #000000; font-weight: bold;">@</span>gmail.com <span style="color: #660033;">-P</span> wordlist.txt <span style="color: #660033;">-V</span> localhost imap</pre></div></div>

<p>The -V option will show the login and password combination for each attempt. Once it finds a match it will need to kill all the other attempts that it is running. At the end of your prompt you should see something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[143][imap] host: 127.0.0.1   login: username@gmail.com   password: 12345678
[STATUS] attack finished for localhost (waiting for childs to finish)
Hydra (http://www.thc.org) finished at 2010-08-24 14:12:59</pre></div></div>

<p>Congratulations, you now have access to YOUR email. You can reward yourself by purchasing a t-shirt that publicizes your brand new conquest <a title="ThinkGeek :: i read your e-mail." href="http://www.thinkgeek.com/tshirts-apparel/unisex/frustrations/31fb/" target="_blank">here</a>.</p>
<div class="shr-publisher-111"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://edwincastillo.com/archives/111/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Installing THC-Hydra 5.7 on Ubuntu Lucid Lynx 10.04</title>
		<link>http://edwincastillo.com/archives/95</link>
		<comments>http://edwincastillo.com/archives/95#comments</comments>
		<pubDate>Sat, 21 Aug 2010 19:40:11 +0000</pubDate>
		<dc:creator>Edwin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://edwincastillo.com/?p=95</guid>
		<description><![CDATA[Wikipedia describes THC-Hydra as &#8220;&#8230; software &#8230; that uses a dictionary attack to test for weak or simple passwords on one or many remote hosts running a variety of different services.&#8221; Its useful for doing quick tests against your servers to make sure that your users are not using simple passwords. In pen tester speak, [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://freeworld.thc.org/thc-hydra/"><img src="http://edwincastillo.com/wp-content/uploads/2010/08/xhydra.png" alt="" title="xhydra" width="610" height="320" class="alignnone size-full wp-image-200" /></a>Wikipedia describes THC-Hydra as &#8220;&#8230; software &#8230; that uses a dictionary attack to test for weak or simple passwords on one or many remote hosts running a variety of different services.&#8221; Its useful for doing quick tests against your servers to make sure that your users are not using simple passwords. In pen tester speak, this is called a brute-force attack.</p>
<p>Here are the steps needed for installing it on the 32-bit version of Ubuntu Lucid Lynx 10.04.<span id="more-95"></span></p>
<p>Make sure you have all the necessary development tools (i.e. libraries, compilers, headers) and the source files for GTK:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential linux-headers-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">uname</span> -r<span style="color: #7a0874; font-weight: bold;">&#41;</span> libgtk2.0-dev</pre></div></div>

<p>Download and extract the THC-Hydra tarball</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-c</span> http:<span style="color: #000000; font-weight: bold;">//</span>freeworld.thc.org<span style="color: #000000; font-weight: bold;">/</span>releases<span style="color: #000000; font-weight: bold;">/</span>hydra-<span style="color: #000000;">5.7</span>-src.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> hydra-<span style="color: #000000;">5.7</span>-src.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> hydra-<span style="color: #000000;">5.7</span>-src</pre></div></div>

<p>Now you are ready to compile:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> makeinstall</pre></div></div>

<p>You are now ready to use Hydra. Type ./hydra -h to get syntax help. The GUI version can be started by running xhydra.</p>
<p>An example of using Hydra would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>hydra <span style="color: #660033;">-l</span> yourfriend<span style="color: #000000; font-weight: bold;">@</span>hisdomain.com <span style="color: #660033;">-P</span> password.txt <span style="color: #660033;">-V</span> mail.hisdomain.com imap</pre></div></div>

<p><em>I believe that I am only at a beginning, only knocking at a door, and I believe that the best is yet to come.</em> &#8211;Pat Buckley</p>
<div class="shr-publisher-95"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://edwincastillo.com/archives/95/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Installing Metasploit on Ubuntu Lucid Lynx 10.04</title>
		<link>http://edwincastillo.com/archives/87</link>
		<comments>http://edwincastillo.com/archives/87#comments</comments>
		<pubDate>Fri, 20 Aug 2010 18:02:47 +0000</pubDate>
		<dc:creator>Edwin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://edwincastillo.com/?p=87</guid>
		<description><![CDATA[OMG, Installing Metasploit on Ubuntu is SOOO easy now. I installed it all of 5 minutes by following the instructions at http://www.metasploit.com/redmine/projects/framework/wiki/Install_Linux. Download the Linux 32-bit (x86) installer from the downloads page and run the following commands: $ chmod +x framework-3.*-linux-i686.run $ sudo ./framework-3.*-linux-i686.run Once the installation process is complete, enter &#8220;hash -r&#8221; to reload your [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://www.metasploit.com/framework/"><img src="http://edwincastillo.com/wp-content/uploads/2010/08/metasploit-framework.png" alt="" title="metasploit-framework" width="610" height="320" class="alignnone size-full wp-image-202" /></a>OMG, Installing Metasploit on Ubuntu is SOOO easy now. I installed it all of 5 minutes by following the instructions at <a href="http://www.metasploit.com/redmine/projects/framework/wiki/Install_Linux">http://www.metasploit.com/redmine/projects/framework/wiki/Install_Linux</a>.</p>
<p><span id="more-87"></span>Download the Linux 32-bit (x86) installer from the <a href="http://www.metasploit.com/framework/download/">downloads</a> page and run the following commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> +x framework-<span style="color: #000000;">3</span>.<span style="color: #000000; font-weight: bold;">*</span>-linux-i686.run
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>framework-<span style="color: #000000;">3</span>.<span style="color: #000000; font-weight: bold;">*</span>-linux-i686.run</pre></div></div>

<p>Once the installation process is complete, enter &#8220;hash -r&#8221; to reload your path. At this point all of the framework commands should be in the system path (via symlinks in /usr/local/bin), and the framework can be updated by running &#8220;msfupdate&#8221; as the root user.</p>
<div class="shr-publisher-87"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://edwincastillo.com/archives/87/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

