33from src .Osintgram import Osintgram
44import argparse
55from src import printcolors as pc
6+ from src import artwork
67import sys
78import signal
89
1617
1718
1819def printlogo ():
19- pc .printout ("________ .__ __ \n " , pc .YELLOW )
20- pc .printout ("\_____ \ _____|__| _____/ |_ ________________ _____ \n " , pc .YELLOW )
21- pc .printout (" / | \ / ___/ |/ \ __\/ ___\_ __ \__ \ / \ \n " , pc .YELLOW )
22- pc .printout ("/ | \\ \___ \| | | \ | / /_/ > | \// __ \| Y Y \\ \n " , pc .YELLOW )
23- pc .printout ("\_______ /____ >__|___| /__| \___ /|__| (____ /__|_| /\n " , pc .YELLOW )
24- pc .printout (" \/ \/ \/ /_____/ \/ \/ \n " , pc .YELLOW )
25- print ('\n ' )
26- pc .printout ("Version 1.2 - Developed by Giuseppe Criscione\n \n " , pc .YELLOW )
20+ pc .printout (artwork .ascii_art , pc .YELLOW )
21+ pc .printout ("\n Version 1.1 - Developed by Giuseppe Criscione\n \n " , pc .YELLOW )
2722 pc .printout ("Type 'list' to show all allowed commands\n " )
2823 pc .printout ("Type 'FILE=y' to save results to files like '<target username>_<command>.txt (default is disabled)'\n " )
2924 pc .printout ("Type 'FILE=n' to disable saving to files'\n " )
@@ -39,6 +34,8 @@ def cmdlist():
3934 print ("Enable/disable export in a '<target username>_<command>.json' file'" )
4035 pc .printout ("addrs\t \t " )
4136 print ("Get all registered addressed by target photos" )
37+ pc .printout ("cache\t \t " )
38+ print ("Clear cache of the tool" )
4239 pc .printout ("captions\t " )
4340 print ("Get target's photos captions" )
4441 pc .printout ("commentdata\t " )
@@ -108,18 +105,21 @@ def _quit():
108105 gnureadline .parse_and_bind ("tab: complete" )
109106 gnureadline .set_completer (completer )
110107
111- printlogo ()
112-
113108parser = argparse .ArgumentParser (description = 'Osintgram is a OSINT tool on Instagram. It offers an interactive shell '
114109 'to perform analysis on Instagram account of any users by its nickname ' )
115110parser .add_argument ('id' , type = str , # var = id
116111 help = 'username' )
112+ parser .add_argument ('-C' ,'--cookies' , help = 'clear\' s previous cookies' , action = "store_true" )
117113parser .add_argument ('-j' , '--json' , help = 'save commands output as JSON file' , action = 'store_true' )
118114parser .add_argument ('-f' , '--file' , help = 'save output in a file' , action = 'store_true' )
115+ parser .add_argument ('-c' , '--command' , help = 'run in single command mode & execute provided command' , action = 'store' )
116+ parser .add_argument ('-o' , '--output' , help = 'where to store photos' , action = 'store' )
119117
120118args = parser .parse_args ()
121119
122- api = Osintgram (args .id , args .file , args .json )
120+
121+ api = Osintgram (args .id , args .file , args .json , args .command , args .output , args .cookies )
122+
123123
124124
125125commands = {
@@ -128,6 +128,7 @@ def _quit():
128128 'quit' : _quit ,
129129 'exit' : _quit ,
130130 'addrs' : api .get_addrs ,
131+ 'cache' : api .clear_cache ,
131132 'captions' : api .get_captions ,
132133 "commentdata" : api .get_comment_data ,
133134 'comments' : api .get_total_comments ,
@@ -151,6 +152,7 @@ def _quit():
151152 'wtagged' : api .get_people_who_tagged
152153}
153154
155+
154156signal .signal (signal .SIGINT , signal_handler )
155157if is_windows :
156158 pyreadline .Readline ().parse_and_bind ("tab: complete" )
@@ -159,14 +161,25 @@ def _quit():
159161 gnureadline .parse_and_bind ("tab: complete" )
160162 gnureadline .set_completer (completer )
161163
164+ if not args .command :
165+ printlogo ()
166+
167+
162168while True :
163- pc .printout ("Run a command: " , pc .YELLOW )
164- cmd = input ()
169+ if args .command :
170+ cmd = args .command
171+ _cmd = commands .get (args .command )
172+ else :
173+ signal .signal (signal .SIGINT , signal_handler )
174+ gnureadline .parse_and_bind ("tab: complete" )
175+ gnureadline .set_completer (completer )
176+ pc .printout ("Run a command: " , pc .YELLOW )
177+ cmd = input ()
178+
179+ _cmd = commands .get (cmd )
165180
166- _cmd = commands .get (cmd )
167-
168181 if _cmd :
169- _cmd ()
182+ _cmd ()
170183 elif cmd == "FILE=y" :
171184 api .set_write_file (True )
172185 elif cmd == "FILE=n" :
@@ -179,3 +192,6 @@ def _quit():
179192 print ("" )
180193 else :
181194 pc .printout ("Unknown command\n " , pc .RED )
195+
196+ if args .command :
197+ break
0 commit comments