Skip to content

Instantly share code, notes, and snippets.

@tsalvia
Created March 31, 2019 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsalvia/29e61e40608dcf07468381f89ca9e5b7 to your computer and use it in GitHub Desktop.
Save tsalvia/29e61e40608dcf07468381f89ca9e5b7 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define XOR_PASSWORD "]pyyzJR}|qgt4" // Hello_Ghidra! xor 0x15
#define XOR_KEY 0x15
#define PASSWORD_LEN 13
int check_password(char *password)
{
char buf[PASSWORD_LEN];
int i;
if (strlen(password) != PASSWORD_LEN)
return -1;
for (i = 0; i < PASSWORD_LEN; i++)
buf[i] = password[i] ^ XOR_KEY;
if (strncmp(buf, XOR_PASSWORD, PASSWORD_LEN) != 0)
return -1;
return 0;
}
int main(int argc, char *argv[])
{
if (argc < 2) {
printf("Usage: %s <password>\n", argv[0]);
return -1;
}
if (check_password(argv[1]) < 0) {
printf("Incorrect password.\n");
return -1;
}
printf("Congratulations! flag{%s}\n", argv[1]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment