Skip to content

Commit 9ea08b2

Browse files
authored
Merge pull request sherlock-project#1650 from orionkendrick/master
Add --browse functionallity
2 parents 3a25c0b + 96c65c2 commit 9ea08b2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

sherlock/notify.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66
from result import QueryStatus
77
from colorama import Fore, Style
8+
import webbrowser
89
globvar = 0 # global variable to count the number of results.
910

1011
class QueryNotify:
@@ -109,7 +110,7 @@ class QueryNotifyPrint(QueryNotify):
109110
Query notify class that prints results.
110111
"""
111112

112-
def __init__(self, result=None, verbose=False, print_all=False):
113+
def __init__(self, result=None, verbose=False, print_all=False, browse=False):
113114
"""Create Query Notify Print Object.
114115
115116
Contains information about a specific method of notifying the results
@@ -121,6 +122,7 @@ def __init__(self, result=None, verbose=False, print_all=False):
121122
results for this query.
122123
verbose -- Boolean indicating whether to give verbose output.
123124
print_all -- Boolean indicating whether to only print all sites, including not found.
125+
browse -- Boolean indicating whether to open found sites in a web browser.
124126
125127
Return Value:
126128
Nothing.
@@ -129,6 +131,7 @@ def __init__(self, result=None, verbose=False, print_all=False):
129131
super().__init__(result)
130132
self.verbose = verbose
131133
self.print_all = print_all
134+
self.browse = browse
132135

133136
return
134137

@@ -227,7 +230,9 @@ def update(self, result):
227230
Fore.GREEN +
228231
f" {self.result.site_name}: " +
229232
Style.RESET_ALL +
230-
f"{self.result.site_url_user}")
233+
f"{self.result.site_url_user}")
234+
if self.browse:
235+
webbrowser.open(self.result.site_url_user,2)
231236

232237
elif result.status == QueryStatus.AVAILABLE:
233238
if self.print_all:

sherlock/sherlock.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,8 @@ def main():
664664
# Create notify object for query results.
665665
query_notify = QueryNotifyPrint(result=None,
666666
verbose=args.verbose,
667-
print_all=args.print_all)
667+
print_all=args.print_all,
668+
browse=args.browse)
668669

669670
# Run report on all specified users.
670671

0 commit comments

Comments
 (0)