-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathgenerate_credentials_file.py
executable file
·38 lines (30 loc) · 1.14 KB
/
generate_credentials_file.py
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
#!/usr/bin/env python3
import argparse
import yaml
import os
import sys
from kik_unofficial.utilities.credential_utilities import random_device_id, random_android_id
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-o", "--output", default="creds.yaml", help="Name of output credentials file")
parser.add_argument("-u", "--username", required=True, help="Kik username")
parser.add_argument("-p", "--password", help="Kik password (optional)")
parser.add_argument("-n", "--node", help="Kik node (optional)")
args = parser.parse_args()
if os.path.exists(args.output):
raise Exception(f"Output file {args.output} already exists!")
file_obj = {
"device_id": random_device_id(),
"android_id": random_android_id(),
"username": args.username,
}
if args.password:
file_obj["password"] = args.password
if args.node:
file_obj["node"] = args.node
with open(args.output, "w") as f:
f.write(f"# Auto-generated by {sys.argv[0]}\n")
yaml.dump(file_obj, f)
print(f"Wrote credentials to {args.output}")
if __name__ == "__main__":
main()