From 19de4146d88e7a6e8c2c6448949715ea672b9a1d Mon Sep 17 00:00:00 2001 From: HarryLudemann <60420781+HarryLudemann@users.noreply.github.com> Date: Thu, 11 Nov 2021 16:42:28 +1300 Subject: [PATCH] Delete configuration/plugin/test directory --- configuration/plugin/test/google2.py | 62 --------------------- configuration/plugin/test/test2/google3.py | 63 ---------------------- 2 files changed, 125 deletions(-) delete mode 100644 configuration/plugin/test/google2.py delete mode 100644 configuration/plugin/test/test2/google3.py diff --git a/configuration/plugin/test/google2.py b/configuration/plugin/test/google2.py deleted file mode 100644 index f4a7ad5..0000000 --- a/configuration/plugin/test/google2.py +++ /dev/null @@ -1,62 +0,0 @@ -from ngoto import Plugin -import logging -try: - from googlesearch import search -except ImportError: - logging.warning("No module named 'google' found, cannot use google dorking/search") - -class Plugin(Plugin): - name = 'Google2' - version = 0.1 - description = 'Google Search' - - def get_info(self, query, types, parameter, max_results=10): - """ given query, list of websites eg ['twitter.com', 'facebook.com'] or ['pdf', 'xlsx] and parameter eg filetype: or site: - returns list of url's """ - if not types: # if types is empty - logging.error('types var must contain list of requested file types') - return [] - else: - formatted_query = f"\"{query}\" {parameter}{types[0]}" - for type in types[1:]: # iterate skipping first item - formatted_query += f" OR {parameter}{type}" - return { 'urls': search(formatted_query, num_results=max_results, lang="en" ) } - - def main(self, hz): - type = hz.interface.get_input("Search f:file or w:website: ", '[Google]', hz.current_pos) - if type == 'back': return {} - target = hz.interface.get_input("Enter query: ", '[Google]', hz.current_pos) - if target == 'back': return {} - if type == 'f': - files = hz.interface.get_input("Enter file types eg. pdf xlsx docx: ", '[Google]', hz.current_pos).split() - if files == 'back': return {} - maxcount = hz.interface.get_input("Optionally enter max results: ", '[Google]', hz.current_pos) - if maxcount == 'back': return {} - return self.get_info(target, files, 'filetype:', int(maxcount)) - elif type == 'w': - websites = hz.interface.get_input("Enter websites eg facebook.com twitter.com: ", '[Google]', hz.current_pos).split() - if websites == 'back': return {} - maxcount = hz.interface.get_input("Optionally enter max results: ", '[Google]', hz.current_pos) - if maxcount == 'back': return {} - return self.get_info(target, websites, 'site:', int(maxcount)) - - def get_context(self, args): - return self.get_info(args[0], args[1], args[2], args[3]) - - def print_info(self, hz, context, tables): - col_names = ['URL'] - col_values = [] - longest_url = 0 - for item in context['urls']: - col_values.append( [item] ) - if len(item) > longest_url: - longest_url = len(item) - col_widths = [longest_url] - hz.interface.output( '\n' + tables.get_table(col_names, col_widths, col_values) ) - - def create_table(self): - return ''' - CREATE TABLE IF NOT EXISTS google ( - id integer PRIMARY KEY AUTOINCREMENT, - url text ); - ''' \ No newline at end of file diff --git a/configuration/plugin/test/test2/google3.py b/configuration/plugin/test/test2/google3.py deleted file mode 100644 index 407a80b..0000000 --- a/configuration/plugin/test/test2/google3.py +++ /dev/null @@ -1,63 +0,0 @@ -from sys import version -from ngoto import Plugin -import logging -try: - from googlesearch import search -except ImportError: - logging.warning("No module named 'google' found, cannot use google dorking/search") - -class Plugin(Plugin): - name = 'Google3' - version = 0.1 - description = 'Google Search' - - def get_info(self, query, types, parameter, max_results=10): - """ given query, list of websites eg ['twitter.com', 'facebook.com'] or ['pdf', 'xlsx] and parameter eg filetype: or site: - returns list of url's """ - if not types: # if types is empty - logging.error('types var must contain list of requested file types') - return [] - else: - formatted_query = f"\"{query}\" {parameter}{types[0]}" - for type in types[1:]: # iterate skipping first item - formatted_query += f" OR {parameter}{type}" - return { 'urls': search(formatted_query, num_results=max_results, lang="en" ) } - - def main(self, hz): - type = hz.interface.get_input("Search f:file or w:website: ", '[Google]', hz.current_pos) - if type == 'back': return {} - target = hz.interface.get_input("Enter query: ", '[Google]', hz.current_pos) - if target == 'back': return {} - if type == 'f': - files = hz.interface.get_input("Enter file types eg. pdf xlsx docx: ", '[Google]', hz.current_pos).split() - if files == 'back': return {} - maxcount = hz.interface.get_input("Optionally enter max results: ", '[Google]', hz.current_pos) - if maxcount == 'back': return {} - return self.get_info(target, files, 'filetype:', int(maxcount)) - elif type == 'w': - websites = hz.interface.get_input("Enter websites eg facebook.com twitter.com: ", '[Google]', hz.current_pos).split() - if websites == 'back': return {} - maxcount = hz.interface.get_input("Optionally enter max results: ", '[Google]', hz.current_pos) - if maxcount == 'back': return {} - return self.get_info(target, websites, 'site:', int(maxcount)) - - def get_context(self, args): - return self.get_info(args[0], args[1], args[2], args[3]) - - def print_info(self, hz, context, tables): - col_names = ['URL'] - col_values = [] - longest_url = 0 - for item in context['urls']: - col_values.append( [item] ) - if len(item) > longest_url: - longest_url = len(item) - col_widths = [longest_url] - hz.interface.output( '\n' + tables.get_table(col_names, col_widths, col_values) ) - - def create_table(self): - return ''' - CREATE TABLE IF NOT EXISTS google ( - id integer PRIMARY KEY AUTOINCREMENT, - url text ); - ''' \ No newline at end of file