~alienagain/Stix_stuff

3959dbdee64c63da04021d5158d00e67a7a58faa — terceranexus6 1 year, 1 month ago d21c0e4
the uuid generator uses uuid library
1 files changed, 6 insertions(+), 17 deletions(-)

M from_csv/create_id.py
M from_csv/create_id.py => from_csv/create_id.py +6 -17
@@ 1,21 1,10 @@
import random
import string
import sys
import uuid

def create_id(itype):
    # lenghts for generating random strings for the id
    l1 = 8
    l2 = 4
    l3 = 12
# use uuid format! very important to avoid issues
myuuid = uuid.uuid4()

    chars = string.ascii_letters + string.digits
    random_string_1 = ''.join(random.choice(chars) for i in range(l1))
    random_string_2 = ''.join(random.choice(chars) for i in range(l2))
    random_string_3 = ''.join(random.choice(chars) for i in range(l2))
    random_string_4 = ''.join(random.choice(chars) for i in range(l2))
    random_string_5 = ''.join(random.choice(chars) for i in range(l3))
# type could be malware, indicator, etc
type_ = sys.argv[1]

    print(itype+"--"+random_string_1+"-"+random_string_2+"-"+random_string_3+"-"+random_string_4+"-"+random_string_5)

# read argument from command to check the type
create_id(str(sys.argv[1]))
print(type_+"--"+str(myuuid))