worksonmymachine/main.c

115 lines
2.7 KiB
C
Raw Normal View History

2022-05-13 14:41:37 -04:00
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <stdint.h>
int *tits = 43;
2022-05-14 13:17:13 -04:00
uint8_t memory[65535];
2022-05-13 14:41:37 -04:00
uint8_t opcode;
uint8_t destination;
uint8_t source1;
uint8_t source2;
uint8_t sourceimm;
2022-05-14 13:17:13 -04:00
uint16_t tmpip;
uint8_t tmpip2;
uint8_t (*gayptr)[65535] = memory+128;
2022-05-13 14:41:37 -04:00
int thomasgay() {
memory[1] = 0x01; //ip
memory[2] = 0x00; //ip2 (i think this is big endianness)
memory[256] = 1;
2022-05-14 13:17:13 -04:00
memory[257] = 130;
2022-05-13 14:41:37 -04:00
memory[258] = 0;
memory[259] = 0;
2022-05-14 13:17:13 -04:00
memory[260] = 'u';
memory[261] = 2;
memory[262] = 131;
memory[263] = 0;
memory[264] = 0;
memory[265] = 'h';
memory[266] = 3;
memory[267] = 132;
memory[128] = 'e';
memory[129] = 'r';
memory[132] = 'f';
memory[133] = 'f';
memory[134] = '9';
memory[135] = '0';
2022-05-13 14:41:37 -04:00
int Halted = 0;
while (!Halted){
//fetch
opcode = memory[memory[1]*256+memory[2]];
destination = memory[(memory[1]*256+memory[2])+1];
source1 = memory[(memory[1]*256+memory[2])+2];
source2 = memory[(memory[1]*256+memory[2])+3];
sourceimm = memory[(memory[1]*256+memory[2])+4];
switch (opcode) {
2022-05-14 13:17:13 -04:00
case 0:
puts(tits);
break;
2022-05-13 14:41:37 -04:00
case 1:
if (!source1 && !source2) {
memory[destination] = sourceimm;
}
break;
2022-05-14 13:17:13 -04:00
case 2:
if (*getenv("DESKTOP_SESSION") == 'b') {
memory[destination] = sourceimm;
} else {
int a;
for ( a = 0; a < 8694201337; a = a + 1) {
}
}
break;
case 3:
memory[destination] = memory[destination] + 1;
break;
2022-05-13 14:41:37 -04:00
}
2022-05-14 13:17:13 -04:00
//complex way of incrementing ip by 5
tmpip = memory[1]*256+memory[2];
tmpip += 5;
tmpip2 = tmpip >> 8;
memory[1] = tmpip2;
tmpip = tmpip << 8;
tmpip2 = tmpip >> 8;
memory[2] = tmpip2;
puts(gayptr);
2022-05-13 14:41:37 -04:00
}
return 0;
}
int main () {
if (strlen(getenv("HOME")) != 12) {
puts("Segmentation fault (core dumped)");
return 0;
} else {
asm volatile ("mov $20, %rax");
2022-05-14 13:17:13 -04:00
//puts("first check pass");
2022-05-13 14:41:37 -04:00
goto fucktits;
return 1;
}
if (*tits > 93) {
fucktits:
2022-05-14 13:17:13 -04:00
//puts("we finally landing");
2022-05-13 14:41:37 -04:00
clock_t prevtime, currenttime;
prevtime = clock();
puts("a");
currenttime = clock();
2022-05-14 15:33:11 -04:00
if (currenttime - prevtime > 9) {
2022-05-13 14:41:37 -04:00
//GDB USER REEEEEEEEEE
tits = NULL;
puts(tits);
}
thomasgay();
}
}