Skip to content

Instantly share code, notes, and snippets.

@kaityo256
Created July 14, 2015 06:27
Show Gist options
  • Save kaityo256/84ecf0f2855ca474135d to your computer and use it in GitHub Desktop.
Save kaityo256/84ecf0f2855ca474135d to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int
main(void) {
const int n = 94;
const char p[8] = {0, 0, 0, 0, 0, 0, 0, 0};
const char *ans = "~~~~!!!!";
char c_ans[256];
strcpy(c_ans, crypt(ans, "AA"));
char pass[9];
pass[8] = NULL;
for (int i = 0; i < 8; i++) {
pass[i] = 33;
}
for (int i1 = 0; i1 < n; i1++) {
for (int i2 = 0; i2 < n; i2++) {
for (int i3 = 0; i3 < n; i3++) {
for (int i4 = 0; i4 < n; i4++) {
pass[0] = 33 + i1;
pass[1] = 33 + i2;
pass[2] = 33 + i3;
pass[3] = 33 + i4;
if (strcmp(c_ans, crypt(pass, "AA")) == 0) {
printf("Match: password = %s\n", pass);
exit(1);
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment