forked from Te-k/harpoon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first organization for code, libs and commands
- Loading branch information
Showing
6 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Command(object): | ||
def add_arguments(self, parser): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#! /usr/bin/env python | ||
from harpoon.commands.base import Command | ||
from harpoon.lib.bitly import Bitly | ||
|
||
class CommandBitly(Command): | ||
name = "bitly" | ||
|
||
def run(self): | ||
print('Bitly') | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('--hash', '-H', help='HASH of a link') | ||
parser.add_argument('--file', '-f', help='File containing list of hashes') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import sys | ||
import argparse | ||
from harpoon.commands.base import Command | ||
|
||
def init_plugins(): | ||
plugin_dir = os.path.dirname(os.path.realpath(__file__)) + '/commands' | ||
plugin_files = [x[:-3] for x in os.listdir(plugin_dir) if x.endswith(".py")] | ||
sys.path.insert(0, plugin_dir) | ||
for plugin in plugin_files: | ||
mod = __import__(plugin) | ||
|
||
PLUGINS = {} | ||
for plugin in Command.__subclasses__(): | ||
PLUGINS[plugin.name] = plugin() | ||
return PLUGINS | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
subparsers = parser.add_subparsers(help='Commands') | ||
|
||
plugins = init_plugins() | ||
for p in plugins: | ||
sp = subparsers.add_parser(plugins[p].name, help='...') | ||
plugins[p].add_arguments(sp) | ||
sp.set_defaults(command=p) | ||
|
||
args = parser.parse_args() | ||
print(args) | ||
|
||
print(plugins) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from setuptools import setup | ||
|
||
setup( | ||
name='harpoon', | ||
version='0.1', | ||
description='Another OSINT CLI tool', | ||
url='https://github.com/Te-k/harpoon', | ||
author='Tek', | ||
author_email='[email protected]', | ||
keywords='osint', | ||
install_requires=['requests', 'click'], | ||
license='GPLv3', | ||
packages=['harpoon', 'harpoon.commands'], | ||
entry_points= { | ||
'console_scripts': [ 'harpoon=harpoon.main:main' ] | ||
} | ||
) |