@Mosrod/

HackathonSubmission

Python

No description

fork
loading
Files
  • main.py
  • serial.txt

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.8436020011597753","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IHN0cmluZwppbXBvcnQgcmFuZG9tCgoKZGVmIGlkX2dlbmVyYXRvcihzaXplPTE2LCBjaGFycz1zdHJpbmcuYXNjaWlfdXBwZXJjYXNlICsgc3RyaW5nLmRpZ2l0cyk6CiAgICByZXR1cm4gJycuam9pbihyYW5kb20uY2hvaWNlKGNoYXJzKSBmb3IgXyBpbiByYW5nZShzaXplKSkKCgpwcmludCgiTGljZW5jZSBLZXkgR2VuIikKbGVuZ3RoID0gaW50KGlucHV0KCJMZW5ndGg6ICIpKSAgIyBMZW5ndGgKY2hzID0gaW50KGlucHV0KCJDaGFyL1NlY3Q6ICIpKSAgIyBDaGFyL1NlY3Qgb3IgQ2hhcmFjdGVycy9TZWN0aW9uCmFtb3VudCA9IGludChpbnB1dCgiQW1vdW50OiAiKSkgICMgQW1vdW50CmZvciBpIGluIHJhbmdlKGFtb3VudCk6CiAgICBJRCA9IGlkX2dlbmVyYXRvcihzaXplPWxlbmd0aCkKICAgICMgcHJpbnQoaW50KGxlbmd0aCAvIGNocykpCiAgICBib3ggPSBpbnQobGVuZ3RoIC8gY2hzKQogICAgaWYgY2hzID4gbGVuZ3RoOiAgIyBJZiBMZW5ndGggPCBDaGFyL1NlY3QsIEV4aXQKICAgICAgICBwcmludCgiTGVuZ3RoIGlzIExlc3MgdGhhbiBDaGFyL1NlY3QiKQogICAgICAgIGV4aXQoKQogICAgaWYgbGVuZ3RoIC8gY2hzID09IDE6ICAjIElmIExlbmd0aCA9IENoYXIvU2VjdCwgRXhpdAogICAgICAgIHByaW50KCJMZW5ndGggaXMgRXF1YWwgdG8gQ2hhci9TZWN0IikKICAgICAgICBleGl0KCkKICAgIGNoZWNrID0gbGVuZ3RoICUgY2hzCiAgICAjIHByaW50KCJDSEs6ICIsIHN0cihjaGVjaykpCiAgICBpZiBjaGVjayA+IDA6ICAjIElmIExlbmd0aC9DaHMgaXMgbm90IGEgRnVsbCBOdW1iZXIsIEV4aXQKICAgICAgICBwcmludCgiTGVuZ3RoIGlzIE5vdCBEaXZpc2libGUgYnkgQ2hhci9TZWN0IikKICAgICAgICBleGl0KCkKICAgIGkgPSAxCiAgICBsZW50byA9IDEKICAgIGlmIGxlbnRvID4gMCBhbmQgYm94ICE9IGxlbmd0aDoKICAgICAgICB3aGlsZSBpIDwgbGVuZ3RoIGFuZCBsZW50byA+IDA6CiAgICAgICAgICAgICMgcHJpbnQoIklPOiAiLCBsZW5ndGggLSAoYm94ICogaSkpCiAgICAgICAgICAgIGxlbnRvID0gbGVuZ3RoIC0gKGNocyAqIGkpCiAgICAgICAgICAgIGkgKz0gMQogICAgICAgICAgICBJRCA9IElEWzpsZW50b10gKyAnLScgKyBJRFtsZW50bzpdCiAgICAgICAgSUQgPSBJRFsxOl0KICAgICAgICBwcmludChJRCkKCiAgICBpZiBib3ggPT0gbGVuZ3RoOgogICAgICAgIHdoaWxlIGkgPCAobGVuZ3RoICsgMSk6CiAgICAgICAgICAgIGkgKz0gMQogICAgICAgICAgICBsZW5nID0gbGVuZ3RoIC0gaQogICAgICAgICAgICBJRCA9IElEWzpsZW5nXSArICctJyArIElEW2xlbmc6XQogICAgICAgIElEID0gSURbMTpdCiAgICAgICAgcHJpbnQoSUQpCiAgICBlbHNlOgogICAgICAgIHBhc3MKCiAgICB0cnk6CiAgICAgICAgd2l0aCBvcGVuKCdzZXJpYWwudHh0JywgJ2EnKSBhcyBmOgogICAgICAgICAgICBmLndyaXRlKElEICsgJ1xuJykKICAgIGV4Y2VwdCBFeGNlcHRpb246CiAgICAgICAgdHJ5OgogICAgICAgICAgICB3aXRoIG9wZW4oJ3NlcmlhbC50eHQnLCAndycpIGFzIGY6CiAgICAgICAgICAgICAgICBmLndyaXRlKElEICsgJ1xuJykKICAgICAgICBleGNlcHQgRXhjZXB0aW9uOgogICAgICAgICAgICBwYXNzCg=="},"asBuffer":null},"loaded":true}}
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
import string
import random


def id_generator(size=16, chars=string.ascii_uppercase + string.digits):
    return ''.join(random.choice(chars) for _ in range(size))


print("Licence Key Gen")
length = int(input("Length: "))  # Length
chs = int(input("Char/Sect: "))  # Char/Sect or Characters/Section
amount = int(input("Amount: "))  # Amount
for i in range(amount):
    ID = id_generator(size=length)
    # print(int(length / chs))
    box = int(length / chs)
    if chs > length:  # If Length < Char/Sect, Exit
        print("Length is Less than Char/Sect")
        exit()
    if length / chs == 1:  # If Length = Char/Sect, Exit
        print("Length is Equal to Char/Sect")
        exit()
    check = length % chs
    # print("CHK: ", str(check))
    if check > 0:  # If Length/Chs is not a Full Number, Exit
        print("Length is Not Divisible by Char/Sect")
        exit()
    i = 1
    lento = 1
    if lento > 0 and box != length:
        while i < length and lento > 0:
            # print("IO: ", length - (box * i))
            lento = length - (chs * i)
            i += 1
            ID = ID[:lento] + '-' + ID[lento:]
        ID = ID[1:]
        print(ID)

    if box == length:
        while i < (length + 1):
            i += 1
            leng = length - i
            ID = ID[:leng] + '-' + ID[leng:]
        ID = ID[1:]
        print(ID)
    else:
        pass

    try:
        with open('serial.txt', 'a') as f:
            f.write(ID + '\n')
    except Exception:
        try:
            with open('serial.txt', 'w') as f:
                f.write(ID + '\n')
        except Exception:
            pass