-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 44baf95
Showing
3 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Instagram Hacks | ||
|
||
Watch Instagram story's and read Direct messages without getting marked as seen. This is can be achieved by using Mitmproxy that allows us to intercept HTTP traffic and tamper data, but in this example it's only blocking some internal API calls. | ||
|
||
## Installation | ||
|
||
* Install: | ||
|
||
```console | ||
# clone the repo | ||
$ git clone https://github.com/maleksal/instagram-hacks | ||
|
||
# install requirements | ||
$ python3 -m pip install -r requirements.txt | ||
|
||
``` | ||
|
||
* Configure system proxy settings: | ||
|
||
If you are using ubuntu, go settings > network > network proxy > click manual. Then in http proxy put 127.0.0.1 and http port 8080 | ||
|
||
* Install certificate: | ||
|
||
run main.py, then in your browser go to mitm.it download the certificate and follow the 2 steps instruction. | ||
|
||
* You're ready to go :). | ||
|
||
> full documentation of Mitmproxy is available [here](https://github.com/mitmproxy/mitmproxy) | ||
|
||
|
||
## Usage | ||
|
||
```console | ||
$ python3 main.py | ||
``` | ||
|
||
> use control-c to exit | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
from mitmproxy.options import Options | ||
from mitmproxy.proxy.config import ProxyConfig | ||
from mitmproxy.proxy.server import ProxyServer | ||
from mitmproxy.tools.dump import DumpMaster | ||
|
||
import threading | ||
import asyncio | ||
import time | ||
|
||
|
||
import re | ||
|
||
|
||
|
||
class InstagramDM(object): | ||
""" | ||
Leaves message as unseen by blocking the seen request. | ||
Leaves story as unseen by blocking the seen request. | ||
""" | ||
|
||
_targets = [ | ||
r"https://i.instagram.com/api/v1/direct_v2/threads/.*/items/.*/seen/", | ||
r"https://www.instagram.com/stories/reel/seen" | ||
] | ||
|
||
def match_url(self, url): | ||
""" | ||
Match url against target url | ||
""" | ||
coms = [ | ||
re.compile(url) for url in self._targets | ||
] | ||
return any([True if re.search(c_url, url) else False for c_url in coms]) | ||
|
||
def request(self, flow): | ||
"""Kill spesific request. | ||
""" | ||
|
||
if self.match_url(flow.request.pretty_url) and flow.request.method == "POST": | ||
print("Marked as unseen :)") | ||
flow.kill() | ||
|
||
|
||
|
||
class MitmClass: | ||
"""Lunch mitmproxy within python. | ||
""" | ||
def __init__(self, host, port, addons): | ||
|
||
self.options = Options( | ||
listen_host=str(host), | ||
listen_port=int(port), | ||
http2=True) | ||
|
||
self.mitm = DumpMaster( | ||
self.options, | ||
with_termlog=False, | ||
with_dumper=False) | ||
|
||
self.addons = addons | ||
self.config_server() | ||
|
||
def config_server(self): | ||
config = ProxyConfig(self.options) | ||
self.mitm.server = ProxyServer(config) | ||
self.mitm.addons.add(self.addons) | ||
|
||
|
||
def loop_in_thread(loop, m): | ||
asyncio.set_event_loop(loop) | ||
m.mitm.run_loop(loop.run_forever) | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
# setup | ||
mitm = MitmClass( | ||
host="127.0.0.1", | ||
port="8080", | ||
addons=InstagramDM() | ||
) | ||
|
||
# run mitm mproxy in backgroud | ||
loop = asyncio.get_event_loop() | ||
t = threading.Thread(target=loop_in_thread, args=(loop, mitm)) | ||
t.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mitmproxy |