Skip to content

Commit

Permalink
Merge pull request #1 from orionkendrick/sherlock-browse-1
Browse files Browse the repository at this point in the history
added browse functionality to notify.py
  • Loading branch information
orionkendrick authored Dec 23, 2022
2 parents d6ce824 + e6eef99 commit 96c65c2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sherlock/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
from result import QueryStatus
from colorama import Fore, Style
import webbrowser
globvar = 0 # global variable to count the number of results.

class QueryNotify:
Expand Down Expand Up @@ -109,7 +110,7 @@ class QueryNotifyPrint(QueryNotify):
Query notify class that prints results.
"""

def __init__(self, result=None, verbose=False, print_all=False):
def __init__(self, result=None, verbose=False, print_all=False, browse=False):
"""Create Query Notify Print Object.
Contains information about a specific method of notifying the results
Expand All @@ -121,6 +122,7 @@ def __init__(self, result=None, verbose=False, print_all=False):
results for this query.
verbose -- Boolean indicating whether to give verbose output.
print_all -- Boolean indicating whether to only print all sites, including not found.
browse -- Boolean indicating whether to open found sites in a web browser.
Return Value:
Nothing.
Expand All @@ -129,6 +131,7 @@ def __init__(self, result=None, verbose=False, print_all=False):
super().__init__(result)
self.verbose = verbose
self.print_all = print_all
self.browse = browse

return

Expand Down Expand Up @@ -227,7 +230,9 @@ def update(self, result):
Fore.GREEN +
f" {self.result.site_name}: " +
Style.RESET_ALL +
f"{self.result.site_url_user}")
f"{self.result.site_url_user}")
if self.browse:
webbrowser.open(self.result.site_url_user,2)

elif result.status == QueryStatus.AVAILABLE:
if self.print_all:
Expand Down

0 comments on commit 96c65c2

Please sign in to comment.