diff --git a/README.md b/README.md
index eae67df8..a7f3ddfe 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Osintgram 🔎📸
-[![version-1.2](https://img.shields.io/badge/version-1.2-green)](https://github.com/Datalux/Osintgram/releases/tag/1.2)
+[![version-1.3](https://img.shields.io/badge/version-1.3-green)](https://github.com/Datalux/Osintgram/releases/tag/1.3)
[![GPLv3](https://img.shields.io/badge/license-GPLv3-blue)](https://img.shields.io/badge/license-GPLv3-blue)
[![Python3](https://img.shields.io/badge/language-Python3-red)](https://img.shields.io/badge/language-Python3-red)
[![Telegram](https://img.shields.io/badge/Telegram-Channel-blue.svg)](https://t.me/osintgram)
@@ -9,10 +9,10 @@
Osintgram is a **OSINT** tool on Instagram to collect, analyze, and run reconnaissance.
-
+
-Disclaimer: **The contributors do not assume any responsibility for the use of this tool**
+Disclaimer: **FOR EDUCATIONAL PURPOSE ONLY! The contributors do not assume any responsibility for the use of this tool.**
Warning: It is advisable to **not** use your own/primary account when using this tool.
@@ -45,7 +45,7 @@ Osintgram offers an interactive shell to perform analysis on Instagram account o
You can find detailed commands usage [here](doc/COMMANDS.md).
-[**Latest version**](https://github.com/Datalux/Osintgram/releases/tag/1.2) |
+[**Latest version**](https://github.com/Datalux/Osintgram/releases/tag/1.3) |
[Commands](doc/COMMANDS.md) |
[CHANGELOG](doc/CHANGELOG.md)
@@ -73,9 +73,10 @@ You can find detailed commands usage [here](doc/COMMANDS.md).
Alternatively, you can run the `make setup` command to populate this file for you.
-7. Run the main.py script
+7. Run the main.py script in one of two ways
- `python3 main.py `
+ * As an interactive prompt `python3 main.py `
+ * Or execute your command straight away `python3 main.py --command `
## Docker Quick Start 🐳
diff --git a/config/credentials.ini b/config/credentials.ini
index 713927b6..44af5bcd 100644
--- a/config/credentials.ini
+++ b/config/credentials.ini
@@ -1,3 +1,3 @@
[Credentials]
-username =
-password =
+username =
+password =
\ No newline at end of file
diff --git a/config/settings.json b/config/settings.json
index 9e26dfee..0d7c76c9 100644
--- a/config/settings.json
+++ b/config/settings.json
@@ -1 +1 @@
-{}
\ No newline at end of file
+{"uuid": "49ed550a-b30f-11eb-ab45-00155d9a47a8", "device_id": "android-49ed5762b30f11eb", "ad_id": "00ea607f-90b5-01af-95ac-c6f37ac93fbd", "session_id": "49ed5848-b30f-11eb-ab45-00155d9a47a8", "cookie": {"__class__": "bytes", "__value__": "gASVRwMAAAAAAAB9lIwOLmluc3RhZ3JhbS5jb22UfZSMAS+UfZQojAljc3JmdG9rZW6UjA5odHRw\nLmNvb2tpZWphcpSMBkNvb2tpZZSTlCmBlH2UKIwHdmVyc2lvbpRLAIwEbmFtZZSMCWNzcmZ0b2tl\nbpSMBXZhbHVllIwgemxlTm5zWjBJeUFPa0NPTzkwVG5rOUc0RHJDbFIzcHCUjARwb3J0lE6MDnBv\ncnRfc3BlY2lmaWVklImMBmRvbWFpbpSMDi5pbnN0YWdyYW0uY29tlIwQZG9tYWluX3NwZWNpZmll\nZJSIjBJkb21haW5faW5pdGlhbF9kb3SUiIwEcGF0aJRoA4wOcGF0aF9zcGVjaWZpZWSUiIwGc2Vj\ndXJllIiMB2V4cGlyZXOUSgCUe2KMB2Rpc2NhcmSUiYwHY29tbWVudJROjAtjb21tZW50X3VybJRO\njAdyZmMyMTA5lImMBV9yZXN0lH2UdWKMA21pZJRoCCmBlH2UKGgLSwBoDGggaA6MHFlKdXhfUUFC\nQUFHUmtGeFRzblNuek5DakpCdXCUaBBOaBGJaBKMDi5pbnN0YWdyYW0uY29tlGgUiGgViGgWaANo\nF4hoGIhoGUr9GF5kaBqJaBtOaBxOaB2JaB59lHVijANydXKUaAgpgZR9lChoC0sAaAxoJmgOjANO\nQU+UaBBOaBGJaBKMDi5pbnN0YWdyYW0uY29tlGgUiGgViGgWaANoF4hoGIhoGU5oGohoG05oHE5o\nHYloHn2UjAhIdHRwT25seZROc3VijApkc191c2VyX2lklGgIKYGUfZQoaAtLAGgMaC1oDowLNDc2\nNTU2NjY1MjeUaBBOaBGJaBKMDi5pbnN0YWdyYW0uY29tlGgUiGgViGgWaANoF4hoGIhoGUoAWRJh\naBqJaBtOaBxOaB2JaB59lHVijAlzZXNzaW9uaWSUaAgpgZR9lChoC0sAaAxoM2gOjCA0NzY1NTY2\nNjUyNyUzQUFkSjZxZkhDZGt2SHdpJTNBM5RoEE5oEYloEowOLmluc3RhZ3JhbS5jb22UaBSIaBWI\naBZoA2gXiGgYiGgZSoDlfGJoGoloG05oHE5oHYloHn2UjAhIdHRwT25seZROc3VidXNzLg==\n"}, "created_ts": 1620816384}
\ No newline at end of file
diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md
index 3b57acf6..7de5340b 100644
--- a/doc/CHANGELOG.md
+++ b/doc/CHANGELOG.md
@@ -1,5 +1,18 @@
# Changelog
+## [1.3](https://github.com/Datalux/Osintgram/releases/tag/1.3)
+**Enhancements**
+- Artwork refactoring (#149)
+- Added command line mode (#155)
+- Added output limiter (#201)
+
+**Bug fixes**
+- Losing collected data (#156)
+- JSON user info (#202)
+- Issue #198 (#200)
+- Issue #204 (12e730e)
+
+
## [1.2](https://github.com/Datalux/Osintgram/releases/tag/1.2)
**Enhancements**
- Added virtual environment (#126)
diff --git a/main.py b/main.py
index 4387adfb..a1500707 100644
--- a/main.py
+++ b/main.py
@@ -3,6 +3,7 @@
from src.Osintgram import Osintgram
import argparse
from src import printcolors as pc
+from src import artwork
import sys
import signal
@@ -16,14 +17,8 @@
def printlogo():
- pc.printout("________ .__ __ \n", pc.YELLOW)
- pc.printout("\_____ \ _____|__| _____/ |_ ________________ _____ \n", pc.YELLOW)
- pc.printout(" / | \ / ___/ |/ \ __\/ ___\_ __ \__ \ / \ \n", pc.YELLOW)
- pc.printout("/ | \\\___ \| | | \ | / /_/ > | \// __ \| Y Y \\\n", pc.YELLOW)
- pc.printout("\_______ /____ >__|___| /__| \___ /|__| (____ /__|_| /\n", pc.YELLOW)
- pc.printout(" \/ \/ \/ /_____/ \/ \/ \n", pc.YELLOW)
- print('\n')
- pc.printout("Version 1.2 - Developed by Giuseppe Criscione\n\n", pc.YELLOW)
+ pc.printout(artwork.ascii_art, pc.YELLOW)
+ pc.printout("\nVersion 1.1 - Developed by Giuseppe Criscione\n\n", pc.YELLOW)
pc.printout("Type 'list' to show all allowed commands\n")
pc.printout("Type 'FILE=y' to save results to files like '_.txt (default is disabled)'\n")
pc.printout("Type 'FILE=n' to disable saving to files'\n")
@@ -39,6 +34,8 @@ def cmdlist():
print("Enable/disable export in a '_.json' file'")
pc.printout("addrs\t\t")
print("Get all registered addressed by target photos")
+ pc.printout("cache\t\t")
+ print("Clear cache of the tool")
pc.printout("captions\t")
print("Get target's photos captions")
pc.printout("commentdata\t")
@@ -108,18 +105,21 @@ def _quit():
gnureadline.parse_and_bind("tab: complete")
gnureadline.set_completer(completer)
-printlogo()
-
parser = argparse.ArgumentParser(description='Osintgram is a OSINT tool on Instagram. It offers an interactive shell '
'to perform analysis on Instagram account of any users by its nickname ')
parser.add_argument('id', type=str, # var = id
help='username')
+parser.add_argument('-C','--cookies', help='clear\'s previous cookies', action="store_true")
parser.add_argument('-j', '--json', help='save commands output as JSON file', action='store_true')
parser.add_argument('-f', '--file', help='save output in a file', action='store_true')
+parser.add_argument('-c', '--command', help='run in single command mode & execute provided command', action='store')
+parser.add_argument('-o', '--output', help='where to store photos', action='store')
args = parser.parse_args()
-api = Osintgram(args.id, args.file, args.json)
+
+api = Osintgram(args.id, args.file, args.json, args.command, args.output, args.cookies)
+
commands = {
@@ -128,6 +128,7 @@ def _quit():
'quit': _quit,
'exit': _quit,
'addrs': api.get_addrs,
+ 'cache': api.clear_cache,
'captions': api.get_captions,
"commentdata": api.get_comment_data,
'comments': api.get_total_comments,
@@ -151,6 +152,7 @@ def _quit():
'wtagged': api.get_people_who_tagged
}
+
signal.signal(signal.SIGINT, signal_handler)
if is_windows:
pyreadline.Readline().parse_and_bind("tab: complete")
@@ -159,14 +161,25 @@ def _quit():
gnureadline.parse_and_bind("tab: complete")
gnureadline.set_completer(completer)
+if not args.command:
+ printlogo()
+
+
while True:
- pc.printout("Run a command: ", pc.YELLOW)
- cmd = input()
+ if args.command:
+ cmd = args.command
+ _cmd = commands.get(args.command)
+ else:
+ signal.signal(signal.SIGINT, signal_handler)
+ gnureadline.parse_and_bind("tab: complete")
+ gnureadline.set_completer(completer)
+ pc.printout("Run a command: ", pc.YELLOW)
+ cmd = input()
+
+ _cmd = commands.get(cmd)
- _cmd = commands.get(cmd)
-
if _cmd:
- _cmd()
+ _cmd()
elif cmd == "FILE=y":
api.set_write_file(True)
elif cmd == "FILE=n":
@@ -179,3 +192,6 @@ def _quit():
print("")
else:
pc.printout("Unknown command\n", pc.RED)
+
+ if args.command:
+ break
diff --git a/output/dont_delete_this_folder.txt b/output/dont_delete_this_folder.txt
index 7c8d83a3..c0962599 100644
--- a/output/dont_delete_this_folder.txt
+++ b/output/dont_delete_this_folder.txt
@@ -1 +1 @@
-Please don't deleate this folder.
\ No newline at end of file
+Please don't delete this folder.
\ No newline at end of file
diff --git a/src/Osintgram.py b/src/Osintgram.py
index 2dc5b093..139b0580 100644
--- a/src/Osintgram.py
+++ b/src/Osintgram.py
@@ -4,6 +4,7 @@
import urllib
import os
import codecs
+from pathlib import Path
import requests
import ssl
@@ -30,16 +31,28 @@ class Osintgram:
target = ""
writeFile = False
jsonDump = False
+ cli_mode = False
+ output_dir = "output"
- def __init__(self, target, is_file, is_json):
+
+ def __init__(self, target, is_file, is_json, is_cli, output_dir, clear_cookies):
+ self.output_dir = output_dir or self.output_dir
+ Path(self.output_dir).mkdir(parents=True, exist_ok=True)
u = config.getUsername()
p = config.getPassword()
- print("\nAttempt to login...")
+ self.clear_cookies(clear_cookies)
+ self.cli_mode = is_cli
+ if not is_cli:
+ print("\nAttempt to login...")
self.login(u, p)
self.setTarget(target)
self.writeFile = is_file
self.jsonDump = is_json
+ def clear_cookies(self,clear_cookies):
+ if clear_cookies:
+ self.clear_cache()
+
def setTarget(self, target):
self.target = target
user = self.get_user(target)
@@ -149,14 +162,14 @@ def get_addrs(self):
i = i + 1
if self.writeFile:
- file_name = "output/" + self.target + "_addrs.txt"
+ file_name = self.output_dir + "/" + self.target + "_addrs.txt"
file = open(file_name, "w")
file.write(str(t))
file.close()
if self.jsonDump:
json_data['address'] = addrs_list
- json_file_name = "output/" + self.target + "_addrs.json"
+ json_file_name = self.output_dir + "/" + self.target + "_addrs.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -199,7 +212,7 @@ def get_captions(self):
file = None
if self.writeFile:
- file_name = "output/" + self.target + "_captions.txt"
+ file_name = self.output_dir + "/" + self.target + "_captions.txt"
file = open(file_name, "w")
for s in captions:
@@ -210,7 +223,7 @@ def get_captions(self):
if self.jsonDump:
json_data['captions'] = captions
- json_file_name = "output/" + self.target + "_followings.json"
+ json_file_name = self.output_dir + "/" + self.target + "_followings.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -238,7 +251,7 @@ def get_total_comments(self):
posts += 1
if self.writeFile:
- file_name = "output/" + self.target + "_comments.txt"
+ file_name = self.output_dir + "/" + self.target + "_comments.txt"
file = open(file_name, "w")
file.write(str(comments_counter) + " comments in " + str(posts) + " posts\n")
file.close()
@@ -248,7 +261,7 @@ def get_total_comments(self):
'comment_counter': comments_counter,
'posts': posts
}
- json_file_name = "output/" + self.target + "_comments.json"
+ json_file_name = self.output_dir + "/" + self.target + "_comments.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -284,13 +297,13 @@ def get_comment_data(self):
print(t)
if self.writeFile:
- file_name = "output/" + self.target + "_comment_data.txt"
+ file_name = self.output_dir + "/" + self.target + "_comment_data.txt"
with open(file_name, 'w') as f:
f.write(str(t))
f.close()
if self.jsonDump:
- file_name_json = "output/" + self.target + "_comment_data.json"
+ file_name_json = self.output_dir + "/" + self.target + "_comment_data.json"
with open(file_name_json, 'w') as f:
f.write("{ \"Comments\":[ \n")
f.write('\n'.join(json.dumps(comment) for comment in _comments) + ',\n')
@@ -350,14 +363,14 @@ def get_followers(self):
followings_list.append(follow)
if self.writeFile:
- file_name = "output/" + self.target + "_followers.txt"
+ file_name = self.output_dir + "/" + self.target + "_followers.txt"
file = open(file_name, "w")
file.write(str(t))
file.close()
if self.jsonDump:
json_data['followers'] = followers
- json_file_name = "output/" + self.target + "_followers.json"
+ json_file_name = self.output_dir + "/" + self.target + "_followers.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -415,14 +428,14 @@ def get_followings(self):
followings_list.append(follow)
if self.writeFile:
- file_name = "output/" + self.target + "_followings.txt"
+ file_name = self.output_dir + "/" + self.target + "_followings.txt"
file = open(file_name, "w")
file.write(str(t))
file.close()
if self.jsonDump:
json_data['followings'] = followings_list
- json_file_name = "output/" + self.target + "_followings.json"
+ json_file_name = self.output_dir + "/" + self.target + "_followings.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -471,7 +484,7 @@ def get_hashtags(self):
hashtags_list = []
if self.writeFile:
- file_name = "output/" + self.target + "_hashtags.txt"
+ file_name = self.output_dir + "/" + self.target + "_hashtags.txt"
file = open(file_name, "w")
for k, v in ssort:
@@ -487,7 +500,7 @@ def get_hashtags(self):
if self.jsonDump:
json_data['hashtags'] = hashtags_list
- json_file_name = "output/" + self.target + "_hashtags.json"
+ json_file_name = self.output_dir + "/" + self.target + "_hashtags.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
else:
@@ -546,8 +559,8 @@ def get_user_info(self):
'biography': data['biography'],
'edge_followed_by': data['follower_count'],
'edge_follow': data['following_count'],
- 'is_business_account': data['is_business_account'],
- 'is_verified': data['is_business'],
+ 'is_business_account': data['is_business'],
+ 'is_verified': data['is_verified'],
'profile_pic_url_hd': data['hd_profile_pic_url_info']['url']
}
if 'public_email' in data and data['public_email']:
@@ -563,7 +576,7 @@ def get_user_info(self):
if 'contact_phone_number' in data and data['contact_phone_number']:
user['contact_phone_number'] = data['contact_phone_number']
- json_file_name = "output/" + self.target + "_info.json"
+ json_file_name = self.output_dir + "/" + self.target + "_info.json"
with open(json_file_name, 'w') as f:
json.dump(user, f)
@@ -589,7 +602,7 @@ def get_total_likes(self):
posts += 1
if self.writeFile:
- file_name = "output/" + self.target + "_likes.txt"
+ file_name = self.output_dir + "/" + self.target + "_likes.txt"
file = open(file_name, "w")
file.write(str(like_counter) + " likes in " + str(like_counter) + " posts\n")
file.close()
@@ -599,7 +612,7 @@ def get_total_likes(self):
'like_counter': like_counter,
'posts': like_counter
}
- json_file_name = "output/" + self.target + "_likes.json"
+ json_file_name = self.output_dir + "/" + self.target + "_likes.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -634,7 +647,7 @@ def get_media_type(self):
if counter > 0:
if self.writeFile:
- file_name = "output/" + self.target + "_mediatype.txt"
+ file_name = self.output_dir + "/" + self.target + "_mediatype.txt"
file = open(file_name, "w")
file.write(str(photo_counter) + " photos and " + str(video_counter) + " video posted by target\n")
file.close()
@@ -647,7 +660,7 @@ def get_media_type(self):
"photos": photo_counter,
"videos": video_counter
}
- json_file_name = "output/" + self.target + "_mediatype.json"
+ json_file_name = self.output_dir + "/" + self.target + "_mediatype.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -699,14 +712,14 @@ def get_people_who_commented(self):
print(t)
if self.writeFile:
- file_name = "output/" + self.target + "_users_who_commented.txt"
+ file_name = self.output_dir + "/" + self.target + "_users_who_commented.txt"
file = open(file_name, "w")
file.write(str(t))
file.close()
if self.jsonDump:
json_data['users_who_commented'] = ssort
- json_file_name = "output/" + self.target + "_users_who_commented.json"
+ json_file_name = self.output_dir + "/" + self.target + "_users_who_commented.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
else:
@@ -767,14 +780,14 @@ def get_people_who_tagged(self):
print(t)
if self.writeFile:
- file_name = "output/" + self.target + "_users_who_tagged.txt"
+ file_name = self.output_dir + "/" + self.target + "_users_who_tagged.txt"
file = open(file_name, "w")
file.write(str(t))
file.close()
if self.jsonDump:
json_data['users_who_tagged'] = ssort
- json_file_name = "output/" + self.target + "_users_who_tagged.json"
+ json_file_name = self.output_dir + "/" + self.target + "_users_who_tagged.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
else:
@@ -815,14 +828,14 @@ def get_photo_description(self):
count += 1
if self.writeFile:
- file_name = "output/" + self.target + "_photodes.txt"
+ file_name = self.output_dir + "/" + self.target + "_photodes.txt"
file = open(file_name, "w")
file.write(str(t))
file.close()
if self.jsonDump:
json_data['descriptions'] = descriptions_list
- json_file_name = "output/" + self.target + "_descriptions.json"
+ json_file_name = self.output_dir + "/" + self.target + "_descriptions.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -835,8 +848,12 @@ def get_user_photo(self):
return
limit = -1
- pc.printout("How many photos you want to download (default all): ", pc.YELLOW)
- user_input = input()
+ if self.cli_mode:
+ user_input = ""
+ else:
+ pc.printout("How many photos you want to download (default all): ", pc.YELLOW)
+ user_input = input()
+
try:
if user_input == "":
pc.printout("Downloading all photos available...\n")
@@ -868,7 +885,7 @@ def get_user_photo(self):
counter = counter + 1
url = item["image_versions2"]["candidates"][0]["url"]
photo_id = item["id"]
- end = "output/" + self.target + "_" + photo_id + ".jpg"
+ end = self.output_dir + "/" + self.target + "_" + photo_id + ".jpg"
urllib.request.urlretrieve(url, end)
sys.stdout.write("\rDownloaded %i" % counter)
sys.stdout.flush()
@@ -880,7 +897,7 @@ def get_user_photo(self):
counter = counter + 1
url = i["image_versions2"]["candidates"][0]["url"]
photo_id = i["id"]
- end = "output/" + self.target + "_" + photo_id + ".jpg"
+ end = self.output_dir + "/" + self.target + "_" + photo_id + ".jpg"
urllib.request.urlretrieve(url, end)
sys.stdout.write("\rDownloaded %i" % counter)
sys.stdout.flush()
@@ -894,7 +911,7 @@ def get_user_photo(self):
sys.stdout.write(" photos")
sys.stdout.flush()
- pc.printout("\nWoohoo! We downloaded " + str(counter) + " photos (saved in output/ folder) \n", pc.GREEN)
+ pc.printout("\nWoohoo! We downloaded " + str(counter) + " photos (saved in " + self.output_dir + " folder) \n", pc.GREEN)
def get_user_propic(self):
@@ -912,7 +929,7 @@ def get_user_propic(self):
URL = data["hd_profile_pic_versions"][items-1]['url']
if URL != "":
- end = "output/" + self.target + "_propic.jpg"
+ end = self.output_dir + "/" + self.target + "_propic.jpg"
urllib.request.urlretrieve(URL, end)
pc.printout("Target propic saved in output folder\n", pc.GREEN)
@@ -941,12 +958,12 @@ def get_user_stories(self):
story_id = i["id"]
if i["media_type"] == 1: # it's a photo
url = i['image_versions2']['candidates'][0]['url']
- end = "output/" + self.target + "_" + story_id + ".jpg"
+ end = self.output_dir + "/" + self.target + "_" + story_id + ".jpg"
urllib.request.urlretrieve(url, end)
elif i["media_type"] == 2: # it's a gif or video
url = i['video_versions'][0]['url']
- end = "output/" + self.target + "_" + story_id + ".mp4"
+ end = self.output_dir + "/" + self.target + "_" + story_id + ".mp4"
urllib.request.urlretrieve(url, end)
if counter > 0:
@@ -1012,14 +1029,14 @@ def get_people_tagged_by_user(self):
tagged_list.append(tag)
if self.writeFile:
- file_name = "output/" + self.target + "_tagged.txt"
+ file_name = self.output_dir + "/" + self.target + "_tagged.txt"
file = open(file_name, "w")
file.write(str(t))
file.close()
if self.jsonDump:
json_data['tagged'] = tagged_list
- json_file_name = "output/" + self.target + "_tagged.json"
+ json_file_name = self.output_dir + "/" + self.target + "_tagged.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -1031,7 +1048,7 @@ def get_user(self, username):
try:
content = self.api.username_info(username)
if self.writeFile:
- file_name = "output/" + self.target + "_user_id.txt"
+ file_name = self.output_dir + "/" + self.target + "_user_id.txt"
file = open(file_name, "w")
file.write(str(content['user']['pk']))
file.close()
@@ -1042,6 +1059,7 @@ def get_user(self, username):
return user
except ClientError as e:
+ pc.printout('ClientError {0!s} (Code: {1:d}, Response: {2!s})'.format(e.msg, e.code, e.error_response), pc.RED)
error = json.loads(e.error_response)
if 'message' in error:
print(error['message'])
@@ -1107,7 +1125,7 @@ def login(self, u, p):
on_login=lambda x: self.onlogin_callback(x, settings_file))
except ClientError as e:
- #pc.printout('ClientError {0!s} (Code: {1:d}, Response: {2!s})'.format(e.msg, e.code, e.error_response), pc.RED)
+ pc.printout('ClientError {0!s} (Code: {1:d}, Response: {2!s})'.format(e.msg, e.code, e.error_response), pc.RED)
error = json.loads(e.error_response)
pc.printout(error['message'], pc.RED)
pc.printout(": ", pc.RED)
@@ -1191,17 +1209,42 @@ def get_fwersemail(self):
print("\n")
results = []
+
+ pc.printout("Do you want to get all emails? y/n: ", pc.YELLOW)
+ value = input()
+
+ if value == str("y") or value == str("yes") or value == str("Yes") or value == str("YES"):
+ value = len(followers)
+ elif value == str(""):
+ print("\n")
+ return
+ elif value == str("n") or value == str("no") or value == str("No") or value == str("NO"):
+ while True:
+ try:
+ pc.printout("How many emails do you want to get? ", pc.YELLOW)
+ new_value = int(input())
+ value = new_value - 1
+ break
+ except ValueError:
+ pc.printout("Error! Please enter a valid integer!", pc.RED)
+ print("\n")
+ return
+ else:
+ pc.printout("Error! Please enter y/n :-)", pc.RED)
+ print("\n")
+ return
for follow in followers:
user = self.api.user_info(str(follow['id']))
if 'public_email' in user['user'] and user['user']['public_email']:
follow['email'] = user['user']['public_email']
+ if len(results) > value:
+ break
results.append(follow)
except ClientThrottledError as e:
pc.printout("\nError: Instagram blocked the requests. Please wait a few minutes before you try again.", pc.RED)
pc.printout("\n")
- return
if len(results) > 0:
@@ -1217,14 +1260,14 @@ def get_fwersemail(self):
t.add_row([str(node['id']), node['username'], node['full_name'], node['email']])
if self.writeFile:
- file_name = "output/" + self.target + "_fwersemail.txt"
+ file_name = self.output_dir + "/" + self.target + "_fwersemail.txt"
file = open(file_name, "w")
file.write(str(t))
file.close()
if self.jsonDump:
json_data['followers_email'] = results
- json_file_name = "output/" + self.target + "_fwersemail.json"
+ json_file_name = self.output_dir + "/" + self.target + "_fwersemail.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -1269,6 +1312,30 @@ def get_fwingsemail(self):
next_max_id = results.get('next_max_id')
results = []
+
+ pc.printout("Do you want to get all emails? y/n: ", pc.YELLOW)
+ value = input()
+
+ if value == str("y") or value == str("yes") or value == str("Yes") or value == str("YES"):
+ value = len(followings)
+ elif value == str(""):
+ print("\n")
+ return
+ elif value == str("n") or value == str("no") or value == str("No") or value == str("NO"):
+ while True:
+ try:
+ pc.printout("How many emails do you want to get? ", pc.YELLOW)
+ new_value = int(input())
+ value = new_value - 1
+ break
+ except ValueError:
+ pc.printout("Error! Please enter a valid integer!", pc.RED)
+ print("\n")
+ return
+ else:
+ pc.printout("Error! Please enter y/n :-)", pc.RED)
+ print("\n")
+ return
for follow in followings:
sys.stdout.write("\rCatched %i followings email" % len(results))
@@ -1276,12 +1343,13 @@ def get_fwingsemail(self):
user = self.api.user_info(str(follow['id']))
if 'public_email' in user['user'] and user['user']['public_email']:
follow['email'] = user['user']['public_email']
+ if len(results) > value:
+ break
results.append(follow)
except ClientThrottledError as e:
pc.printout("\nError: Instagram blocked the requests. Please wait a few minutes before you try again.", pc.RED)
pc.printout("\n")
- return
print("\n")
@@ -1298,14 +1366,14 @@ def get_fwingsemail(self):
t.add_row([str(node['id']), node['username'], node['full_name'], node['email']])
if self.writeFile:
- file_name = "output/" + self.target + "_fwingsemail.txt"
+ file_name = self.output_dir + "/" + self.target + "_fwingsemail.txt"
file = open(file_name, "w")
file.write(str(t))
file.close()
if self.jsonDump:
json_data['followings_email'] = results
- json_file_name = "output/" + self.target + "_fwingsemail.json"
+ json_file_name = self.output_dir + "/" + self.target + "_fwingsemail.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -1350,6 +1418,30 @@ def get_fwingsnumber(self):
next_max_id = results.get('next_max_id')
results = []
+
+ pc.printout("Do you want to get all phone numbers? y/n: ", pc.YELLOW)
+ value = input()
+
+ if value == str("y") or value == str("yes") or value == str("Yes") or value == str("YES"):
+ value = len(followings)
+ elif value == str(""):
+ print("\n")
+ return
+ elif value == str("n") or value == str("no") or value == str("No") or value == str("NO"):
+ while True:
+ try:
+ pc.printout("How many phone numbers do you want to get? ", pc.YELLOW)
+ new_value = int(input())
+ value = new_value - 1
+ break
+ except ValueError:
+ pc.printout("Error! Please enter a valid integer!", pc.RED)
+ print("\n")
+ return
+ else:
+ pc.printout("Error! Please enter y/n :-)", pc.RED)
+ print("\n")
+ return
for follow in followings:
sys.stdout.write("\rCatched %i followings phone numbers" % len(results))
@@ -1357,12 +1449,13 @@ def get_fwingsnumber(self):
user = self.api.user_info(str(follow['id']))
if 'contact_phone_number' in user['user'] and user['user']['contact_phone_number']:
follow['contact_phone_number'] = user['user']['contact_phone_number']
+ if len(results) > value:
+ break
results.append(follow)
except ClientThrottledError as e:
pc.printout("\nError: Instagram blocked the requests. Please wait a few minutes before you try again.", pc.RED)
pc.printout("\n")
- return
print("\n")
@@ -1379,14 +1472,14 @@ def get_fwingsnumber(self):
t.add_row([str(node['id']), node['username'], node['full_name'], node['contact_phone_number']])
if self.writeFile:
- file_name = "output/" + self.target + "_fwingsnumber.txt"
+ file_name = self.output_dir + "/" + self.target + "_fwingsnumber.txt"
file = open(file_name, "w")
file.write(str(t))
file.close()
if self.jsonDump:
json_data['followings_phone_numbers'] = results
- json_file_name = "output/" + self.target + "_fwingsnumber.json"
+ json_file_name = self.output_dir + "/" + self.target + "_fwingsnumber.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -1432,6 +1525,30 @@ def get_fwersnumber(self):
next_max_id = results.get('next_max_id')
results = []
+
+ pc.printout("Do you want to get all phone numbers? y/n: ", pc.YELLOW)
+ value = input()
+
+ if value == str("y") or value == str("yes") or value == str("Yes") or value == str("YES"):
+ value = len(followings)
+ elif value == str(""):
+ print("\n")
+ return
+ elif value == str("n") or value == str("no") or value == str("No") or value == str("NO"):
+ while True:
+ try:
+ pc.printout("How many phone numbers do you want to get? ", pc.YELLOW)
+ new_value = int(input())
+ value = new_value - 1
+ break
+ except ValueError:
+ pc.printout("Error! Please enter a valid integer!", pc.RED)
+ print("\n")
+ return
+ else:
+ pc.printout("Error! Please enter y/n :-)", pc.RED)
+ print("\n")
+ return
for follow in followings:
sys.stdout.write("\rCatched %i followers phone numbers" % len(results))
@@ -1439,12 +1556,13 @@ def get_fwersnumber(self):
user = self.api.user_info(str(follow['id']))
if 'contact_phone_number' in user['user'] and user['user']['contact_phone_number']:
follow['contact_phone_number'] = user['user']['contact_phone_number']
+ if len(results) > value:
+ break
results.append(follow)
except ClientThrottledError as e:
pc.printout("\nError: Instagram blocked the requests. Please wait a few minutes before you try again.", pc.RED)
pc.printout("\n")
- return
print("\n")
@@ -1461,14 +1579,14 @@ def get_fwersnumber(self):
t.add_row([str(node['id']), node['username'], node['full_name'], node['contact_phone_number']])
if self.writeFile:
- file_name = "output/" + self.target + "_fwersnumber.txt"
+ file_name = self.output_dir + "/" + self.target + "_fwersnumber.txt"
file = open(file_name, "w")
file.write(str(t))
file.close()
if self.jsonDump:
json_data['followings_phone_numbers'] = results
- json_file_name = "output/" + self.target + "_fwerssnumber.json"
+ json_file_name = self.output_dir + "/" + self.target + "_fwerssnumber.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
@@ -1523,15 +1641,25 @@ def get_comments(self):
print(t)
if self.writeFile:
- file_name = "output/" + self.target + "_users_who_commented.txt"
+ file_name = self.output_dir + "/" + self.target + "_users_who_commented.txt"
file = open(file_name, "w")
file.write(str(t))
file.close()
if self.jsonDump:
json_data['users_who_commented'] = ssort
- json_file_name = "output/" + self.target + "_users_who_commented.json"
+ json_file_name = self.output_dir + "/" + self.target + "_users_who_commented.json"
with open(json_file_name, 'w') as f:
json.dump(json_data, f)
else:
pc.printout("Sorry! No results found :-(\n", pc.RED)
+
+ def clear_cache(self):
+ try:
+ f = open("config/settings.json",'w')
+ f.write("{}")
+ pc.printout("Cache Cleared.\n",pc.GREEN)
+ except FileNotFoundError:
+ pc.printout("Settings.json don't exist.\n",pc.RED)
+ finally:
+ f.close()
diff --git a/src/artwork.py b/src/artwork.py
new file mode 100644
index 00000000..8e7866eb
--- /dev/null
+++ b/src/artwork.py
@@ -0,0 +1,8 @@
+ascii_art = r"""
+________ .__ __
+\_____ \ _____|__| _____/ |_ ________________ _____
+ / | \ / ___/ |/ \ __\/ ___\_ __ \__ \ / \
+/ | \\___ \| | | \ | / /_/ > | \// __ \| Y Y \
+\_______ /____ >__|___| /__| \___ /|__| (____ /__|_| /
+ \/ \/ \/ /_____/ \/ \/
+ """