Last active
April 11, 2016 11:54
-
-
Save HarDToBelieve/3846bcbd2ef4f2fd64f72ebc0a9ef744 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc pwn1.c | |
#include <stdio.h> | |
#include <string.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#define maxlen 20 | |
int main () { | |
srand(time(0)); | |
int i; | |
char password[maxlen]; | |
char inp[1000]; | |
for (i=0; i<maxlen; ++i) | |
password[i] = (char)(( rand() % 93 ) + 33); | |
puts("password:"); | |
scanf("%s", inp); | |
if ( !strncmp(inp, password, strlen(inp)) ) | |
puts("You win!"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment