commit cfc59b958f7a0217c555be8be19de3406f689d9d
parent c1a3321494b39ddd657683bfba60af1a12cb0b21
Author: Michael Constantine Dimopoulos <mk@mcdim.xyz>
Date: Thu, 17 Feb 2022 23:19:44 +0000
Updated to v2.1
Diffstat:
3 files changed, 61 insertions(+), 32 deletions(-)
diff --git a/README.md b/README.md
@@ -10,9 +10,5 @@ cd jack/ && sudo make install
Read the manpage for more information
```
-man extra/manpage.1
-```
-or
-```
man jack
```
diff --git a/extra/manpage.1 b/extra/manpage.1
@@ -1,13 +1,12 @@
.\" Manpage for Blackjack
-.TH man 8 "03 Apr 2021" "2.0" "Blackjack21 manual page"
+.TH man 8 "03 Apr 2021" "2.1" "Blackjack21 manual page"
.SH NAME
-Blackjack21 \- Minimal password cracking utility
+Blackjack21 \- small password cracking program
.SH SYNOPSIS
jack [HASH-TYPE] [HASH] [DICTIONARY] [OPTIONS]
.SH DESCRIPTION
-Blackjack21 is a minimal offline password cracking utility. It uses a dictionary to compare the hash output of its lines to the hash provided by the user.
-Current version: 2.0
+Blackjack21 is a minimal password cracking utility.
.B
Supported Hashes:
@@ -22,7 +21,7 @@ SHA512
.SH OPTIONS
--v Verbose (not recommended)
+-v verbose (not recommended)
.SH EXAMPLES
.IP \[bu] 2
@@ -41,4 +40,4 @@ Michael Constantine Dimopoulos https://mcdim.xyz
Houndsniff https://mcdim.xyz/projects/hs.html
.SH LICENSE
-GNU Public License 3.0 (GPL-3.0)
+GNU Public License 3.0+ (GPL-3.0+)
diff --git a/jack/jack.cpp b/jack/jack.cpp
@@ -1,15 +1,13 @@
#include <iostream>
+#include <time.h>
#include <cstdio>
-/* BLACKJACK21
- * jack.cpp
- */
+/* blackjack21 */
#include <string>
#include <cstring>
#include <fstream>
-/* Hash Libraries */
#include "lib/md5.h"
#include "lib/sha1.h"
#include "lib/sha256.h"
@@ -22,19 +20,20 @@ bool verbose;
void crack(string hash, string file, int alg);
void
-interface(int f)
+interface(int f, char *exename)
{
- printf( "BlackJack21 Minimal Password Cracking program v2.0\n"
- "Written by MCD (aka mk) - 2017\n\n");
+ printf( "BlackJack21 - small password cracking program v2.1\n"
+ "MCD, 2017\n\n");
if (f == 1)
- printf( "Supported: MD5, SHA1, SHA256, SHA512\n\n"
- "Usage: ./jack [HASH-TYPE] [HASH] [DICTIONARY] [-v]\n");
+ printf( "Supported: md5, sha1, sha256, sha512\n\n"
+ "Usage: %s [HASH-TYPE] [HASH] [DICTIONARY] [-v]\n",
+ exename);
}
int
main(int argc, char* argv[])
{
- if(argc < 4) { interface(1);
+ if(argc < 4) { interface(1, argv[0]);
exit(0);
} else if(argc == 4 || argc == 5) {
string type = argv[1];
@@ -42,35 +41,59 @@ main(int argc, char* argv[])
string dict = argv[3];
std::ifstream file(dict);
if(file.is_open()) {
- if (argc == 5) {
+
+ if (argc == 5)
verbose = true;
- } else {
+ else
verbose = false;
- }
- interface(0);
- printf("Hashing algorithm: %s\nCracking\n\n", type);
+
+ interface(0, argv[0]);
+ cout <<"Hashing algorithm: " << type << "\nCracking...\n\n";
if (type == "MD5" || type == "md5") crack(hash, dict, 0);
else if(type == "SHA1" || type == "sha1") crack(hash, dict, 1);
else if(type == "SHA256" || type == "sha256") crack(hash, dict, 2);
else if(type == "SHA512" || type == "sha512") crack(hash, dict, 3);
} else {
- interface(1);
+ interface(1, argv[0]);
printf("File could not be found.\n");
exit(1);
}
} else {
- interface(1);
- exit(0);
+ interface(1, argv[0]);
}
+
+ exit(1);
+}
+
+int
+iterate(string filename)
+{
+ int tries = 0;
+ std::ifstream file(filename);
+ string pass;
+ while(file >> pass) {
+ tries++;
+ }
+
+ return tries;
}
void
crack(string hash, string filename, int alg)
{
+ int lines = iterate(filename);
int tries = 0;
std::ifstream file(filename);
string pass;
+
+ /* hide cursor */
+ printf("\e[?25l");
+
+ clock_t t;
+ t = clock();
+
while(file >> pass) {
+
tries++;
string hash_sum = "";
@@ -80,12 +103,23 @@ crack(string hash, string filename, int alg)
else if (alg == 3) hash_sum = sha512(pass);
if (hash_sum == hash) {
- printf("\n\n[%d] - PASSWORD FOUND - %s\n\n", tries, pass);
+ cout << "\n\n[" << tries << "] - PASSWORD FOUND - " << pass << "\n\n";
+
+ t = clock() - t;
+ double time_taken = ((double)t) / CLOCKS_PER_SEC;
+ printf("Elapsed time: %fs\n", time_taken);
+
+ printf("\e[?25h");
exit(0);
} else {
- if (verbose == true) {
- printf("[%d] - Failed Attempt - %s\n", tries, pass);
- }
+ if (verbose == true)
+ cout << "[" << tries << "] - Failed attempt - " << pass << endl;
+ else
+ printf("\rTried %d of %d lines", tries, lines );
}
}
+ t = clock() - t;
+ double time_taken = ((double)t) / CLOCKS_PER_SEC;
+ printf("Elapsed time: %.2fs\n", time_taken);
+ printf("\e[?25h");
}