Skip to content

Instantly share code, notes, and snippets.

@HarDToBelieve
Last active April 11, 2016 11:54
Show Gist options
  • Save HarDToBelieve/3846bcbd2ef4f2fd64f72ebc0a9ef744 to your computer and use it in GitHub Desktop.
Save HarDToBelieve/3846bcbd2ef4f2fd64f72ebc0a9ef744 to your computer and use it in GitHub Desktop.
// 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