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.
- Loading branch information
Showing
3 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,13 +1,43 @@ | ||
#! /usr/bin/env python | ||
import sys | ||
from harpoon.commands.base import Command | ||
from harpoon.lib.bitly import Bitly | ||
from harpoon.lib.bitly import Bitly, Link | ||
|
||
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') | ||
|
||
def run(self, conf, args): | ||
if 'Bitly' not in conf and 'token' not in conf['Bitly']: | ||
print('Invalid configuration file, quitting...') | ||
sys.exit(1) | ||
bitly = Bitly(access_token=conf['Bitly']["token"]) | ||
if args.hash: | ||
link = Link(bitly, args.hash) | ||
link.pprint() | ||
elif args.file: | ||
f = open(args.file, 'r') | ||
data = f.read().split() | ||
print("Date;Short URL;Long URL;Analytics;Aggregate;Aggregate Hash;User;Short URL Clicks;Long URL Clicks") | ||
for d in data: | ||
if d.strip() != "": | ||
link = Link(bitly, d) | ||
print("%s;%s;%s;%s;%s;%s;%s;%i;%i" % ( | ||
link.timestamp.strftime("%m/%d/%Y %H:%M:%S"), | ||
link.short_url, | ||
link.long_url, | ||
link.short_url + "+", | ||
link.hash if link.is_aggregate else link.aggregate.hash, | ||
"Yes" if link.is_aggregate else "No", | ||
link.user_hash, | ||
link.clicks, | ||
link.clicks if link.is_aggregate else link.aggregate.clicks | ||
) | ||
) | ||
else: | ||
print("Please provide a hash or a 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
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
author='Tek', | ||
author_email='[email protected]', | ||
keywords='osint', | ||
install_requires=['requests', 'click'], | ||
install_requires=['requests', 'configparser'], | ||
license='GPLv3', | ||
packages=['harpoon', 'harpoon.commands'], | ||
entry_points= { | ||
|