Skip to content

Commit c8209f9

Browse files
committed
added file searching feature
1 parent ca84d97 commit c8209f9

3 files changed

Lines changed: 21 additions & 9 deletions

File tree

gdcli/commands/cli.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
from typing import Dict
3-
43
from gdcli.helpers.browser import open_browser
54
from gdcli.utils.query import builder
65
from gdcli.utils.cli_arguments.args import Init
@@ -20,6 +19,8 @@ def __call__(self):
2019
url = self.__query_build_insta__(vars(self.args))
2120
elif(self.args.option == 3):
2221
url = self.__query_build_phone__(vars(self.args))
22+
elif(self.args.option == 4):
23+
url = self.__query_build_file__(vars(self.args))
2324
else:
2425
raise Exception("Invalid option specified")
2526

@@ -29,7 +30,6 @@ def __call__(self):
2930
self.parser.print_usage()
3031
exit()
3132
if url is not None:
32-
3333
open_browser(url=url)
3434

3535
def __query_build_general__(self, args: Dict) -> str:
@@ -82,3 +82,15 @@ def __query_build_phone__(self, args: Dict) -> str:
8282
sys.stdout.write(str(e))
8383
self.parser.print_usage()
8484
return None
85+
86+
def __query_build_file__(args) -> str:
87+
try:
88+
if(args.get("search_query")):
89+
return f'https://google.com/search?q={args.get("search_query")} filetype:{args.get("file_type")}'
90+
else:
91+
raise Exception(
92+
"search query is not found,pls provide search query")
93+
except Exception as e:
94+
print(e)
95+
exit(0)
96+
return None

gdcli/gd.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
21
from gdcli.commands.cli import Cli
3-
4-
52
cli=Cli()
63
def start():
74
cli()
8-
95
start()

gdcli/utils/cli_arguments/args.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ class Init():
66
def _initialise_args__(self):
77
self.parser = argparse.ArgumentParser(
88
'''Commamd line tool for Google dorks\n
9+
910
1) -op 1 for general query \n
1011
>> gd -op 1 -q ninja -s instagram -e gamer \n
12+
1113
2) -op 2 for instagram user finding
1214
>> gd -op 2 -q ninja -b gamer -l usa
13-
14-
15+
16+
3) -op to for specific filetype
17+
>> gd -op 3 -q python -f docx
18+
1519
''')
1620
self.parser.add_argument(
17-
CLI_OPTIONS[4], dest=DISPLAY_OPTIONS[0], type=int, help="Option [1 2 3]")
21+
CLI_OPTIONS[4], dest=DISPLAY_OPTIONS[0], type=int, help="Option [1 2 3 4]")
1822
self.parser.add_argument(
1923
CLI_OPTIONS[0], dest=DISPLAY_OPTIONS[1], type=str, help="Search Query ")
2024
self.parser.add_argument(

0 commit comments

Comments
 (0)