├── requirements.txt ├── dorks.txt ├── .gitignore ├── README.md ├── gh-dork.py ├── dorker.py └── LICENSE /requirements.txt: -------------------------------------------------------------------------------- 1 | github3.py==2.0.0 2 | -------------------------------------------------------------------------------- /dorks.txt: -------------------------------------------------------------------------------- 1 | # Newline-separated search strings -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 98 | __pypackages__/ 99 | 100 | # Celery stuff 101 | celerybeat-schedule 102 | celerybeat.pid 103 | 104 | # SageMath parsed files 105 | *.sage.py 106 | 107 | # Environments 108 | .env 109 | .venv 110 | env/ 111 | venv/ 112 | ENV/ 113 | env.bak/ 114 | venv.bak/ 115 | 116 | # Spyder project settings 117 | .spyderproject 118 | .spyproject 119 | 120 | # Rope project settings 121 | .ropeproject 122 | 123 | # mkdocs documentation 124 | /site 125 | 126 | # mypy 127 | .mypy_cache/ 128 | .dmypy.json 129 | dmypy.json 130 | 131 | # Pyre type checker 132 | .pyre/ 133 | 134 | # pytype static type analyzer 135 | .pytype/ 136 | 137 | # Cython debug symbols 138 | cython_debug/ 139 | 140 | .DS_Store 141 | .idea/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gh-dork 2 | 3 | Supply a list of dorks and, optionally, one of the following: 4 | * a user (`-u`) 5 | * a file with a list of users (`-uf`) 6 | * an organization (`-org`) 7 | * a file with a list of organizations (`-of`) 8 | * a repo (`-r`) 9 | 10 | You can also pass: 11 | * an output directory to store results (`-o`) 12 | * a filename to store valid items, if your users or org file may contain nonexistent users/orgs (`-vif`) 13 | 14 | All input files (dorks, users, or orgs) should be newline-separated. 15 | 16 | ## Usage 17 | Clone the repository, then run 18 | `pip install -r requirements.txt` 19 | 20 | The only required parameter is the dorks file (`-d`). See 21 | [techguan's github-dorks.txt](https://github.com/techgaun/github-dorks/blob/master/github-dorks.txt) for ideas. 22 | 23 | If an output directory is specified, a file will be created for 24 | each dork in the dorks list, and results will be saved there as well as printed. **Only use an empty/nonexistent 25 | directory or it will be cleared and its contents replaced.** 26 | 27 | If your users or orgs files haven't already been filtered to remove non-existent users/orgs or those without any public 28 | code, it's highly recommended that you pass in a `--valid-items-filename` (`-vif`). This will filter out any invalid 29 | users/orgs when searching for the first dork, and avoid searching against them for subsequent dorks. The output file 30 | can also then be used as the input users/orgs file to speed up later script runs. 31 | 32 | Example usage: 33 | ``` 34 | python gh-dork.py -d dorks.txt # Basic usage 35 | python gh-dork.py -d dorks.txt -u molly # Search repos of a specific user 36 | python gh-dork.py -d dorks.txt -uf users.txt # Search repos of all users in the list 37 | python gh-dork.py -d dorks.txt -uf users.txt -vif valid_users.txt # Search repos of all users in the list, filtering out nonexistent users 38 | python gh-dork.py -d dorks.txt -org github # Search repos of a specific organization 39 | python gh-dork.py -d dorks.txt -of orgs.txt # Search repos of all orgs in the list 40 | python gh-dork.py -d dorks.txt -of orgs.txt -vif valid_orgs.txt # Search repos of all orgs in the list, filtering out nonexistent orgs 41 | python gh-dork.py -d dorks.txt -r molly/gh-dork # Search the specified repo 42 | python gh-dork.py -d dorks.txt -o results # Store results in files in the results/ directory, *overwriting any directory contents* 43 | ``` 44 | 45 | ## Authentication 46 | Authentication is done with environment variables. You can authenticate with a Github private access token (`GH_TOKEN`), 47 | or username and password (`GH_USER` and `GH_PASS`). If you have two-factor authentication enabled, you will be prompted 48 | for a two-factor code. 49 | 50 | You can also pass a Github Enterprise base URL (`GH_URL`) to search against that Github instance; if omitted, this will 51 | run against github.com. 52 | 53 | If no credentials are provided or if credentials are invalid, the script will still run, but will be limited by the 54 | [much lower rate limits](https://docs.github.com/en/rest/reference/search) for unauthenticated users. 55 | 56 | ## Credits 57 | Loosely based on [techgaun/github-dorks](https://github.com/techgaun/github-dorks). -------------------------------------------------------------------------------- /gh-dork.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- encoding: utf-8 -*- 3 | 4 | import argparse 5 | import os 6 | from dorker import Dorker 7 | 8 | 9 | def parse_args(): 10 | parser = argparse.ArgumentParser(description="Github dorker") 11 | 12 | parser.add_argument( 13 | "-d", 14 | "--dork", 15 | required=True, 16 | dest="dorks_filename", 17 | action="store", 18 | help="Text file containing dorks, separated by newline", 19 | ) 20 | parser.add_argument( 21 | "-o", 22 | "--output-dir", 23 | dest="output_dir", 24 | action="store", 25 | help="Directory name for storing results. This will overwrite any directory contents!", 26 | ) 27 | parser.add_argument( 28 | "-vif", 29 | "--valid-items-filename", 30 | dest="valid_items_filename", 31 | action="store", 32 | help="Passing a filename here will allow the script to filter out users or orgs that don't exist and not try to" 33 | " search against them after the first dork. This improves search performance considerably if you haven't " 34 | "already removed nonexistent users/orgs from your input lists, and the file can be reused as an user or orgs " 35 | "input file to prevent such queries later on. This filename will be overwritten if it already exists.", 36 | ) 37 | 38 | group = parser.add_mutually_exclusive_group(required=False) 39 | group.add_argument( 40 | "-u", 41 | "--user", 42 | dest="user", 43 | action="store", 44 | help="Github user to search", 45 | ) 46 | group.add_argument( 47 | "-uf", 48 | "--users-filename", 49 | dest="users_filename", 50 | action="store", 51 | help="Text file containing usernames to search, separated by newline", 52 | ) 53 | group.add_argument( 54 | "-org", 55 | "--org", 56 | dest="org", 57 | action="store", 58 | help="Github organization to search", 59 | ) 60 | group.add_argument( 61 | "-of", 62 | "--orgs-filename", 63 | dest="orgs_filename", 64 | action="store", 65 | help="Text file containing orgs to search, separated by newline", 66 | ) 67 | group.add_argument( 68 | "-r", 69 | "--repo", 70 | dest="repo", 71 | action="store", 72 | help="Github repo to search. For example molly/projectname", 73 | ) 74 | 75 | args = parser.parse_args() 76 | 77 | if not os.path.isfile(args.dorks_filename): 78 | raise Exception("Dorks file does not exist: " + args.dorks_filename) 79 | 80 | if args.output_dir: 81 | if not os.path.exists(args.output_dir): 82 | # Create the output directory if it doesn't exist 83 | os.mkdir(args.output_dir) 84 | else: 85 | # Clear the directory if it does 86 | files = os.listdir(args.output_dir) 87 | if len(files) != 0: 88 | [os.remove(os.path.join(args.output_dir, f)) for f in files] 89 | 90 | if args.valid_items_filename: 91 | if os.path.exists(args.valid_items_filename): 92 | os.remove(args.valid_items_filename) 93 | 94 | return { 95 | "dorks_filename": args.dorks_filename, 96 | "output_dir": args.output_dir, 97 | "user": args.user, 98 | "users_filename": args.users_filename, 99 | "org": args.org, 100 | "orgs_filename": args.orgs_filename, 101 | "repo": args.repo, 102 | "valid_items_filename": args.valid_items_filename, 103 | } 104 | 105 | 106 | if __name__ == "__main__": 107 | args = parse_args() 108 | dorker = Dorker(args) 109 | dorker.run() 110 | -------------------------------------------------------------------------------- /dorker.py: -------------------------------------------------------------------------------- 1 | import github3 2 | import github3.exceptions 3 | import os 4 | import re 5 | import time 6 | 7 | 8 | def two_factor(): 9 | code = None 10 | while not code: 11 | input("Two-factor authentication code: ") 12 | return code 13 | 14 | 15 | class Dorker: 16 | def __init__(self, args): 17 | self.user = args["user"] 18 | self.users_filename = args["users_filename"] 19 | self.org = args["org"] 20 | self.orgs_filename = args["orgs_filename"] 21 | self.repo = args["repo"] 22 | self.dorks_filename = args["dorks_filename"] 23 | self.output_dir = args["output_dir"] 24 | self.valid_items_filename = args["valid_items_filename"] 25 | 26 | self.gh = None 27 | 28 | def authenticate(self): 29 | gh_user = os.getenv("GH_USER", None) 30 | gh_pass = os.getenv("GH_PASS", None) 31 | gh_token = os.getenv("GH_TOKEN", None) 32 | gh_url = os.getenv("GH_URL", None) 33 | 34 | if gh_url: 35 | client = github3.GitHubEnterprise(url=gh_url) 36 | else: 37 | client = github3.GitHub() 38 | 39 | client.login( 40 | username=gh_user, 41 | password=gh_pass, 42 | token=gh_token, 43 | two_factor_callback=two_factor, 44 | ) 45 | 46 | # Check if login worked 47 | try: 48 | client.me() 49 | print("Successfully authenticated.") 50 | except github3.exceptions.AuthenticationFailed: 51 | print( 52 | "Login failed. Proceeding as unauthenticated user, with low rate limit." 53 | ) 54 | 55 | self.gh = { 56 | "client": client, 57 | "reset": { 58 | "search": None, 59 | "core": None, 60 | }, 61 | } 62 | 63 | def get_filename(self, dork): 64 | """Get a filename to store results for this query. In most cases this will just be the dork string sans any 65 | non-alphanumeric characters, but if there are collisions it will add a numeric increment to the end of the 66 | filename to avoid overwriting.""" 67 | filename_base = re.sub("[^a-zA-Z0-9 _]+", "", dork) 68 | filename_base = re.sub(" ", "_", filename_base) 69 | increment = 0 70 | uniq = "" 71 | while True: 72 | if os.path.exists( 73 | os.path.join(self.output_dir, filename_base + uniq + ".txt") 74 | ): 75 | increment += 1 76 | uniq = "_" + str(increment) 77 | else: 78 | return filename_base + uniq + ".txt" 79 | 80 | def handle_rate_limit(self, resource="core"): 81 | """Sleep until the relevant rate limit resets.""" 82 | rate_limit_resp = self.gh["client"].rate_limit() 83 | rate_limit_reset = rate_limit_resp["resources"][resource]["reset"] 84 | self.gh["reset"][resource] = rate_limit_reset 85 | now = int(time.time()) 86 | if self.gh["reset"][resource] and self.gh["reset"][resource] > now: 87 | sleep_duration = self.gh["reset"][resource] - now + 1 88 | print( 89 | "Github {} rate limit hit. Sleeping {} seconds.".format( 90 | resource, 91 | sleep_duration, 92 | ) 93 | ) 94 | time.sleep(sleep_duration) 95 | 96 | def check_user_exists(self, user): 97 | """Check if the user exists before doing the query. This helps reduce the number of calls to the search API, 98 | which has a much lower rate limit.""" 99 | user = user.strip() 100 | try: 101 | self.gh["client"].user(user) 102 | return True 103 | except github3.exceptions.ForbiddenError: 104 | self.handle_rate_limit("core") 105 | return self.check_user_exists(user) 106 | except github3.exceptions.NotFoundError: 107 | print("User {} doesn't exist".format(user)) 108 | return False 109 | 110 | def check_org_exists(self, org): 111 | """Check if the org exists before doing the query. This helps reduce the number of calls to the search API, 112 | which has a much lower rate limit.""" 113 | org = org.strip() 114 | try: 115 | self.gh["client"].organization(org) 116 | return True 117 | except github3.exceptions.ForbiddenError: 118 | self.handle_rate_limit("core") 119 | return self.check_org_exists(org) 120 | except github3.exceptions.NotFoundError: 121 | print("Org {} doesn't exist".format(org)) 122 | return False 123 | 124 | def search(self, query, output_filename): 125 | """Search Github and print/log results.""" 126 | print("Searching: " + query) 127 | try: 128 | found = False 129 | search_results = self.gh["client"].search_code(query) 130 | for result in search_results: 131 | found = True 132 | formatted_result = "\n".join( 133 | [ 134 | "Found result for {dork}", 135 | "Text matches: {text_matches}", 136 | "File path: {path}", 137 | "Score: {score}", 138 | "File URL: {url}", 139 | ] 140 | ).format( 141 | dork=query, 142 | text_matches=result.text_matches, 143 | path=result.path, 144 | score=result.score, 145 | url=result.url, 146 | ) 147 | if output_filename: 148 | with open( 149 | os.path.join(self.output_dir, output_filename), "a+" 150 | ) as output_file: 151 | output_file.write(formatted_result + "\n\n") 152 | print(formatted_result) 153 | if not found: 154 | with open( 155 | os.path.join(self.output_dir, output_filename), "a+" 156 | ) as output_file: 157 | output_file.write("No results for {}\n\n".format(query)) 158 | print("No results for " + query) 159 | return True # Valid user with code results 160 | except github3.exceptions.ForbiddenError as e: 161 | self.handle_rate_limit("search") 162 | return self.search(query, output_filename) 163 | except github3.exceptions.GitHubError as e: 164 | if e.code == 422: 165 | return False 166 | raise e 167 | except Exception as e: 168 | raise e 169 | 170 | def search_with_filter(self, dork, filter_name, filter_value, output_filename): 171 | """Strip search values of whitespace, form the query, and call the search function.""" 172 | stripped_value = filter_value.strip() 173 | if not stripped_value: 174 | return False 175 | query = "{dork} {filter}:{value}".format( 176 | dork=dork, filter=filter_name, value=stripped_value 177 | ) 178 | return self.search(query, output_filename) 179 | 180 | def search_with_users_file(self, dork, output_filename): 181 | if not self.valid_items_filename: 182 | # Search without saving whether the user exists/has public code 183 | with open(self.users_filename, "r") as users_file: 184 | for user in users_file: 185 | if not self.check_user_exists(user): 186 | continue 187 | self.search_with_filter(dork, "user", user, output_filename) 188 | elif self.valid_items_filename and os.path.exists(self.valid_items_filename): 189 | # We already have a list of valid users, so don't need to check 190 | with open(self.valid_items_filename, "r") as users_file: 191 | for user in users_file: 192 | self.search_with_filter(dork, "user", user, output_filename) 193 | else: 194 | # We haven't yet filtered the users, but we want to save the valid ones 195 | with open(self.users_filename, "r") as users_file: 196 | for user in users_file: 197 | if not self.check_user_exists(user): 198 | continue 199 | user_has_code = self.search_with_filter( 200 | dork, "user", user, output_filename 201 | ) 202 | if user_has_code: 203 | with open(self.valid_items_filename, "a+") as valid_users_file: 204 | valid_users_file.write(user) 205 | 206 | def search_with_orgs_file(self, dork, output_filename): 207 | if not self.valid_items_filename: 208 | # Search without saving whether the org exists/has public code 209 | with open(self.orgs_filename, "r") as orgs_file: 210 | for org in orgs_file: 211 | if not self.check_org_exists(org): 212 | continue 213 | self.search_with_filter(dork, "org", org, output_filename) 214 | elif self.valid_items_filename and os.path.exists(self.valid_items_filename): 215 | # We already have a list of valid orgs, so don't need to check 216 | with open(self.valid_items_filename, "r") as orgs_file: 217 | for org in orgs_file: 218 | self.search_with_filter(dork, "org", org, output_filename) 219 | else: 220 | # We haven't yet filtered the orgs, but we want to save the valid ones 221 | with open(self.orgs_filename, "r") as orgs_file: 222 | for org in orgs_file: 223 | if not self.check_org_exists(org): 224 | continue 225 | org_has_code = self.search_with_filter( 226 | dork, "org", org, output_filename 227 | ) 228 | if org_has_code: 229 | with open(self.valid_items_filename, "a+") as valid_orgs_file: 230 | valid_orgs_file.write(org) 231 | 232 | def dork(self): 233 | with open(self.dorks_filename, "r") as dorks_file: 234 | for dork in dorks_file: 235 | dork = dork.strip() 236 | if not dork or dork[0] in "#;": 237 | continue 238 | 239 | print(dork) 240 | 241 | output_filename = None 242 | if self.output_dir: 243 | output_filename = self.get_filename(dork) 244 | 245 | if self.user: 246 | # Single user 247 | self.search_with_filter(dork, "user", self.user, output_filename) 248 | elif self.users_filename: 249 | # Users file 250 | self.search_with_users_file(dork, output_filename) 251 | elif self.org: 252 | # Single org 253 | self.search_with_filter(dork, "org", self.org, output_filename) 254 | elif self.orgs_filename: 255 | # Orgs file 256 | self.search_with_orgs_file(dork, output_filename) 257 | elif self.repo: 258 | self.search_with_filter(dork, "repo", self.repo, output_filename) 259 | 260 | def run(self): 261 | self.authenticate() 262 | self.dork() 263 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------