From 238eb8617eb3456a27075ffb5a512a60afc002f2 Mon Sep 17 00:00:00 2001 From: Paul Makles <paulmakles@gmail.com> Date: Sun, 13 Oct 2019 20:31:09 +0100 Subject: [PATCH] Extra obfuscation --- j.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/j.c b/j.c index 8ff9b5d..19b9dff 100644 --- a/j.c +++ b/j.c @@ -2,31 +2,40 @@ #include <stdio.h> #include <string.h> -void deny() { +void deny(unsigned int r, unsigned int l) { printf("Access denied!\n"); } -void victory() { +void victory(unsigned int r, unsigned int l) { char alpha[36] = "abcdefghijklmnopqrstuvwxyz0123456789"; int target[11] = { 26, 20, 19, 26, 5, 1, 26, 20, 13, 3, 18 }; printf("Flag: "); - for (int i=0;i<11;i++) - printf("%c", alpha[target[i]]); + for (int i=0;i<11;i++) { + if (((unsigned long) *victory) >> 32 == l) { + if ((unsigned int) *victory == r) { + printf("%c", alpha[target[i]]); + } else { + printf("%c", alpha[target[i] - 1] + 5); + } + } else { + printf("%c", alpha[target[i] + 1] - 5); + } + } printf("\n"); } int main() { char name[4]; - void (*ptr)() = *deny; + void (*ptr)(unsigned int r, unsigned int l) = *deny; printf("I heard you should be at 0x%lx\n", (unsigned long) *victory); printf("Enter the secret code [4 chars]: "); gets(name); - (*ptr)(); + (*ptr)(*ptr, ((unsigned long) *ptr) >> 32); return 0; } \ No newline at end of file -- GitLab