Skip to content

Instantly share code, notes, and snippets.

@7marcus9
Last active October 24, 2019 08:51
Show Gist options
  • Save 7marcus9/69ee56f94d825f223779587234719bba to your computer and use it in GitHub Desktop.
Save 7marcus9/69ee56f94d825f223779587234719bba to your computer and use it in GitHub Desktop.
void hello()
{
char name[?];
//__x86.get_pc_thunk.bx
puts("What's your name?");
fgets(&name, 0x20, stdin);
if(strchr(name, '%') && strchr(name, 'n')) exit(1);
printf("Hello ");
printf(name);
}
void login()
{
char password[?];
char passRand[?];
puts("Please enter the password");
fgets(&password, 0x40, stdin);
int fp = open("/dev/urandom", O_RDONLY);
if(fp == -1) exit(1);
read(fp, passRand, 0x10);
close(fp);
if(memcmp(password, passRand, 0x10))
{
puts("Shell for you :)");
system("false && /bin/sh");
}else{
puts("Sorry, wrong password");
}
}
int main()
{
setbuf(0, ?);
setbuf(0, ?);
hello();
login();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment