<?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>Yet another web log &#187; Security</title>
	<atom:link href="http://blog.philippheckel.com/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.philippheckel.com</link>
	<description>Life, Linux and other things</description>
	<lastBuildDate>Thu, 17 Mar 2011 10:04:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Hacking Flash Applications and Games: A Case Study</title>
		<link>http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/</link>
		<comments>http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 06:00:40 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[SWF]]></category>
		<category><![CDATA[SWF Decompiler]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/?p=674</guid>
		<description><![CDATA[Adobe&#8217;s proprietary Flash format has become a significant part of the Internet as it is today. While its importance in Web applications is slowly decreasing due to Web 2.0 technologies and HTML5, it is still a major player in the browser game and application sector. The majority of these games and applications are for entertainment [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe&#8217;s proprietary Flash format has become a significant part of the Internet as it is today. While its importance in Web applications is slowly decreasing due to Web 2.0 technologies and HTML5, it is still a major player in the browser game and application sector. The majority of these games and applications are for entertainment only and offer you nothing but a nice rank in the high score. On rare occasions, however, there are Flash games in which you can actually win something valuable such as concert tickets or even money. And of course there are applications that let you stream, but not download content from a website.</p>
<p>So what&#8217;s the problem with that, you think? The problem is that almost <strong>all Flash applications can be hacked</strong> very easily and most developers are not aware of that. </p>
<p>As a reminder of how vulnerable Flash applications are, this post aims to raise awareness for these issues. In a case study, it shows how a Flash-based game and its server side high score can be tricked within a few minutes using free tools only.</p>
<p><span id="more-674"></span></p>
<hr />
<div class="toc">
<ol>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Disclaimer">Disclaimer</a></li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Introduction">1. Introduction</a>
<ol>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#The-problem-with-Flash-applications">1.1. The problem with Flash applications</a></li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Checksums-as-a-solution">1.2. Checksums as a solution?</a></li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Tools-and-basic-approach">1.3. Tools and basic approach</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Case-study-a-car-parking-game">2. Case study: a car parking game (with high score)</a>
<ol>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Capture-the-client-server-communication">2.1. Capture the client-server communication</a></li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Decompile-the-SWF-file-and-find-the-checksum-algorithm">2.2. Decompile the SWF file and find the checksum algorithm</a></li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Write-a-script">2.3. Write a script</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Conclusion">3. Conclusion</a></li>
</ol>
</div>
<hr />
<h3 id="Disclaimer" >Disclaimer</h3>
<p>This post is meant to raise awareness for the vulnerabilities of Flash-based applications. It is not a hacking tutorial or how-to. For that reason, I will not describe all steps in great detail, but only sketch the basic steps.</p>
<h3 id="Introduction" >1. Introduction</h3>
<h4 id="The-problem-with-Flash-applications" >1.1. The problem with Flash applications</h4>
<p>Flash applications are similar to normal Windows/Linux executables: Like normal programs, their source code is compiled to a binary format and later executed on the client machine. The major difference to .exe or Linux binaries is that decompiling is a lot easier: while a C or C++ compiler translates the source code into machine code, i.e. CPU instructions, SWF files contain the ActionScript code in plain text. That is with the right tools, <strong>extracting the complete code is a no-brainer</strong>!</p>
<p>Combining this with the fact that <strong>sniffing into the client-server communication</strong> is also not the most difficult task, one can easily simulate the Flash client with own code snippets and scripts, and thereby send <strong>forged requests</strong> to the server.</p>
<h4 id="Checksums-as-a-solution" >1.2. Checksums as a solution?</h4>
<p>Most application developers at least know that the client-server communication can be sniffed into. As an attempt to make it more difficult for people to send forged requests to the server, applications mostly use a message authentication code (MAC) or some other checksum-based mechanism. So instead of sending a plain text update query to the server (1), the application creates a hash by concatenating the user input with (to the user unknown) other data (2):</p>
<table style="width: 90%; margin: 5px auto; line-height: 130%" border="0">
<tr class="toprow">
<td style="width: 50%; text-align: left; font-size: 12px; padding: 5px">(1) Without checksum mechanism</td>
<td style="width: 50%; text-align: left; font-size: 12px; padding: 5px">(2) With checksum mechanism</td>
</tr>
<tr class="odd">
<td style='width: 50%; vertical-align: top; text-align: left; font-size: 12px; padding: 5px'>
<b>POST</b> /write-highscore.php <b>HTTP/1.1</b><br />
<b>Host</b>: www.example.com<br />
<b>User-Agent</b>: Mozilla/5.0 &#8230;<br />
&#8230;<br />
name=Phil&#038;score=40
</td>
<td style='width: 50%; vertical-align: top; text-align: left; font-size: 12px; padding: 5px'>
<b>POST</b> /write-highscore.php <b>HTTP/1.1</b><br />
<b>Host</b>: www.example.com<br />
<b>User-Agent</b>: Mozilla/5.0 &#8230;<br />
&#8230;<br />
name=Phil&amp;score=40&amp;<span style="color: red; font-weight: bold">check=283647a&#8230;</span>
</td>
</tr>
</table>
<p>This mechanism is completely based on the fact that the user does not know how the checksum is created. While this approach is very effective in regular applications, it completely fails in Flash programs: disassembling a Windows or Linux binary is very difficult and requires know how in assembler. Decompiling SWF files, however, is fairly easy and can be done in under a minute. That is retrieving the code that generates the checksum is only a matter of seconds.</p>
<h4 id="Tools-and-basic-approach" >1.3. Tools and basic approach</h4>
<p>The following steps present a generic approach on how any Flash application can be exploited like described above. </p>
<p><strong>Required Tools</strong>:</p>
<ul>
<li><a href="https://addons.mozilla.org/en-us/firefox/addon/firebug/">Firebug</a>: Firefox plugin for basic communication sniffing</li>
<li><a href="http://www.sothink.com/product/flashdecompiler/">Sothink Flash Decompiler</a>: required to extract ActionScript code (trial version is sufficient)</li>
<li><a href="http://www.wireshark.org/">Wireshark</a>: required for detailed communication sniffing (byte-for-byte)</li>
</ul>
<p><strong>Generic Approach</strong>:</p>
<ol>
<li>Enable Firebug and start sniffing with Wireshark.</li>
<li>Go to the target web site and play the game or use the application.</li>
<li>Look at the communication of the Flash application with the server. If there are any parts of the requests that cannot be recreated without the source code, e.g. checksums, download the important SWF files and decompile them.</li>
<li>Analyze the ActionScript code and find the part which creates the checksum.</li>
<li>Make a script that generates the same request with arbitrary input data, e.g. any score or name. For this script, the checksum algorithm from the ActionScript code can be used (or recreated).</li>
</ol>
<h3 id="Case-study-a-car-parking-game" >2. Case study: a car parking game (with high score)</h3>
<p>Our local newspaper <a href="http://www.morgenweb.de/">Mannheimer Morgen</a> recently hosted a competition in which users had to park a (virtual) car into different parking spots without damaging the car and with minimal fuel usage. Prizes were a safety training and concert tickets. While in this case the score of the participants did not decide who won (winners were drawn by lot), the winner in other competitions might be the one with the best score. <em>Please note that I did not take part in this competition and I did under no circumstances try to win the prizes.</em></p>
<p><img src="http://blog.philippheckel.com/wp-content/uploads/2011/02/parking-screenshot.png" alt="" title="parking-screenshot" width="450" height="349" class="aligncenter size-full wp-image-729" style="border: 0" /></p>
<p style="text-align: center; font-size: .8em; line-height: 115%"><strong>Parking Game</strong>: The target application in this case is a game called &#8220;Parking&#8221;.</p>
<h4 id="Capture-the-client-server-communication" >2.1. Capture the client-server communication</h4>
<p>Following the instructions from above, the first step is to capture the communication between the Flash client and the server. In this case, we are particularly interested in how to <strong>add our name with an arbitrary score to the high score list</strong>.</p>
<p><strong>Firebug</strong>:<br />
Using Firebug, we can see three interesting requests: </p>
<ul>
<li><em>savescore.swf</em> is the part of the client that is responsible for sending the score to the server.</li>
<li><em>serverdate-read.php</em> is called by savescore.swf for no obvious reason &#8211; very suspicious. We will later see that the result is used in the checksum generation.</li>
<li><em>highscore-write.php</em> is also called by savescore.swf and actually writes the user&#8217;s score to the database on the server.</li>
</ul>
<p><img src="http://blog.philippheckel.com/wp-content/uploads/2011/02/firebug.png" alt="" width="500" height="399" class="aligncenter size-full wp-image-735" /></p>
<p style="text-align: center; font-size: .8em; line-height: 115%"><strong>Firebug</strong> identifies the interesting files and requests.<br />In this case, three requests are relevant for the high score forgery.</p>
<p>What is particularly important is the two parameters <b>__ctrl</b> and <b>controlvalue</b>. Both are obviously generated by some checksum function in the <em>savescore.swf</em>-file. So the next step is to decompile the SWF file and look for the checksum-generating function.</p>
<p><strong>Wireshark</strong>:<br />
If we additionally enable Wireshark, we can get a plain text (or hex) representation of the HTTP request-response cycle. That is particularly important if one wants to forge a request in a way that it cannot be detected by the server. </p>
<h4 id="Decompile-the-SWF-file-and-find-the-checksum-algorithm" >2.2. Decompile the SWF file and find the checksum algorithm</h4>
<p>Using the SWF Decompiler software (trial version is sufficient), the <em>savescore.swf</em> can be examined very closely. Most of the applications are not very complex and the relevant code pieces are found very easily.</p>
<p><img src="/wp-content/uploads/2011/02/swfdecompile.png" alt="" width="500" height="334" class="aligncenter size-full wp-image-742" /></p>
<p>When analyzing <em>savescore.swf</em>, the two parts in which the checksums are created are found at different positions in the file. The <b>__ctrl</b> parameter is generated by taking a MD5 hash over the two concatenated values of <em>score</em> and <em>email</em>. The <b>controlvalue</b> parameter is created in a similar fashion and involves the previously queried <em>serverdate</em>.</p>
<p><img src="/wp-content/uploads/2011/02/checksum1.png" alt="" width="491" height="197" class="aligncenter size-full wp-image-740" /></p>
<p style="text-align: center; font-size: .8em; line-height: 115%">The <b>__ctrl</b> parameter is a hash value over two of the variable input parameters.<br />The <b>controlvalue</b> parameter is created similarly.</p>
<h4 id="Write-a-script" >2.3. Write a script</h4>
<p>Once it is clear how the checksums are generated, the puzzle is solved. The only thing left is to write a script that allows entering arbitrary input values, and using the previously determined checksum-mechanisms to generate a MAC.</p>
<p>Here is a short excerpt of how this could look like (using PHP):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$score</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;999.999&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$email</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;nobody@example.com&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">&quot;__ctrl&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$score</span><span style="color: #339933;">.</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
	<span style="color: #339933;">...</span>
	<span style="color: #0000ff;">&quot;score&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$score</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;controlvalue&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">...</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
	<span style="color: #339933;">...</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> 
	<span style="color: #000088;">$data_enc</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;=&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$req</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;POST /parking/highscore-write.php HTTP/1.1<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
     <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;Host: www.morgenweb.de<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
     <span style="color: #339933;">...</span>
     <span style="color: #339933;">.</span> <span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$data_enc</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fsockopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;www.morgenweb.de&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">80</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$req</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fgets</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>	
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3 id="Conclusion" >3. Conclusion</h3>
<p>This blog post introduced a common way to outsmart Flash applications and games. It demonstrated that by sniffing into client-server communication and decompiling SWF files, many Flash applications can be misused. Using the example of a Flash game, the post showed that SWF cannot be compared to Windows/Linux binaries, but must rather be seen as JavaScript-like client code. </p>
<p>Even though this post only demonstrated this using a rather harmless game, more serious misuse is also possible. Flash-based music streaming sites such as <a href="http://www.simfy.com/">Simfy</a>, <a href="http://www.spotify.com/">Spotify</a> <a href="http://www.grooveshark.com/">Grooveshark</a> are affected as well. They all use a similar mechanism for their Flash-based music player. Using the approach presented above combined with tools like <em>rtmpdump</em> can potentially harm their services significantly.</p>
<p>Flash once was a great way for bringing a little dynamic in the Web 1.0, but is no outdated. With various JavaScript frameworks and HTML5 on the way, Flash is going to retire soon. Developers and companies must be aware of the flaws of Flash and adjust their services accordingly to make sure that they cannot be misused.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Altering old SVN revisions: removing confidental data from a Subversion repository</title>
		<link>http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/</link>
		<comments>http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 11:26:44 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/?p=588</guid>
		<description><![CDATA[Version control systems like CVS or Subversion are designed for keeping track of the changes of a project and for having the possibility to revert to old revisions if something goes wrong. In contrast to regular relational databases, these systems are made only for adding new content to a repository, and not for removing data [...]]]></description>
			<content:encoded><![CDATA[<p>Version control systems like <a href="http://www.nongnu.org/cvs/">CVS</a> or <a href="http://subversion.apache.org/">Subversion</a> are designed for keeping track of the changes of a project and for having the possibility to revert to old revisions if something goes wrong. In contrast to regular relational databases, these systems are made only for adding new content to a repository, and not for removing data from it. In fact, deleting old content is <a href=" http://subversion.apache.org/faq.html#removal">not a built-in functionality</a> in SVN, and mostly requires removing entire revisions from the repository or even <a href="http://svnbook.red-bean.com/en/1.1/ch05s03.html#svn-ch-5-sect-3.1.3">creating a new one</a>. </p>
<p>But what happens if you <strong>accidentally commit a password</strong> or other sensitive information to a repository? This post explains <strong>how to remove this confidential data</strong> permanently from the repository by simply overwriting it in old revisions, i.e. without having to remove revisions or create a new repository.</p>
<p><span id="more-588"></span></p>
<hr />
<b>Contents</b></p>
<div class="toc">
<ol>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Introduction">1. Introduction</a></p>
<ol>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Disclaimer">1.1. Disclaimer</a></li>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Requirements">1.2. Requirements</a></li>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Example-Scenario">1.3. Example Scenario</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Local-machine-Identify-the-affected-revisions-in-the-working-copy">2. Local machine: Identify the affected revisions in the working copy</a>
<ol>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Fix-and-commit-the-affected-file">2.1. Fix and commit the affected file</a></li>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Identify-the-affected-file-versions-locally">2.2. Identify the affected file versions locally</a></li>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Get-MD5-checksums-of-the-affected-versions">2.3. Get MD5 checksums of the affected versions</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#SVN-repository-Correct-the-affected-files">3. SVN repository: Correct the affected files</a>
<ol>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Make-a-repository-backup">3.1. Make a repository backup</a></li>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Verify-affected-versions">3.2. Verify affected versions</a></li>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Replace-the-password-and-checksums">3.3. Replace the password and checksums</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Test-locally">4. Test locally</a></li>
<li><a href="http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/#Bash-history-cleanup">5. Bash history cleanup</a></li>
</ol>
</div>
<hr />
<h3 id="Introduction" >1. Introduction</h3>
<h4 id="Disclaimer" >1.1. Disclaimer</h4>
<p>The following actions might lead to data loss. I am not responsible for anything that goes wrong because of my description. </p>
<h4 id="Requirements" >1.2. Requirements</h4>
<p>It is absolutely necessary to have <strong>root access to the SVN respository</strong>. That is not only through the svnadmin command, but full command line access to the files, particularly to the &#8220;repos&#8221; directory.</p>
<p>If you do not have root access to the repository, you cannot remove any data from the repository! In that case, contact your SVN administrator.</p>
<h4 id="Example-Scenario" >1.3. Example Scenario</h4>
<p>For this example, let&#8217;s assume you accidentally committed the file <strong>config.cfg</strong> with a plain text password <em style="color: red">123secret</em> a while ago (in <strong>revision 12</strong>). The repository is currently at <strong>revision 25</strong> and you just realized that the password was in there all the time:</p>

<div class="wp_syntax"><div class="code"><pre class="config" style="font-family:monospace;"># Config file &quot;config.cfg&quot;
username = someone
password = 123secret
...</pre></div></div>

<h3 id="Local-machine-Identify-the-affected-revisions-in-the-working-copy" >2. Local machine: Identify the affected revisions in the working copy</h3>
<h4 id="Fix-and-commit-the-affected-file" >2.1. Fix and commit the affected file</h4>
<p>The following commands are performed on <strong>your local machine</strong> within the working copy of the project, i.e. on the client machine.</p>
<p>Before we start tinkering and forging the SVN history and its repository, first fix the affected file and commit a new revision to the repository. In most cases, people are not going to look in old revisions of a config file, so the faster you commit a new version, the less likely it is that someone sees it!</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>Dev<span style="color: #000000; font-weight: bold;">/</span>yourproject
$ <span style="color: #c20cb9; font-weight: bold;">vi</span> config.cfg
<span style="color: #666666; font-style: italic;"># Change password to something else</span>
$ <span style="color: #c20cb9; font-weight: bold;">svn</span> commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;config update&quot;</span>
...
Transmitting <span style="color: #c20cb9; font-weight: bold;">file</span> data .
Committed revision <span style="color: #000000;">26</span>.</pre></div></div>

<h4 id="Identify-the-affected-file-versions-locally" >2.2. Identify the affected file versions locally</h4>
<p>In most cases you will probably realize right away that you just committed something confidential to the SVN repository. In this case, you only have to fix one single version of that file and is pretty clear which revision is affected.</p>
<p>In other cases, however, the affected file might be in the repository for many revisions before you realize it. If this is the case, there might be multiple revisions of the file in the repository and each of these versions needs to be fixed. To identify the possibly affected versions of the file, you can peak into the logs:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> log config.cfg
<span style="color: #660033;">------------------------------------------------------------------------</span>
r22 <span style="color: #000000; font-weight: bold;">|</span> someone <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">2011</span>-01-<span style="color: #000000;">25</span> 01:<span style="color: #000000;">36</span>:<span style="color: #000000;">12</span> +0100 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Tue, <span style="color: #000000;">25</span> Jan <span style="color: #000000;">2011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">1</span> line
&nbsp;
update xy config
<span style="color: #660033;">------------------------------------------------------------------------</span>
r12 <span style="color: #000000; font-weight: bold;">|</span> someone <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">2011</span>-01-05 00:<span style="color: #000000;">45</span>:<span style="color: #000000;">19</span> +0100 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Wed, 05 Jan <span style="color: #000000;">2011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">1</span> line
&nbsp;
added connection details to config
<span style="color: #660033;">------------------------------------------------------------------------</span>
...</pre></div></div>

<p>In this case, the file has been altered in the two <strong>revisions 12 and 22</strong>. Both <strong>might</strong> include the password and are stored in the repository, i.e. both potentially need to be corrected.</p>
<h4 id="Get-MD5-checksums-of-the-affected-versions" >2.3. Get MD5 checksums of the affected versions</h4>
<p>SVN ensures the integrity of its repository by saving MD5 checksums of all the files and its versions. Since it is now clear which revisions might be affected, you need to get the <em>current</em> checksums of these file versions and calculate checksums for the new <em>corrected</em> (&#8220;forged&#8221;) versions. In short, you need to do the following <strong>for each affected version</strong>:</p>
<ul>
<li>Retrieve the version and calculate its MD5 checksum</li>
<li>Make a copy of file, replace the confidential information with &#8220;x&#8221;s and calculate the MD5 checksum of the new file.</li>
<li>Remember or copy all the checksums and versions into a file.</li>
</ul>
<p>In this example, we&#8217;ll have to get the checksums for revisions 12 and 22 of the <em>config.cfg</em>-file. The code below only shows what to do for revision 22; revision 12 is analogue:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Get current checksum of revision 22</span>
$ <span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #660033;">--revision</span> <span style="color: #000000;">22</span> config.cfg
...
At revision <span style="color: #000000;">22</span>.
$ md5sum config.cfg
0e28c6c8342649c290400567130f657b  config.cfg
&nbsp;
<span style="color: #666666; font-style: italic;"># Correct the file and get new checksum</span>
$ <span style="color: #c20cb9; font-weight: bold;">cp</span> config.cfg <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>config.cfg-<span style="color: #000000;">22</span>
$ <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>config.cfg-<span style="color: #000000;">22</span>
<span style="color: #666666; font-style: italic;"># Overwrite the password with &quot;xxxxxxxxx&quot; (same length as the old password!!)</span>
$ md5sum <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>config.cfg-<span style="color: #000000;">22</span>
459a78e2eae02b28f810f9fdebdc5b52  <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>config.cfg-<span style="color: #000000;">22</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Repeat this for revision 12</span></pre></div></div>

<h3 id="SVN-repository-Correct-the-affected-files" >3. SVN repository: Correct the affected files</h3>
<div style="border: 1px solid red; background: #fcc; padding: 5px; margin-top: 8px"><strong>Warning</strong>: This step can damage your repository, so make sure you backup as described in 3.1. before you change anything.</div>
<p>In this step, we finally start altering the repository. All the actions are performed on <strong>the server machine</strong> as <strong>root</strong> user inside the actual SVN repository directory, so be sure not to confuse it with you local machine.</p>
<h4 id="Make-a-repository-backup" >3.1. Make a repository backup</h4>
<p>Creating some sort of backup is crucial, since we are about to change the binary revision files of the Subversion repository. The easiest way to do this is to backup the whole repository folder of your project, e.g. /path/to/svn/repos/yourproject. However, if its total size is too big you can also choose to only backup the files identified in 3.2.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Make backup of project; Note the &quot;-a&quot; parameter to keep the permissions.</span>
$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backups
$ <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-a</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>svn<span style="color: #000000; font-weight: bold;">/</span>repos<span style="color: #000000; font-weight: bold;">/</span>yourproject <span style="color: #000000; font-weight: bold;">/</span>backups</pre></div></div>

<h4 id="Verify-affected-versions" >3.2. Verify affected versions</h4>
<p>After the backup, we need to verify that we really need to change all the versions we identified earlier. To do that, navigate to the &#8220;revs&#8221; folder inside the repository and grep for the password:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <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>svn<span style="color: #000000; font-weight: bold;">/</span>repos<span style="color: #000000; font-weight: bold;">/</span>yourproject<span style="color: #000000; font-weight: bold;">/</span>db<span style="color: #000000; font-weight: bold;">/</span>revs<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span>
$ <span style="color: #c20cb9; font-weight: bold;">grep</span> 123secret <span style="color: #000000; font-weight: bold;">*</span>
Binary <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000;">12</span> matches
Binary <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000;">22</span> matches</pre></div></div>

<p>The matching files are the revisions that contain the password, and hence also the files that need to be &#8220;corrected&#8221;. Note that sometimes not all the versions identified through the &#8220;svn log&#8221; command appear in this list. That is because when the file is simply moved and not changed or other parts of it were altered, its contents will not be stored in the SVN revision file.</p>
<h4 id="Replace-the-password-and-checksums" >3.3. Replace the password and checksums</h4>
<p>Since the SVN revision files are binary, we need a hex editor to edit them. Hence install hexedit, and then simply replace the password and checksums like identified before:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> hexedit
&nbsp;
$ hexedit <span style="color: #000000;">22</span>
<span style="color: #666666; font-style: italic;"># Hex editor opens the file for revision 22</span>
<span style="color: #666666; font-style: italic;"># Replace passwords and checksums</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Repeat this for revision 12</span></pre></div></div>

<p>Hexedit is not the easiest editor to use. So here is a step-by-step of what you need to do:</p>
<ul>
<li>Hit TAB, then CTRL-S to search</li>
<li>Enter the password <em style="color: red">123secret</em> and hit return</li>
<li>Overwrite the password with <em style="color: red">xxxxxxxxx</em> (same length!)</li>
<li>Hit CTRL-S, then &#8220;Y&#8221; to save</li>
<li>Repeat 1-4 for each occurance of the password.</li>
<li>Do the same for the old checksum &#8220;0e28c6c8342649c290400567130f657b&#8221;, and replace it with the new one &#8220;f85abfd8b63fa7ab68abc9364f2d339e&#8221;</li>
<li>Hit CTRL-X to quit</li>
<li>Repeat this for all affected revisions</li>
</ul>
<p>That&#8217;s the complete magic. If checked out, the revisions 12 and 22 (and of course also their succeeding versions) will show <em style="color: red">xxxxxxxxx</em> instead of the initially committed password.</p>
<h3 id="Test-locally" ">4. Test locally</h3>
<p>Now test locally if you can switch between revisions and every works without error messages:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #660033;">--revision</span> <span style="color: #000000;">12</span> update
...
At revision <span style="color: #000000;">12</span>.
$ <span style="color: #c20cb9; font-weight: bold;">grep</span> password config.cfg
password = xxxxxxxxx</pre></div></div>

<p>If you did everything as the tutorial says, you shouldn&#8217;t get any errors. If you forgot to replace checksums or you changed something that you weren&#8217;t supposed to change in the SVN revision file, you might get an error like below. However, if that happens, you can always go back to your backup and try it again&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #660033;">--revision</span> <span style="color: #000000;">12</span> update
<span style="color: #c20cb9; font-weight: bold;">svn</span>: Checksum mismatch <span style="color: #000000; font-weight: bold;">while</span> reading representation:
   expected:  f85abfd8b63fa7ab68abc9364f2d339e
     actual:  de6f581d115197baebc43c3975b9e396</pre></div></div>

<h3 id="Bash-history-cleanup" >5. Bash history cleanup</h3>
<p>In step 3.2. we typed the plain text password in the bash. As you might know, this leaves traces in the ~/.bash_history file. Delete them by opening the files and then by simply removing the according lines. Make sure that you <strong>do not use the search</strong> function of VIM, since that has a history on its own. If you do, delete the history of VIM in ~/.viminfo.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">vi</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_history
<span style="color: #666666; font-style: italic;"># Remove everything that contains the password</span>
<span style="color: #666666; font-style: italic;"># Do NOT use the search function, but search manually!</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2011/02/01/altering-old-svn-revisions-removing-confidental-data-from-subversion-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP-UN: WordPress version update notification with cron</title>
		<link>http://blog.philippheckel.com/2010/01/29/wp-un-wordpress-version-update-notification-with-cron/</link>
		<comments>http://blog.philippheckel.com/2010/01/29/wp-un-wordpress-version-update-notification-with-cron/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 13:32:30 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Cron]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/?p=164</guid>
		<description><![CDATA[WordPress is a very popular open-source blog software and is used widely throughout the Internet. However, with great success comes great attack potential: like any other wide spread open-source software, WordPress is target for frequent hacking attacks and spam-bots. All the more important is it to always update the distribution to the latest release. As [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wordpress.org/">WordPress</a> is a very popular open-source blog software and is used widely throughout the Internet. However, with great success comes great attack potential: like any other wide spread open-source software, WordPress is target for frequent hacking attacks and spam-bots. All the more important is it to always update the distribution to the latest release.</p>
<p>As Debian/Ubuntu user, I am spoiled when it comes to update management: <em>apt-get</em> updates most of my software, and <em>apticron</em> notifies me when updates are available. For WordPress however, the packaged versions of Debian/Ubuntu are really old and less adjustable which unfortunately makes a manual installation inevitable. While there are several automated WordPress update mechanisms out there, I couldn&#8217;t find a simple notify-on-update tool.</p>
<p>This post introduces the <em>WordPress Update Notifier</em> (WP-UN), a simple script that frequently compares the installed WordPress version with the latest available one. If a new version is available, it sends an e-mail to a given address.</p>
<p><span id="more-164"></span></p>
<h3 id="toc-update">Update</h3>
<p><strong>February &#8217;11</strong>: I updated the script so that it now uses the WordPress API. If you want, you can still download the <a href="http://blog.philippheckel.com/uploads/2010/01/wp-un-0.1">old version of WP-UN</a>, but since wordpress.org changed their download mechanisms, it does not work any more. </p>
<h3 id="toc-requirements">Requirements</h3>
<p>WP-UN is compatible with <strong>WordPress 2.5-3.x</strong>. It needs a  <strong>local mail server</strong> such as <a href="http://www.sendmail.org/">Sendmail</a> or <a href="http://www.postfix.org/">Postfix</a> to deliver the notification e-mail. </p>
<h3 id="toc-download-installation">Download &amp; Installation</h3>
<p>Download the script, save it to your preferred location and make it executable:</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;">-O</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>wp-un \
          http:<span style="color: #000000; font-weight: bold;">//</span>blog.philippheckel.com<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>01<span style="color: #000000; font-weight: bold;">/</span>wp-un
$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>wp-un</pre></div></div>

<p>That&#8217;s it for the installation. The script can now be called by simply running <em>wp-un</em>.</p>
<p><strong>Download</strong>: <a href="http://blog.philippheckel.com/uploads/2010/01/wp-un">WP-UN 0.2, February 2011</a><br />
<strong>Old version</strong>: <a href="http://blog.philippheckel.com/uploads/2010/01/wp-un-0.1">WP-UN 0.1, January 2010</a> (broken!)</p>
<h3 id="toc-usage">Usage</h3>
<p>Now you can call the script with the following arguments:</p>
<ul>
<li><strong>&#8211;test</strong>: to test if the notification works, use the <em>&#8211;test</em> parameter (optional).</li>
<li><strong>INSTALL-DIR</strong>: the path to your local WordPress installation, for example /var/www/myblog.</li>
<li><strong>NOTIFY-EMAIL</strong>: the e-mail address of the person to notify if a new WordPress version is available.</li>
</ul>
<p>By default, the script is completely silent so that adding a cronjob doesn&#8217;t require output redirections. If, however, the <em>&#8211;test</em> option is given, it is more verbose and sends the notification e-mail in any case.</p>
<p>If a new WordPress version is available, the output looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ wp-un --test /var/www/myblog admin@example.com
Checking installed version... WordPress 2.5.1
Checking latest version... WordPress 2.9.1
Update required; Sending notification to admin@example.com... done.</pre></div></div>

<p>If WordPress is up-to-date, WP-UN would normally not send any notification. If, however, the <em>&#8211;test</em> option is enabled, it sends the e-mail no matter what. In this case, the output will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ wp-un --test /var/www/myblog admin@example.com
Checking installed version... WordPress 2.9.1
Checking latest version... WordPress 2.9.1
Update not necessary; WordPress is up-to-date.
TEST-flag enabled: sending notfication to admin@example.com... done.</pre></div></div>

<p>The notification you receive will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"> The WordPress installation on host example.com needs an update:
&nbsp;
   Installed Version: WordPress 2.5.1
                  at: /var/www/myblog
&nbsp;
      Latest Version: WordPress 2.9.1
            Download: http://www.wordpress.org/latest.tar.gz</pre></div></div>

<h3 id="toc-as-cronjob">As cronjob</h3>
<p>If you want to be notified as soon as a new version comes out, installing a cronjob is a good idea. Simply run <em>crontab -e</em> and add the following line to the file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span> <span style="color: #000000;">6</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>wp-un <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>myblog admin<span style="color: #000000; font-weight: bold;">@</span>example.com</pre></div></div>

<p>WP-UN will now run every morning at 6am and notify you if a new WordPress version is out there!</p>
<h3 id="toc-conclusion">Conclusion</h3>
<p>WP-UN is just one of many solutions and it&#8217;s only the work of one afternoon. However, it doesn&#8217;t need any additional software and keeps it simple. It serves its purpose and keeps my WordPress installation always up-to-date. If you have any suggestions or questions, feel free to comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2010/01/29/wp-un-wordpress-version-update-notification-with-cron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simsafe: Simple command-line password safe</title>
		<link>http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/</link>
		<comments>http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 00:20:29 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[GPG]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/</guid>
		<description><![CDATA[Nowadays, it appears to me as if almost everything in the big and fancy world of IT comes with the need to sign up and create an account. Every little online tool, every social networking site and of course every instant messenger account. System administrators hits it even harder: The setup of a server machine [...]]]></description>
			<content:encoded><![CDATA[<p>Nowadays, it appears to me as if almost everything in the big and fancy world of IT comes with the need to sign up and create an account. Every little online tool, every social networking site and of course every instant messenger account. System administrators hits it even harder: The setup of a server machine requires to create lots of different users for every kind of service, &#8212; be it Postfix, Sendmail, Courier, MySQL, PostgreSQL, etc. Most of them require some kind of super-user password or account.</p>
<p>This is where a password manager comes in handy: Open the password vault by typing in the master password, put in all you secrets and crucial information, save it and be happy. <em>As if!</em></p>
<p>Almost every password manager I found on the Web was crowded out by details so that it took minutes to add a single account. What I wanted was something like a text-file with password &#8212; and that&#8217;s what I made: <strong>A simple command-line password safe</strong>.</p>
<p><span id="more-22"></span></p>
<h3 id="toc-how-it-works">How it works</h3>
<p>Simsafe is nothing else but a simple Perl script wrapped around the symmetric encryption functions of GPG. Every box with GPG and Perl installed can hence use the script (= every linux box!). And even if the <em>simsafe</em>-script is not installed on the system, a simple <em>gpg &#8211;decrypt FILE</em> shows the plain text contents. That is, Simsafe files are nothing more but <strong>text-files with password!</strong></p>
<h3 id="toc-usage">Usage</h3>
<p>It&#8217;s simple and really easy to use.<br />
Syntax:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ simsafe FILE</pre></div></div>

<h4 id="toc-create-a-new-password-safe-file">Create a new password safe file</h4>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ simsafe mySafe
simsafe: Creating a new password safe 'mySafe'
simsafe: Please enter the new password: (type in your password)
simsafe: Please confirm the password: (confirm your password)
simsafe: Executing editor vi ...
  // VI or your favourite editor opens
  // and you can edit the plain text file
simsafe: Encrypting with GPG ...</pre></div></div>

<h4 id="toc-addingremoving-entries-to-the-password-vault">Adding/Removing entries to the password vault</h4>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ simsafe mySafe
simsafe: Please enter the safe password: (type in your password)
simsafe: Decrypting with GPG ...
simsafe: Executing editor vi ...
  // VI or your favourite editor opens
  // and you can edit the plain text file
simsafe: Safe unchanged.</pre></div></div>

<h3 id="toc-get-it">Get it!</h3>
<p>It&#8217;s a reeeaallly small script and this post is possible longer than the perl-file itself, but here it is. Simply download it, make it executable and put it somewhere in your PATH.</p>
<p><strong>Download:</strong> <a href="/uploads/2009/04/simsafe">Simsafe v0.1, Apr. 2009</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

