<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: jas0n</title>
    <description>The latest articles on DEV Community by jas0n (@jas0n).</description>
    <link>https://dev.to/jas0n</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F540253%2Fa0905c2f-6ef4-4eb5-b781-a7feacc1b5dc.jpg</url>
      <title>DEV Community: jas0n</title>
      <link>https://dev.to/jas0n</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jas0n"/>
    <language>en</language>
    <item>
      <title>An Idiot's Guide to Bruteforcing Part I</title>
      <dc:creator>jas0n</dc:creator>
      <pubDate>Mon, 14 Dec 2020 22:38:29 +0000</pubDate>
      <link>https://dev.to/jas0n/an-idiot-s-guide-to-bruteforcing-part-i-1ah</link>
      <guid>https://dev.to/jas0n/an-idiot-s-guide-to-bruteforcing-part-i-1ah</guid>
      <description>&lt;p&gt;The other day i found a password-protected zip file on an old hard drive. Seeing that it had an intruiging name, and that i didn't know the password, i told my self that this would be a good challange to learn bruteforcing.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Bruteforcing&lt;/em&gt;. The act of systematically checking every possible password until the correct one is found - &lt;a href="https://en.wikipedia.org/wiki/Brute-force_attack"&gt;see Wikipedia for more.&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  The Math Behind It
&lt;/h1&gt;

&lt;p&gt;I know, now you'll start to hate me. It seems that the definition of bruteforcing requires you not to worry about math. If anything, bruteforcers want to get away from math. But once you get started with it, it's not possible to evade it.&lt;/p&gt;

&lt;p&gt;So i told myself i needed to learn it, at least to be able to know how long cracking this file would work.&lt;/p&gt;

&lt;p&gt;Bruteforcing is pure math and i didn't understand that in the beginning. Which is why i ended up frustrated after trying to crack on password 24/7 for 30 consecutive days with no results :(.&lt;/p&gt;

&lt;p&gt;The math it is simple. Let's define its two component and then their relationship:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Character set&lt;/li&gt;
&lt;li&gt;Password length&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Character Set
&lt;/h1&gt;

&lt;p&gt;The character set is a list of characters the password, you are trying to bruteforce, contains. Typically it's made up of a combination of the following types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;lowercase alphabet [a-z]&lt;/li&gt;
&lt;li&gt;uppercase alphabet [A-Z]&lt;/li&gt;
&lt;li&gt;numbers [0-9]&lt;/li&gt;
&lt;li&gt;extra characters [.-!]&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's use a practical example. In the case of the file i wanted to crack, i used the following command to bruteforce it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;fcrackzip &lt;span class="nt"&gt;-b&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; aA1! &lt;span class="nt"&gt;-u&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; 4-10 file.zip &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; result.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;code&gt;fcrackzip&lt;/code&gt; the &lt;code&gt;c aA1!&lt;/code&gt; parameter defines the character set. In this case it means that we are going to use lowercase and uppercase alphabet numbers and extra characters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Character &lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; a-z + A-Z + 0-9 + .-!

&lt;span class="c"&gt;# of characters = 26 + 26 + 10 + 33 = 95&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you add all these characters, you will end up with a total of 95. Let's go look at password length.&lt;/p&gt;

&lt;h1&gt;
  
  
  Password Length
&lt;/h1&gt;

&lt;p&gt;It defines how many characters the password, we are trying to crack, has.&lt;/p&gt;

&lt;p&gt;When bruteforcing, the password length tends to be an educated guess. It's rare to exactly know how long the password is. More often we know a minimal and maximum password length.&lt;/p&gt;

&lt;p&gt;If we took at the command from above again, we can see that i, too, made an educated guess concercing the password length.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;fcrackzip &lt;span class="nt"&gt;-b&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; aA1! &lt;span class="nt"&gt;-u&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; 4-10 file.zip &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; result.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I estimated it to be between 4 and 10 characters.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Relationship
&lt;/h1&gt;

&lt;p&gt;Now that we have the basic information straightened out, let's see how this helps us. Let us calculate the total number of possible combinations.&lt;/p&gt;

&lt;p&gt;So far, we have established the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Minimum password length : 4
Maximum password length : 10
Size of character &lt;span class="nb"&gt;set&lt;/span&gt; : 95
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The relationship between the two is described by this equation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_YvIpiCs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/FPip4mE.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_YvIpiCs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/FPip4mE.png" alt="Character Set" width="800" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For each character in the password you have 95 possibilities.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;95 x 95 x 95 x 95 &lt;span class="o"&gt;=&lt;/span&gt; 81,450,625 possible combinations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That means for a 4 characters password, you have 81 million possible combinations. For a password with 5 characters the total number of combinations is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;95 x 95 x 95 x 95 x 95 &lt;span class="o"&gt;=&lt;/span&gt; 7,737,809,375 possible combinations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can obviously also calculate the number of combinations for a 6, 7, 8, 9 or 10 character password - if it interests you, do go ahead and calculate it.&lt;/p&gt;

</description>
      <category>security</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
