Skip to content

Commit

Permalink
Merge pull request #155 from anatolykopyl/development
Browse files Browse the repository at this point in the history
Added a command line mode
  • Loading branch information
Datalux authored May 12, 2021
2 parents 2926950 + 58cee62 commit 621dd66
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 63 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <target username>`
* As an interactive prompt `python3 main.py <target username>`
* Or execute your command straight away `python3 main.py <target username> --command <command>`

## Docker Quick Start 🐳

Expand Down
31 changes: 20 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,18 @@ 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('-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)


commands = {
Expand Down Expand Up @@ -146,18 +146,24 @@ def _quit():
'wtagged': api.get_people_who_tagged
}

signal.signal(signal.SIGINT, signal_handler)
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":
Expand All @@ -170,3 +176,6 @@ def _quit():
print("")
else:
pc.printout("Unknown command\n", pc.RED)

if args.command:
break
2 changes: 1 addition & 1 deletion output/dont_delete_this_folder.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Please don't deleate this folder.
Please don't delete this folder.
Loading

0 comments on commit 621dd66

Please sign in to comment.