Skip to content

Commit 37f7ff0

Browse files
committed
Merge pull request #2 from adhocore/master
dork file
2 parents 0d7a427 + 5b55877 commit 37f7ff0

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

github-dork.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,22 @@
1111
gh_user = os.getenv('GH_USER', None)
1212
gh_pass = os.getenv('GH_PWD', None)
1313
gh_token = os.getenv('GH_TOKEN', None)
14-
gh_dorks_file = "github-dorks.txt"
1514

1615
gh = github.GitHub(username=gh_user, password=gh_pass, token=gh_token)
1716

1817

19-
def search(repo_to_search=None, user_to_search=None):
18+
def search(repo_to_search=None, user_to_search=None, gh_dorks_file=None):
19+
if gh_dorks_file is None:
20+
gh_dorks_file = 'github-dorks.txt'
21+
if not os.path.isfile(gh_dorks_file):
22+
raise Exception('Error, the dorks file path is not valid')
23+
2024
found = False
2125
with open(gh_dorks_file, 'r') as dork_file:
2226
for dork in dork_file:
2327
dork = dork.strip()
28+
if not dork or dork[0] in '#;':
29+
continue
2430
addendum = ''
2531
if repo_to_search is not None:
2632
addendum = ' repo:' + repo_to_search
@@ -88,10 +94,19 @@ def main():
8894
help='Github repo to search within. Eg: techgaun/github-dorks'
8995
)
9096

97+
parser.add_argument(
98+
'-d',
99+
'--dork',
100+
dest='gh_dorks_file',
101+
action='store',
102+
help='Github dorks file. Eg: github-dorks.txt'
103+
)
104+
91105
args = parser.parse_args()
92106
search(
93107
repo_to_search=args.repo_to_search,
94-
user_to_search=args.user_to_search
108+
user_to_search=args.user_to_search,
109+
gh_dorks_file=args.gh_dorks_file
95110
)
96111

97112
if __name__ == '__main__':

0 commit comments

Comments
 (0)