Mercurial > codedump
annotate win95kg.c @ 96:d2e0edd4a070
Update kemonopartydownloader.py
committer: GitHub <noreply@github.com>
author | Paper <37962225+mrpapersonic@users.noreply.github.com> |
---|---|
date | Sun, 07 Aug 2022 11:57:09 -0400 |
parents | 96b9e046f45d |
children |
rev | line source |
---|---|
64 | 1 /** |
2 * Windows 95 Keygen - 4/23/2022 | |
3 * By Paper | |
4 * a "rewrite" of my C++ app to vanilla C | |
5 * truth be told, most of it was C already | |
6 * | |
7 * skaven is awesome!! | |
8 **/ | |
9 #include <stdio.h> | |
10 #include <stdlib.h> | |
11 #include <math.h> | |
12 #include <time.h> | |
13 #include <string.h> | |
14 #define CONCAT_INTS(x, y) \ | |
15 x * pow(10, log10(y)+1) + y; | |
16 | |
17 int get_sum(int n) { | |
18 int sum; | |
19 for (sum = 0; n > 0; sum += n % 10, n /= 10); // copied this from google. sorry not sorry | |
20 return sum; | |
21 } | |
22 | |
23 int win95_nt4_prefix() { | |
24 int num = rand() % 1000; | |
25 while ((num == 333) || (num == 444) || (num == 555) || (num == 666) || (num == 777) || (num == 888) || (num == 999) || ((num % 3) != 0)) { | |
26 num = num + 1; | |
27 } | |
28 return num; | |
29 } | |
30 | |
31 int win95_suffix() { | |
32 int first_digits, last_digit, second_segment = 5; | |
33 while (second_segment % 7 != 0) { | |
34 first_digits = rand() % 1000000; | |
35 last_digit = rand() % 10; | |
36 while ((last_digit == 0) || (last_digit >= 8)) { | |
37 last_digit = rand() % 10; | |
38 } | |
39 second_segment = CONCAT_INTS(first_digits, last_digit); | |
40 } | |
41 return second_segment; | |
42 } | |
43 | |
44 int office_prefix() { | |
45 int new_site = rand() % 1000; | |
46 int ez_pwned = new_site % 10 + 1; | |
47 while (ez_pwned >= 10) { | |
48 ez_pwned = ez_pwned - 10; | |
49 } | |
50 return CONCAT_INTS(new_site, ez_pwned); | |
51 } | |
52 | |
53 int oem_prefix() { | |
54 int years[] = { | |
55 95, | |
56 96, | |
57 97, | |
58 98, | |
59 99, | |
60 00, | |
61 01, | |
62 02, | |
63 03 | |
64 }; | |
65 return CONCAT_INTS(((rand() % 366) + 1), years[rand() % 9]); | |
66 } | |
67 | |
68 int oem_middle() { | |
69 int first_digits, last_digit, second_segment, sum = 1; | |
70 while (sum % 7 != 0) { | |
71 sum = 0; | |
72 first_digits = rand() % 10000; | |
73 last_digit = rand() % 10; | |
74 while ((last_digit == 0) || (last_digit >= 8)) { | |
75 last_digit = rand() % 10; | |
76 } | |
77 second_segment = CONCAT_INTS(first_digits, last_digit); | |
78 get_sum(second_segment); | |
79 } | |
80 return second_segment; | |
81 } | |
82 | |
83 int main(int argc, char* argv[]) { | |
92
96b9e046f45d
sranddev() for macs
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
64
diff
changeset
|
84 #ifndef __APPLE__ |
64 | 85 srand((unsigned) time(NULL)); // magic rand() stuff :p |
92
96b9e046f45d
sranddev() for macs
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
64
diff
changeset
|
86 #else |
96b9e046f45d
sranddev() for macs
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
64
diff
changeset
|
87 sranddev(); |
96b9e046f45d
sranddev() for macs
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
64
diff
changeset
|
88 #endif |
64 | 89 if (argc >= 2) { |
90 if (strcmp(argv[1], "--office") == 0) { | |
91 printf("%04d-%07d", office_prefix(), win95_suffix()); | |
92 return 0; | |
93 } else if (strcmp(argv[1], "--oem") == 0) { | |
94 printf("%05d-OEM-%07d-%05d", oem_prefix(), oem_middle(), (rand() % 100000)); | |
95 return 0; | |
96 } else if (strcmp(argv[1], "--normal") == 0) { | |
97 printf("%03d-%07d", win95_nt4_prefix(), win95_suffix()); | |
98 return 0; | |
99 } | |
100 } | |
101 printf("usage: %s [--normal] [--oem] [--office]", argv[0]); | |
102 return 0; | |
92
96b9e046f45d
sranddev() for macs
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
64
diff
changeset
|
103 } |