-
Notifications
You must be signed in to change notification settings - Fork 62
/
terra.py
286 lines (257 loc) · 11.8 KB
/
terra.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
import argparse
import sys
import os
from rich.console import Console
from pyfiglet import Figlet
from rich.style import Style
from src.instagram import Instagram
from src.twittr import Twitter
pc = Console()
def twitter_all_commands():
pc.print("FILE=y/n : ", style="yellow", end='')
print(" Enable/disable output in a '<target username>_<command>.txt' file")
pc.print("JSON=y/n : \t", style="white", end='')
print("Enable/disable export in a '<target username>_<command>.json' file'")
pc.print("tweets\t : ", style="bright_cyan", end='')
print("Get recent tweets of target")
pc.print("favtweets : \t", style="yellow", end='')
print("Get recent tweets which are liked by target")
pc.print("followers : \t", style="bright_green", end='')
print(" Get total followers of Target")
pc.print("following : \t", style="cyan", end='')
print("Get total followings of target")
pc.print("reset target : \t", style='green', end='')
print(" Select new target")
pc.print("timeline : \t", style="dark_cyan", end='')
print("Full information of target's account")
pc.print("profile pic : ", style='bright_magenta', end='')
print("Download Target's Profile Picture")
pc.print("banner : ", style='steel_blue1', end='')
print("Download Target's Profile Banner ")
pc.print('htags : ', style='bright_red', end='')
print('Get hashtags used by target')
pc.print('mentions : ', style='pink1')
print('Get users who got mentioned by target in recent tweets')
print(" ")
pc.print(" Also supports basic terminal commands : ", style='cyan')
pc.print("ls : ", style='pink1', end='')
pc.print("Displaying all Commands ", ":search:", style='bright_white')
pc.print("exit : ", style='orange_red1', end='')
pc.print("For Exit from Terra", style='bright_white')
pc.print("clear : ", style='orchid2', end='')
pc.print("Clear your Screen", style='bright_white')
pc.print('back : ', style='purple', end='')
pc.print('Back to Main Menu', style='yellow')
def insta_all_commands():
pc.print("FILE=y/n : ", style="yellow",end='')
print(" Enable/disable output in a '<target username>_<command>.txt' file")
pc.print("JSON=y/n : \t", style="white", end='')
print("Enable/disable export in a '<target username>_<command>.json' file'")
pc.print("locations : \t", style="green", end='')
print("Get all registered addressed by target photos")
pc.print("captions : \t", style="cyan", end='')
print("Get target's photos captions")
pc.print("comments : \t", style="red", end='')
print("Get total comments of target's posts")
pc.print("followers : \t", style="yellow", end='')
print("get target's followers")
pc.print("followings : \t", style="red", end='')
print("Get users followed by target")
pc.print("followers emails : \t", style="green", end='')
print("Get email of target followers")
pc.print("following emails : \t", style="yellow", end='')
print("Get email of users followed by target")
pc.print("followers phone : \t", style="red", end='')
print("Get phone number of target followers")
pc.print("followings phone : \t" ,style="cyan", end='')
print("Get phone number of users followed by target")
pc.print("tags : \t", style="yellow", end='')
print("Get hashtags used by target")
pc.print("info : \t", style="white", end='')
print("Target timeline and information")
pc.print("likes : \t", style="red", end='')
print("Get total likes of target's posts")
pc.print("mediatype : \t", style="green", end='')
print("Get target's posts type (photo or video)")
pc.print("photodes : \t", style="cyan", end='')
print("Get description of target's photos")
pc.print("photos : \t", style="yellow", end='')
print("Download target's photos in output folder")
pc.print("profile pic : \t", style="white", end='')
print("Download target's profile picture")
pc.print("stories : \t", style="cyan", end='')
print("Download target's stories")
pc.print("tagged : \t", style="red", end='')
print("Get list of users tagged by target")
pc.print("reset target : \t\t", style="white", end='')
print("Set new target")
pc.print("commenter : \t", style="red", end='')
print("Get a list of user who commented target's photos")
pc.print("ttag : \t", style="green", end='')
print("Get a list of user who tagged target")
print(" ")
pc.print(" Also supports basic terminal commands : ", style='cyan')
pc.print("ls : ", style='pink1', end='')
pc.print("Displaying all Commands ", ":search:", style='bright_white')
pc.print("exit : ", style='orange_red1', end='')
pc.print("For Exit from Terra", style='bright_white')
pc.print("clear : ", style='orchid2', end='')
pc.print("Clear your Screen", style='bright_white')
pc.print('back : ', style='purple', end='')
pc.print('Back to Main Menu', style='yellow')
def clear():
# for windows screen
if sys.platform.startswith('win'):
os.system('cls')
# for mac or linux
else:
os.system('clear')
def banner():
clear()
banner = Figlet(font='isometric3',justify='right')
pc.print(banner.renderText("Terra"),style="bold red")
pc.print(" OSINT TOOL ON SOCIAL MEDIA NETWORKS ", style="cyan1")
print(" ")
pc.print(" @xadhrit (github.com/xadhrit/) " , style='bold red')
def _out():
pc.print("Thank you for using Terra!", style="yellow")
sys.exit(0)
"""
def handle_single(sig, frame):
pc.print("\n Sending you Out \n", style="red")
sys.exit(0)
"""
parser = argparse.ArgumentParser(description="Recon with Terra")
parser.add_argument('target', type=str, help='username of target')
parser.add_argument('-j', '--json', help='save results in a JSON file', action='store_true')
parser.add_argument('-f', '--file', help='save results in a Text File', action='store_true')
args = parser.parse_args()
def main():
banner()
pc.print(" \n> 1 for Twitter ",style="bright_yellow")
pc.print(" \n> 2 for Instagram ",style="green3")
pc.print(" \n> 3 for Exit ")
print(" ")
pc.print("> Choose one option : ",style='purple',end='')
u_input = str(input())
try:
if u_input == '1':
parser = argparse.ArgumentParser(description="Recon with Terra")
parser.add_argument('target', type=str, help='username of target')
parser.add_argument('-j', '--json', help='save results in a JSON file', action='store_true')
parser.add_argument('-f', '--file', help='save results in a Text File', action='store_true')
args = parser.parse_args()
api = Twitter(args.target,args.file,args.json)
commands = {
'ls': twitter_all_commands,
'help': twitter_all_commands,
'quit': quit,
'clear': clear,
'exit': _out,
'back': main,
'reset target': api.reset_target,
'tweets': api.recent_tweets,
'favtweets': api.recent_fav,
'followers': api.get_followers,
'following': api.get_frnds,
'timeline': api.user_info,
'profile pic': api.profile_pic,
'banner': api.banner_pic,
'htags': api.get_hashtags,
'mentions':api.get_mentions
}
while True:
print(" ")
pc.print("~/Terra Command >$ ", style='purple', end='')
user_input = input()
cmd = commands.get(user_input)
if cmd:
cmd()
elif user_input == 'FILE=y':
api.write_file(True)
elif user_input == 'FILE=n':
api.write_file(False)
elif user_input == 'JSON=y':
api.json_dump(True)
elif user_input == 'JSON=n':
api.json_dump(False)
elif user_input == '':
print("")
else:
pc.print("ILLEGAL COMMAND", style="red")
if u_input == '2':
parser = argparse.ArgumentParser(description="Recon with Terra")
parser.add_argument('target', type=str, help='username of target')
parser.add_argument('-j', '--json', help='save results in a JSON file', action='store_true')
parser.add_argument('-f', '--file', help='save results in a Text File', action='store_true')
args = parser.parse_args()
api = Instagram(args.target,args.file,args.json)
commands = {
'ls': insta_all_commands,
'help': insta_all_commands,
'clear': clear,
'quit': quit,
'exit': _out,
'back' : main,
'locations': api.target_locations,
'captions': api.__getCaptions__,
'reset target': api.change_target,
'comments': api._all_comments,
'followers': api._followers,
'followings': api._followings,
'followers emails': api.followers_email,
'following emails': api.followings_email,
'followers phone': api.followers_phoneNumber,
'followings phone': api.followings_phoneNumber,
'tags': api._hashtags,
'timeline': api._user_timeline,
'likes': api._total_likes,
'mediatype': api._media_type,
'photodes': api._photo_description,
'photos': api._user_photo,
'profile pic': api._user_profilepic,
'stories': api._user_stories,
'tagged': api._people_who_tagged_by_target,
'commenter': api._people_who_commented,
'ttag': api._users_who_tagged
}
while True:
pc.print("~/Terra Command >$ ", style='purple', end='')
user_input = input()
cmd = commands.get(user_input)
if cmd:
cmd()
elif user_input == 'FILE=y':
api.write_file(True)
elif user_input == 'FILE=n':
api.write_file(False)
elif user_input == 'JSON=y':
api.json_dump(True)
elif user_input == 'JSON=n':
api.json_dump(False)
elif user_input == '':
print("")
else:
pc.print("ILLEGAL COMMAND", style="red")
if u_input == '3':
sys.exit(0)
if u_input == 'exit':
sys.exit(0)
if KeyboardInterrupt:
pc.print('Invalid Option! Try Again.... ', style='bold red')
pc.print('Do you want to choose again ? (y/n)', style='red')
io = input()
if io == 'y' or 'Y':
main()
elif io == 'n' or 'N':
sys.exit(0)
else:
print('Not a option! Good Bye!')
sys.exit(0)
else:
pc.print('Invalid Option! ',style='bright_red')
sys.exit(0)
except Exception as e:
pc.print(e,style='orange1')
if __name__ == '__main__':
main()