1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python3
2
2
# -*- coding: utf-8 -*-
3
3
4
4
from src .Osintgram import Osintgram
5
5
import argparse
6
6
from src import printcolors as pc
7
7
import sys
8
8
import signal
9
- import readline
10
9
11
- commands = ["quit" , "exit" , "list" , "help" , "addrs" , "captions" , "comments" , "followers" ,
12
- "followings" , "fwersemail" , "fwingsemail" , "hashtags" , "info" , "likes" ,
13
- "mediatype" , "photodes" , "photos" , "propic" , "stories" , "tagged" , "target" ,
14
- "wcommented" , "wtagged" ]
10
+ is_windows = False
11
+
12
+ try :
13
+ import gnureadline
14
+ except :
15
+ is_windows = True
16
+ import pyreadline
15
17
16
18
17
19
def printlogo ():
@@ -22,7 +24,7 @@ def printlogo():
22
24
pc .printout ("\_______ /____ >__|___| /__| \___ /|__| (____ /__|_| /\n " , pc .YELLOW )
23
25
pc .printout (" \/ \/ \/ /_____/ \/ \/ \n " , pc .YELLOW )
24
26
print ('\n ' )
25
- pc .printout ("Version 1.0. 1 - Developed by Giuseppe Criscione\n \n " , pc .YELLOW )
27
+ pc .printout ("Version 1.1 - Developed by Giuseppe Criscione\n \n " , pc .YELLOW )
26
28
pc .printout ("Type 'list' to show all allowed commands\n " )
27
29
pc .printout ("Type 'FILE=y' to save results to files like '<target username>_<command>.txt (deafult is disabled)'\n " )
28
30
pc .printout ("Type 'FILE=n' to disable saving to files'\n " )
@@ -50,6 +52,10 @@ def cmdlist():
50
52
print ("Get email of target followers" )
51
53
pc .printout ("fwingsemail\t " )
52
54
print ("Get email of users followed by target" )
55
+ pc .printout ("fwersnumber\t " )
56
+ print ("Get phone number of target followers" )
57
+ pc .printout ("fwingsnumber\t " )
58
+ print ("Get phone number of users followed by target" )
53
59
pc .printout ("hashtags\t " )
54
60
print ("Get hashtags used by target" )
55
61
pc .printout ("info\t \t " )
@@ -88,10 +94,18 @@ def completer(text, state):
88
94
else :
89
95
return None
90
96
97
+ def _quit ():
98
+ pc .printout ("Goodbye!\n " , pc .RED )
99
+ sys .exit (0 )
100
+
91
101
92
102
signal .signal (signal .SIGINT , signal_handler )
93
- readline .parse_and_bind ("tab: complete" )
94
- readline .set_completer (completer )
103
+ if is_windows :
104
+ pyreadline .Readline ().parse_and_bind ("tab: complete" )
105
+ pyreadline .Readline ().set_completer (completer )
106
+ else :
107
+ gnureadline .parse_and_bind ("tab: complete" )
108
+ gnureadline .set_completer (completer )
95
109
96
110
printlogo ()
97
111
@@ -106,52 +120,47 @@ def completer(text, state):
106
120
107
121
api = Osintgram (args .id , args .file , args .json )
108
122
123
+
124
+ commands = {
125
+ 'list' : cmdlist ,
126
+ 'help' : cmdlist ,
127
+ 'quit' : _quit ,
128
+ 'exit' : _quit ,
129
+ 'addrs' : api .get_addrs ,
130
+ 'captions' : api .get_captions ,
131
+ 'comments' : api .get_total_comments ,
132
+ 'followers' : api .get_followers ,
133
+ 'followings' : api .get_followings ,
134
+ 'fwersemail' : api .get_fwersemail ,
135
+ 'fwingsemail' : api .get_fwingsemail ,
136
+ 'fwersnumber' : api .get_fwersnumber ,
137
+ 'fwingsnumber' : api .get_fwingsnumber ,
138
+ 'hashtags' : api .get_hashtags ,
139
+ 'info' : api .get_user_info ,
140
+ 'likes' : api .get_total_likes ,
141
+ 'mediatype' : api .get_media_type ,
142
+ 'photodes' : api .get_photo_description ,
143
+ 'photos' : api .get_user_photo ,
144
+ 'propic' : api .get_user_propic ,
145
+ 'stories' : api .get_user_stories ,
146
+ 'tagged' : api .get_people_tagged_by_user ,
147
+ 'target' : api .change_target ,
148
+ 'wcommented' : api .get_people_who_commented ,
149
+ 'wtagged' : api .get_people_who_tagged
150
+ }
151
+
152
+ signal .signal (signal .SIGINT , signal_handler )
153
+ gnureadline .parse_and_bind ("tab: complete" )
154
+ gnureadline .set_completer (completer )
155
+
109
156
while True :
110
157
pc .printout ("Run a command: " , pc .YELLOW )
111
158
cmd = input ()
112
- if cmd == "quit" or cmd == "exit" :
113
- pc .printout ("Goodbye!\n " , pc .RED )
114
- sys .exit (0 )
115
- elif cmd == "list" or cmd == "help" :
116
- cmdlist ()
117
- elif cmd == "addrs" :
118
- api .get_addrs ()
119
- elif cmd == "captions" :
120
- api .get_captions ()
121
- elif cmd == "comments" :
122
- api .get_total_comments ()
123
- elif cmd == "followers" :
124
- api .get_followers ()
125
- elif cmd == "followings" :
126
- api .get_followings ()
127
- elif cmd == 'fwersemail' :
128
- api .get_fwersemail ()
129
- elif cmd == 'fwingsemail' :
130
- api .get_fwingsemail ()
131
- elif cmd == "hashtags" :
132
- api .get_hashtags ()
133
- elif cmd == "info" :
134
- api .get_user_info ()
135
- elif cmd == "likes" :
136
- api .get_total_likes ()
137
- elif cmd == "mediatype" :
138
- api .get_media_type ()
139
- elif cmd == "photodes" :
140
- api .get_photo_description ()
141
- elif cmd == "photos" :
142
- api .get_user_photo ()
143
- elif cmd == "propic" :
144
- api .get_user_propic ()
145
- elif cmd == "stories" :
146
- api .get_user_stories ()
147
- elif cmd == "tagged" :
148
- api .get_people_tagged_by_user ()
149
- elif cmd == "target" :
150
- api .change_target ()
151
- elif cmd == "wcommented" :
152
- api .get_people_who_commented ()
153
- elif cmd == "wtagged" :
154
- api .get_people_who_tagged ()
159
+
160
+ _cmd = commands .get (cmd )
161
+
162
+ if _cmd :
163
+ _cmd ()
155
164
elif cmd == "FILE=y" :
156
165
api .set_write_file (True )
157
166
elif cmd == "FILE=n" :
@@ -160,5 +169,7 @@ def completer(text, state):
160
169
api .set_json_dump (True )
161
170
elif cmd == "JSON=n" :
162
171
api .set_json_dump (False )
172
+ elif cmd == "" :
173
+ print ("" )
163
174
else :
164
175
pc .printout ("Unknown command\n " , pc .RED )
0 commit comments