]> git.siccegge.de Git - frida/frida.git/blobdiff - samples/crypt/main.c
Add some simple samples for screenshots and similar stuff
[frida/frida.git] / samples / crypt / main.c
diff --git a/samples/crypt/main.c b/samples/crypt/main.c
new file mode 100644 (file)
index 0000000..773f0ea
--- /dev/null
@@ -0,0 +1,21 @@
+#define _GNU_SOURCE
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+
+int check(char * str) {
+       /* Ich bin der größte! */
+       static const char * correct = "TOgP5hrln1SAE";
+       printf("%s\n", crypt(str, "TOPSECRET"));
+       return ! strcmp(correct, crypt(str, "TOPSECRET"));
+}
+
+int main() {
+       char password[255];
+       printf("Password: ");
+       scanf("%s", password);
+       if (check(password))
+               printf("Success!\n");
+       else
+               printf("Failure!\n");
+}