Decrypt Firefox 3.5 and 3.6 stored passwords in C | Source Code | Application


If you have already decrypted passwords for Firefox 1, 2 and 3 (if you need them, it’s here), here is the source code in C that helps you decrypt Firefox passwords for version 3.5 and 3.6!  This source code is written by ZeR0 from HackHound.org.  This source code is generally open source by the author but the terms of use is to give credits if you use it.

Download source code here (link removed).
Download binary / application here (link removed).

Decrypting sophisticated ciphers


There was once where i was stucked looking for a site which contains all the encryption and decryption process for most of the common available encryption algorithm.  I recently found it from a tutorial on HackForums and thought of sharing it here as well as keeping it close to myself.  Although it is common on HackForums i don’t hang around there much though so i kind of forgot the site.

http://www.crypo.com/ is the website to all your cryptography needs.

Binary to Hex Converter


This source code below converts a text file with binaries into a text file with hexadecimals. Imagine we have a file of binaries called “hello.bin”, we are going to convert it into hexadecimals and write it into a file called “hello.com”.

hello.bin

10110100 00001001
10111010 00001001 00000001
11001101 00100001
11001101 00100000
01101000 01100101 01101100 01101100 01101111 00100100

Concept (in terms of ASM)

mov ah,09
mov dx,0109
int 21
int 20
db "hello$"

hello.com

B4 09 BA 09 01 CD 21 CD 20 68 65 6C 6C 6F 24

where you can see how the binaries, hexadecimals and ASM are linked.

10110100 = B4 = mov ah
00001001 = 09 = 09

What “hello.com” does when ran is it prints the word “hello” and exits. Generally this code is a converter but it has given me a further insight of what assembly would look like and how the machine language works now. The source code is as below and it is done in C language (but you would need to write the filename as .cpp instead of .c since the program was not programmed according the C proper structure whereby it should be defining variables before statements).

Source code

#include <stdio.h>
#include <stdlib.h>

void help(char* fname) {
    printf(
        "Code programs in binary - by Jakash3\n"
        "Usage: %s outfile infile"
        "Notes:\n"
        "   infile = Text file containing ascii 1's and 0's.\n"
        "            8 bits per byte, all other characters\n"
      "            and whitespace ignored.\n"
        "   outfile = Name of program to create and write to.\n",
        fname
    );
    exit(1);
}

int main(int argc, char** argv) {
    if (argc!=3) help(argv[0]);
    FILE *dst, *src;
    dst = fopen(argv[1],"wb");
    if (!dst) { printf("Could not create or truncate %s\nQuitting...",argv[1]); return 1;}
    src = fopen(argv[2],"r");
    if (!src) { printf("Could not open %s\nQuitting...",argv[2]); return 1;}
    char c, byte=0;
    int i=0, count=0;
    while (!feof(src)) {
        if (i==8) { fwrite(&byte,1,1,dst); byte=0; i=0; count++; }
        fread(&c,1,1,src);
        switch (c) {
            case '1':
                byte |= ((c=='1') << (7-i));
            case '0':
                i++;
        }
    }
    fclose(src);
    if (!fclose(dst))
        printf("Wrote %d bytes to %s\n",count,argv[1]);
    return 0;
}

Download binary (.exe).

This code was written by jakash3 from Leetcoders.org
* Original link here.

Cryptography | Caesar | Vigenere | Vernam | Columnar


A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5

Always remember that the character A-Z starts from 0 and ends at 25 and not from 1 to 26!

Caesar cipher

Alright i am pretty sure we all know that we move it forward by 3 characters. So to encrypt the character A (or numeric 0) + 3 would be D (or numeric 3).  Caesar cipher reference.

Look into some Caesar and Rot13 source codes (C language) here.

Vernam cipher

Basically this is simple, it is taught to convert that character A-Z into numeric 0-25 and add them with a random number and mod it into 26 and we get it right? So the formula should be something like the code below for encryption process.

Ci = Pi + Ri (mod 26)

C = Cipher Text
P = Plain Text
R = Random

Note that what was taught in the class was not complete. A vernam cipher generally requires the length of the original data and the length of the key to be the same. We were given an example of an image below.

Generally the example is not wrong but there would be no decryption process possible here. As we have only 26 characters in the alphabetical table and the key 105 appeared, the encryption process made decryption impossible. However as the lecturer has mentioned we are only concerned about encrypting the plain text only, so remember the encryption algorithm.

Vigenere cipher

Vigenere cipher is not that hard to encrypt and decrypt. For your information, looking into alphabetic table is not a necessary tool. A cipher always exists with an algorithm (as far as i’m concerned, i might not be right). Be amazed with vigenere cipher’s algorithm.

Ci = Pi + Ki (mod 26)
Pi = Ci - Ki (mod 26)

P = Plain Text
K = Key
C = Cipher Text

If you’re having calculation problem with this, please do post it as a comment so i could help. It’s quite a hassle to do all of them in an example. However you can see that to encrypt the character A with the key L it would be A + L = 0 + 11 = 11 (L).  You may also see that Vigenere cipher and Vernam cipher is pretty much the same thing, only that the reason they were made for was different.

Columnar cipher

T h i s i
s a m e s
s a g e

From the above, “This is a message” was written in a 5 x 3 block. All you have to do in order to encrypt using columnar cipher is to place them in x * y block whereby x is 5 and y would end when the message to encrypt ends. After that read the text from top to bottom, left to right to get the cipher text. The message encrypted would be “tssha aimgs eeis”.

This post was made to aid those that have cryptography problem which was related to an exam for my subject.

Caesar and Rot Cipher Source Code


Ever wanted a portable caesar cipher and decipher at one go? At the end of this post you will find the binary as well as the source code (built in C) for the application. Below is an image of the application testing on “abcdefgh” text.  At [+13] you can see that it is equivalent to ROT13 cipher.  For those that are familiar with command line, use application.exe “text here”.

/*
 * url:   https://genesisdatabase.wordpress.com
 * email: genesisdatabase@gmail.com
 *
 * This source code is free to be used by any programmers
 * Source code converts all uppercase to lowercase during decryption
 * Supports command line usage, use text as argument eg. crack.exe "abcdef"
 */

#include <stdio.h>
#include <string.h>
//#include <stdlib.h> /*include if using system()*/

void DecryptCaesar(char *Encrypted)
{
	char i;
	int j;

	Encrypted = strlwr(Encrypted); /*supports only lowercase*/
	//system("REM"); /*use this to copy paste in windows*/

	printf(" Caesar Cipher\n\n");
	for(i = 0 ; i < 27 ; i++)
	{
		printf(" [+%d]\t", i);
		for(j = 0 ; j < (signed)strlen(Encrypted) ; j++)
		{
			if(Encrypted[j] == ' ')
				printf(""); /*replace "" with " " if you prefer to preserve spacing*/
			else if(Encrypted[j] < 'a' || Encrypted[j] > 'z')
				printf("%c", Encrypted[j]); /*preserved non-alphabets*/
			else if(Encrypted[j] + i > 'z')
				printf("%c", Encrypted[j] + i - 26);
			else
				printf("%c", Encrypted[j] + i);
		}

		if(i == 13)
			printf(" (ROT)");

		printf("\n");
		if(i == 25)
		{
			printf(" ");
			for(j = 0 ; j < (signed)strlen(Encrypted) + 8 ; j++)
				printf("-");

			printf("\n");
		}

	}
	printf("\n");
}
int main(int argc, char **argv)
{
	char string[64 +1] = {'\0'};

	if(argc == 2)
	{
		strncpy(string, argv[1], 64);
		printf("\n");
		DecryptCaesar(string);
		return 0;
	}

	for( ; ; )
	{
		printf("\n Enter a text to encrypt/decrypt (EXIT to quit): ");

		fflush(stdin);		/*windows*/
		//fpurge(stdin);	/*linux*/

		scanf("%64[^\n]", string);

		if(string[0] == 'E' && string[1] == 'X' && string[2] == 'I' && string[3] == 'T' && string[4] == '\0')
			break;

		printf("\n\n");
		DecryptCaesar(string);
	}

	printf("\n Thanks for using...\n");
	return 0;
}

Download Binary
Download Source Code