summaryrefslogtreecommitdiff
path: root/ini/gen_ini_file.py
blob: acf078dfd76c3e2259dc52284f0f0c63bf129e4c (plain)
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
import base64
from random import randint

MAX_LINES = 12

def random_line():
    num = randint(0, 99999999);
    keyb64 = base64.b64encode(bytes(ascii(num), encoding="ASCII")) # i have no idea
    key = str(keyb64, encoding="utf8")
    key = key[:len(key)-2]

    valueb64 = base64.b32encode(bytes(ascii(num), encoding="ASCII")) # yeah
    value = str(valueb64, encoding="utf8")
    value = value[:len(value)-3]
    return key + "=" + value + "\n"

def random_section():
   num = randint(0, 99999999);
   secb64 = base64.b64encode(bytes(ascii(num), encoding="ASCII"))
   sec = str(secb64, encoding="utf8")
   return '[' + sec[:len(sec)-2] + ']\n'

f = open("random.ini", "w")

lines = 0

f.write(random_section())
while(lines <= MAX_LINES):
    if randint(0, 5) == 1:
        f.write('\n')
        f.write(random_section())
    f.write(random_line())
    lines += 1

f.close()