This commit is contained in:
2025-12-15 13:31:12 +01:00
commit 26e0102f58
10165 changed files with 233472 additions and 0 deletions

12
2/Basics3/README Normal file
View File

@@ -0,0 +1,12 @@
Welcome to basics3!
-----
We encrypted the flag, but we lost our decryption routine.
We only remember the key we used: 02723
You will find the encryption software in your home directory.
Can you recover the flag?
Hints
-----
Code may do weird things, you don't have to understand all of it if you
can calculate the same result or the input for some result (without knowing exactly what happens).

BIN
2/Basics3/a.out Executable file

Binary file not shown.

BIN
2/Basics3/challenge Executable file

Binary file not shown.

3
2/Basics3/flag.enc Normal file
View File

@@ -0,0 +1,3 @@
2c 1d 5d b1 67 85 0f 52 69 93 1c 2d 79 f0 4b c2
64 bd 0f da 95 88 16 0c 2f 5e 9e 68 ee f4 1e b6
b8 a7 7d 43 a8 00 51 c4 fe 54 10 26 f1 d3 2b

53
2/Basics3/test.c Normal file
View File

@@ -0,0 +1,53 @@
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
char test[] = "hacklab{ ";
unsigned int start_key=2723;
//paste flag.enc here (add ", 0x")
char text[] = {0x2c, 0x1d, 0x5d, 0xb1, 0x67, 0x85, 0x0f, 0x52, 0x69, 0x93, 0x1c, 0x2d, 0x79, 0xf0, 0x4b, 0xc2, 0x64, 0xbd, 0x0f, 0xda, 0x95, 0x88, 0x16, 0x0c, 0x2f, 0x5e, 0x9e, 0x68, 0xee, 0xf4, 0x1e, 0xb6, 0xb8, 0xa7, 0x7d, 0x43, 0xa8, 0x00, 0x51, 0xc4, 0xfe, 0x54, 0x10, 0x26, 0xf1, 0xd3, 0x2b};
typedef uint8_t byte;
byte scramble_key(unsigned int *key_input){
*key_input = (*key_input * 0x41c64e6d + 0x3039) % 0x80000000;
return *(byte *)((long)key_input + 3) ^
(byte)*key_input ^ *(byte *)((long)key_input + 1) ^ *(byte *)((long)key_input + 2);
}
void encrypt(uint32_t key,char *text,ulong len)
{
byte bVar1;
uint32_t local_1c [4];
int i;
local_1c[0] = key;
for (i = 0; (ulong)(long)i < len; i = i + 1) {
bVar1 = scramble_key(local_1c);
text[i] = bVar1 ^ text[i];
text[i] = text[i] + 'O';
}
return;
}
void decrypt(uint32_t key,char *text,ulong len)
{
byte bVar1;
uint32_t local_1c [4];
int i;
local_1c[0] = key;
for (i = 0; (ulong)(long)i < len; i = i + 1) {
bVar1 = scramble_key(local_1c);
text[i] = text[i] - 'O';
text[i] = bVar1 ^ text[i];
}
return;
}
int main(int argc, char** args){
decrypt(start_key, text, sizeof(text));
for(uint8_t i=0; i<sizeof(text); i++)
printf("%c", text[i]);
}