Commit c38c3c85 authored by Margarita A. Cholokidi's avatar Margarita A. Cholokidi
Browse files

nobody loves penguins

parent c6baa81d
all:
chmod +x script.sh
./script.sh
clean:
rm fact.txt
rm multiplex.txt
#!/bin/bash
echo -n "Enter a num: "
read i
fact=$i
case $i in
0)
echo "Pls input smth not eq to 0"
;;
[1-9]|1[1-9])
echo>fact.txt
i=$((i-1))
while [ $i -gt 1 ]
do
echo "$fact*$i=$((fact*i))">>fact.txt
fact=$((fact*i))
i=$((i-1))
done
echo "Factorial is $fact"
;;
*)
echo "Multiplex table"
echo>multiplex.txt
for n in {1..10}
do
echo "$i * $n = $(($n * $i))"
echo "$((i * n))">>multiplex.txt
done
;;
esac
all:
gcc -o sha512 sha512.c -lcrypt -lssl
gcc -o md5 md5.c -lcrypto -lssl
sha512: sha512.c
gcc -o sha512 sha512.c -lcrypt -lssl
md5: md5.c
gcc -o md5 md5.c -lcrypto -lssl
clean:
rm sha512
rm md5
\ No newline at end of file
#include <stdio.h>
#include <string.h>
#include <openssl/md5.h>
#define A 97
#define Z 122
unsigned char ustinovs [] = {"8215e48bd370871e71a61118277b6876"};
unsigned char *passptr = ustinovs;
int equals(unsigned char *given, unsigned char *gen)
{
char tmp[MD5_DIGEST_LENGTH*2];
for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) {
sprintf(tmp + 2 * i, "%02x", gen[i]);
}
if (memcmp(given, tmp, MD5_DIGEST_LENGTH) == 0) return 0;
}
unsigned char lchange (unsigned char *array, int index, unsigned char *given) {
int a = (int)array[index];
if (a > Z) a = A - 1;
unsigned char hash[MD5_DIGEST_LENGTH];
a += 1;
array[index] = (unsigned char)a;
// for (int x=0; x < 6; x++) {
// printf("%c", array[x]);
// }
// printf ("\n");
if (equals(given, MD5(array, 6, hash)) == 0) {
printf("%s", "OK:");
for (int x=0; x < 6; x++) {
printf("%c", array[x]);
}
printf ("\n");
return 0;
}
}
int main() {
printf("%s %s \n", "MD5 hash to crack:", passptr);
unsigned char init [6] = {"``````"};
unsigned char *ptr = init;
int x = 5;
int FIN = 0;
for (int i = A; i <= Z; ++i) {
if (lchange(ptr, 0, passptr)== 0 || FIN == 1) break;
for (int i = A; i <= Z; ++i) {
if (lchange(ptr, 1, passptr)== 0 || FIN == 1) break;
for (int i = A; i <= Z; ++i) {
if (lchange(ptr, 2, passptr)== 0 || FIN == 1) break;
for (int i = A; i <= Z; ++i) {
if (lchange(ptr, 3, passptr)== 0 || FIN == 1) break;
for (int i = A; i <= Z; ++i) {
if (lchange(ptr, 4, passptr) == 0 || FIN == 1) break;
for (int i = A; i <= Z; ++i) {
if (lchange(ptr, 5, passptr) == 0) {
FIN = 1;
break;
}
}
}
}
}
}
}
return 0;
}
\ No newline at end of file
#include <stdio.h>
#include <string.h>
#include <openssl/sha.h>
#include <crypt.h>
#define A 97
#define Z 121
unsigned char PASS_SHA512 [] = {"$6$0yvtOtV9gO23XokQ$7LYogZk/NlxOer0OO7LZW6shvtXmfLMfCf0n.37fp5JpFebpU5u8Kh88O/uYVWM27p9YdmhjvtHO8uWs5QG.Y1"};
unsigned char *passptr = PASS_SHA512;
int equals(unsigned char *given, unsigned char *gen)
{
if (memcmp(given, gen, 107) == 0) return 0;
}
unsigned char lchange (unsigned char *array, int index, unsigned char *given) {
int a = (int)array[index];
if (a > Z) a = A - 1;
unsigned char hash[SHA512_DIGEST_LENGTH];
unsigned char salt[] = {"$6$0yvtOtV9gO23XokQ$"};
a += 1;
array[index] = (unsigned char)a;
// for (int x=0; x < 5; x++) {
// printf("%c", array[x]);
// }
// printf ("\n");
if (equals(given, crypt(array, salt)) == 0) {
printf("%s", "OK:");
for (int x=0; x < 5; x++) {
printf("%c", array[x]);
}
printf ("\n");
return 0;
}
}
int st1 (unsigned char *array, int x, int y) {
for (int i = A; i <= Z; ++i) {
if (lchange(array, (x - y), passptr) == 0) {
return 0;
break;
}
}
array[x - y] = (unsigned char)A;
}
int main() {
printf("%s %s \n", "SHA-512 hash to crack:", passptr);
unsigned char init [5] = {"uhq``"};
unsigned char *ptr = init;
int x = 4;
int FIN = 0;
for (int i = A; i <= Z; ++i) {
if (lchange(ptr, 0, passptr) == 0 || FIN == 1) break;
for (int i = A; i <= Z; ++i) {
if (lchange(ptr, 1, passptr) == 0 || FIN == 1) break;
for (int i = A; i <= Z; ++i) {
if (lchange(ptr, 2, passptr) == 0 || FIN == 1) break;
for (int i = A; i <= Z; ++i) {
if (lchange(ptr, 3, passptr) && st1(ptr, x, 0) == 0) {
FIN = 1;
break;
}
}
}
}
}
return 0;
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment