<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Untitled Publication]]></title><description><![CDATA[Untitled Publication]]></description><link>https://mararejohn.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 20 Jun 2026 20:00:14 GMT</lastBuildDate><atom:link href="https://mararejohn.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Crackme4 ALX-Holberton challenge.]]></title><description><![CDATA[Cracking passwords can be a bit tricky for most of us, well unless you are the infamous Johnny Ramensky. Just kidding. But here is the thing, with the right tools and procedure, you can crack any password. I'm a noob when it comes to password crackin...]]></description><link>https://mararejohn.hashnode.dev/crackme4-alx-holberton-challenge</link><guid isPermaLink="true">https://mararejohn.hashnode.dev/crackme4-alx-holberton-challenge</guid><category><![CDATA[Programming Blogs]]></category><category><![CDATA[passwords]]></category><category><![CDATA[alx-software-engineering]]></category><category><![CDATA[Python]]></category><category><![CDATA[noob]]></category><dc:creator><![CDATA[John Marare]]></dc:creator><pubDate>Sat, 17 Jun 2023 11:41:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/npxXWgQ33ZQ/upload/6c6f5b8ac530e51fbb68212d7c8cef15.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Cracking passwords can be a bit tricky for most of us, well unless you are the infamous Johnny Ramensky. Just kidding. But here is the thing, with the right tools and procedure, you can crack any password. I'm a noob when it comes to password cracking and coding in general so I found it interesting after going through many resources just to find the right way to do this task given to us by Alx SWE and I thought it good to share what I learned through the process.</p>
<p>In the <a target="_blank" href="https://github.com/alx-tools/0x17.c.git">crackme4</a> file, only one Hint is provided: The program prints “OK” when the password is correct. Well, of course, the file is password protected and we have to find the password.</p>
<p>There are several tools used to convert a Python bytecode to a Python file and to mention a few we have uncompyle6, pycdc3, decompyle3 and many more. These tools can be very useful for reverse engineering and understanding the code from a compiled Python bytecode. Let us focus on Uncompyle6. First of all, we need to install it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686995292068/ae63906f-ab6f-48a4-bc54-41c09d59cb3f.png" alt class="image--center mx-auto" /></p>
<p>Done, we now have to find the contents of our file, and to do this we run the ls command with the l flag. thus ls -l.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686995592576/72614251-1075-4e55-985c-735990552a41.png" alt class="image--center mx-auto" /></p>
<p>From the file permissions above, observe that this is not an executable file so we need to further investigate our file and see what type it is. thus we run the file command in the terminal:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686995922917/a0ad2666-0eff-43a3-96ef-3dc296e48184.png" alt class="image--center mx-auto" /></p>
<p>The output from the file command tells us that crackme4 is a byte-compiled Python file compiled by Python 3.4.</p>
<p><a target="_blank" href="https://towardsdatascience.com/understanding-python-bytecode-e7edaae8734d">The bytecode is a low-level platform-independent representation of your source code</a>.</p>
<p>Understanding that the file is in bytecode and needs to be translated to a Python file, we get back to the beloved uncompyle6 and run the following command. $ uncompyle6 crackme4 &gt; crackme4.py</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686996827381/68e17729-cfab-45b8-a39f-d67339bb9c97.png" alt class="image--center mx-auto" /></p>
<p>As you can see, the output is in comment form. What it tells us is the comment is related to the file named crackme4 and goes on to clarify that the acceptable formats for the <code>crackme4</code> file should either be a Python source file (with a <code>.py</code> extension) that can be compiled and executed directly by the Python interpreter, or a Python bytecode file (with a <code>.pyc</code> or <code>.pyo</code> extension) that contains pre-compiled Python code.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686997439366/140df222-90c3-4419-bc2f-d154981d03c6.jpeg" alt class="image--center mx-auto" /></p>
<p>Getting more and more interesting I know, so let us rename it and find out. we pass the following commands.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686997625273/ab15e6fc-6c81-459c-b3d8-172063726496.png" alt class="image--center mx-auto" /></p>
<p>If we do an ls we realize that we now have 3 files. the crackme4 file, crackme.pyc and crackme.py files. Interesting, because now we have been able to successfully decompile our file.</p>
<p>If we run the file .py and input a random password. Oops, dead. KO.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1687000439131/2da72d08-a62f-4d3f-b682-a817b1c0766b.png" alt class="image--center mx-auto" /></p>
<p>Well, using your favorite text editor vim(I know this may cause an uprising from team Emacs but as the saying goes irriz what irriz.) let us examine our file. Maybe there is a hint inside. We run:$ vim crackme4.py.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686998407544/331daca8-aeb4-4609-95b0-890958ddd57e.png" alt class="image--center mx-auto" /></p>
<p>From the above source code, there are at least 3 distinguishing things. The comments, variables and of course the if...else loop. Observing the comment let us break down what they mean. line 1 is the version I am using of uncompyle6, line 2 indicates that the bytecode was generated with Python version 3.4, lines 3 and 4 show information on the Python and GCC versions used during decompilation, line 5 indicates the source file name while line 7 indicates the date and time when the source code was compiled into bytecode.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686999212953/012eada4-256b-4c32-8211-f3594789fba5.jpeg" alt class="image--center mx-auto" /></p>
<p>Satisfaction! Yes!!. That is the word. Now examining further to line 8, the line prompts the user to enter a password and assigns the input to the variable 'pwd'. Line 9 initializes the variable 'ok' with a string value "Zen of Python". Line 10 further concatenates the string "C" to the value 'ok'. Now we have "Zen of Python C"</p>
<p>The variable 'ok' is further manipulated by performing several operations.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686999779780/3231a397-eb0a-44ea-8ca2-839a56ec0c7e.png" alt class="image--center mx-auto" /></p>
<p>The line <code>print(ok)</code> then prints the value of the variable <code>ok</code>, which is <code>'en C Pyfo neZ'</code>.</p>
<p>Isn't it amazing. For now, we not only have our password but also completed our task. Running the command.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1687000668224/cd74d66b-3684-4c16-9f67-9d2e497835fc.png" alt class="image--center mx-auto" /></p>
<p>Well, that's it for now. Karibu.</p>
]]></content:encoded></item></channel></rss>