Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a command line mode #155

Merged
merged 8 commits into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,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 @@ -108,18 +108,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.cli, args.output)


commands = {
Expand Down Expand Up @@ -151,18 +151,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.cli:
printlogo()

while True:
pc.printout("Run a command: ", pc.YELLOW)
cmd = input()
if args.cli:
cmd = args.cli
_cmd = commands.get(args.cli)
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 @@ -175,3 +181,6 @@ def _quit():
print("")
else:
pc.printout("Unknown command\n", pc.RED)

if args.cli:
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