Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
deathsec
GitHub Repository: deathsec/instagram-py
Path: blob/master/InstagramPy/InstagramPyConfigurationCreator.py
197 views
1
# The MIT License.
2
# Copyright (C) 2017 The Future Shell , DeathSec.
3
#
4
# @filename : InstagramPyConfigurationCreator.py
5
# @description : Create a Configuration file for Instagram-Py with ease.
6
import os
7
import json
8
from .colors import *
9
10
11
class InstagramPyConfigurationCreator:
12
config_path = None
13
default_config = {
14
"api-url": "https://i.instagram.com/api/v1/",
15
"user-agent": "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)",
16
"ig-sig-key": "4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178",
17
"ig-sig-version": "4",
18
"tor": {
19
"server": "127.0.0.1",
20
"port": "9050",
21
"protocol": "socks5",
22
"control": {
23
"password": "",
24
"port": "9051"
25
}
26
}
27
}
28
29
def __init__(self, path):
30
self.config_path = path
31
32
'''
33
create():
34
- Simply Creates a Configuration with the default settings.
35
'''
36
37
def create(self):
38
with open(self.config_path, 'w') as f:
39
json.dump(self.default_config, f)
40
print("{}Written Configuration at {}{}".format(
41
Style.BRIGHT, self.config_path, Style.RESET_ALL))
42
return True
43
44
def easy_create(self):
45
tor_server_ip = None
46
tor_port = None
47
tor_control_port = None
48
tor_control_password = None
49
print("{}Welcome to Instagram-Py Configuration Creator!{}".format(Style.BRIGHT, Style.RESET_ALL))
50
tor_server_ip = input("{}Tor Server IP(default=[Press Enter]):: {}"
51
.format(Style.BRIGHT + Fore.MAGENTA, Style.RESET_ALL))
52
tor_port = input("{}Tor Server Port(default=[Press Enter]):: {}"
53
.format(Style.BRIGHT + Fore.MAGENTA, Style.RESET_ALL))
54
tor_control_port = input("{}Tor Control Port(default=[Press Enter]):: {}"
55
.format(Style.BRIGHT + Fore.MAGENTA, Style.RESET_ALL))
56
tor_control_password = input("{}Tor Authentication Password(default=[Press Enter]):: {}"
57
.format(Style.BRIGHT + Fore.MAGENTA, Style.RESET_ALL))
58
59
print("{}Writing Configuration...{}".format(
60
Style.BRIGHT, Style.RESET_ALL))
61
62
if tor_server_ip is not '':
63
self.default_config['tor']['server'] = tor_server_ip
64
if tor_port is not '':
65
self.default_config['tor']['port'] = tor_port
66
if tor_control_port is not '':
67
self.default_config['tor']['control']['port'] = tor_control_port
68
if tor_control_password is not '':
69
self.default_config['tor']['control']['password'] = tor_control_password
70
71
with open(self.config_path, 'w') as f:
72
json.dump(self.default_config, f)
73
74
print("{}Written Configuration at {}{}".format(
75
Style.BRIGHT, self.config_path, Style.RESET_ALL))
76
return True
77
78