Skip to content

Commit

Permalink
Add support for GitHub Enterprise (#10)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
crdotson authored and techgaun committed Sep 1, 2016
1 parent df70a79 commit a8078fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pip install -r requirements.txt
GH_USER - Environment variable to specify github user
GH_PWD - Environment variable to specify password
GH_TOKEN - Environment variable to specify github token
GH_URL - Environment variable to specify GitHub Enterprise base URL
```

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

GH_TOKEN=<github_token> python github-dork.py -u dev-nepal # search using auth token

GH_URL=https://github.example.com python github-dork.py -u dev-nepal # search a GitHub Enterprise instance
```

#### Limitations
Expand Down
6 changes: 5 additions & 1 deletion github-dork.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
gh_user = os.getenv('GH_USER', None)
gh_pass = os.getenv('GH_PWD', None)
gh_token = os.getenv('GH_TOKEN', None)
gh_url = os.getenv('GH_URL', None)

gh = github.GitHub(username=gh_user, password=gh_pass, token=gh_token)
if gh_url is None:
gh = github.GitHub(username=gh_user, password=gh_pass, token=gh_token)
else:
gh = github.GitHubEnterprise(url=gh_url, username=gh_user, password=gh_pass, token=gh_token)

def search_wrapper(gen):
while True:
Expand Down

0 comments on commit a8078fb

Please sign in to comment.