Skip to content

Commit a8078fb

Browse files
crdotsontechgaun
authored andcommitted
Add support for GitHub Enterprise (#10)
* Add support for GitHub Enterprise Allows you to set the GH_URL environment variable, which will cause github-dork to connect to that URL instead of github.com. * Add support for GitHub Enterprise
1 parent df70a79 commit a8078fb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pip install -r requirements.txt
1717
GH_USER - Environment variable to specify github user
1818
GH_PWD - Environment variable to specify password
1919
GH_TOKEN - Environment variable to specify github token
20+
GH_URL - Environment variable to specify GitHub Enterprise base URL
2021
```
2122

2223
Some example usages are listed below:
@@ -31,6 +32,8 @@ python github-dork.py -u dev-nepal # search
3132
GH_USER=techgaun GH_PWD=<mypass> python github-dork.py -u dev-nepal # search as authenticated user
3233

3334
GH_TOKEN=<github_token> python github-dork.py -u dev-nepal # search using auth token
35+
36+
GH_URL=https://github.example.com python github-dork.py -u dev-nepal # search a GitHub Enterprise instance
3437
```
3538

3639
#### Limitations

github-dork.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
gh_user = os.getenv('GH_USER', None)
1414
gh_pass = os.getenv('GH_PWD', None)
1515
gh_token = os.getenv('GH_TOKEN', None)
16+
gh_url = os.getenv('GH_URL', None)
1617

17-
gh = github.GitHub(username=gh_user, password=gh_pass, token=gh_token)
18+
if gh_url is None:
19+
gh = github.GitHub(username=gh_user, password=gh_pass, token=gh_token)
20+
else:
21+
gh = github.GitHubEnterprise(url=gh_url, username=gh_user, password=gh_pass, token=gh_token)
1822

1923
def search_wrapper(gen):
2024
while True:

0 commit comments

Comments
 (0)