Path: blob/master/InstagramPy/InstagramPyConfigurationCreator.py
197 views
# The MIT License.1# Copyright (C) 2017 The Future Shell , DeathSec.2#3# @filename : InstagramPyConfigurationCreator.py4# @description : Create a Configuration file for Instagram-Py with ease.5import os6import json7from .colors import *8910class InstagramPyConfigurationCreator:11config_path = None12default_config = {13"api-url": "https://i.instagram.com/api/v1/",14"user-agent": "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)",15"ig-sig-key": "4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178",16"ig-sig-version": "4",17"tor": {18"server": "127.0.0.1",19"port": "9050",20"protocol": "socks5",21"control": {22"password": "",23"port": "9051"24}25}26}2728def __init__(self, path):29self.config_path = path3031'''32create():33- Simply Creates a Configuration with the default settings.34'''3536def create(self):37with open(self.config_path, 'w') as f:38json.dump(self.default_config, f)39print("{}Written Configuration at {}{}".format(40Style.BRIGHT, self.config_path, Style.RESET_ALL))41return True4243def easy_create(self):44tor_server_ip = None45tor_port = None46tor_control_port = None47tor_control_password = None48print("{}Welcome to Instagram-Py Configuration Creator!{}".format(Style.BRIGHT, Style.RESET_ALL))49tor_server_ip = input("{}Tor Server IP(default=[Press Enter]):: {}"50.format(Style.BRIGHT + Fore.MAGENTA, Style.RESET_ALL))51tor_port = input("{}Tor Server Port(default=[Press Enter]):: {}"52.format(Style.BRIGHT + Fore.MAGENTA, Style.RESET_ALL))53tor_control_port = input("{}Tor Control Port(default=[Press Enter]):: {}"54.format(Style.BRIGHT + Fore.MAGENTA, Style.RESET_ALL))55tor_control_password = input("{}Tor Authentication Password(default=[Press Enter]):: {}"56.format(Style.BRIGHT + Fore.MAGENTA, Style.RESET_ALL))5758print("{}Writing Configuration...{}".format(59Style.BRIGHT, Style.RESET_ALL))6061if tor_server_ip is not '':62self.default_config['tor']['server'] = tor_server_ip63if tor_port is not '':64self.default_config['tor']['port'] = tor_port65if tor_control_port is not '':66self.default_config['tor']['control']['port'] = tor_control_port67if tor_control_password is not '':68self.default_config['tor']['control']['password'] = tor_control_password6970with open(self.config_path, 'w') as f:71json.dump(self.default_config, f)7273print("{}Written Configuration at {}{}".format(74Style.BRIGHT, self.config_path, Style.RESET_ALL))75return True767778