├── .circleci └── config.yml ├── .gitignore ├── .goreleaser.yml ├── LICENSE ├── README.md ├── assets └── assets.go ├── command ├── apiroutes │ ├── apiroutes.go │ ├── helper.go │ └── models.go ├── deletedfiles │ ├── deleted.go │ ├── helper.go │ └── models.go ├── directories │ ├── directories.go │ ├── helper.go │ └── models.go ├── parameters │ ├── helper.go │ ├── models.go │ └── parameters.go ├── routes │ ├── helper.go │ ├── models.go │ └── routes.go ├── subdomains │ ├── helper.go │ ├── models.go │ └── subdomains.go ├── technologies │ ├── helper.go │ ├── models.go │ └── technologies.go └── wordswithext │ ├── helper.go │ ├── models.go │ └── words.go ├── commands.go ├── data ├── filters │ ├── numerical-parameters.txt │ └── string-parameters.txt └── sql │ ├── github │ ├── deleted-files-test.sql │ ├── deleted-files.sql │ ├── nodejs-routes-test.sql │ ├── nodejs-routes.sql │ ├── rails-routes-test.sql │ ├── rails-routes.sql │ ├── tomcat-routes-test.sql │ ├── tomcat-routes.sql │ └── words-with-ext.sql │ ├── hackernews │ └── subdomains.sql │ └── http-archive │ ├── apiroutes.sql │ ├── directories.sql │ ├── parameters.sql │ ├── subdomains.sql │ ├── technologies.sql │ └── words-with-ext.sql ├── glide.lock ├── glide.yaml ├── log └── log.go ├── main.go ├── noisey └── noisey.go └── version.go /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | working_directory: /go/src/github.com/assetnote/commonspeak2 5 | docker: 6 | - image: circleci/golang:1.10 7 | steps: 8 | - checkout 9 | - run: go get -u -v -t github.com/Masterminds/glide 10 | - run: glide install -v 11 | - run: go build 12 | release: 13 | working_directory: /go/src/github.com/assetnote/commonspeak2 14 | docker: 15 | - image: circleci/golang:1.10 16 | steps: 17 | - checkout 18 | - run: go get -u -v -t github.com/Masterminds/glide 19 | - run: glide install -v 20 | - run: curl -sL https://git.io/goreleaser | bash 21 | workflows: 22 | version: 2 23 | build: 24 | jobs: 25 | - build 26 | release: 27 | jobs: 28 | - release: 29 | filters: 30 | branches: 31 | ignore: /.*/ 32 | tags: 33 | only: /v[0-9]+(\.[0-9]+)*(-.*)*/ 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | vendor/** 3 | compiled/** 4 | credentials.json 5 | credentials-assetnote.json -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | builds: 2 | - env: 3 | - CGO_ENABLED=0 4 | archive: 5 | replacements: 6 | darwin: Darwin 7 | linux: Linux 8 | windows: Windows 9 | 386: i386 10 | amd64: x86_64 11 | checksum: 12 | name_template: 'checksums.txt' 13 | snapshot: 14 | name_template: "{{ .Tag }}-next" 15 | changelog: 16 | sort: asc 17 | filters: 18 | exclude: 19 | - '^docs:' 20 | - '^test:' -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Commonspeak2 2 | --- 3 | 4 | Commonspeak2 leverages publicly available datasets from Google BigQuery to generate content discovery and subdomain wordlists. 5 | 6 | As these datasets are updated on a regular basis, the wordlists generated via Commonspeak2 reflect the current technologies used on the web. 7 | 8 | By using the Golang client for BigQuery, we can stream the data and process it very quickly. The future of this project will revolve around improving the quality of wordlists generated by creating automated filters and substitution functions. 9 | 10 | Let's turn creating wordlists from a manual task, into a reproducible and reliable science with BigQuery. 11 | 12 | 13 | I just want the wordlists... 14 | ---- 15 | We will update [wordlists.assetnote.io](https://wordlists.assetnote.io) website with any wordlists generated the Commonspeak2 tool. 16 | 17 | Wordlists are automatically generated at the end of each month and uploaded to this site. Further details here: https://github.com/assetnote/wordlists 18 | 19 | 20 | Instructions & Usage 21 | ---- 22 | 23 | If you're compiling or running Commonspeak2 from source: 24 | 25 | * [Golang 1.10 or above](https://storage.googleapis.com/golang/getgo/installer_linux) 26 | * [Glide](https://github.com/Masterminds/glide) 27 | * [Google Cloud Service Account with access to BigQuery](https://cloud.google.com/bigquery/docs/reference/libraries#client-libraries-install-go) 28 | 29 | If you're using the pre-built binaries: 30 | 31 | * Download the newest release [here](https://github.com/assetnote/commonspeak2/releases) 32 | 33 | Upon completing the above steps, Commonspeak2 can be used in the following ways: 34 | 35 | ### Subdomains 36 | 37 | Currently subdomains are extracted from HackerNews and HTTPArchive's latest scans. Unlike the previous revision of Commonspeak, the datasets and queries have been optimised to contain valid data that occurs often in the wild. 38 | 39 | `⟩ ./commonspeak2 --project crunchbox-160315 --credentials credentials.json subdomains -o subdomains.txt` 40 | 41 | ``` 42 | INFO[0000] Generated SQL template for HackerNews. Mode=Subdomains 43 | INFO[0000] Generated SQL template for HTTPArchive. Mode=Subdomains 44 | INFO[0000] Executing BigQuery SQL... this could take some time. Mode=Subdomains Source=hackernews 45 | INFO[0019] Total rows extracted 71415. Mode=Subdomains Silent=false Source=hackernews Verbose=false 46 | INFO[0019] Executing BigQuery SQL... this could take some time. Mode=Subdomains Source=httparchive 47 | INFO[0075] Total rows extracted 484701. Mode=Subdomains Silent=false Source=httparchive Verbose=false 48 | ``` 49 | 50 | ### Words with extensions 51 | 52 | Using a single query on GitHub's dataset, we can extract every path filtered by file extension. This can be done with: 53 | 54 | `⟩ ./commonspeak2 --project crunchbox-160315 --credentials credentials.json ext-wordlist -e jsp -l 100000 -o jsp.txt` 55 | 56 | 57 | ``` 58 | INFO[0000] Executing BigQuery SQL... this could take some time. Extensions=jsp Limit=100000 Mode=WordsWithExt Source=Github 59 | INFO[0013] Total rows extracted 100000. Mode=WordsWithExt Source=Github 60 | ``` 61 | 62 | Any set of extensions can be passed via the `-e` flag, i.e. `-e aspx,php,html,js`. 63 | 64 | ### Deleted files 65 | 66 | *Contributed by [mhmdiaa](https://twitter.com/mhmdiaa)* 67 | 68 | Using GitHub's commits dataset, we can extract what may be files that developers decided to delete from their public repositories. These files may contain sensitive data. This can be done with: 69 | 70 | `⟩ ./commonspeak2 --project crunchbox-160315 --credentials credentials.json deleted-files -l 50000 -o deleted.txt` 71 | 72 | 73 | ``` 74 | INFO[0000] Executing BigQuery SQL... this could take some time. Limit=50000 Mode=DeletedFiles Source=Github 75 | INFO[0013] Total rows extracted 50000. Mode=DeletedFiles Source=Github 76 | ``` 77 | 78 | 79 | ### Features in Active Development 80 | 81 | Feel free to send pull requests to complete the features below, add datasets or improve the architecture of this project. Thank you! 82 | 83 | **Routes Based Extraction** 84 | 85 | We can create SQL statements that cover routing patterns in almost any web framework. For now we support the following web frameworks to extract path's from: 86 | 87 | - Rails [working implementation ✅] 88 | - NodeJS [to be implemented ❎] 89 | - Tomcat [to be implemented ❎] 90 | 91 | This data can be extracted using the following command: 92 | 93 | `⟩ ./commonspeak2 --project crunchbox-160315 --credentials credentials.json routes --frameworks rails -l 100000 -o rails-routes.txt` 94 | 95 | WARNING: running the above query will cost you **lots** of money (over $20 per framework). Commonspeak2 will prompt to confirm that this is OK. To skip this prompt use the `--silent` flag. 96 | 97 | When this is ran on for Rails routes, Commonspeak2 does the following: 98 | 99 | 1) Pulls Rails routes from `config/routes.rb` using Regex and the latest Github dataset. 100 | 2) Processes the data, converts it into paths and does contexual replacements to make the path valid (i.e. converting `/:id` to `/1234`) 101 | 3) Normalizes the path, finally saving to disk after all the processing is complete. 102 | 103 | **Scheduled Wordlist Generation** 104 | 105 | Planned feature to use a cron-like system to allow for wordlist generation from BigQuery to happen continuously. 106 | 107 | When this command is introduced, we will insert the `--schedule` parameter to any of our pre-existing commands covered in this README like so: 108 | 109 | `⟩ ./commonspeak2 --project crunchbox-160315 --credentials credentials.json --schedule weekly routes --frameworks nodejs,tomcat -l 100000 -o nodejs-tomcat-routes.txt` 110 | 111 | The above query will run a weekly BigQuery and save the output to `./nodejs-tomcat-routes.txt`. 112 | 113 | **Substitutions and Alterations** 114 | 115 | Generate smart substitutions and alterations for the datasets that it makes sense for. For example, converting string values from `/admin/users/:id` to `/admin/users/1234` (contextually aware of the number). 116 | 117 | Credits 118 | ---- 119 | 120 | Shubham Shah [@infosec_au](https://twitter.com/infosec_au) 121 | 122 | Michael Gianarakis [@mgianarakis](https://twitter.com/mgianarakis) 123 | 124 | License 125 | ---- 126 | 127 | ``` 128 | Copyright 2018 Assetnote 129 | 130 | Licensed under the Apache License, Version 2.0 (the "License"); 131 | you may not use this file except in compliance with the License. 132 | You may obtain a copy of the License at 133 | 134 | http://www.apache.org/licenses/LICENSE-2.0 135 | 136 | Unless required by applicable law or agreed to in writing, software 137 | distributed under the License is distributed on an "AS IS" BASIS, 138 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 139 | See the License for the specific language governing permissions and 140 | limitations under the License. 141 | ``` 142 | 143 | [Assetnote Pty. Ltd.](https://assetnote.io/) - Twitter [@assetnote](https://twitter.com/assetnote) 144 | -------------------------------------------------------------------------------- /assets/assets.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-bindata. DO NOT EDIT. @generated 2 | // sources: 3 | // data/.DS_Store 4 | // data/filters/numerical-parameters.txt 5 | // data/filters/string-parameters.txt 6 | // data/sql/.DS_Store 7 | // data/sql/github/deleted-files-test.sql 8 | // data/sql/github/deleted-files.sql 9 | // data/sql/github/nodejs-routes-test.sql 10 | // data/sql/github/nodejs-routes.sql 11 | // data/sql/github/rails-routes-test.sql 12 | // data/sql/github/rails-routes.sql 13 | // data/sql/github/tomcat-routes-test.sql 14 | // data/sql/github/tomcat-routes.sql 15 | // data/sql/github/words-with-ext.sql 16 | // data/sql/hackernews/subdomains.sql 17 | // data/sql/http-archive/apiroutes.sql 18 | // data/sql/http-archive/directories.sql 19 | // data/sql/http-archive/parameters.sql 20 | // data/sql/http-archive/subdomains.sql 21 | // data/sql/http-archive/technologies.sql 22 | // data/sql/http-archive/words-with-ext.sql 23 | package assets 24 | 25 | import ( 26 | "bytes" 27 | "compress/gzip" 28 | "fmt" 29 | "io" 30 | "io/ioutil" 31 | "os" 32 | "path/filepath" 33 | "strings" 34 | "time" 35 | ) 36 | 37 | func bindataRead(data []byte, name string) ([]byte, error) { 38 | gz, err := gzip.NewReader(bytes.NewBuffer(data)) 39 | if err != nil { 40 | return nil, fmt.Errorf("Read %q: %v", name, err) 41 | } 42 | 43 | var buf bytes.Buffer 44 | _, err = io.Copy(&buf, gz) 45 | clErr := gz.Close() 46 | 47 | if err != nil { 48 | return nil, fmt.Errorf("Read %q: %v", name, err) 49 | } 50 | if clErr != nil { 51 | return nil, err 52 | } 53 | 54 | return buf.Bytes(), nil 55 | } 56 | 57 | type asset struct { 58 | bytes []byte 59 | info os.FileInfo 60 | } 61 | 62 | type bindataFileInfo struct { 63 | name string 64 | size int64 65 | mode os.FileMode 66 | modTime time.Time 67 | } 68 | 69 | func (fi bindataFileInfo) Name() string { 70 | return fi.name 71 | } 72 | func (fi bindataFileInfo) Size() int64 { 73 | return fi.size 74 | } 75 | func (fi bindataFileInfo) Mode() os.FileMode { 76 | return fi.mode 77 | } 78 | func (fi bindataFileInfo) ModTime() time.Time { 79 | return fi.modTime 80 | } 81 | func (fi bindataFileInfo) IsDir() bool { 82 | return false 83 | } 84 | func (fi bindataFileInfo) Sys() interface{} { 85 | return nil 86 | } 87 | 88 | var _dataDs_store = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x98\x4d\x6a\xc3\x30\x10\x85\xdf\x28\x2e\x18\xba\xd1\xb2\x4b\x5d\x21\x37\x10\x41\x3d\x81\xa1\xeb\x42\x0c\xe9\xc2\x89\xd3\x9f\x74\xed\x53\xf4\x6a\xbd\x4d\x29\x42\x2f\xb4\x25\x76\x77\x6d\xdd\xf0\x3e\x30\x9f\x61\x2c\x79\xd0\x42\x9a\x11\x00\x5b\x1d\xda\x25\xe0\x01\xd4\x28\xb6\xfc\x32\x42\xcd\xe7\x04\x47\x5f\xe4\xc1\x79\x8e\x65\xb3\xee\xb7\xfb\xf1\x59\x66\x4a\xce\x7d\x81\x47\xdc\xa3\xeb\x36\x27\xf9\x33\xb2\xed\x53\x6a\x0f\x4f\x6b\xe0\xf5\xe5\xed\xe6\x6b\xa4\x9d\x88\xec\xef\xa6\x66\x7b\x6e\x1e\x76\x5d\xbf\xdb\x94\x55\x13\x42\x08\x21\x7e\x19\x9e\x3e\xf5\xe5\x5f\x27\x22\x84\x98\x1d\x79\x7f\x08\x74\xa4\x87\x62\x63\xdc\xd1\xd5\xa7\x31\x9e\x0e\x74\xa4\x87\x62\xe3\x77\x8e\xae\xe8\x9a\xf6\x74\xa0\x23\x3d\x14\x73\xd3\x32\x36\x1f\xc6\x3f\x1f\x9b\x17\xf3\x74\xa0\xe3\xcf\xac\x8d\x10\xff\x9d\x45\x91\xcf\xe7\xff\xf5\x74\xff\x2f\x84\x38\x63\xac\x4a\x4d\x5a\x7d\x73\x1d\xe5\x58\x08\xdc\x1e\x07\xb0\x10\xc0\x48\x11\xe0\xca\x65\xe1\x15\x3e\xe2\x2a\x04\x84\x98\x19\xef\x01\x00\x00\xff\xff\xf8\x96\xbb\x9f\x04\x18\x00\x00") 89 | 90 | func dataDs_storeBytes() ([]byte, error) { 91 | return bindataRead( 92 | _dataDs_store, 93 | "data/.DS_Store", 94 | ) 95 | } 96 | 97 | func dataDs_store() (*asset, error) { 98 | bytes, err := dataDs_storeBytes() 99 | if err != nil { 100 | return nil, err 101 | } 102 | 103 | info := bindataFileInfo{name: "data/.DS_Store", size: 6148, mode: os.FileMode(420), modTime: time.Unix(1534152160, 0)} 104 | a := &asset{bytes: bytes, info: info} 105 | return a, nil 106 | } 107 | 108 | var _dataFiltersNumericalParametersTxt = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x4c\x50\x4d\x92\xec\x20\x08\xde\x73\x9b\x77\xa2\x2e\x5a\xd1\xe6\x25\x11\x0b\x30\xd3\xb9\xfd\x14\xea\x62\x56\xf0\x29\xdf\x0f\x70\x06\x73\x2c\xe5\xc5\x19\xe8\xa6\xe6\xd1\xd8\x85\xea\xaf\xae\xf2\x7d\x02\x1e\xf4\xc0\x29\xb5\xe2\xfb\xa4\xc0\x45\x74\x5c\xd1\xb8\x74\x4e\xd1\x24\x69\x37\xa9\xa1\xb3\xb4\xc0\xdc\x32\x7d\x41\x29\x89\x66\xc0\x94\x64\x2c\xe1\x8e\x95\x80\xdb\xcd\xbe\x46\x5d\x0e\x6a\x11\x40\x1d\xa8\x65\xc8\xe8\x04\x5d\xe5\x3f\xa5\x39\xdf\xa4\x75\x95\xc2\x13\x0c\x23\x8d\x8a\x75\xc7\xcc\x6c\x69\x98\x6d\xcf\x42\x94\x5f\x63\x86\xb9\xae\xc5\x38\xe8\x59\xae\x9d\x74\x7e\x55\x95\xd1\xa7\xc6\xf0\xcf\x76\x4f\xe8\x54\x45\xd7\xa4\xb2\x2d\xb5\x95\x9d\x5b\xdd\xeb\x15\xd6\xeb\x6f\xe6\x30\xd9\x31\x3e\x62\x7b\x39\x8d\x17\x3b\x47\x85\x37\xa6\x63\x32\xf1\x3c\xa3\xfe\x03\x4c\xce\xf7\x52\x48\x92\x09\x32\x3e\x06\x8d\x7e\xe6\xb9\xcc\xc6\xbc\x6c\x95\xdb\x75\x53\xcd\xa9\xff\x06\x00\x00\xff\xff\xa5\xa2\x2a\xa0\x9e\x01\x00\x00") 109 | 110 | func dataFiltersNumericalParametersTxtBytes() ([]byte, error) { 111 | return bindataRead( 112 | _dataFiltersNumericalParametersTxt, 113 | "data/filters/numerical-parameters.txt", 114 | ) 115 | } 116 | 117 | func dataFiltersNumericalParametersTxt() (*asset, error) { 118 | bytes, err := dataFiltersNumericalParametersTxtBytes() 119 | if err != nil { 120 | return nil, err 121 | } 122 | 123 | info := bindataFileInfo{name: "data/filters/numerical-parameters.txt", size: 414, mode: os.FileMode(420), modTime: time.Unix(1534152261, 0)} 124 | a := &asset{bytes: bytes, info: info} 125 | return a, nil 126 | } 127 | 128 | var _dataFiltersStringParametersTxt = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x4c\x91\x41\xb2\x1b\x21\x0c\x44\xf7\x7d\x9b\x24\x77\xc8\x0d\xb2\x9e\x92\xa1\x3d\xa6\x2c\x10\x91\x34\x4e\x26\xa7\x4f\x0d\xfe\x0b\xef\x1a\xaa\x1f\x7a\x85\xa6\xdb\xab\x55\x3a\x86\x74\x42\x4a\x36\x1b\xf8\x15\x74\xdc\xac\x9e\x98\xf4\x2e\xda\xc6\x13\xca\xbd\x85\x4a\xb6\x17\xb7\xa4\x77\x4c\x99\x74\x84\x1e\x3b\x8a\xf5\x69\x83\x23\xb7\x6f\x1f\xf9\xfb\x47\xfe\x01\xb5\x7d\x97\x9b\x72\xcb\x73\x12\xce\x69\x90\x5a\x9d\x11\x38\x29\x8e\x6e\x23\x1f\x50\x2b\xa2\x44\xda\x93\x03\x29\x7b\xe0\x08\xfa\xdb\xcd\xcb\x83\x0b\x5e\x3e\xe5\xc1\xf2\x84\xcc\xf6\xc2\xef\x83\x7e\xe2\xde\x94\xab\x58\xe5\xc4\x9d\xac\x10\xcf\x56\x94\xdb\xba\x2d\x36\xd2\x4d\xf5\x72\x4e\xc9\x23\x10\x2c\xce\x5c\x03\x50\xac\x12\x29\x37\x04\xfd\xd5\x0a\x91\xfc\x9b\xf8\xd9\x94\x5d\x86\xec\x57\xe3\x70\xe7\x28\x27\xba\x55\x2a\xa6\x4a\xde\xcd\x3b\x5a\x9d\x28\xa6\xe6\x38\x5c\xb7\xb7\xb8\xd4\xde\xc6\xf6\xe4\x89\xa2\x8d\x23\x11\xc7\x2d\x8a\xb7\xb9\x7e\x57\x99\x49\x47\x6f\xa3\x45\xbe\xc5\xaf\xf3\x85\x47\x8a\xe7\x4a\x1c\x15\xc1\x88\x0b\x90\x39\xb5\x15\x59\xf0\xe0\x9f\xf8\x7a\xe0\x1a\x2f\x89\x22\xc9\xdd\xfc\xdc\xd6\x2a\xcc\x77\x19\xed\xdf\x2a\xff\x0f\x00\x00\xff\xff\xd3\x06\x0c\xa1\xdc\x01\x00\x00") 129 | 130 | func dataFiltersStringParametersTxtBytes() ([]byte, error) { 131 | return bindataRead( 132 | _dataFiltersStringParametersTxt, 133 | "data/filters/string-parameters.txt", 134 | ) 135 | } 136 | 137 | func dataFiltersStringParametersTxt() (*asset, error) { 138 | bytes, err := dataFiltersStringParametersTxtBytes() 139 | if err != nil { 140 | return nil, err 141 | } 142 | 143 | info := bindataFileInfo{name: "data/filters/string-parameters.txt", size: 476, mode: os.FileMode(420), modTime: time.Unix(1534152277, 0)} 144 | a := &asset{bytes: bytes, info: info} 145 | return a, nil 146 | } 147 | 148 | var _dataSqlDs_store = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x98\x31\x4a\xc5\x40\x10\x86\xff\x59\x53\x2c\x68\xb1\xa5\xe5\x5e\xc0\xc2\x1b\x2c\x21\x9e\x20\x17\x50\x54\x8c\x20\x51\x42\x4c\x9d\xca\x73\x79\x34\x09\xfb\x8b\x4a\x12\x9b\xc7\xe3\xe5\x3d\xfe\x0f\x96\xaf\xc8\x4c\x12\xb6\xd8\x9d\x19\x00\x56\xbe\x3f\x5c\x03\x01\x80\x47\x36\x3e\xb0\x88\xe7\x9a\xe1\x68\xcb\x2b\x00\x57\xb8\x43\x87\x7b\x34\x78\x5e\x7e\xd7\x8c\x29\xf7\x02\x0d\x7a\xf4\x78\xfb\x93\x3f\xe0\x71\xa8\xbb\xf6\xe5\xb5\x7d\x62\x9c\x10\x42\x08\x21\x76\x87\x77\xaa\x3f\x3f\xf4\x8f\x08\x21\x36\xc7\x74\x3e\x44\x3a\xd1\x63\xb6\xf1\xb9\xa3\x8b\x5f\x39\x81\x8e\x74\xa2\xc7\x6c\x63\x9c\xa3\x0b\xda\xd3\x81\x8e\x74\xa2\xc7\x6c\x1e\x5a\xc6\xe6\xc3\xf8\x65\x63\x87\x62\x81\x8e\x74\xda\xcf\xde\x08\x71\xec\x9c\x65\x85\xe9\xfe\xbf\x59\xef\xff\x85\x10\x27\x8c\x15\x55\x5d\x95\xff\x0c\xd9\x1c\x0b\x81\x5b\xc6\x7c\x7e\x27\xae\x14\x02\x2e\x0f\x0c\x2f\xf1\x13\xa7\x62\x40\x88\x0d\xf1\x15\x00\x00\xff\xff\xeb\xa0\x56\x2e\x04\x18\x00\x00") 149 | 150 | func dataSqlDs_storeBytes() ([]byte, error) { 151 | return bindataRead( 152 | _dataSqlDs_store, 153 | "data/sql/.DS_Store", 154 | ) 155 | } 156 | 157 | func dataSqlDs_store() (*asset, error) { 158 | bytes, err := dataSqlDs_storeBytes() 159 | if err != nil { 160 | return nil, err 161 | } 162 | 163 | info := bindataFileInfo{name: "data/sql/.DS_Store", size: 6148, mode: os.FileMode(420), modTime: time.Unix(1534152160, 0)} 164 | a := &asset{bytes: bytes, info: info} 165 | return a, nil 166 | } 167 | 168 | var _dataSqlGithubDeletedFilesTestSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\x4f\x6f\xa3\x30\x14\xc4\xef\xfe\x14\x23\xb4\x12\xb0\x4a\x22\xed\x79\x4f\x2c\x71\xd8\x48\x89\x1d\x19\xa3\x36\xca\x1f\x02\xc4\x4a\x88\x20\x50\xdb\x54\xad\xc4\x87\xaf\xa0\x69\x4f\x3d\xce\xd3\xfc\xde\xbc\x79\xa1\xa0\x81\xa4\x90\x74\xbd\xe1\x22\x10\x5b\x2c\x12\x16\xca\x25\x67\x04\x50\x6f\x56\x67\x85\x4d\xdb\xcc\x5e\x3d\xd3\xe5\x37\x55\x58\x18\xab\xcb\xfb\xc5\x27\x80\xa0\x32\x11\x2c\x46\x2c\xc5\x92\x45\x04\x58\x05\x2c\x4a\x82\x88\xe2\x66\x10\xc4\x70\x1c\x87\x00\x5a\xd9\x4e\xdf\xf1\xc0\x67\xa6\xad\x4a\xeb\xb9\x70\xfd\xdd\x9f\x03\x71\x1c\xe7\x2f\x89\xe9\x8a\x86\x92\x00\x43\xce\x84\x00\x21\x4f\x98\xf4\x06\xe5\x0f\x7b\x8a\xa6\xbb\x5b\xb2\x10\x7c\x0d\x8f\x00\xdf\xf6\x9f\x0f\x1c\x91\x61\x40\x80\x81\x19\x8d\xa7\xbc\xbc\xbc\x74\x4a\xbf\x4f\xdb\x2e\xaf\xca\x62\x7a\xce\x6c\x36\xbb\x94\xf6\xda\xe5\xa9\x56\x6d\x63\x66\x26\xab\xdb\x4a\xa5\x45\x53\xd7\xa5\x35\x27\x02\x3c\xfd\xa7\x82\x8e\xb8\xa0\x11\x7d\xde\xa4\x21\x67\x32\x58\xb2\xf8\x2b\x6a\x02\xf7\xe8\x69\x55\x37\xaf\xfd\x59\x55\xca\xf6\x4a\x67\xc6\xf7\x54\xaf\xce\xbd\x32\xfd\xf0\x26\xec\x8e\xfb\xbd\x39\xfc\xfe\xe5\xfa\xf0\x49\x24\x78\xb2\xc1\xbf\xed\xa3\x2b\xe1\x62\x4e\xc5\xa7\x1e\x4b\x62\x4e\xe3\xf0\x23\x00\x00\xff\xff\x81\xbd\xa6\xc4\x92\x01\x00\x00") 169 | 170 | func dataSqlGithubDeletedFilesTestSqlBytes() ([]byte, error) { 171 | return bindataRead( 172 | _dataSqlGithubDeletedFilesTestSql, 173 | "data/sql/github/deleted-files-test.sql", 174 | ) 175 | } 176 | 177 | func dataSqlGithubDeletedFilesTestSql() (*asset, error) { 178 | bytes, err := dataSqlGithubDeletedFilesTestSqlBytes() 179 | if err != nil { 180 | return nil, err 181 | } 182 | 183 | info := bindataFileInfo{name: "data/sql/github/deleted-files-test.sql", size: 402, mode: os.FileMode(420), modTime: time.Unix(1535099018, 0)} 184 | a := &asset{bytes: bytes, info: info} 185 | return a, nil 186 | } 187 | 188 | var _dataSqlGithubDeletedFilesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\xcf\x6e\xb2\x40\x14\xc5\xf7\xf7\x29\x4e\xc8\x97\x00\x5f\xd4\xa4\xeb\xae\x28\x8e\xd4\x44\x07\x33\x0c\x69\x8d\x7f\x01\x27\x8a\x51\xa1\x33\x43\xd3\x26\x3c\x7c\x03\xb5\x5d\x75\x79\x6e\xce\xef\x9e\x7b\x6e\x28\x58\x20\x19\x24\x9b\x2f\x62\x11\x88\x25\x26\x29\x0f\xe5\x34\xe6\x04\xa8\x0f\xab\xb3\xc2\xee\xea\xcc\x9e\x3c\xd3\xe4\x67\x55\x58\x18\xab\xcb\xdb\xd1\x27\x40\x30\x99\x0a\x9e\x20\x91\x62\xca\x23\x02\x66\x01\x8f\xd2\x20\x62\x38\x1b\x04\x09\x1c\xc7\x21\x40\x2b\xdb\xe8\x1b\xee\xf8\xc8\xd4\x97\xd2\x7a\x2e\x5c\x7f\xf5\xb0\x21\xc7\x71\x1e\x29\x61\x33\x16\x4a\x02\xba\x9c\x01\x01\x61\x9c\x72\xe9\x75\xca\xef\xf6\x14\x55\x73\xb3\x34\x11\xf1\x1c\x1e\x01\xbf\xf6\xbf\x0f\xec\x91\x6e\x40\x40\xc7\xf4\xc6\x7d\x5e\x1e\xdf\x1a\xa5\x3f\x87\x75\x93\x5f\xca\x62\x78\xc8\x6c\x36\x3a\x96\xf6\xd4\xe4\x3b\xad\xea\xca\x8c\x8a\xea\x7a\x2d\xad\xd9\x13\xf0\xf2\xcc\x04\xeb\x39\xc1\x22\xf6\xba\xd8\x85\x31\x97\xc1\x94\x27\x3f\x19\x03\xb8\x5b\x4f\xab\x6b\xf5\xde\x1e\xd4\x45\xd9\x56\xe9\xcc\xf8\x9e\x6a\xd5\xa1\x55\xa6\xed\xfe\x83\xd5\x76\xbd\x36\x9b\xff\xff\x5c\x1f\x3e\x45\x22\x4e\x17\x78\x5a\xde\x4b\x52\x2c\xc6\x4c\x7c\xeb\xbe\x1d\xc6\x2c\x09\xbf\x02\x00\x00\xff\xff\x24\xcb\x8a\x5b\x8b\x01\x00\x00") 189 | 190 | func dataSqlGithubDeletedFilesSqlBytes() ([]byte, error) { 191 | return bindataRead( 192 | _dataSqlGithubDeletedFilesSql, 193 | "data/sql/github/deleted-files.sql", 194 | ) 195 | } 196 | 197 | func dataSqlGithubDeletedFilesSql() (*asset, error) { 198 | bytes, err := dataSqlGithubDeletedFilesSqlBytes() 199 | if err != nil { 200 | return nil, err 201 | } 202 | 203 | info := bindataFileInfo{name: "data/sql/github/deleted-files.sql", size: 395, mode: os.FileMode(420), modTime: time.Unix(1535099018, 0)} 204 | a := &asset{bytes: bytes, info: info} 205 | return a, nil 206 | } 207 | 208 | var _dataSqlGithubNodejsRoutesTestSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x51\x51\x6f\xd3\x30\x18\x7c\xf7\xaf\x38\x2c\x60\xc9\xa0\x29\xaf\x30\x8a\x08\x99\x57\x82\x5a\x67\x72\x12\xa1\xb2\x8e\x36\x4d\xdd\xd4\x28\x4d\x42\xe2\x20\xa0\xeb\x7f\x47\x71\xda\xb1\x49\xbc\xf0\xf4\xd9\xdf\x7d\x77\xe7\xef\xec\x09\xe6\x46\x0c\x11\x9b\x5e\x07\xc2\x15\x33\x5c\xc5\xdc\x8b\xfc\x80\xa3\x4a\xea\x46\x8a\xb2\xd5\xb2\xb1\x6a\x53\xbc\x72\x2d\x11\x46\xc2\xe7\x63\x9b\x08\x16\xc5\x82\x87\x70\x85\x70\x67\x6f\xfb\xee\x3b\x4c\x5c\x3e\x8e\xdd\x31\xc3\xb7\x06\x6e\x08\x4a\x29\x21\xc0\x8f\xa4\x46\x2d\x33\xf9\x13\x23\x0c\x2d\x7a\x77\x66\xdf\x24\x83\xdf\xee\xe0\xcb\xe2\xd5\xe0\xf5\x7c\x3e\x9c\xcf\xdf\x3c\x79\xff\xf4\xd9\xd7\xe7\xe7\x96\xfd\x62\x74\x7b\x6e\x9d\xdd\x51\x7b\xb8\xcb\xd4\x05\x01\xd4\x06\x0f\xfc\x6d\xec\x09\x70\x92\x6c\xda\x5c\x63\x84\xbf\xb0\xb3\x4b\x74\xba\xb5\x8c\x99\xdd\xb1\x0f\x90\x79\x23\xff\x45\xba\xb9\x35\x38\x01\x6a\xa9\xdb\xba\x38\x22\x5d\x93\x52\x7a\x41\x48\xc8\x26\xcc\x8b\x3a\xbc\x93\x7f\x49\x00\x2f\x88\x79\xd4\x3f\xc6\xee\xd6\x4b\xcb\xb6\xd0\xe4\x4a\x04\x53\x58\x04\xb8\x27\xe0\x51\x78\xa9\x93\x96\x85\x96\x85\x36\x1c\xc3\x26\x40\xc7\x32\xa3\xcb\x95\xca\xbe\xb7\xb2\xfe\x35\xa8\xda\x55\xae\xd2\xc1\x3a\xd1\x89\x93\x29\xbd\x6d\x57\x8b\x5a\x56\x65\xe3\x34\xc9\xae\xca\xe5\xe2\x28\xd3\x2c\x91\x12\xe0\x53\xe0\x73\x63\xfb\xc8\x18\x50\x6b\x73\xb8\xd7\xff\x1f\x87\x8d\xca\x65\xb3\x34\xb4\xcf\x1f\x99\x60\x47\x81\x2a\xd1\x5b\x8c\x40\xd3\xb2\xd8\xa8\x6c\xd8\xc7\xed\xd4\x2b\x0a\x1b\x1b\x02\x04\xdc\x0c\x6e\x1c\xb5\xc6\x08\x69\x57\xec\xe3\xa7\x74\xb1\xc5\x9c\xb3\xf0\x61\x6e\x7d\x06\x27\x07\x73\x83\x1f\x82\x07\x11\x78\x3c\x99\x90\xb1\x08\xe2\x6b\x7c\x98\x9d\x40\x12\x88\x4b\x26\xfa\x86\xc9\x1c\x97\x2c\xf4\xc8\xc4\x9f\xfa\xdd\xd6\xfb\x7d\xae\x76\x4a\x1f\x0e\x7f\x02\x00\x00\xff\xff\x08\xac\xb3\x1f\xcd\x02\x00\x00") 209 | 210 | func dataSqlGithubNodejsRoutesTestSqlBytes() ([]byte, error) { 211 | return bindataRead( 212 | _dataSqlGithubNodejsRoutesTestSql, 213 | "data/sql/github/nodejs-routes-test.sql", 214 | ) 215 | } 216 | 217 | func dataSqlGithubNodejsRoutesTestSql() (*asset, error) { 218 | bytes, err := dataSqlGithubNodejsRoutesTestSqlBytes() 219 | if err != nil { 220 | return nil, err 221 | } 222 | 223 | info := bindataFileInfo{name: "data/sql/github/nodejs-routes-test.sql", size: 717, mode: os.FileMode(420), modTime: time.Unix(1534148741, 0)} 224 | a := &asset{bytes: bytes, info: info} 225 | return a, nil 226 | } 227 | 228 | var _dataSqlGithubNodejsRoutesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00") 229 | 230 | func dataSqlGithubNodejsRoutesSqlBytes() ([]byte, error) { 231 | return bindataRead( 232 | _dataSqlGithubNodejsRoutesSql, 233 | "data/sql/github/nodejs-routes.sql", 234 | ) 235 | } 236 | 237 | func dataSqlGithubNodejsRoutesSql() (*asset, error) { 238 | bytes, err := dataSqlGithubNodejsRoutesSqlBytes() 239 | if err != nil { 240 | return nil, err 241 | } 242 | 243 | info := bindataFileInfo{name: "data/sql/github/nodejs-routes.sql", size: 0, mode: os.FileMode(420), modTime: time.Unix(1534039257, 0)} 244 | a := &asset{bytes: bytes, info: info} 245 | return a, nil 246 | } 247 | 248 | var _dataSqlGithubRailsRoutesTestSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x51\x51\x6f\xd3\x30\x18\x7c\xf7\xaf\x38\x2c\x60\xc9\xa0\x29\xaf\x30\x8a\x08\x99\x57\x82\x5a\x67\x72\x12\xa1\xb2\x8e\x36\x4d\xdd\xd4\x28\x4d\x42\xe2\x20\xa0\xeb\x7f\x47\x71\xda\xb1\x49\xbc\xf0\xf4\xd9\xdf\x7d\x77\xe7\xef\xec\x09\xe6\x46\x0c\x11\x9b\x5e\x07\xc2\x15\x33\x5c\xc5\xdc\x8b\xfc\x80\xa3\x4a\xea\x46\x8a\xb2\xd5\xb2\xb1\x6a\x53\xbc\x72\x2d\x11\x46\xc2\xe7\x63\x9b\x08\x16\xc5\x82\x87\x70\x85\x70\x67\x6f\xfb\xee\x3b\x4c\x5c\x3e\x8e\xdd\x31\xc3\xb7\x06\x6e\x08\x4a\x29\x21\xc0\x8f\xa4\x46\x2d\x33\xf9\x13\x23\x0c\x2d\x7a\x77\x66\xdf\x24\x83\xdf\xee\xe0\xcb\xe2\xd5\xe0\xf5\x7c\x3e\x9c\xcf\xdf\x3c\x79\xff\xf4\xd9\xd7\xe7\xe7\x96\xfd\x62\x74\x7b\x6e\x9d\xdd\x51\x7b\xb8\xcb\xd4\x05\x01\xd4\x06\x0f\xfc\x6d\xec\x09\x70\x92\x6c\xda\x5c\x63\x84\xbf\xb0\xb3\x4b\x74\xba\xb5\x8c\x99\xdd\xb1\x0f\x90\x79\x23\xff\x45\xba\xb9\x35\x38\x01\x6a\xa9\xdb\xba\x38\x22\x5d\x93\x52\x7a\x41\x48\xc8\x26\xcc\x8b\x3a\xbc\x93\x7f\x49\x00\x2f\x88\x79\xd4\x3f\xc6\xee\xd6\x4b\xcb\xb6\xd0\xe4\x4a\x04\x53\x58\x04\xb8\x27\xe0\x51\x78\xa9\x93\x96\x85\x96\x85\x36\x1c\xc3\x26\x40\xc7\x32\xa3\xcb\x95\xca\xbe\xb7\xb2\xfe\x35\xa8\xda\x55\xae\xd2\xc1\x3a\xd1\x89\x93\x29\xbd\x6d\x57\x8b\x5a\x56\x65\xe3\x34\xc9\xae\xca\xe5\xe2\x28\xd3\x2c\x91\x12\xe0\x53\xe0\x73\x63\xfb\xc8\x18\x50\x6b\x73\xb8\xd7\xff\x1f\x87\x8d\xca\x65\xb3\x34\xb4\xcf\x1f\x99\x60\x47\x81\x2a\xd1\x5b\x8c\x40\xd3\xb2\xd8\xa8\x6c\xd8\xc7\xed\xd4\x2b\x0a\x1b\x1b\x02\x04\xdc\x0c\x6e\x1c\xb5\xc6\x08\x69\x57\xec\xe3\xa7\x74\xb1\xc5\x9c\xb3\xf0\x61\x6e\x7d\x06\x27\x07\x73\x83\x1f\x82\x07\x11\x78\x3c\x99\x90\xb1\x08\xe2\x6b\x7c\x98\x9d\x40\x12\x88\x4b\x26\xfa\x86\xc9\x1c\x97\x2c\xf4\xc8\xc4\x9f\xfa\xdd\xd6\xfb\x7d\xae\x76\x4a\x1f\x0e\x7f\x02\x00\x00\xff\xff\x08\xac\xb3\x1f\xcd\x02\x00\x00") 249 | 250 | func dataSqlGithubRailsRoutesTestSqlBytes() ([]byte, error) { 251 | return bindataRead( 252 | _dataSqlGithubRailsRoutesTestSql, 253 | "data/sql/github/rails-routes-test.sql", 254 | ) 255 | } 256 | 257 | func dataSqlGithubRailsRoutesTestSql() (*asset, error) { 258 | bytes, err := dataSqlGithubRailsRoutesTestSqlBytes() 259 | if err != nil { 260 | return nil, err 261 | } 262 | 263 | info := bindataFileInfo{name: "data/sql/github/rails-routes-test.sql", size: 717, mode: os.FileMode(420), modTime: time.Unix(1534136427, 0)} 264 | a := &asset{bytes: bytes, info: info} 265 | return a, nil 266 | } 267 | 268 | var _dataSqlGithubRailsRoutesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x91\x51\x73\x93\x40\x14\x85\xdf\xf7\x57\x1c\x77\xd4\x42\x35\x89\xaf\x5a\x71\x44\xba\x8d\x38\x74\xe9\x2c\x30\x4e\x6c\x6a\x43\xc8\x42\xd6\x21\x10\x61\x71\xd4\x34\xff\xdd\x61\x49\x6a\x3b\xe3\x83\x4f\x17\xee\xb9\xdf\x3d\xdc\x83\x27\x98\x1b\x33\xc4\xec\xf2\x2a\x14\xae\x98\xe1\x22\xe1\x5e\xec\x87\x1c\xdb\xb4\x69\xa5\xa8\x3b\x2d\x5b\xab\x31\xc5\xab\x57\x12\x51\x2c\x7c\x3e\xb5\x89\x60\x71\x22\x78\x04\x57\x08\x77\xf6\x76\xe8\xbe\x43\xe0\xf2\x69\xe2\x4e\x19\xbe\xb5\x70\x23\x50\x4a\x09\x01\x7e\xa4\x0d\x1a\x59\xc8\x9f\x70\x30\xb1\xe8\xdd\x89\x7d\x9d\x8e\x7e\xbb\xa3\x2f\xb7\xaf\x46\xaf\xe7\xf3\xc9\x7c\xfe\xe6\xc9\xfb\xa7\xcf\xbe\x3e\x3f\xb5\xec\x17\xce\xcd\xa9\x75\x72\x47\xed\xc9\xa6\x50\x67\x04\x50\x39\x1e\xf8\xdb\xd8\x11\xe0\xb8\xb2\xed\x4a\x0d\x07\x7f\xe5\xf1\x26\xd5\xd9\xda\x32\x66\x76\x4f\xef\x21\xcb\x56\xfe\x0b\xba\xbe\x31\x3a\x01\x1a\xa9\xbb\xa6\x3a\x28\x7d\x93\x52\x7a\x46\x48\xc4\x02\xe6\xc5\xbd\xde\xaf\x7f\x49\x00\x2f\x4c\x78\x3c\x7c\x8c\xdd\x9f\x97\xd5\x5d\xa5\xc9\x85\x08\x2f\x61\x11\xe0\x1e\xc0\xa3\xf0\xb2\x71\x56\x57\x5a\x56\xda\x30\x86\x26\x40\x4f\x99\xd1\xc5\x52\x15\xdf\x3b\xd9\xfc\x1a\x6d\xbb\x65\xa9\xb2\xd1\x2a\xd5\xe9\xb8\x50\x7a\xdd\x2d\x6f\x1b\xb9\xad\xdb\x23\xdf\x2e\x90\x11\xe0\x53\xe8\x73\xe3\xf7\xc8\x11\x50\x2b\xf3\x70\xbf\xf8\xbf\x56\xe7\xaa\x94\xed\xc2\xcc\x7f\xfe\xc8\x04\x3b\x90\xdb\x54\xaf\xe1\x80\x66\x75\x95\xab\x62\x32\x04\x3c\x6e\x96\x14\x36\x72\x02\x84\xdc\x0c\xe6\x63\xb5\x82\x83\xac\x2f\xf6\xe1\x37\xf4\x41\x25\x9c\xb3\xe8\x61\x52\xc3\xd5\x47\x07\xf3\x06\x3f\x02\x0f\x63\xf0\x24\x08\xc8\x54\x84\xc9\x15\x3e\xcc\x8e\x22\x09\xc5\x39\x13\x43\xc3\xa4\x8c\x73\x16\x79\x24\xf0\x2f\xfd\xfe\xdc\xdd\xae\x54\x1b\xa5\xf7\xfb\x3f\x01\x00\x00\xff\xff\x01\xe3\x7c\x25\xbf\x02\x00\x00") 269 | 270 | func dataSqlGithubRailsRoutesSqlBytes() ([]byte, error) { 271 | return bindataRead( 272 | _dataSqlGithubRailsRoutesSql, 273 | "data/sql/github/rails-routes.sql", 274 | ) 275 | } 276 | 277 | func dataSqlGithubRailsRoutesSql() (*asset, error) { 278 | bytes, err := dataSqlGithubRailsRoutesSqlBytes() 279 | if err != nil { 280 | return nil, err 281 | } 282 | 283 | info := bindataFileInfo{name: "data/sql/github/rails-routes.sql", size: 703, mode: os.FileMode(420), modTime: time.Unix(1534136417, 0)} 284 | a := &asset{bytes: bytes, info: info} 285 | return a, nil 286 | } 287 | 288 | var _dataSqlGithubTomcatRoutesTestSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x51\x51\x6f\xd3\x30\x18\x7c\xf7\xaf\x38\x2c\x60\xc9\xa0\x29\xaf\x30\x8a\x08\x99\x57\x82\x5a\x67\x72\x12\xa1\xb2\x8e\x36\x4d\xdd\xd4\x28\x4d\x42\xe2\x20\xa0\xeb\x7f\x47\x71\xda\xb1\x49\xbc\xf0\xf4\xd9\xdf\x7d\x77\xe7\xef\xec\x09\xe6\x46\x0c\x11\x9b\x5e\x07\xc2\x15\x33\x5c\xc5\xdc\x8b\xfc\x80\xa3\x4a\xea\x46\x8a\xb2\xd5\xb2\xb1\x6a\x53\xbc\x72\x2d\x11\x46\xc2\xe7\x63\x9b\x08\x16\xc5\x82\x87\x70\x85\x70\x67\x6f\xfb\xee\x3b\x4c\x5c\x3e\x8e\xdd\x31\xc3\xb7\x06\x6e\x08\x4a\x29\x21\xc0\x8f\xa4\x46\x2d\x33\xf9\x13\x23\x0c\x2d\x7a\x77\x66\xdf\x24\x83\xdf\xee\xe0\xcb\xe2\xd5\xe0\xf5\x7c\x3e\x9c\xcf\xdf\x3c\x79\xff\xf4\xd9\xd7\xe7\xe7\x96\xfd\x62\x74\x7b\x6e\x9d\xdd\x51\x7b\xb8\xcb\xd4\x05\x01\xd4\x06\x0f\xfc\x6d\xec\x09\x70\x92\x6c\xda\x5c\x63\x84\xbf\xb0\xb3\x4b\x74\xba\xb5\x8c\x99\xdd\xb1\x0f\x90\x79\x23\xff\x45\xba\xb9\x35\x38\x01\x6a\xa9\xdb\xba\x38\x22\x5d\x93\x52\x7a\x41\x48\xc8\x26\xcc\x8b\x3a\xbc\x93\x7f\x49\x00\x2f\x88\x79\xd4\x3f\xc6\xee\xd6\x4b\xcb\xb6\xd0\xe4\x4a\x04\x53\x58\x04\xb8\x27\xe0\x51\x78\xa9\x93\x96\x85\x96\x85\x36\x1c\xc3\x26\x40\xc7\x32\xa3\xcb\x95\xca\xbe\xb7\xb2\xfe\x35\xa8\xda\x55\xae\xd2\xc1\x3a\xd1\x89\x93\x29\xbd\x6d\x57\x8b\x5a\x56\x65\xe3\x34\xc9\xae\xca\xe5\xe2\x28\xd3\x2c\x91\x12\xe0\x53\xe0\x73\x63\xfb\xc8\x18\x50\x6b\x73\xb8\xd7\xff\x1f\x87\x8d\xca\x65\xb3\x34\xb4\xcf\x1f\x99\x60\x47\x81\x2a\xd1\x5b\x8c\x40\xd3\xb2\xd8\xa8\x6c\xd8\xc7\xed\xd4\x2b\x0a\x1b\x1b\x02\x04\xdc\x0c\x6e\x1c\xb5\xc6\x08\x69\x57\xec\xe3\xa7\x74\xb1\xc5\x9c\xb3\xf0\x61\x6e\x7d\x06\x27\x07\x73\x83\x1f\x82\x07\x11\x78\x3c\x99\x90\xb1\x08\xe2\x6b\x7c\x98\x9d\x40\x12\x88\x4b\x26\xfa\x86\xc9\x1c\x97\x2c\xf4\xc8\xc4\x9f\xfa\xdd\xd6\xfb\x7d\xae\x76\x4a\x1f\x0e\x7f\x02\x00\x00\xff\xff\x08\xac\xb3\x1f\xcd\x02\x00\x00") 289 | 290 | func dataSqlGithubTomcatRoutesTestSqlBytes() ([]byte, error) { 291 | return bindataRead( 292 | _dataSqlGithubTomcatRoutesTestSql, 293 | "data/sql/github/tomcat-routes-test.sql", 294 | ) 295 | } 296 | 297 | func dataSqlGithubTomcatRoutesTestSql() (*asset, error) { 298 | bytes, err := dataSqlGithubTomcatRoutesTestSqlBytes() 299 | if err != nil { 300 | return nil, err 301 | } 302 | 303 | info := bindataFileInfo{name: "data/sql/github/tomcat-routes-test.sql", size: 717, mode: os.FileMode(420), modTime: time.Unix(1534149328, 0)} 304 | a := &asset{bytes: bytes, info: info} 305 | return a, nil 306 | } 307 | 308 | var _dataSqlGithubTomcatRoutesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00") 309 | 310 | func dataSqlGithubTomcatRoutesSqlBytes() ([]byte, error) { 311 | return bindataRead( 312 | _dataSqlGithubTomcatRoutesSql, 313 | "data/sql/github/tomcat-routes.sql", 314 | ) 315 | } 316 | 317 | func dataSqlGithubTomcatRoutesSql() (*asset, error) { 318 | bytes, err := dataSqlGithubTomcatRoutesSqlBytes() 319 | if err != nil { 320 | return nil, err 321 | } 322 | 323 | info := bindataFileInfo{name: "data/sql/github/tomcat-routes.sql", size: 0, mode: os.FileMode(420), modTime: time.Unix(1534039265, 0)} 324 | a := &asset{bytes: bytes, info: info} 325 | return a, nil 326 | } 327 | 328 | var _dataSqlGithubWordsWithExtSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2c\xce\xcd\x4e\x84\x30\x14\x40\xe1\xfd\x7d\x8a\xbb\x30\x19\x30\xce\xbc\x80\x2b\x2d\x57\x24\x01\x4a\x0a\x44\x5d\xf1\x67\x85\x26\x08\x48\xdb\x44\xd3\xf4\xdd\x8d\x38\xcb\xb3\x3a\x5f\x49\x29\xb1\x0a\x10\xb7\xce\x4c\x77\x80\xc8\x78\x9d\x57\xc1\x6d\x88\xc3\x6a\x17\x03\x4f\x82\x67\x80\xd8\xf6\x6a\xfc\xb2\x72\xff\x39\x6f\xb6\x9f\xd5\x70\x7e\xef\x4c\x77\x19\x95\x99\x6c\xdf\xec\x72\x5b\xf5\xe5\x43\xcd\x52\xb7\xf0\xf2\x4c\x82\x00\x51\x50\x4c\xaf\x45\xc3\x78\x5e\x3d\x24\x79\x89\xc1\x31\xc0\xfd\x14\x38\x27\xbf\x8d\x5c\xb4\x5a\x17\xed\x7d\x78\x73\x0a\x21\x16\xbc\x2e\xf0\xf1\xed\xea\x00\x2e\x22\x12\xff\x7d\x30\x30\xa2\x92\x41\x9a\x64\xc9\x1f\xd5\xb9\x59\x7d\x2a\xe3\xfd\xfd\x6f\x00\x00\x00\xff\xff\xdb\xe0\xde\xd1\xbe\x00\x00\x00") 329 | 330 | func dataSqlGithubWordsWithExtSqlBytes() ([]byte, error) { 331 | return bindataRead( 332 | _dataSqlGithubWordsWithExtSql, 333 | "data/sql/github/words-with-ext.sql", 334 | ) 335 | } 336 | 337 | func dataSqlGithubWordsWithExtSql() (*asset, error) { 338 | bytes, err := dataSqlGithubWordsWithExtSqlBytes() 339 | if err != nil { 340 | return nil, err 341 | } 342 | 343 | info := bindataFileInfo{name: "data/sql/github/words-with-ext.sql", size: 190, mode: os.FileMode(420), modTime: time.Unix(1532021038, 0)} 344 | a := &asset{bytes: bytes, info: info} 345 | return a, nil 346 | } 347 | 348 | var _dataSqlHackernewsSubdomainsSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x8f\x4f\x8f\x9b\x30\x14\xc4\xef\xef\x53\x8c\x38\xc5\x52\x43\xee\x45\x3d\xb0\xac\x17\x21\x25\x10\x19\x38\xe4\xd4\x35\x84\x64\xbd\x0b\x66\xeb\x3f\xea\x46\x51\xbe\x7b\x15\x42\x53\xa5\x07\x4b\xf6\xf3\xcc\xbc\xdf\x24\x82\xc7\x15\x47\xc5\x37\xdb\x42\xc4\x62\x87\x97\x3a\x4f\xaa\xac\xc8\x71\xec\x5c\xe9\x9b\xfd\x38\x48\xa5\x17\x5f\x28\x2b\x91\xe5\x29\x03\x48\xf0\xaa\x16\x79\x39\x4f\x00\x02\xd6\x71\x9e\xd6\x71\xca\xf1\x6e\x11\x97\x08\x82\x80\x80\x83\xd7\xad\x53\xa3\x7e\x4c\xb2\x0c\x67\x02\x00\x67\x4e\xf3\x0d\x30\x9d\xf3\x46\xa3\x16\xd9\xc2\xb2\xd0\xde\xc5\x2c\x9a\x04\x17\xb4\xd2\xb5\x6f\x58\x74\x5f\xec\x7f\x8f\x9d\x25\x74\x3b\xf3\xf4\x11\x9e\x45\x74\x45\x2a\xb6\xd7\x62\x25\x16\x13\x73\xaf\x1a\x23\xcd\xe9\x47\x70\xb4\xdf\x57\xab\x76\x1c\x86\x51\xdb\xcf\x4e\x7e\x2c\xfd\xfe\xb0\xaa\x45\x16\x0e\x4a\x87\xef\x36\x20\x16\x11\x95\x7c\xcd\x93\x6a\x32\x3e\x64\x7b\xd3\xb3\x6b\xe5\x3b\xf3\x37\x02\xda\xd1\x6b\x77\xfb\x92\xf6\xf6\xa2\x17\x51\x6c\x26\xfb\x6b\xa3\x8e\xbf\x7c\x67\x4e\xcb\x4f\xdf\xf4\xaa\x5d\xee\xa5\x93\xe1\x9b\x6c\x3f\x3a\xf3\x53\x77\xbf\x6d\x78\xf0\x7d\xff\x4a\xa9\x28\xea\x2d\x9e\x76\x84\x7f\xe1\x54\x88\x67\x2e\xf0\xb4\xc3\xdf\x2d\x78\xe6\x65\x42\xeb\x6c\x93\x55\x04\x9c\xcf\xbd\x1a\x94\xbb\x5c\xa2\x3f\x01\x00\x00\xff\xff\x59\xeb\x00\xbf\xd8\x01\x00\x00") 349 | 350 | func dataSqlHackernewsSubdomainsSqlBytes() ([]byte, error) { 351 | return bindataRead( 352 | _dataSqlHackernewsSubdomainsSql, 353 | "data/sql/hackernews/subdomains.sql", 354 | ) 355 | } 356 | 357 | func dataSqlHackernewsSubdomainsSql() (*asset, error) { 358 | bytes, err := dataSqlHackernewsSubdomainsSqlBytes() 359 | if err != nil { 360 | return nil, err 361 | } 362 | 363 | info := bindataFileInfo{name: "data/sql/hackernews/subdomains.sql", size: 472, mode: os.FileMode(420), modTime: time.Unix(1534034400, 0)} 364 | a := &asset{bytes: bytes, info: info} 365 | return a, nil 366 | } 367 | 368 | var _dataSqlHttpArchiveApiroutesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x90\x4f\x8f\x9b\x30\x10\xc5\xef\xf3\x29\x46\x3e\x61\xa9\x05\xb5\xc7\x22\x0e\x94\x75\x10\x52\x02\xc8\x18\x55\x7b\xea\xba\x89\xb3\x78\xc3\xbf\xda\x26\x4a\x45\xf8\xee\x15\x49\x95\x4b\x95\xdb\xbc\xf7\x1b\xbd\xd1\x9b\x84\xb3\x58\x30\x14\x6c\x57\x16\x3c\xe6\xaf\xb8\xa9\xf3\x44\x64\x45\x0e\xef\xca\x6d\x4a\xef\x82\x95\xe0\x59\x9e\x52\xe0\x4c\xd4\x3c\xaf\xfe\x69\xd8\xc6\x79\x5a\xc7\x29\xc3\x0f\x8b\x71\x05\x84\x10\x38\x4b\x83\xa3\x74\x4d\x54\xf3\xcc\xbb\x50\x7f\x9d\x7b\xd9\x29\x8f\x86\xa0\x8f\xe8\xad\xda\xb7\x4e\x1a\x67\x7f\x68\xd7\x78\x24\x90\xa3\x0e\x08\xc5\xeb\x15\xff\x67\xe7\x2f\xcf\xd1\xd7\xa7\xc8\x28\xeb\x02\x42\xe9\x0c\x88\x88\x46\xd9\x68\xdd\x09\x61\x51\xad\x55\x33\xac\x0e\x46\x48\x48\x08\x0b\x80\x51\x6e\x32\xfd\xea\x85\xb7\x02\x45\xb9\x36\xaf\x00\xd1\xc3\x56\xff\x32\xd2\xfc\x89\xc8\xbb\xfd\x16\x04\xfb\xa1\xeb\x86\xde\x8e\x4a\x9e\x3e\x4f\x87\x63\x50\xf3\xcc\xef\x74\xef\x7f\x58\x82\x34\x84\x8a\x6d\x59\x22\x00\xf1\xfe\xb4\xc9\xb4\x14\xe3\x0a\x8f\x53\xdb\xae\xe7\x3f\x01\x62\x52\xd4\xb9\x78\x90\xfd\x30\xf5\x0e\x36\xbc\xd8\x01\xe2\x5b\xe3\xdc\x28\xcd\xbe\xd1\x67\xe5\x1b\xf5\x7b\x52\xd6\x59\x7f\x9e\x0f\xd2\xa9\x65\xf9\x79\x50\xf6\xe4\x86\xf1\x0d\x52\x5e\xd4\x25\x7e\x7f\x05\x7c\x24\x43\xc1\x5f\x18\xbf\x7b\xb7\x4c\x7c\x61\x55\x02\xdb\x6c\x97\x09\x9c\xe7\x56\x77\xda\x2d\x4b\xf8\x37\x00\x00\xff\xff\x36\x17\x7a\x27\xe6\x01\x00\x00") 369 | 370 | func dataSqlHttpArchiveApiroutesSqlBytes() ([]byte, error) { 371 | return bindataRead( 372 | _dataSqlHttpArchiveApiroutesSql, 373 | "data/sql/http-archive/apiroutes.sql", 374 | ) 375 | } 376 | 377 | func dataSqlHttpArchiveApiroutesSql() (*asset, error) { 378 | bytes, err := dataSqlHttpArchiveApiroutesSqlBytes() 379 | if err != nil { 380 | return nil, err 381 | } 382 | 383 | info := bindataFileInfo{name: "data/sql/http-archive/apiroutes.sql", size: 486, mode: os.FileMode(420), modTime: time.Unix(1605916308, 0)} 384 | a := &asset{bytes: bytes, info: info} 385 | return a, nil 386 | } 387 | 388 | var _dataSqlHttpArchiveDirectoriesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x8f\x4f\x8f\x9b\x30\x10\xc5\xef\xf3\x29\x9e\x38\x61\xa9\x25\xf7\xa2\x1e\x28\xf1\x22\xa4\x04\x22\x63\x0e\x7b\xea\x52\xf0\x6e\x9c\xf0\x27\xb5\x4d\x95\x08\xf1\xdd\x2b\x12\xd2\x4a\x7b\x18\x69\xe6\xe9\xcd\xd3\xfb\xc5\x82\x47\x92\x43\xf2\xfd\x21\x17\x91\x78\xc5\x4b\x99\xc5\x32\xcd\x33\x02\x3e\x94\xdb\x6a\xe3\x5f\x51\x48\x91\x66\x09\x23\x40\x70\x59\x8a\xac\x58\x15\x02\x76\x51\x96\x94\x51\xc2\x71\xb2\x88\x0a\x78\x9e\x47\xc0\xfb\xd8\xd7\x4e\x0f\xfd\x33\xc1\x32\x4c\x04\x00\xce\xdc\xd6\x0d\x30\xca\x8d\xa6\x47\x29\x52\xdf\xb2\xa0\xd1\x46\xd5\x6e\x30\x37\x9f\x85\x77\xc3\x8c\xba\x72\xf5\x11\xbe\xba\xb2\xcf\x3f\x76\xb5\xd0\x63\x56\xf5\x59\x97\x85\xb4\xd4\xc8\x0f\x0b\x46\x41\x80\x8f\x56\xff\x32\x95\xb9\x7d\xf7\x3e\xec\xb7\xcd\xa6\x1e\xba\x6e\xe8\xed\x45\x55\xe7\xaf\x63\xf3\xbe\x29\x45\x1a\x74\xba\x0f\x4e\xd6\x03\x0b\xa9\xe0\x3b\x1e\xcb\xff\xfc\xa3\x69\xd9\xc2\x36\x9a\xf6\x0b\x01\x71\x5e\x66\xf2\x9f\x58\x0f\x63\xef\xe8\x45\xe4\x7b\x02\xde\x8e\xce\x5d\x2a\x53\x1f\xf5\x1f\x15\x18\xf5\x7b\x54\xd6\xd9\x60\x9a\x9a\xca\xa9\x79\xfe\xd9\x28\x7b\x76\xc3\xe5\x8d\x12\x91\x97\x07\xfc\x78\x25\x2c\xa1\x94\x8b\x2d\x17\x8f\xf3\x1e\x87\x2d\x2f\x62\xda\xa5\xfb\x54\x62\x9a\x5a\xdd\x69\x37\xcf\xe1\xdf\x00\x00\x00\xff\xff\xa0\xad\x0d\x72\xaa\x01\x00\x00") 389 | 390 | func dataSqlHttpArchiveDirectoriesSqlBytes() ([]byte, error) { 391 | return bindataRead( 392 | _dataSqlHttpArchiveDirectoriesSql, 393 | "data/sql/http-archive/directories.sql", 394 | ) 395 | } 396 | 397 | func dataSqlHttpArchiveDirectoriesSql() (*asset, error) { 398 | bytes, err := dataSqlHttpArchiveDirectoriesSqlBytes() 399 | if err != nil { 400 | return nil, err 401 | } 402 | 403 | info := bindataFileInfo{name: "data/sql/http-archive/directories.sql", size: 426, mode: os.FileMode(420), modTime: time.Unix(1605580993, 0)} 404 | a := &asset{bytes: bytes, info: info} 405 | return a, nil 406 | } 407 | 408 | var _dataSqlHttpArchiveParametersSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x4c\x90\x5b\x6b\xdb\x40\x10\x85\xdf\xe7\x57\x0c\x7a\xda\x85\x54\x7e\xaf\xea\xc2\x56\xd9\x18\x81\xbd\x72\xf7\xf2\x60\x4a\x69\xb6\xf1\x26\x56\x6c\x5d\xb2\x97\x10\x23\xf4\xdf\x8b\x14\x48\xf3\x38\xdf\xe1\xcc\x39\x33\xa5\xe4\x4c\x73\xd4\x7c\xb7\xaf\x25\x93\x07\xbc\x33\xa2\xd4\x55\x2d\xe0\xc9\xc5\x9f\xc9\xf9\x2b\x79\x43\xa5\x65\x25\x36\x14\x24\xd7\x46\x0a\x85\x4c\x4a\x76\xf8\xf6\x4e\xbf\xc3\x96\x89\x8d\x61\x1b\x8e\xcf\x01\x99\x82\x2c\xcb\xe0\xd5\x7a\x7c\x99\xcd\x6b\x23\x2b\xf2\x46\xf3\xe0\xac\x7f\x38\x91\xe8\x93\xa3\xc5\x22\x9f\xdd\x35\xe0\x1a\x7f\xfd\x2e\xe0\xb1\xf7\x64\x41\xd8\x74\xef\x36\xba\xc8\xf9\x90\xc2\x89\x9c\x69\x01\xde\xc5\xe4\xbb\x05\x16\x4b\x40\xbd\x9f\x3b\x2a\x40\x24\x78\x69\xfe\x7a\xeb\xaf\xeb\xec\x29\x7c\x5d\xad\x1e\xfa\xb6\xed\xbb\x30\x38\x7b\xfe\x92\x8e\x8f\x2b\x23\xab\xbc\x6d\xba\xfc\x39\x64\x48\x0b\x50\x7c\xcb\x4b\x0d\x88\x65\x6d\x84\x26\x83\xf5\xb6\x75\xd1\x79\x8a\x4c\xe1\x32\x95\x7d\xea\xe2\x0d\x20\x7e\x68\x37\x70\x27\xeb\x1d\x20\xde\x9f\x62\x1c\xe6\x43\x9a\x57\x97\x7b\xf7\x92\x5c\x88\x21\x1f\xc7\xa3\x8d\x6e\x9a\xfe\x1c\x5d\x38\xc7\x7e\xb8\x9f\xcd\x46\x08\xae\x34\xf9\x78\x62\xf2\x17\x4a\xd1\x86\xff\x5b\x61\x23\x6b\xb3\xc7\x1f\x87\xcf\x51\x50\xcb\x5b\x2e\x3f\xc1\xa5\x0d\xde\x72\x55\xc2\xb6\xda\x55\x1a\xc7\xf1\xd2\xb4\x4d\x9c\xa6\xe2\x5f\x00\x00\x00\xff\xff\xb8\x27\xc5\x51\xbb\x01\x00\x00") 409 | 410 | func dataSqlHttpArchiveParametersSqlBytes() ([]byte, error) { 411 | return bindataRead( 412 | _dataSqlHttpArchiveParametersSql, 413 | "data/sql/http-archive/parameters.sql", 414 | ) 415 | } 416 | 417 | func dataSqlHttpArchiveParametersSql() (*asset, error) { 418 | bytes, err := dataSqlHttpArchiveParametersSqlBytes() 419 | if err != nil { 420 | return nil, err 421 | } 422 | 423 | info := bindataFileInfo{name: "data/sql/http-archive/parameters.sql", size: 443, mode: os.FileMode(420), modTime: time.Unix(1605990736, 0)} 424 | a := &asset{bytes: bytes, info: info} 425 | return a, nil 426 | } 427 | 428 | var _dataSqlHttpArchiveSubdomainsSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x90\x41\xef\x9a\x40\x14\xc4\xef\xef\x53\x4c\x38\xb1\x49\x8b\xf7\x92\x1e\x28\xff\x95\x90\x28\x98\x65\x39\x78\xaa\x08\xab\xa2\x02\x76\x77\x69\x34\x84\xef\xde\xa8\xc4\x46\x0f\x9b\x6c\xe6\xcd\x9b\xfc\xe6\x85\x82\x07\x92\x43\xf2\xe5\x2a\x15\x81\x58\x63\x9e\x27\xa1\x8c\xd3\x84\x80\xbd\xb2\x59\xbf\xad\xba\xa6\xa8\x5b\xf7\x8a\x4c\x8a\x38\x89\x18\x01\x82\xcb\x5c\x24\xd9\xa4\x10\xb0\x08\x92\x28\x0f\x22\x8e\xa3\x41\x90\xc1\x71\x1c\x02\x76\x7d\x5b\xda\xba\x6b\xdf\x73\x0c\xc3\x40\x00\x60\xf5\x6d\xfa\x01\x5a\xd9\x5e\xb7\xc8\x45\xec\x1a\xe6\x99\x97\x99\xf9\x0f\xc3\x88\xb2\xb0\xe5\x01\xae\xba\xb2\xcf\x1d\x33\x59\xe8\xf9\x26\xf5\x1d\x9d\xf9\x74\x47\x4a\x57\xf7\x62\x19\x01\x2e\xce\xf5\x56\x17\xfa\xf6\xd3\xd9\x9b\x1f\xb3\x59\xd9\x35\x4d\xd7\x9a\x8b\x2a\x4e\xdf\xfb\x6a\x37\xcb\x45\xec\x35\x75\xeb\x1d\x8d\x03\xe6\x53\xc6\x17\x3c\x94\x9f\x17\xe9\xf5\x99\xdd\xdb\xbe\x70\xbf\x11\x10\xa6\x79\x22\x5f\xa3\xb2\xeb\x5b\x4b\x73\x91\x2e\x09\xd8\x1c\xac\xbd\x14\xba\x3c\xd4\x7f\x95\xa7\xd5\x9f\x5e\x19\x6b\xbc\x61\xa8\x0a\xab\xc6\xf1\x77\xa5\xcc\xc9\x76\x97\x0d\x45\x22\xcd\x57\xf8\xb5\x26\xfc\x8f\xa6\x54\x7c\x71\xf1\x14\x1f\xa1\xf8\xe2\x59\x48\x8b\x78\x19\x4b\x0c\xc3\xb9\x6e\x6a\x3b\x8e\xfe\xbf\x00\x00\x00\xff\xff\xc5\x85\x14\xbd\xce\x01\x00\x00") 429 | 430 | func dataSqlHttpArchiveSubdomainsSqlBytes() ([]byte, error) { 431 | return bindataRead( 432 | _dataSqlHttpArchiveSubdomainsSql, 433 | "data/sql/http-archive/subdomains.sql", 434 | ) 435 | } 436 | 437 | func dataSqlHttpArchiveSubdomainsSql() (*asset, error) { 438 | bytes, err := dataSqlHttpArchiveSubdomainsSqlBytes() 439 | if err != nil { 440 | return nil, err 441 | } 442 | 443 | info := bindataFileInfo{name: "data/sql/http-archive/subdomains.sql", size: 462, mode: os.FileMode(420), modTime: time.Unix(1605607736, 0)} 444 | a := &asset{bytes: bytes, info: info} 445 | return a, nil 446 | } 447 | 448 | var _dataSqlHttpArchiveTechnologiesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x0a\x76\xf5\x71\x75\x0e\xe1\x52\x50\x28\x2d\xca\xe1\x72\x0b\xf2\xf7\xe5\x52\x50\x48\xc8\x28\x29\x29\x48\x2c\x4a\xce\xc8\x2c\x4b\xd5\x2b\x49\x4d\xce\xc8\xcb\xcf\xc9\x4f\xcf\x4c\x2d\xd6\xab\xae\x4e\x49\x2c\x49\xad\xad\x8d\x4f\x49\x2d\xce\x2e\xc9\x2f\x48\xe0\x0a\xf7\x70\x0d\x72\xe5\x52\x50\x48\x2c\x28\x50\xb0\x55\x50\xaf\xae\x86\xab\xaf\xac\xad\x55\xe7\xf2\xf1\xf4\xf5\x04\x99\x5e\x5d\x9d\x93\x99\x9b\x59\x52\x5b\x0b\x08\x00\x00\xff\xff\x9f\x3f\x79\xb3\x70\x00\x00\x00") 449 | 450 | func dataSqlHttpArchiveTechnologiesSqlBytes() ([]byte, error) { 451 | return bindataRead( 452 | _dataSqlHttpArchiveTechnologiesSql, 453 | "data/sql/http-archive/technologies.sql", 454 | ) 455 | } 456 | 457 | func dataSqlHttpArchiveTechnologiesSql() (*asset, error) { 458 | bytes, err := dataSqlHttpArchiveTechnologiesSqlBytes() 459 | if err != nil { 460 | return nil, err 461 | } 462 | 463 | info := bindataFileInfo{name: "data/sql/http-archive/technologies.sql", size: 112, mode: os.FileMode(420), modTime: time.Unix(1605610287, 0)} 464 | a := &asset{bytes: bytes, info: info} 465 | return a, nil 466 | } 467 | 468 | var _dataSqlHttpArchiveWordsWithExtSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x90\x51\x6f\x9b\x30\x14\x85\xdf\xef\xaf\x38\x42\x93\x8a\xa5\x8e\xbc\x2f\xda\x03\xa3\x0e\x43\x4a\x20\x32\x46\x5b\x9f\x5a\x46\x9c\xc6\x2d\x98\xcc\x36\x53\x2a\xc4\x7f\x9f\x68\xd9\xa4\xe6\xc1\x92\x7d\x7c\xee\xd1\x77\x6e\x22\x78\x2c\x39\x24\xdf\xed\x0b\x11\x8b\x7b\x6c\xaa\x3c\x91\x59\x91\x13\xf0\xa4\xfc\x46\xb7\xca\xd4\x9d\x0a\x2f\x28\xa5\xc8\xf2\x94\x11\x20\xb8\xac\x44\x5e\x2e\x0a\x01\xdb\x38\x4f\xab\x38\xe5\x78\x76\x88\x4b\x04\x41\x40\xc0\x71\x30\x8d\xd7\xbd\xf9\x10\xe3\x18\x46\x02\x00\x6f\x5f\x97\x1b\x60\x95\x1f\xac\x41\x25\xb2\xd0\xb1\xe8\xf8\xcf\xcb\xd6\x6f\xff\x13\x9a\xda\x37\x27\x84\xea\xc2\xae\x47\xdc\x62\xa1\xf7\xb3\xa8\x1f\xb8\xd9\x9a\x66\x9e\x62\x3f\x97\x2a\x09\x08\xd1\xea\x5f\xb6\xb6\xaf\x5f\x83\x27\xf7\x65\xb5\x6a\xfa\xae\xeb\x8d\x3b\xab\xfa\xe5\xf3\x70\x38\xae\x2a\x91\x45\x9d\x36\xd1\xb3\x0b\xc0\xd6\x54\xf2\x2d\x4f\xe4\xd5\x36\x06\xdb\xb2\xb9\xe9\x60\xdb\x5b\x02\x92\xa2\xca\xe5\x7f\xb1\xe9\x07\xe3\x69\x23\x8a\x1d\x01\x8f\x27\xef\xcf\xb5\x6d\x4e\xfa\x8f\x8a\xac\xfa\x3d\x28\xe7\x5d\x34\x8e\x87\xda\xab\x69\x7a\x38\x28\xf7\xe2\xfb\xf3\x23\xfd\xf8\xce\x05\x87\xe0\x29\xff\xb9\x7f\x48\x8a\x5c\xc6\x59\x5e\x62\xce\xbc\x85\xbd\x09\xc7\x51\x5d\xbc\x32\x4e\xf7\xc6\x4d\x13\xfb\x74\xc3\x28\x15\x45\xb5\xc7\xb7\x7b\xc2\x8c\x41\x85\xb8\xe3\xe2\xfd\xf9\x06\x80\x3b\x5e\x26\xb4\xcd\x76\x99\xc4\x38\xb6\xba\xd3\x7e\x9a\xd6\x7f\x03\x00\x00\xff\xff\x2f\xdd\x00\x30\xef\x01\x00\x00") 469 | 470 | func dataSqlHttpArchiveWordsWithExtSqlBytes() ([]byte, error) { 471 | return bindataRead( 472 | _dataSqlHttpArchiveWordsWithExtSql, 473 | "data/sql/http-archive/words-with-ext.sql", 474 | ) 475 | } 476 | 477 | func dataSqlHttpArchiveWordsWithExtSql() (*asset, error) { 478 | bytes, err := dataSqlHttpArchiveWordsWithExtSqlBytes() 479 | if err != nil { 480 | return nil, err 481 | } 482 | 483 | info := bindataFileInfo{name: "data/sql/http-archive/words-with-ext.sql", size: 495, mode: os.FileMode(420), modTime: time.Unix(1605527689, 0)} 484 | a := &asset{bytes: bytes, info: info} 485 | return a, nil 486 | } 487 | 488 | // Asset loads and returns the asset for the given name. 489 | // It returns an error if the asset could not be found or 490 | // could not be loaded. 491 | func Asset(name string) ([]byte, error) { 492 | cannonicalName := strings.Replace(name, "\\", "/", -1) 493 | if f, ok := _bindata[cannonicalName]; ok { 494 | a, err := f() 495 | if err != nil { 496 | return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) 497 | } 498 | return a.bytes, nil 499 | } 500 | return nil, fmt.Errorf("Asset %s not found", name) 501 | } 502 | 503 | // MustAsset is like Asset but panics when Asset would return an error. 504 | // It simplifies safe initialization of global variables. 505 | func MustAsset(name string) []byte { 506 | a, err := Asset(name) 507 | if err != nil { 508 | panic("asset: Asset(" + name + "): " + err.Error()) 509 | } 510 | 511 | return a 512 | } 513 | 514 | // AssetInfo loads and returns the asset info for the given name. 515 | // It returns an error if the asset could not be found or 516 | // could not be loaded. 517 | func AssetInfo(name string) (os.FileInfo, error) { 518 | cannonicalName := strings.Replace(name, "\\", "/", -1) 519 | if f, ok := _bindata[cannonicalName]; ok { 520 | a, err := f() 521 | if err != nil { 522 | return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) 523 | } 524 | return a.info, nil 525 | } 526 | return nil, fmt.Errorf("AssetInfo %s not found", name) 527 | } 528 | 529 | // AssetNames returns the names of the assets. 530 | func AssetNames() []string { 531 | names := make([]string, 0, len(_bindata)) 532 | for name := range _bindata { 533 | names = append(names, name) 534 | } 535 | return names 536 | } 537 | 538 | // _bindata is a table, holding each asset generator, mapped to its name. 539 | var _bindata = map[string]func() (*asset, error){ 540 | "data/.DS_Store": dataDs_store, 541 | "data/filters/numerical-parameters.txt": dataFiltersNumericalParametersTxt, 542 | "data/filters/string-parameters.txt": dataFiltersStringParametersTxt, 543 | "data/sql/.DS_Store": dataSqlDs_store, 544 | "data/sql/github/deleted-files-test.sql": dataSqlGithubDeletedFilesTestSql, 545 | "data/sql/github/deleted-files.sql": dataSqlGithubDeletedFilesSql, 546 | "data/sql/github/nodejs-routes-test.sql": dataSqlGithubNodejsRoutesTestSql, 547 | "data/sql/github/nodejs-routes.sql": dataSqlGithubNodejsRoutesSql, 548 | "data/sql/github/rails-routes-test.sql": dataSqlGithubRailsRoutesTestSql, 549 | "data/sql/github/rails-routes.sql": dataSqlGithubRailsRoutesSql, 550 | "data/sql/github/tomcat-routes-test.sql": dataSqlGithubTomcatRoutesTestSql, 551 | "data/sql/github/tomcat-routes.sql": dataSqlGithubTomcatRoutesSql, 552 | "data/sql/github/words-with-ext.sql": dataSqlGithubWordsWithExtSql, 553 | "data/sql/hackernews/subdomains.sql": dataSqlHackernewsSubdomainsSql, 554 | "data/sql/http-archive/apiroutes.sql": dataSqlHttpArchiveApiroutesSql, 555 | "data/sql/http-archive/directories.sql": dataSqlHttpArchiveDirectoriesSql, 556 | "data/sql/http-archive/parameters.sql": dataSqlHttpArchiveParametersSql, 557 | "data/sql/http-archive/subdomains.sql": dataSqlHttpArchiveSubdomainsSql, 558 | "data/sql/http-archive/technologies.sql": dataSqlHttpArchiveTechnologiesSql, 559 | "data/sql/http-archive/words-with-ext.sql": dataSqlHttpArchiveWordsWithExtSql, 560 | } 561 | 562 | // AssetDir returns the file names below a certain 563 | // directory embedded in the file by go-bindata. 564 | // For example if you run go-bindata on data/... and data contains the 565 | // following hierarchy: 566 | // data/ 567 | // foo.txt 568 | // img/ 569 | // a.png 570 | // b.png 571 | // then AssetDir("data") would return []string{"foo.txt", "img"} 572 | // AssetDir("data/img") would return []string{"a.png", "b.png"} 573 | // AssetDir("foo.txt") and AssetDir("notexist") would return an error 574 | // AssetDir("") will return []string{"data"}. 575 | func AssetDir(name string) ([]string, error) { 576 | node := _bintree 577 | if len(name) != 0 { 578 | cannonicalName := strings.Replace(name, "\\", "/", -1) 579 | pathList := strings.Split(cannonicalName, "/") 580 | for _, p := range pathList { 581 | node = node.Children[p] 582 | if node == nil { 583 | return nil, fmt.Errorf("Asset %s not found", name) 584 | } 585 | } 586 | } 587 | if node.Func != nil { 588 | return nil, fmt.Errorf("Asset %s not found", name) 589 | } 590 | rv := make([]string, 0, len(node.Children)) 591 | for childName := range node.Children { 592 | rv = append(rv, childName) 593 | } 594 | return rv, nil 595 | } 596 | 597 | type bintree struct { 598 | Func func() (*asset, error) 599 | Children map[string]*bintree 600 | } 601 | 602 | var _bintree = &bintree{nil, map[string]*bintree{ 603 | "data": &bintree{nil, map[string]*bintree{ 604 | ".DS_Store": &bintree{dataDs_store, map[string]*bintree{}}, 605 | "filters": &bintree{nil, map[string]*bintree{ 606 | "numerical-parameters.txt": &bintree{dataFiltersNumericalParametersTxt, map[string]*bintree{}}, 607 | "string-parameters.txt": &bintree{dataFiltersStringParametersTxt, map[string]*bintree{}}, 608 | }}, 609 | "sql": &bintree{nil, map[string]*bintree{ 610 | ".DS_Store": &bintree{dataSqlDs_store, map[string]*bintree{}}, 611 | "github": &bintree{nil, map[string]*bintree{ 612 | "deleted-files-test.sql": &bintree{dataSqlGithubDeletedFilesTestSql, map[string]*bintree{}}, 613 | "deleted-files.sql": &bintree{dataSqlGithubDeletedFilesSql, map[string]*bintree{}}, 614 | "nodejs-routes-test.sql": &bintree{dataSqlGithubNodejsRoutesTestSql, map[string]*bintree{}}, 615 | "nodejs-routes.sql": &bintree{dataSqlGithubNodejsRoutesSql, map[string]*bintree{}}, 616 | "rails-routes-test.sql": &bintree{dataSqlGithubRailsRoutesTestSql, map[string]*bintree{}}, 617 | "rails-routes.sql": &bintree{dataSqlGithubRailsRoutesSql, map[string]*bintree{}}, 618 | "tomcat-routes-test.sql": &bintree{dataSqlGithubTomcatRoutesTestSql, map[string]*bintree{}}, 619 | "tomcat-routes.sql": &bintree{dataSqlGithubTomcatRoutesSql, map[string]*bintree{}}, 620 | "words-with-ext.sql": &bintree{dataSqlGithubWordsWithExtSql, map[string]*bintree{}}, 621 | }}, 622 | "hackernews": &bintree{nil, map[string]*bintree{ 623 | "subdomains.sql": &bintree{dataSqlHackernewsSubdomainsSql, map[string]*bintree{}}, 624 | }}, 625 | "http-archive": &bintree{nil, map[string]*bintree{ 626 | "apiroutes.sql": &bintree{dataSqlHttpArchiveApiroutesSql, map[string]*bintree{}}, 627 | "directories.sql": &bintree{dataSqlHttpArchiveDirectoriesSql, map[string]*bintree{}}, 628 | "parameters.sql": &bintree{dataSqlHttpArchiveParametersSql, map[string]*bintree{}}, 629 | "subdomains.sql": &bintree{dataSqlHttpArchiveSubdomainsSql, map[string]*bintree{}}, 630 | "technologies.sql": &bintree{dataSqlHttpArchiveTechnologiesSql, map[string]*bintree{}}, 631 | "words-with-ext.sql": &bintree{dataSqlHttpArchiveWordsWithExtSql, map[string]*bintree{}}, 632 | }}, 633 | }}, 634 | }}, 635 | }} 636 | 637 | // RestoreAsset restores an asset under the given directory 638 | func RestoreAsset(dir, name string) error { 639 | data, err := Asset(name) 640 | if err != nil { 641 | return err 642 | } 643 | info, err := AssetInfo(name) 644 | if err != nil { 645 | return err 646 | } 647 | err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) 648 | if err != nil { 649 | return err 650 | } 651 | err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) 652 | if err != nil { 653 | return err 654 | } 655 | err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) 656 | if err != nil { 657 | return err 658 | } 659 | return nil 660 | } 661 | 662 | // RestoreAssets restores an asset under the given directory recursively 663 | func RestoreAssets(dir, name string) error { 664 | children, err := AssetDir(name) 665 | // File 666 | if err != nil { 667 | return RestoreAsset(dir, name) 668 | } 669 | // Dir 670 | for _, child := range children { 671 | err = RestoreAssets(dir, filepath.Join(name, child)) 672 | if err != nil { 673 | return err 674 | } 675 | } 676 | return nil 677 | } 678 | 679 | func _filePath(dir, name string) string { 680 | cannonicalName := strings.Replace(name, "\\", "/", -1) 681 | return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) 682 | } 683 | -------------------------------------------------------------------------------- /command/apiroutes/apiroutes.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package apiroutes 18 | 19 | import ( 20 | "fmt" 21 | "os" 22 | "strings" 23 | "time" 24 | 25 | "cloud.google.com/go/bigquery" 26 | "github.com/assetnote/commonspeak2/assets" 27 | "github.com/assetnote/commonspeak2/log" 28 | "github.com/urfave/cli" 29 | "github.com/valyala/fasttemplate" 30 | "golang.org/x/net/context" 31 | "google.golang.org/api/option" 32 | ) 33 | 34 | func CmdStatus(c *cli.Context) error { 35 | verboseOpt := c.GlobalBool("verbose") 36 | silentOpt := c.GlobalBool("silent") 37 | project := c.GlobalString("project") 38 | credentials := c.GlobalString("credentials") 39 | limitArg := c.String("limit") 40 | outputFile := c.String("output") 41 | sources := c.String("sources") 42 | date := c.String("date") 43 | 44 | if _, err := os.Stat(credentials); os.IsNotExist(err) { 45 | log.Fatalln(`credentials file not found, either have credentials.json saved in this folder, or provide the 46 | the credentials file path via the --credentials parameter.`) 47 | } 48 | 49 | if credentials == "" { 50 | log.Fatalln("credentials are required, provide it using the --credentials parameter.") 51 | } 52 | 53 | if project == "" { 54 | log.Fatalln("project is required, provide it using the --project parameter.") 55 | } 56 | 57 | fields := log.Fields{ 58 | "Mode": "APIRoutes", 59 | } 60 | sourceList := strings.Split(sources, ",") 61 | sqlTemplateStrings := make(map[string]string) 62 | for _, s := range sourceList { 63 | switch s { 64 | case "httparchive": 65 | haDirsSqlAsset, err := assets.Asset("data/sql/http-archive/apiroutes.sql") 66 | if err != nil { 67 | // Asset was not found. 68 | } 69 | haDirsTemplate := string(haDirsSqlAsset[:]) 70 | haTemplate := fasttemplate.New(haDirsTemplate, "{{", "}}") 71 | currentTime := time.Now() 72 | haDate := currentTime.Format("2006_01") 73 | firstHaDate := fmt.Sprintf("%s_01", haDate) 74 | if date != "" { 75 | firstHaDate = date 76 | } 77 | haCompiledSql := haTemplate.ExecuteString(map[string]interface{}{ 78 | "limit": limitArg, 79 | "date": firstHaDate, 80 | }) 81 | 82 | fields := log.Fields{ 83 | "Mode": "APIRoutes", 84 | "Source": "HTTPArchive", 85 | "Limit": limitArg, 86 | } 87 | 88 | if verboseOpt { 89 | log.WithFields(fields).Infof("Compiled SQL Template: %s", haCompiledSql) 90 | } 91 | sqlTemplateStrings["httparchive"] = haCompiledSql 92 | log.WithFields(fields).Info("Generated SQL template for HTTP Archive.") 93 | } 94 | } 95 | 96 | ctx := context.Background() 97 | 98 | client, err := bigquery.NewClient(ctx, project, option.WithCredentialsFile(credentials)) 99 | if err != nil { 100 | log.WithFields(fields).Warning("Failed to create a BigQuery client. Please check your credentials.") 101 | } 102 | 103 | // Iterate over generated templates and obtain results 104 | for source, compiledSqlValue := range sqlTemplateStrings { 105 | fields["Source"] = source 106 | log.WithFields(fields).Info("Executing BigQuery SQL... this could take some time.") 107 | rows, err := query(client, ctx, compiledSqlValue) 108 | 109 | if err != nil { 110 | fields["Error"] = err.Error() 111 | log.WithFields(fields).Fatal("Error executing BigQuery SQL.") 112 | } 113 | 114 | resultsErr := handleResults(os.Stdout, rows, outputFile, source, silentOpt, verboseOpt) 115 | 116 | if resultsErr != nil { 117 | fields["Error"] = resultsErr.Error() 118 | log.WithFields(fields).Fatal("Error handling results.") 119 | } 120 | } 121 | 122 | return nil 123 | } 124 | -------------------------------------------------------------------------------- /command/apiroutes/helper.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package apiroutes 18 | 19 | import ( 20 | "fmt" 21 | "io" 22 | "os" 23 | 24 | "cloud.google.com/go/bigquery" 25 | "github.com/assetnote/commonspeak2/log" 26 | "github.com/assetnote/commonspeak2/noisey" 27 | "golang.org/x/net/context" 28 | "google.golang.org/api/iterator" 29 | ) 30 | 31 | func query(client *bigquery.Client, ctx context.Context, compiledSql string) (*bigquery.RowIterator, error) { 32 | query := client.Query(compiledSql) 33 | return query.Read(ctx) 34 | } 35 | 36 | func handleResults(w io.Writer, iter *bigquery.RowIterator, outputFile string, source string, silent bool, verbose bool) error { 37 | fields := log.Fields{ 38 | "Mode": "APIRoutes", 39 | "Source": source, 40 | } 41 | file, err := os.Create(outputFile) 42 | if err != nil { 43 | fields["Filename"] = outputFile 44 | fields["Error"] = err.Error() 45 | log.WithFields(fields).Fatal("Cannot create output file") 46 | } 47 | defer file.Close() 48 | totalRows := 0 49 | for { 50 | switch source { 51 | case "httparchive": 52 | var row HTTPArchiveAPIRoutes 53 | err := iter.Next(&row) 54 | if err == iterator.Done { 55 | if !silent { 56 | log.WithFields(fields).Infof("Total rows extracted %d.", totalRows) 57 | } 58 | return nil 59 | } 60 | if err != nil { 61 | return err 62 | } 63 | // dont save if its an MD5,SHA1,SHA256,SHA512 hash or other noise 64 | if noisey.IsNotNoisey(row.Fullpath.String()) { 65 | // Save to output file 66 | fmt.Fprintf(file, "%s\n", row.Fullpath) 67 | // Print to console if verbose mode is on 68 | if verbose { 69 | fmt.Fprintf(w, "Path: %s Count: %s\n", row.Fullpath, row.UrlCount.String()) 70 | } 71 | totalRows++ 72 | } 73 | 74 | } 75 | 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /command/apiroutes/models.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package apiroutes 18 | 19 | import "cloud.google.com/go/bigquery" 20 | 21 | type HTTPArchiveAPIRoutes struct { 22 | Fullpath bigquery.NullString `bigquery:"fullpath"` 23 | UrlCount bigquery.NullInt64 `bigquery:"count"` 24 | } 25 | -------------------------------------------------------------------------------- /command/deletedfiles/deleted.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package deletedfiles 18 | 19 | import ( 20 | "os" 21 | 22 | "cloud.google.com/go/bigquery" 23 | "github.com/assetnote/commonspeak2/assets" 24 | "github.com/assetnote/commonspeak2/log" 25 | "github.com/urfave/cli" 26 | "github.com/valyala/fasttemplate" 27 | "golang.org/x/net/context" 28 | "google.golang.org/api/option" 29 | ) 30 | 31 | func CmdStatus(c *cli.Context) error { 32 | deletedFilesAssetPath := "data/sql/github/deleted-files.sql" 33 | verboseOpt := c.GlobalBool("verbose") 34 | silentOpt := c.GlobalBool("silent") 35 | testOpt := c.GlobalBool("test") 36 | project := c.GlobalString("project") 37 | credentials := c.GlobalString("credentials") 38 | limitArg := c.String("limit") 39 | outputFile := c.String("output") 40 | 41 | if _, err := os.Stat(credentials); os.IsNotExist(err) { 42 | log.Fatalln(`credentials file not found, either have credentials.json saved in this folder, or provide the 43 | the credentials file path via the --credentials parameter.`) 44 | } 45 | 46 | if credentials == "" { 47 | log.Fatalln("credentials are required, provide it using the --credentials parameter.") 48 | } 49 | 50 | if project == "" { 51 | log.Fatalln("project is required, provide it using the --project parameter.") 52 | } 53 | fields := log.Fields{ 54 | "Mode": "DeletedFiles", 55 | "Source": "Github", 56 | "Limit": limitArg, 57 | } 58 | 59 | // If test mode is enabled, let's use the testing SQL queries 60 | // the testing SQL query uses `sample_commits`. 61 | // This is to avoid breaking the bank! 62 | if testOpt { 63 | deletedFilesAssetPath = "data/sql/github/deleted-files-test.sql" 64 | log.WithFields(fields).Info("Running in test mode.") 65 | } 66 | deletedSqlAsset, err := assets.Asset(deletedFilesAssetPath) 67 | if err != nil { 68 | // Asset was not found. 69 | } 70 | wordsTemplate := string(deletedSqlAsset[:]) 71 | template := fasttemplate.New(wordsTemplate, "{{", "}}") 72 | compiledSql := template.ExecuteString(map[string]interface{}{ 73 | "limit": limitArg, 74 | }) 75 | 76 | if verboseOpt { 77 | log.WithFields(fields).Infof("Compiled SQL Template: %s", compiledSql) 78 | } 79 | 80 | ctx := context.Background() 81 | 82 | client, err := bigquery.NewClient(ctx, project, option.WithCredentialsFile(credentials)) 83 | if err != nil { 84 | log.WithFields(fields).Warning("Failed to create a BigQuery client. Please check your credentials.") 85 | } 86 | 87 | log.WithFields(fields).Info("Executing BigQuery SQL... this could take some time.") 88 | rows, err := query(client, ctx, compiledSql) 89 | 90 | if err != nil { 91 | fields["Error"] = err.Error() 92 | log.WithFields(fields).Fatal("Error executing BigQuery SQL.") 93 | } 94 | 95 | resultsErr := handleResults(os.Stdout, rows, outputFile, silentOpt, verboseOpt) 96 | 97 | if resultsErr != nil { 98 | fields["Error"] = err.Error() 99 | log.WithFields(fields).Fatal("Error handling results.") 100 | } 101 | 102 | return nil 103 | } 104 | -------------------------------------------------------------------------------- /command/deletedfiles/helper.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package deletedfiles 18 | 19 | import ( 20 | "fmt" 21 | "io" 22 | "os" 23 | 24 | "cloud.google.com/go/bigquery" 25 | "github.com/assetnote/commonspeak2/log" 26 | "golang.org/x/net/context" 27 | "google.golang.org/api/iterator" 28 | ) 29 | 30 | func query(client *bigquery.Client, ctx context.Context, compiledSql string) (*bigquery.RowIterator, error) { 31 | query := client.Query(compiledSql) 32 | return query.Read(ctx) 33 | } 34 | 35 | func handleResults(w io.Writer, iter *bigquery.RowIterator, outputFile string, silent bool, verbose bool) error { 36 | fields := log.Fields{ 37 | "Mode": "DeletedFiles", 38 | "Source": "Github", 39 | } 40 | file, err := os.Create(outputFile) 41 | if err != nil { 42 | fields["Filename"] = outputFile 43 | fields["Error"] = err.Error() 44 | log.WithFields(fields).Fatal("Cannot create output file") 45 | } 46 | defer file.Close() 47 | totalRows := 0 48 | for { 49 | var row Paths 50 | err := iter.Next(&row) 51 | if err == iterator.Done { 52 | if !silent { 53 | log.WithFields(fields).Infof("Total rows extracted %d.", totalRows) 54 | } 55 | return nil 56 | } 57 | if err != nil { 58 | return err 59 | } 60 | // Save to output file 61 | fmt.Fprintf(file, "%s\n", row.Path) 62 | // Print to console if verbose mode is on 63 | if verbose { 64 | fmt.Fprintf(w, "Path: %s Count: %s\n", row.Path, row.PathCount.String()) 65 | } 66 | totalRows++ 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /command/deletedfiles/models.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package deletedfiles 18 | 19 | import "cloud.google.com/go/bigquery" 20 | 21 | type Paths struct { 22 | Path bigquery.NullString `bigquery:"path"` 23 | PathCount bigquery.NullInt64 `bigquery:"count"` 24 | } 25 | -------------------------------------------------------------------------------- /command/directories/directories.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package directories 18 | 19 | import ( 20 | "fmt" 21 | "os" 22 | "strings" 23 | "time" 24 | 25 | "cloud.google.com/go/bigquery" 26 | "github.com/assetnote/commonspeak2/assets" 27 | "github.com/assetnote/commonspeak2/log" 28 | "github.com/urfave/cli" 29 | "github.com/valyala/fasttemplate" 30 | "golang.org/x/net/context" 31 | "google.golang.org/api/option" 32 | ) 33 | 34 | func CmdStatus(c *cli.Context) error { 35 | verboseOpt := c.GlobalBool("verbose") 36 | silentOpt := c.GlobalBool("silent") 37 | project := c.GlobalString("project") 38 | credentials := c.GlobalString("credentials") 39 | limitArg := c.String("limit") 40 | outputFile := c.String("output") 41 | sources := c.String("sources") 42 | date := c.String("date") 43 | 44 | if _, err := os.Stat(credentials); os.IsNotExist(err) { 45 | log.Fatalln(`credentials file not found, either have credentials.json saved in this folder, or provide the 46 | the credentials file path via the --credentials parameter.`) 47 | } 48 | 49 | if credentials == "" { 50 | log.Fatalln("credentials are required, provide it using the --credentials parameter.") 51 | } 52 | 53 | if project == "" { 54 | log.Fatalln("project is required, provide it using the --project parameter.") 55 | } 56 | 57 | fields := log.Fields{ 58 | "Mode": "Directories", 59 | } 60 | sourceList := strings.Split(sources, ",") 61 | sqlTemplateStrings := make(map[string]string) 62 | for _, s := range sourceList { 63 | switch s { 64 | case "httparchive": 65 | haDirsSqlAsset, err := assets.Asset("data/sql/http-archive/directories.sql") 66 | if err != nil { 67 | // Asset was not found. 68 | } 69 | haDirsTemplate := string(haDirsSqlAsset[:]) 70 | haTemplate := fasttemplate.New(haDirsTemplate, "{{", "}}") 71 | currentTime := time.Now() 72 | haDate := currentTime.Format("2006_01") 73 | firstHaDate := fmt.Sprintf("%s_01", haDate) 74 | if date != "" { 75 | firstHaDate = date 76 | } 77 | haCompiledSql := haTemplate.ExecuteString(map[string]interface{}{ 78 | "limit": limitArg, 79 | "date": firstHaDate, 80 | }) 81 | 82 | fields := log.Fields{ 83 | "Mode": "Directories", 84 | "Source": "HTTPArchive", 85 | "Limit": limitArg, 86 | } 87 | 88 | if verboseOpt { 89 | log.WithFields(fields).Infof("Compiled SQL Template: %s", haCompiledSql) 90 | } 91 | sqlTemplateStrings["httparchive"] = haCompiledSql 92 | log.WithFields(fields).Info("Generated SQL template for HTTP Archive.") 93 | } 94 | } 95 | 96 | ctx := context.Background() 97 | 98 | client, err := bigquery.NewClient(ctx, project, option.WithCredentialsFile(credentials)) 99 | if err != nil { 100 | log.WithFields(fields).Warning("Failed to create a BigQuery client. Please check your credentials.") 101 | } 102 | 103 | // Iterate over generated templates and obtain results 104 | for source, compiledSqlValue := range sqlTemplateStrings { 105 | fields["Source"] = source 106 | log.WithFields(fields).Info("Executing BigQuery SQL... this could take some time.") 107 | rows, err := query(client, ctx, compiledSqlValue) 108 | 109 | if err != nil { 110 | fields["Error"] = err.Error() 111 | log.WithFields(fields).Fatal("Error executing BigQuery SQL.") 112 | } 113 | 114 | resultsErr := handleResults(os.Stdout, rows, outputFile, source, silentOpt, verboseOpt) 115 | 116 | if resultsErr != nil { 117 | fields["Error"] = resultsErr.Error() 118 | log.WithFields(fields).Fatal("Error handling results.") 119 | } 120 | } 121 | 122 | return nil 123 | } 124 | -------------------------------------------------------------------------------- /command/directories/helper.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package directories 18 | 19 | import ( 20 | "fmt" 21 | "io" 22 | "os" 23 | 24 | "cloud.google.com/go/bigquery" 25 | "github.com/assetnote/commonspeak2/log" 26 | "github.com/assetnote/commonspeak2/noisey" 27 | "golang.org/x/net/context" 28 | "google.golang.org/api/iterator" 29 | ) 30 | 31 | func query(client *bigquery.Client, ctx context.Context, compiledSql string) (*bigquery.RowIterator, error) { 32 | query := client.Query(compiledSql) 33 | return query.Read(ctx) 34 | } 35 | 36 | func handleResults(w io.Writer, iter *bigquery.RowIterator, outputFile string, source string, silent bool, verbose bool) error { 37 | fields := log.Fields{ 38 | "Mode": "Directories", 39 | "Source": source, 40 | } 41 | file, err := os.Create(outputFile) 42 | if err != nil { 43 | fields["Filename"] = outputFile 44 | fields["Error"] = err.Error() 45 | log.WithFields(fields).Fatal("Cannot create output file") 46 | } 47 | defer file.Close() 48 | totalRows := 0 49 | for { 50 | switch source { 51 | case "httparchive": 52 | var row HTTPArchiveDirectories 53 | err := iter.Next(&row) 54 | if err == iterator.Done { 55 | if !silent { 56 | log.WithFields(fields).Infof("Total rows extracted %d.", totalRows) 57 | } 58 | return nil 59 | } 60 | if err != nil { 61 | return err 62 | } 63 | // dont save if its an MD5,SHA1,SHA256,SHA512 hash or other noise 64 | if noisey.IsNotNoisey(row.Url.String()) { 65 | // Save to output file 66 | fmt.Fprintf(file, "%s\n", row.Url) 67 | // Print to console if verbose mode is on 68 | if verbose { 69 | fmt.Fprintf(w, "Path: %s Count: %s\n", row.Url, row.UrlCount.String()) 70 | } 71 | totalRows++ 72 | } 73 | 74 | } 75 | 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /command/directories/models.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package directories 18 | 19 | import "cloud.google.com/go/bigquery" 20 | 21 | type HTTPArchiveDirectories struct { 22 | Url bigquery.NullString `bigquery:"url"` 23 | UrlCount bigquery.NullInt64 `bigquery:"count"` 24 | } 25 | -------------------------------------------------------------------------------- /command/parameters/helper.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package parameters 18 | 19 | import ( 20 | "fmt" 21 | "io" 22 | "os" 23 | "strings" 24 | 25 | "cloud.google.com/go/bigquery" 26 | "github.com/assetnote/commonspeak2/log" 27 | "github.com/assetnote/commonspeak2/noisey" 28 | "golang.org/x/net/context" 29 | "google.golang.org/api/iterator" 30 | ) 31 | 32 | func query(client *bigquery.Client, ctx context.Context, compiledSql string) (*bigquery.RowIterator, error) { 33 | query := client.Query(compiledSql) 34 | return query.Read(ctx) 35 | } 36 | 37 | func handleResults(w io.Writer, iter *bigquery.RowIterator, outputFile string, source string, silent bool, verbose bool) error { 38 | fields := log.Fields{ 39 | "Mode": "Parameters", 40 | "Source": source, 41 | } 42 | file, err := os.Create(outputFile) 43 | if err != nil { 44 | fields["Filename"] = outputFile 45 | fields["Error"] = err.Error() 46 | log.WithFields(fields).Fatal("Cannot create output file") 47 | } 48 | defer file.Close() 49 | totalRows := 0 50 | for { 51 | switch source { 52 | case "httparchive": 53 | var row HTTPArchiveParameters 54 | err := iter.Next(&row) 55 | if err == iterator.Done { 56 | if !silent { 57 | log.WithFields(fields).Infof("Total rows extracted %d.", totalRows) 58 | } 59 | return nil 60 | } 61 | if err != nil { 62 | return err 63 | } 64 | // dont save if theres a "/" or a " " in the param or if its an MD5,SHA1,SHA256,SHA512 hash or other noise 65 | if !strings.Contains(row.Parameter.String(), "/") && !strings.Contains(row.Parameter.String(), " ") && noisey.IsNotNoisey(row.Parameter.String()) { 66 | // Save to output file 67 | fmt.Fprintf(file, "%s\n", row.Parameter) 68 | // Print to console if verbose mode is on 69 | if verbose { 70 | fmt.Fprintf(w, "Parameter: %s Count: %s\n", row.Parameter, row.ParamCount.String()) 71 | } 72 | totalRows++ 73 | } 74 | 75 | } 76 | 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /command/parameters/models.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package parameters 18 | 19 | import "cloud.google.com/go/bigquery" 20 | 21 | type HTTPArchiveParameters struct { 22 | Parameter bigquery.NullString `bigquery:"parameter"` 23 | ParamCount bigquery.NullInt64 `bigquery:"paramCount"` 24 | } 25 | -------------------------------------------------------------------------------- /command/parameters/parameters.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package parameters 18 | 19 | import ( 20 | "fmt" 21 | "os" 22 | "strings" 23 | "time" 24 | 25 | "cloud.google.com/go/bigquery" 26 | "github.com/assetnote/commonspeak2/assets" 27 | "github.com/assetnote/commonspeak2/log" 28 | "github.com/urfave/cli" 29 | "github.com/valyala/fasttemplate" 30 | "golang.org/x/net/context" 31 | "google.golang.org/api/option" 32 | ) 33 | 34 | func CmdStatus(c *cli.Context) error { 35 | verboseOpt := c.GlobalBool("verbose") 36 | silentOpt := c.GlobalBool("silent") 37 | project := c.GlobalString("project") 38 | credentials := c.GlobalString("credentials") 39 | limitArg := c.String("limit") 40 | outputFile := c.String("output") 41 | sources := c.String("sources") 42 | date := c.String("date") 43 | 44 | if _, err := os.Stat(credentials); os.IsNotExist(err) { 45 | log.Fatalln(`credentials file not found, either have credentials.json saved in this folder, or provide the 46 | the credentials file path via the --credentials parameter.`) 47 | } 48 | 49 | if credentials == "" { 50 | log.Fatalln("credentials are required, provide it using the --credentials parameter.") 51 | } 52 | 53 | if project == "" { 54 | log.Fatalln("project is required, provide it using the --project parameter.") 55 | } 56 | 57 | fields := log.Fields{ 58 | "Mode": "Parameters", 59 | } 60 | sourceList := strings.Split(sources, ",") 61 | sqlTemplateStrings := make(map[string]string) 62 | for _, s := range sourceList { 63 | switch s { 64 | case "httparchive": 65 | haDirsSqlAsset, err := assets.Asset("data/sql/http-archive/parameters.sql") 66 | if err != nil { 67 | // Asset was not found. 68 | } 69 | haDirsTemplate := string(haDirsSqlAsset[:]) 70 | haTemplate := fasttemplate.New(haDirsTemplate, "{{", "}}") 71 | currentTime := time.Now() 72 | haDate := currentTime.Format("2006_01") 73 | firstHaDate := fmt.Sprintf("%s_01", haDate) 74 | if date != "" { 75 | firstHaDate = date 76 | } 77 | haCompiledSql := haTemplate.ExecuteString(map[string]interface{}{ 78 | "limit": limitArg, 79 | "date": firstHaDate, 80 | }) 81 | 82 | fields := log.Fields{ 83 | "Mode": "Parameters", 84 | "Source": "HTTPArchive", 85 | "Limit": limitArg, 86 | } 87 | 88 | if verboseOpt { 89 | log.WithFields(fields).Infof("Compiled SQL Template: %s", haCompiledSql) 90 | } 91 | sqlTemplateStrings["httparchive"] = haCompiledSql 92 | log.WithFields(fields).Info("Generated SQL template for HTTP Archive.") 93 | } 94 | } 95 | 96 | ctx := context.Background() 97 | 98 | client, err := bigquery.NewClient(ctx, project, option.WithCredentialsFile(credentials)) 99 | if err != nil { 100 | log.WithFields(fields).Warning("Failed to create a BigQuery client. Please check your credentials.") 101 | } 102 | 103 | // Iterate over generated templates and obtain results 104 | for source, compiledSqlValue := range sqlTemplateStrings { 105 | fields["Source"] = source 106 | log.WithFields(fields).Info("Executing BigQuery SQL... this could take some time.") 107 | rows, err := query(client, ctx, compiledSqlValue) 108 | 109 | if err != nil { 110 | fields["Error"] = err.Error() 111 | log.WithFields(fields).Fatal("Error executing BigQuery SQL.") 112 | } 113 | 114 | resultsErr := handleResults(os.Stdout, rows, outputFile, source, silentOpt, verboseOpt) 115 | 116 | if resultsErr != nil { 117 | fields["Error"] = resultsErr.Error() 118 | log.WithFields(fields).Fatal("Error handling results.") 119 | } 120 | } 121 | 122 | return nil 123 | } 124 | -------------------------------------------------------------------------------- /command/routes/helper.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package routes 18 | 19 | import ( 20 | "github.com/assetnote/commonspeak2/assets" 21 | "github.com/assetnote/commonspeak2/log" 22 | "github.com/icrowley/fake" 23 | "cloud.google.com/go/bigquery" 24 | "google.golang.org/api/iterator" 25 | "golang.org/x/net/context" 26 | "io" 27 | "os" 28 | "fmt" 29 | "strings" 30 | "regexp" 31 | ) 32 | 33 | func query(client *bigquery.Client, ctx context.Context, compiledSql string) (*bigquery.RowIterator, error) { 34 | query := client.Query(compiledSql) 35 | return query.Read(ctx) 36 | } 37 | 38 | 39 | // readLines reads a whole file into memory 40 | // and returns a slice of its lines. 41 | func readLines(path string) ([]string, error) { 42 | file, err := assets.Asset(path) 43 | if err != nil { 44 | return nil, err 45 | } 46 | filterString := string(file[:]) 47 | lines := strings.Split(filterString, "\n") 48 | return lines, nil 49 | } 50 | 51 | 52 | 53 | func cleanPathData(route string, framework string, numericalFilter []string, stringFilter []string) string { 54 | switch framework { 55 | case "rails": 56 | // Initial route clean up 57 | railsCleaner := strings.NewReplacer( 58 | "'", "", 59 | "\"", "", 60 | "(", "", 61 | ")", "", 62 | "*", ":", 63 | ) 64 | route = railsCleaner.Replace(route) 65 | // Make numerical replacements (random number 5 digits) 66 | numericalReplacer := strings.NewReplacer(numericalFilter...) 67 | route = numericalReplacer.Replace(route) 68 | // Make string replacements (random english word) 69 | stringReplacer := strings.NewReplacer(stringFilter...) 70 | route = stringReplacer.Replace(route) 71 | // Generic replacements: integers are more likely valid than strings 72 | // as most frameworks will treat or convert integers to strings anyways... 73 | re := regexp.MustCompile("(\\:[a-zA-Z0-9_]*)") 74 | route = re.ReplaceAllString(route, fake.Digits()) 75 | } 76 | 77 | // Conform to starting with a "/" 78 | if !strings.HasPrefix(route ,"/") { 79 | route = "/" + route 80 | } 81 | return route 82 | } 83 | 84 | 85 | func handleResults(w io.Writer, iter *bigquery.RowIterator, outputFile string, framework string, silent bool, verbose bool) error { 86 | fields := log.Fields{ 87 | "Mode": "Routes", 88 | "Framework": framework, 89 | "Source": "Github", 90 | } 91 | 92 | // obtain numerical parameter filters 93 | numericalParameters, err := readLines("data/filters/numerical-parameters.txt") 94 | if err != nil { 95 | log.WithFields(fields).Debugf("Numerical parameters not found: %s", err.Error()) 96 | } 97 | 98 | // obtain string parameter filters 99 | stringParameters, stringErr := readLines("data/filters/string-parameters.txt") 100 | if stringErr != nil { 101 | log.WithFields(fields).Debugf("String parameters not found: %s", stringErr.Error()) 102 | } 103 | 104 | numericalFilter := []string{} 105 | stringFilter := []string{} 106 | 107 | for _, parameter := range numericalParameters { 108 | fmt.Println(parameter) 109 | switch framework { 110 | case "rails": 111 | railsParam := fmt.Sprintf(":%s", parameter) 112 | railsNumerical := fake.Digits() 113 | numericalFilter = append(numericalFilter, railsParam, railsNumerical) 114 | case "nodejs": 115 | continue 116 | case "tomcat": 117 | continue 118 | } 119 | } 120 | 121 | for _, parameter := range stringParameters { 122 | fmt.Println(parameter) 123 | switch framework { 124 | case "rails": 125 | railsParam := fmt.Sprintf(":%s", parameter) 126 | railsString := fake.Word() 127 | stringFilter = append(stringFilter, railsParam, railsString) 128 | case "nodejs": 129 | continue 130 | case "tomcat": 131 | continue 132 | } 133 | } 134 | 135 | // fmt.Printf("%v",numericalFilter) 136 | // fmt.Printf("%v",stringFilter) 137 | 138 | file, err := os.Create(outputFile) 139 | if err != nil { 140 | fields["Filename"] = outputFile 141 | fields["Error"] = err.Error() 142 | log.WithFields(fields).Fatal("Cannot create output file") 143 | } 144 | defer file.Close() 145 | totalRows := 0 146 | for { 147 | var row Routes 148 | err := iter.Next(&row) 149 | if err == iterator.Done { 150 | if !silent { 151 | log.WithFields(fields).Infof("Total rows extracted %d.", totalRows) 152 | } 153 | return nil 154 | } 155 | if err != nil { 156 | return err 157 | } 158 | 159 | parsedRoute := cleanPathData(row.Route.String(), framework, numericalFilter, stringFilter) 160 | 161 | // Save to output file 162 | fmt.Fprintf(file, "%s\n", parsedRoute) 163 | // Print to console if verbose mode is on 164 | if verbose { 165 | fmt.Fprintf(w, "Route: %s Count: %s\n", parsedRoute, row.RouteCount.String()) 166 | } 167 | totalRows++ 168 | } 169 | } -------------------------------------------------------------------------------- /command/routes/models.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package routes 18 | 19 | import "cloud.google.com/go/bigquery" 20 | 21 | type Routes struct { 22 | Route bigquery.NullString 23 | RouteCount bigquery.NullInt64 24 | } -------------------------------------------------------------------------------- /command/routes/routes.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package routes 18 | 19 | import ( 20 | "github.com/urfave/cli" 21 | "github.com/assetnote/commonspeak2/assets" 22 | "github.com/assetnote/commonspeak2/log" 23 | "golang.org/x/net/context" 24 | "github.com/valyala/fasttemplate" 25 | "google.golang.org/api/option" 26 | "cloud.google.com/go/bigquery" 27 | "os" 28 | "strings" 29 | ) 30 | 31 | func CmdStatus(c *cli.Context) error { 32 | // Constant asset paths 33 | RailsSqlAssetPath := "data/sql/github/rails-routes.sql" 34 | NodeSqlAssetPath := "data/sql/github/nodejs-routes.sql" 35 | TomcatSqlAssetPath := "data/sql/github/tomcat-routes.sql" 36 | 37 | verboseOpt := c.GlobalBool("verbose") 38 | silentOpt := c.GlobalBool("silent") 39 | testOpt := c.GlobalBool("test") 40 | project := c.GlobalString("project") 41 | credentials := c.GlobalString("credentials") 42 | limitArg := c.String("limit") 43 | frameworks := c.String("frameworks") 44 | outputFile := c.String("output") 45 | 46 | // TODO: Create route based extraction functionality 47 | // log.Fatal("Feature to be implemented...") 48 | 49 | if _, err := os.Stat(credentials); os.IsNotExist(err) { 50 | log.Fatalln(`credentials file not found, either have credentials.json saved in this folder, or provide the 51 | the credentials file path via the --credentials parameter.`) 52 | } 53 | 54 | if credentials == "" { 55 | log.Fatalln("credentials are required, provide it using the --credentials parameter.") 56 | } 57 | 58 | if project == "" { 59 | log.Fatalln("project is required, provide it using the --project parameter.") 60 | } 61 | 62 | fields := log.Fields{ 63 | "Mode": "Routes", 64 | } 65 | 66 | // If test mode is enabled, let's use the testing SQL queries 67 | // testing SQL queries use `sample_contents` or smaller datasets. 68 | // This is to avoid breaking the bank! 69 | if testOpt { 70 | RailsSqlAssetPath = "data/sql/github/rails-routes-test.sql" 71 | NodeSqlAssetPath = "data/sql/github/nodejs-routes-test.sql" 72 | TomcatSqlAssetPath = "data/sql/github/tomcat-routes-test.sql" 73 | log.WithFields(fields).Info("Running in test mode.") 74 | } 75 | 76 | // Store generated templates in a string slice, if no 77 | // source parameter is provided, the default is to 78 | // run all sources available in the below switch statement 79 | sqlTemplateStrings := make(map[string]string) 80 | frameworkList := strings.Split(frameworks, ",") 81 | for _, fw := range frameworkList { 82 | switch fw { 83 | case "rails": 84 | RailsSqlAsset, err := assets.Asset(RailsSqlAssetPath) 85 | if err != nil { 86 | log.Debug("SQL for Rails not found.") 87 | } 88 | RailsSQLString := string(RailsSqlAsset[:]) 89 | RailsTemplate := fasttemplate.New(RailsSQLString, "{{", "}}") 90 | RailsCompiledSql := RailsTemplate.ExecuteString(map[string]interface{}{ 91 | "limit": limitArg, 92 | }) 93 | if verboseOpt { 94 | log.WithFields(fields).Infof("Compiled SQL Template: %s", RailsCompiledSql) 95 | } 96 | sqlTemplateStrings["rails"] = RailsCompiledSql 97 | log.WithFields(fields).Info("Generated SQL template for Rails routes.") 98 | case "nodejs": 99 | NodeSqlAsset, err := assets.Asset(NodeSqlAssetPath) 100 | if err != nil { 101 | log.Debug("SQL for NodeJS not found.") 102 | } 103 | NodeSQLString := string(NodeSqlAsset[:]) 104 | NodeTemplate := fasttemplate.New(NodeSQLString, "{{", "}}") 105 | NodeCompiledSql := NodeTemplate.ExecuteString(map[string]interface{}{ 106 | "limit": limitArg, 107 | }) 108 | if verboseOpt { 109 | log.WithFields(fields).Infof("Compiled SQL Template: %s", NodeCompiledSql) 110 | } 111 | sqlTemplateStrings["nodejs"] = NodeCompiledSql 112 | log.WithFields(fields).Info("Generated SQL template for NodeJS routes.") 113 | case "tomcat": 114 | TomcatSqlAsset, err := assets.Asset(TomcatSqlAssetPath) 115 | if err != nil { 116 | log.Debug("SQL for Tomcat not found.") 117 | } 118 | TomcatSQLString := string(TomcatSqlAsset[:]) 119 | TomcatTemplate := fasttemplate.New(TomcatSQLString, "{{", "}}") 120 | TomcatCompiledSql := TomcatTemplate.ExecuteString(map[string]interface{}{ 121 | "limit": limitArg, 122 | }) 123 | if verboseOpt { 124 | log.WithFields(fields).Infof("Compiled SQL Template: %s", TomcatCompiledSql) 125 | } 126 | sqlTemplateStrings["tomcat"] = TomcatCompiledSql 127 | log.WithFields(fields).Info("Generated SQL template for Tomcat routes.") 128 | } 129 | } 130 | 131 | // Initialise BigQuery Golang Client 132 | ctx := context.Background() 133 | client, err := bigquery.NewClient(ctx, project, option.WithCredentialsFile(credentials)) 134 | if err != nil { 135 | log.WithFields(fields).Warning("Failed to create a BigQuery client. Please check your credentials.") 136 | } 137 | 138 | // Iterate over generated templates and obtain results 139 | for framework, compiledSqlValue := range sqlTemplateStrings { 140 | fields["Framework"] = framework 141 | log.WithFields(fields).Info("Executing BigQuery SQL... this could take some time.") 142 | rows, err := query(client, ctx, compiledSqlValue) 143 | 144 | if err != nil { 145 | fields["Error"] = err.Error() 146 | log.WithFields(fields).Fatal("Error executing BigQuery SQL.") 147 | } 148 | 149 | resultsErr := handleResults(os.Stdout, rows, outputFile, framework, silentOpt, verboseOpt) 150 | 151 | if resultsErr != nil { 152 | fields["Error"] = resultsErr.Error() 153 | log.WithFields(fields).Fatal("Error handling results.") 154 | } 155 | } 156 | 157 | 158 | return nil 159 | } -------------------------------------------------------------------------------- /command/subdomains/helper.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package subdomains 18 | 19 | import ( 20 | "fmt" 21 | "io" 22 | "os" 23 | 24 | "cloud.google.com/go/bigquery" 25 | "github.com/assetnote/commonspeak2/log" 26 | "github.com/assetnote/commonspeak2/noisey" 27 | "golang.org/x/net/context" 28 | "google.golang.org/api/iterator" 29 | // "time" 30 | ) 31 | 32 | func query(client *bigquery.Client, ctx context.Context, compiledSql string) (*bigquery.RowIterator, error) { 33 | query := client.Query(compiledSql) 34 | return query.Read(ctx) 35 | } 36 | 37 | func handleResults(w io.Writer, iter *bigquery.RowIterator, outputFile string, source string, silent bool, verbose bool) error { 38 | fields := log.Fields{ 39 | "Mode": "Subdomains", 40 | "Source": source, 41 | "Silent": silent, 42 | "Verbose": verbose, 43 | } 44 | file, err := os.Create(outputFile) 45 | if err != nil { 46 | fields["Filename"] = outputFile 47 | fields["Error"] = err.Error() 48 | log.WithFields(fields).Fatal("Cannot create output file") 49 | } 50 | defer file.Close() 51 | totalRows := 0 52 | for { 53 | var row SubdomainNames 54 | err := iter.Next(&row) 55 | if err == iterator.Done { 56 | if !silent { 57 | log.WithFields(fields).Infof("Total rows extracted %d.", totalRows) 58 | } 59 | return nil 60 | } 61 | if err != nil { 62 | return err 63 | } 64 | // dont save if its an MD5,SHA1,SHA256,SHA512 hash or other noise 65 | if noisey.IsNotNoisey(row.Subdomain.String()) { 66 | // Save to output file 67 | fmt.Fprintf(file, "%s\n", row.Subdomain) 68 | // Print to console if verbose mode is on 69 | if verbose { 70 | fmt.Fprintf(w, "Subdomain: %s Count: %s\n", row.Subdomain, row.SubdomainCount.String()) 71 | } 72 | totalRows++ 73 | } 74 | 75 | } 76 | } 77 | 78 | // This function will be used in the future for HTTPArchive `runs` tables on BQuery 79 | // func generateTablePrefixForHA() string { 80 | // year, month, _ := time.Now().Date() 81 | // tablePrefix := fmt.Sprintf("%d_%02d_*", year, int(month)) 82 | // return tablePrefix 83 | // } 84 | -------------------------------------------------------------------------------- /command/subdomains/models.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package subdomains 18 | 19 | import "cloud.google.com/go/bigquery" 20 | 21 | type SubdomainNames struct { 22 | Subdomain bigquery.NullString `bigquery:"subdomain"` 23 | SubdomainCount bigquery.NullInt64 `bigquery:"count"` 24 | } -------------------------------------------------------------------------------- /command/subdomains/subdomains.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package subdomains 18 | 19 | import ( 20 | "fmt" 21 | "os" 22 | "strings" 23 | "time" 24 | 25 | "cloud.google.com/go/bigquery" 26 | "github.com/assetnote/commonspeak2/assets" 27 | "github.com/assetnote/commonspeak2/log" 28 | "github.com/urfave/cli" 29 | "github.com/valyala/fasttemplate" 30 | "golang.org/x/net/context" 31 | "google.golang.org/api/option" 32 | ) 33 | 34 | func CmdStatus(c *cli.Context) error { 35 | verboseOpt := c.GlobalBool("verbose") 36 | silentOpt := c.GlobalBool("silent") 37 | project := c.GlobalString("project") 38 | credentials := c.GlobalString("credentials") 39 | limitArg := c.String("limit") 40 | sources := c.String("sources") 41 | date := c.String("date") 42 | outputFile := c.String("output") 43 | 44 | if _, err := os.Stat(credentials); os.IsNotExist(err) { 45 | log.Fatalln(`credentials file not found, either have credentials.json saved in this folder, or provide the 46 | the credentials file path via the --credentials parameter.`) 47 | } 48 | 49 | if credentials == "" { 50 | log.Fatalln("credentials are required, provide it using the --credentials parameter.") 51 | } 52 | 53 | if project == "" { 54 | log.Fatalln("project is required, provide it using the --project parameter.") 55 | } 56 | 57 | fields := log.Fields{ 58 | "Mode": "Subdomains", 59 | } 60 | 61 | // Store generated templates in a string slice, if no 62 | // source parameter is provided, the default is to 63 | // run all sources available in the below switch statement 64 | sqlTemplateStrings := make(map[string]string) 65 | sourceList := strings.Split(sources, ",") 66 | for _, s := range sourceList { 67 | switch s { 68 | case "hackernews": 69 | hnSubdomainsSqlAsset, err := assets.Asset("data/sql/hackernews/subdomains.sql") 70 | if err != nil { 71 | log.Debug("SQL for HackerNews not found.") 72 | } 73 | hnSQLString := string(hnSubdomainsSqlAsset[:]) 74 | hnTemplate := fasttemplate.New(hnSQLString, "{{", "}}") 75 | // TODO: Complete feature to extract data from the runs tables 76 | // httpArchiveTablePrefix := generateTablePrefixForHA() 77 | hnCompiledSql := hnTemplate.ExecuteString(map[string]interface{}{ 78 | "limit": limitArg, 79 | }) 80 | if verboseOpt { 81 | log.WithFields(fields).Infof("Compiled SQL Template: %s", hnCompiledSql) 82 | } 83 | sqlTemplateStrings["hackernews"] = hnCompiledSql 84 | log.WithFields(fields).Info("Generated SQL template for HackerNews.") 85 | case "httparchive": 86 | haSubdomainsSqlAsset, err := assets.Asset("data/sql/http-archive/subdomains.sql") 87 | if err != nil { 88 | log.Debug("SQL for HTTPArchive not found.") 89 | } 90 | haSQLString := string(haSubdomainsSqlAsset[:]) 91 | haTemplate := fasttemplate.New(haSQLString, "{{", "}}") 92 | currentTime := time.Now() 93 | haDate := currentTime.Format("2006_01") 94 | firstHaDate := fmt.Sprintf("%s_01", haDate) 95 | if date != "" { 96 | firstHaDate = date 97 | } 98 | // TODO: Complete feature to extract data from the runs tables 99 | // httpArchiveTablePrefix := generateTablePrefixForHA() 100 | haCompiledSql := haTemplate.ExecuteString(map[string]interface{}{ 101 | "limit": limitArg, 102 | "date": firstHaDate, 103 | }) 104 | if verboseOpt { 105 | log.WithFields(fields).Infof("Compiled SQL Template: %s", haCompiledSql) 106 | } 107 | sqlTemplateStrings["httparchive"] = haCompiledSql 108 | log.WithFields(fields).Info("Generated SQL template for HTTPArchive.") 109 | } 110 | } 111 | 112 | // Initialise BigQuery Golang Client 113 | ctx := context.Background() 114 | client, err := bigquery.NewClient(ctx, project, option.WithCredentialsFile(credentials)) 115 | if err != nil { 116 | log.WithFields(fields).Warning("Failed to create a BigQuery client. Please check your credentials.") 117 | } 118 | 119 | // Iterate over generated templates and obtain results 120 | for source, compiledSqlValue := range sqlTemplateStrings { 121 | fields["Source"] = source 122 | log.WithFields(fields).Info("Executing BigQuery SQL... this could take some time.") 123 | rows, err := query(client, ctx, compiledSqlValue) 124 | 125 | if err != nil { 126 | fields["Error"] = err.Error() 127 | log.WithFields(fields).Fatal("Error executing BigQuery SQL.") 128 | } 129 | 130 | resultsErr := handleResults(os.Stdout, rows, outputFile, source, silentOpt, verboseOpt) 131 | 132 | if resultsErr != nil { 133 | fields["Error"] = resultsErr.Error() 134 | log.WithFields(fields).Fatal("Error handling results.") 135 | } 136 | } 137 | 138 | return nil 139 | } 140 | -------------------------------------------------------------------------------- /command/technologies/helper.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package technologies 18 | 19 | import ( 20 | "fmt" 21 | "io" 22 | "os" 23 | 24 | "cloud.google.com/go/bigquery" 25 | "github.com/assetnote/commonspeak2/log" 26 | "golang.org/x/net/context" 27 | "google.golang.org/api/iterator" 28 | ) 29 | 30 | func query(client *bigquery.Client, ctx context.Context, compiledSql string) (*bigquery.RowIterator, error) { 31 | query := client.Query(compiledSql) 32 | return query.Read(ctx) 33 | } 34 | 35 | func handleResults(w io.Writer, iter *bigquery.RowIterator, outputFile string, silent bool, verbose bool) error { 36 | fields := log.Fields{ 37 | "Mode": "Technologies", 38 | "Source": "HTTPArchive", 39 | } 40 | file, err := os.Create(outputFile) 41 | if err != nil { 42 | fields["Filename"] = outputFile 43 | fields["Error"] = err.Error() 44 | log.WithFields(fields).Fatal("Cannot create output file") 45 | } 46 | defer file.Close() 47 | totalRows := 0 48 | for { 49 | var row Technologies 50 | err := iter.Next(&row) 51 | if err == iterator.Done { 52 | if !silent { 53 | log.WithFields(fields).Infof("Total rows extracted %d.", totalRows) 54 | } 55 | return nil 56 | } 57 | if err != nil { 58 | return err 59 | } 60 | // Save to output file 61 | fmt.Fprintf(file, "%s\n", row.Url) 62 | // Print to console if verbose mode is on 63 | if verbose { 64 | fmt.Fprintf(w, "URL: %s\n", row.Url) 65 | } 66 | totalRows++ 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /command/technologies/models.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package technologies 18 | 19 | import "cloud.google.com/go/bigquery" 20 | 21 | type Technologies struct { 22 | Url bigquery.NullString `bigquery:"url"` 23 | } 24 | -------------------------------------------------------------------------------- /command/technologies/technologies.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package technologies 18 | 19 | import ( 20 | "fmt" 21 | "os" 22 | "time" 23 | 24 | "cloud.google.com/go/bigquery" 25 | "github.com/assetnote/commonspeak2/assets" 26 | "github.com/assetnote/commonspeak2/log" 27 | "github.com/urfave/cli" 28 | "github.com/valyala/fasttemplate" 29 | "golang.org/x/net/context" 30 | "google.golang.org/api/option" 31 | ) 32 | 33 | func CmdStatus(c *cli.Context) error { 34 | technologiesAssetPath := "data/sql/http-archive/technologies.sql" 35 | verboseOpt := c.GlobalBool("verbose") 36 | silentOpt := c.GlobalBool("silent") 37 | project := c.GlobalString("project") 38 | credentials := c.GlobalString("credentials") 39 | limitArg := c.String("limit") 40 | technology := c.String("technology") 41 | date := c.String("date") 42 | outputFile := c.String("output") 43 | 44 | if _, err := os.Stat(credentials); os.IsNotExist(err) { 45 | log.Fatalln(`credentials file not found, either have credentials.json saved in this folder, or provide the 46 | the credentials file path via the --credentials parameter.`) 47 | } 48 | 49 | if credentials == "" { 50 | log.Fatalln("credentials are required, provide it using the --credentials parameter.") 51 | } 52 | 53 | if project == "" { 54 | log.Fatalln("project is required, provide it using the --project parameter.") 55 | } 56 | fields := log.Fields{ 57 | "Mode": "Technologies", 58 | "Source": "HTTPArchive", 59 | "Limit": limitArg, 60 | } 61 | 62 | technologiesSqlAsset, err := assets.Asset(technologiesAssetPath) 63 | if err != nil { 64 | // Asset was not found. 65 | } 66 | currentTime := time.Now() 67 | haDate := currentTime.Format("2006_01") 68 | firstHaDate := fmt.Sprintf("%s_01", haDate) 69 | if date != "" { 70 | firstHaDate = date 71 | } 72 | wordsTemplate := string(technologiesSqlAsset[:]) 73 | template := fasttemplate.New(wordsTemplate, "{{", "}}") 74 | compiledSql := template.ExecuteString(map[string]interface{}{ 75 | "limit": limitArg, 76 | "date": firstHaDate, 77 | "technology": technology, 78 | }) 79 | 80 | if verboseOpt { 81 | log.WithFields(fields).Infof("Compiled SQL Template: %s", compiledSql) 82 | } 83 | 84 | ctx := context.Background() 85 | 86 | client, err := bigquery.NewClient(ctx, project, option.WithCredentialsFile(credentials)) 87 | if err != nil { 88 | log.WithFields(fields).Warning("Failed to create a BigQuery client. Please check your credentials.") 89 | } 90 | 91 | log.WithFields(fields).Info("Executing BigQuery SQL... this could take some time.") 92 | rows, err := query(client, ctx, compiledSql) 93 | 94 | if err != nil { 95 | fields["Error"] = err.Error() 96 | log.WithFields(fields).Fatal("Error executing BigQuery SQL.") 97 | } 98 | 99 | resultsErr := handleResults(os.Stdout, rows, outputFile, silentOpt, verboseOpt) 100 | 101 | if resultsErr != nil { 102 | fields["Error"] = err.Error() 103 | log.WithFields(fields).Fatal("Error handling results.") 104 | } 105 | 106 | return nil 107 | } 108 | -------------------------------------------------------------------------------- /command/wordswithext/helper.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package wordswithext 18 | 19 | import ( 20 | "fmt" 21 | "io" 22 | "os" 23 | "strings" 24 | 25 | "cloud.google.com/go/bigquery" 26 | "github.com/assetnote/commonspeak2/log" 27 | "github.com/assetnote/commonspeak2/noisey" 28 | "golang.org/x/net/context" 29 | "google.golang.org/api/iterator" 30 | ) 31 | 32 | func query(client *bigquery.Client, ctx context.Context, compiledSql string) (*bigquery.RowIterator, error) { 33 | query := client.Query(compiledSql) 34 | return query.Read(ctx) 35 | } 36 | 37 | func handleResults(w io.Writer, iter *bigquery.RowIterator, outputFile string, source string, silent bool, verbose bool) error { 38 | fields := log.Fields{ 39 | "Mode": "WordsWithExt", 40 | "Source": source, 41 | } 42 | file, err := os.Create(outputFile) 43 | if err != nil { 44 | fields["Filename"] = outputFile 45 | fields["Error"] = err.Error() 46 | log.WithFields(fields).Fatal("Cannot create output file") 47 | } 48 | defer file.Close() 49 | totalRows := 0 50 | for { 51 | switch source { 52 | case "github": 53 | var row GithubExtPaths 54 | err := iter.Next(&row) 55 | if err == iterator.Done { 56 | if !silent { 57 | log.WithFields(fields).Infof("Total rows extracted %d.", totalRows) 58 | } 59 | return nil 60 | } 61 | if err != nil { 62 | return err 63 | } 64 | // dont save if its an MD5,SHA1,SHA256,SHA512 hash or other noise 65 | if noisey.IsNotNoisey(row.Path.String()) { 66 | // Save to output file 67 | fmt.Fprintf(file, "%s\n", row.Path) 68 | // Print to console if verbose mode is on 69 | if verbose { 70 | fmt.Fprintf(w, "Path: %s Count: %s\n", row.Path, row.PathCount.String()) 71 | } 72 | } 73 | totalRows++ 74 | case "httparchive": 75 | var row HTTPArchiveExtPaths 76 | err := iter.Next(&row) 77 | if err == iterator.Done { 78 | if !silent { 79 | log.WithFields(fields).Infof("Total rows extracted %d.", totalRows) 80 | } 81 | return nil 82 | } 83 | if err != nil { 84 | return err 85 | } 86 | // dont save if its an MD5,SHA1,SHA256,SHA512 hash or other noise 87 | if noisey.IsNotNoisey(row.Path.String()) { 88 | // Save to output file 89 | fmt.Fprintf(file, "%s\n", row.Path) 90 | // Print to console if verbose mode is on 91 | if verbose { 92 | fmt.Fprintf(w, "Path: %s Count: %s\n", row.Path, row.PathCount.String()) 93 | } 94 | totalRows++ 95 | } 96 | 97 | } 98 | 99 | } 100 | 101 | } 102 | 103 | func convertExtensionsToRegex(extensions string) string { 104 | extList := strings.Split(extensions, ",") 105 | convertedList := make([]string, 0) 106 | for _, elm := range extList { 107 | convertedElm := fmt.Sprintf("\\.%s", elm) 108 | convertedList = append(convertedList, convertedElm) 109 | } 110 | finalRegex := strings.Join(convertedList, "|") 111 | return finalRegex 112 | } 113 | -------------------------------------------------------------------------------- /command/wordswithext/models.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package wordswithext 18 | 19 | import "cloud.google.com/go/bigquery" 20 | 21 | type GithubExtPaths struct { 22 | Path bigquery.NullString `bigquery:"path"` 23 | PathCount bigquery.NullInt64 `bigquery:"count"` 24 | } 25 | 26 | type HTTPArchiveExtPaths struct { 27 | Path bigquery.NullString `bigquery:"url"` 28 | PathCount bigquery.NullInt64 `bigquery:"count"` 29 | } 30 | -------------------------------------------------------------------------------- /command/wordswithext/words.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package wordswithext 18 | 19 | import ( 20 | "fmt" 21 | "os" 22 | "strings" 23 | "time" 24 | 25 | "cloud.google.com/go/bigquery" 26 | "github.com/assetnote/commonspeak2/assets" 27 | "github.com/assetnote/commonspeak2/log" 28 | "github.com/urfave/cli" 29 | "github.com/valyala/fasttemplate" 30 | "golang.org/x/net/context" 31 | "google.golang.org/api/option" 32 | ) 33 | 34 | func CmdStatus(c *cli.Context) error { 35 | verboseOpt := c.GlobalBool("verbose") 36 | silentOpt := c.GlobalBool("silent") 37 | project := c.GlobalString("project") 38 | credentials := c.GlobalString("credentials") 39 | extensions := c.String("extensions") 40 | limitArg := c.String("limit") 41 | outputFile := c.String("output") 42 | sources := c.String("sources") 43 | date := c.String("date") 44 | 45 | if _, err := os.Stat(credentials); os.IsNotExist(err) { 46 | log.Fatalln(`credentials file not found, either have credentials.json saved in this folder, or provide the 47 | the credentials file path via the --credentials parameter.`) 48 | } 49 | 50 | if credentials == "" { 51 | log.Fatalln("credentials are required, provide it using the --credentials parameter.") 52 | } 53 | 54 | if project == "" { 55 | log.Fatalln("project is required, provide it using the --project parameter.") 56 | } 57 | 58 | if extensions == "" { 59 | log.Fatalln("extensions are required, provide it using the -e parameter.") 60 | } 61 | fields := log.Fields{ 62 | "Mode": "WordsWithExt", 63 | } 64 | extensionsRegex := convertExtensionsToRegex(extensions) 65 | sourceList := strings.Split(sources, ",") 66 | sqlTemplateStrings := make(map[string]string) 67 | for _, s := range sourceList { 68 | switch s { 69 | case "github": 70 | ghWordsSqlAsset, err := assets.Asset("data/sql/github/words-with-ext.sql") 71 | if err != nil { 72 | // Asset was not found. 73 | } 74 | ghWordsTemplate := string(ghWordsSqlAsset[:]) 75 | ghTemplate := fasttemplate.New(ghWordsTemplate, "{{", "}}") 76 | ghCompiledSql := ghTemplate.ExecuteString(map[string]interface{}{ 77 | "extensions": extensionsRegex, 78 | "limit": limitArg, 79 | }) 80 | 81 | fields := log.Fields{ 82 | "Mode": "WordsWithExt", 83 | "Source": "Github", 84 | "Limit": limitArg, 85 | "Extensions": extensions, 86 | } 87 | 88 | if verboseOpt { 89 | log.WithFields(fields).Infof("Compiled SQL Template: %s", ghCompiledSql) 90 | } 91 | sqlTemplateStrings["github"] = ghCompiledSql 92 | log.WithFields(fields).Info("Generated SQL template for Github.") 93 | case "httparchive": 94 | haWordsSqlAsset, err := assets.Asset("data/sql/http-archive/words-with-ext.sql") 95 | if err != nil { 96 | // Asset was not found. 97 | } 98 | haWordsTemplate := string(haWordsSqlAsset[:]) 99 | haTemplate := fasttemplate.New(haWordsTemplate, "{{", "}}") 100 | currentTime := time.Now() 101 | haDate := currentTime.Format("2006_01") 102 | firstHaDate := fmt.Sprintf("%s_01", haDate) 103 | if date != "" { 104 | firstHaDate = date 105 | } 106 | haCompiledSql := haTemplate.ExecuteString(map[string]interface{}{ 107 | "extensions": extensionsRegex, 108 | "limit": limitArg, 109 | "date": firstHaDate, 110 | }) 111 | 112 | fields := log.Fields{ 113 | "Mode": "WordsWithExt", 114 | "Source": "HTTPArchive", 115 | "Limit": limitArg, 116 | "Extensions": extensions, 117 | } 118 | 119 | if verboseOpt { 120 | log.WithFields(fields).Infof("Compiled SQL Template: %s", haCompiledSql) 121 | } 122 | sqlTemplateStrings["httparchive"] = haCompiledSql 123 | log.WithFields(fields).Info("Generated SQL template for HTTP Archive.") 124 | } 125 | } 126 | 127 | ctx := context.Background() 128 | 129 | client, err := bigquery.NewClient(ctx, project, option.WithCredentialsFile(credentials)) 130 | if err != nil { 131 | log.WithFields(fields).Warning("Failed to create a BigQuery client. Please check your credentials.") 132 | } 133 | 134 | // Iterate over generated templates and obtain results 135 | for source, compiledSqlValue := range sqlTemplateStrings { 136 | fields["Source"] = source 137 | log.WithFields(fields).Info("Executing BigQuery SQL... this could take some time.") 138 | rows, err := query(client, ctx, compiledSqlValue) 139 | 140 | if err != nil { 141 | fields["Error"] = err.Error() 142 | log.WithFields(fields).Fatal("Error executing BigQuery SQL.") 143 | } 144 | 145 | resultsErr := handleResults(os.Stdout, rows, outputFile, source, silentOpt, verboseOpt) 146 | 147 | if resultsErr != nil { 148 | fields["Error"] = resultsErr.Error() 149 | log.WithFields(fields).Fatal("Error handling results.") 150 | } 151 | } 152 | 153 | return nil 154 | } 155 | -------------------------------------------------------------------------------- /commands.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "fmt" 21 | "os" 22 | 23 | "github.com/assetnote/commonspeak2/command/apiroutes" 24 | "github.com/assetnote/commonspeak2/command/deletedfiles" 25 | "github.com/assetnote/commonspeak2/command/directories" 26 | "github.com/assetnote/commonspeak2/command/parameters" 27 | "github.com/assetnote/commonspeak2/command/routes" 28 | "github.com/assetnote/commonspeak2/command/subdomains" 29 | "github.com/assetnote/commonspeak2/command/technologies" 30 | "github.com/assetnote/commonspeak2/command/wordswithext" 31 | "github.com/sirupsen/logrus" 32 | "github.com/urfave/cli" 33 | ) 34 | 35 | var GlobalFlags = []cli.Flag{ 36 | cli.StringFlag{ 37 | Name: "project, p", 38 | Value: "", 39 | Usage: "The Google Cloud Project to use for the queries.", 40 | }, 41 | cli.StringFlag{ 42 | Name: "credentials, c", 43 | Usage: "Refer to: https://cloud.google.com/bigquery/docs/reference/libraries#client-libraries-install-go", 44 | FilePath: "credentials.json", 45 | }, 46 | cli.BoolFlag{ 47 | Name: "verbose", 48 | Usage: "Enable verbose output.", 49 | }, 50 | cli.BoolFlag{ 51 | Name: "silent, s", 52 | Usage: "If this is set to true, the results will be written to a file but not to STDOUT.", 53 | }, 54 | cli.BoolFlag{ 55 | Name: "test, t", 56 | Usage: "If this is set to true, Commonspeak2 will execute queries against smaller, testing datasets.", 57 | }, 58 | } 59 | 60 | var Commands = []cli.Command{ 61 | { 62 | Name: "ext-wordlist", 63 | Usage: "Generate wordlists based on extensions provided by the user.", 64 | Action: wordswithext.CmdStatus, 65 | Flags: []cli.Flag{ 66 | cli.StringFlag{ 67 | Name: "extensions, e", 68 | Value: "", 69 | Usage: "Extensions to generate wordlists e.g. html,php,js", 70 | }, 71 | cli.StringFlag{ 72 | Name: "limit, l", 73 | Value: "200000", 74 | Usage: "Limit the wordlist to a certain number of lines. e.g. 200000", 75 | }, 76 | cli.StringFlag{ 77 | Name: "output, o", 78 | Value: "", 79 | Usage: "Data output location e.g. wordlist.txt", 80 | }, 81 | cli.StringFlag{ 82 | Name: "sources", 83 | Value: "github,httparchive", 84 | Usage: "Comma delimited sources to pull data from [github,httparchive]", 85 | }, 86 | cli.StringFlag{ 87 | Name: "date", 88 | Value: "", 89 | Usage: "Date to use for HTTPArchive", 90 | }, 91 | }, 92 | }, 93 | { 94 | Name: "directories", 95 | Usage: "Generate directory wordlists using URI.js and BigQuery", 96 | Action: directories.CmdStatus, 97 | Flags: []cli.Flag{ 98 | cli.StringFlag{ 99 | Name: "limit, l", 100 | Value: "200000", 101 | Usage: "Limit the wordlist to a certain number of lines. e.g. 200000", 102 | }, 103 | cli.StringFlag{ 104 | Name: "output, o", 105 | Value: "", 106 | Usage: "Data output location e.g. wordlist.txt", 107 | }, 108 | cli.StringFlag{ 109 | Name: "sources", 110 | Value: "httparchive", 111 | Usage: "Comma delimited sources to pull data from [httparchive]", 112 | }, 113 | cli.StringFlag{ 114 | Name: "date", 115 | Value: "", 116 | Usage: "Date to use for HTTPArchive", 117 | }, 118 | }, 119 | }, 120 | { 121 | Name: "apiroutes", 122 | Usage: "Generate API routes wordlists using URI.js and BigQuery", 123 | Action: apiroutes.CmdStatus, 124 | Flags: []cli.Flag{ 125 | cli.StringFlag{ 126 | Name: "limit, l", 127 | Value: "200000", 128 | Usage: "Limit the wordlist to a certain number of lines. e.g. 200000", 129 | }, 130 | cli.StringFlag{ 131 | Name: "output, o", 132 | Value: "", 133 | Usage: "Data output location e.g. wordlist.txt", 134 | }, 135 | cli.StringFlag{ 136 | Name: "sources", 137 | Value: "httparchive", 138 | Usage: "Comma delimited sources to pull data from [httparchive]", 139 | }, 140 | cli.StringFlag{ 141 | Name: "date", 142 | Value: "", 143 | Usage: "Date to use for HTTPArchive", 144 | }, 145 | }, 146 | }, 147 | { 148 | Name: "parameters", 149 | Usage: "Generate GET parameters wordlists using URI.js and BigQuery", 150 | Action: parameters.CmdStatus, 151 | Flags: []cli.Flag{ 152 | cli.StringFlag{ 153 | Name: "limit, l", 154 | Value: "200000", 155 | Usage: "Limit the wordlist to a certain number of lines. e.g. 200000", 156 | }, 157 | cli.StringFlag{ 158 | Name: "output, o", 159 | Value: "", 160 | Usage: "Data output location e.g. wordlist.txt", 161 | }, 162 | cli.StringFlag{ 163 | Name: "sources", 164 | Value: "httparchive", 165 | Usage: "Comma delimited sources to pull data from [httparchive]", 166 | }, 167 | cli.StringFlag{ 168 | Name: "date", 169 | Value: "", 170 | Usage: "Date to use for HTTPArchive", 171 | }, 172 | }, 173 | }, 174 | { 175 | Name: "subdomains", 176 | Usage: "Generates a list of subdomains from all available BigQuery public datasets.", 177 | Action: subdomains.CmdStatus, 178 | Flags: []cli.Flag{ 179 | cli.StringFlag{ 180 | Name: "limit, l", 181 | Value: "20000000", 182 | Usage: "Limit the subdomain list to a certain number of lines. e.g. 20000000", 183 | }, 184 | cli.StringFlag{ 185 | Name: "output, o", 186 | Value: "", 187 | Usage: "Data output location e.g. subdomains.txt", 188 | }, 189 | cli.StringFlag{ 190 | Name: "sources", 191 | Value: "hackernews,httparchive", 192 | Usage: "Comma delimited sources to pull data from [hackernews,httparchive]", 193 | }, 194 | cli.StringFlag{ 195 | Name: "date", 196 | Value: "", 197 | Usage: "Date to use for HTTPArchive", 198 | }, 199 | }, 200 | }, 201 | { 202 | Name: "technologies", 203 | Usage: "Generates a list of assets that have a specific technology from the HTTPArchive dataset.", 204 | Action: technologies.CmdStatus, 205 | Flags: []cli.Flag{ 206 | cli.StringFlag{ 207 | Name: "limit, l", 208 | Value: "20000000", 209 | Usage: "Limit the asset list to a certain number of lines. e.g. 20000000", 210 | }, 211 | cli.StringFlag{ 212 | Name: "output, o", 213 | Value: "", 214 | Usage: "Data output location e.g. technologies.txt", 215 | }, 216 | cli.StringFlag{ 217 | Name: "technology", 218 | Value: "Adobe Experience Manaager", 219 | Usage: "Technology you wish to retrieve assets for.", 220 | }, 221 | cli.StringFlag{ 222 | Name: "date", 223 | Value: "", 224 | Usage: "Date to use for HTTPArchive", 225 | }, 226 | }, 227 | }, 228 | { 229 | Name: "routes", 230 | Usage: "Generate wordlists based on routes extracted from popular frameworks.", 231 | Action: routes.CmdStatus, 232 | Flags: []cli.Flag{ 233 | cli.StringFlag{ 234 | Name: "frameworks, f", 235 | Value: "rails,nodejs,tomcat", 236 | Usage: "Frameworks to generate wordlists for, currently limited to [rails,nodejs,tomcat]", 237 | }, 238 | cli.StringFlag{ 239 | Name: "limit, l", 240 | Value: "200000", 241 | Usage: "Limit the wordlist to a certain number of lines. e.g. 200000", 242 | }, 243 | cli.StringFlag{ 244 | Name: "output, o", 245 | Value: "", 246 | Usage: "Data output location e.g. routes.txt", 247 | }, 248 | }, 249 | }, 250 | { 251 | Name: "deleted-files", 252 | Usage: "Generate a list of deleted files based on GitHub commit messages.", 253 | Action: deletedfiles.CmdStatus, 254 | Flags: []cli.Flag{ 255 | cli.StringFlag{ 256 | Name: "limit, l", 257 | Value: "200000", 258 | Usage: "Limit the wordlist to a certain number of lines. e.g. 200000", 259 | }, 260 | cli.StringFlag{ 261 | Name: "output, o", 262 | Value: "", 263 | Usage: "Data output location e.g. deleted.txt", 264 | }, 265 | }, 266 | }, 267 | } 268 | 269 | var before = func(context *cli.Context) error { 270 | debugEnabled := context.GlobalBool("debug") 271 | if debugEnabled { 272 | logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true}) 273 | logrus.SetLevel(logrus.DebugLevel) 274 | } 275 | return nil 276 | } 277 | 278 | func CommandNotFound(c *cli.Context, command string) { 279 | fmt.Fprintf(os.Stderr, "%s: '%s' is not a %s command. See '%s --help'.", c.App.Name, command, c.App.Name, c.App.Name) 280 | os.Exit(2) 281 | } 282 | -------------------------------------------------------------------------------- /data/filters/numerical-parameters.txt: -------------------------------------------------------------------------------- 1 | id 2 | staff_id 3 | event_id 4 | smart_proxy_id 5 | key 6 | loggable_id 7 | forum_id 8 | topic_id 9 | conversation_id 10 | index 11 | record 12 | account_id 13 | page 14 | invitation_token 15 | start 16 | end 17 | date 18 | project_id 19 | nonprofit_id 20 | user_id 21 | agent_id 22 | discussion_id 23 | feed_uid 24 | commit_id 25 | key_id 26 | paper_uid 27 | group_id 28 | auth_token 29 | category_id 30 | prison_id 31 | recording_id 32 | confirmation_token 33 | comment_id 34 | host_id 35 | parent_slug 36 | back_id 37 | call_id 38 | 1 39 | activation_code 40 | days 41 | new_id 42 | issue_id 43 | govtrack_id 44 | step -------------------------------------------------------------------------------- /data/filters/string-parameters.txt: -------------------------------------------------------------------------------- 1 | provider 2 | name 3 | action 4 | User 5 | body 6 | permalink 7 | legislative_term 8 | paper 9 | slug 10 | component_1 11 | component_2 12 | component_3 13 | loggable_type 14 | repo 15 | address 16 | year 17 | month 18 | locale 19 | token 20 | tags 21 | username 22 | archetype 23 | link 24 | check 25 | apiv 26 | query 27 | filename 28 | day 29 | feed 30 | article_name 31 | controller 32 | status 33 | secret 34 | user 35 | code 36 | tab 37 | service 38 | text 39 | Filemanager 40 | currency 41 | model 42 | platform 43 | idp 44 | color 45 | url_token 46 | admin_key 47 | client 48 | subscription 49 | letter 50 | ministry 51 | filter 52 | url_start 53 | url_end 54 | session 55 | application 56 | newsletter 57 | format 58 | category_slug 59 | organization -------------------------------------------------------------------------------- /data/sql/github/deleted-files-test.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMPORARY FUNCTION 2 | extract_path(subject string) 3 | RETURNS STRING 4 | LANGUAGE js AS """ 5 | return subject.split(' ')[1] 6 | """; 7 | SELECT 8 | path, 9 | COUNT(path) AS count 10 | FROM ( 11 | SELECT 12 | extract_path(subject) AS path 13 | FROM 14 | `bigquery-public-data.github_repos.sample_commits` 15 | WHERE 16 | REGEXP_CONTAINS(subject, '^(remov|delet|eras)(e|ed|es|ing) [^\\s]*$') ) 17 | GROUP BY 18 | path 19 | ORDER BY 20 | count DESC -------------------------------------------------------------------------------- /data/sql/github/deleted-files.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMPORARY FUNCTION 2 | extract_path(subject string) 3 | RETURNS STRING 4 | LANGUAGE js AS """ 5 | return subject.split(' ')[1] 6 | """; 7 | SELECT 8 | path, 9 | COUNT(path) AS count 10 | FROM ( 11 | SELECT 12 | extract_path(subject) AS path 13 | FROM 14 | `bigquery-public-data.github_repos.commits` 15 | WHERE 16 | REGEXP_CONTAINS(subject, '^(remov|delet|eras)(e|ed|es|ing) [^\\s]*$') ) 17 | GROUP BY 18 | path 19 | ORDER BY 20 | count DESC -------------------------------------------------------------------------------- /data/sql/github/nodejs-routes-test.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMPORARY FUNCTION parseRoutes(routesCode STRING) 2 | RETURNS ARRAY LANGUAGE js AS """ 3 | 4 | var regex = /("|')[a-zA-Z_0-9\\/\\:!@$%^&*()+=]*('|")/mgi; 5 | if (routesCode) { 6 | var result = routesCode.match(regex); 7 | } else { 8 | var result = []; 9 | } 10 | return result; 11 | """; 12 | 13 | SELECT 14 | route, 15 | COUNT(route) AS count 16 | FROM ( 17 | SELECT 18 | parseRoutes(c.content) AS route 19 | FROM 20 | `bigquery-public-data.github_repos.sample_contents` c 21 | JOIN ( 22 | SELECT 23 | id 24 | FROM 25 | `bigquery-public-data.github_repos.sample_files` 26 | WHERE 27 | path = "config/routes.rb" ) f 28 | ON 29 | f.id = c.id ) routes, 30 | UNNEST(route) AS route 31 | WHERE 32 | route IS NOT NULL 33 | GROUP BY 34 | route 35 | ORDER BY 36 | count DESC 37 | LIMIT 38 | {{limit}} -------------------------------------------------------------------------------- /data/sql/github/nodejs-routes.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assetnote/commonspeak2/ba241100335281873f14f4e6cdaba6dd10cd669b/data/sql/github/nodejs-routes.sql -------------------------------------------------------------------------------- /data/sql/github/rails-routes-test.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMPORARY FUNCTION parseRoutes(routesCode STRING) 2 | RETURNS ARRAY LANGUAGE js AS """ 3 | 4 | var regex = /("|')[a-zA-Z_0-9\\/\\:!@$%^&*()+=]*('|")/mgi; 5 | if (routesCode) { 6 | var result = routesCode.match(regex); 7 | } else { 8 | var result = []; 9 | } 10 | return result; 11 | """; 12 | 13 | SELECT 14 | route, 15 | COUNT(route) AS count 16 | FROM ( 17 | SELECT 18 | parseRoutes(c.content) AS route 19 | FROM 20 | `bigquery-public-data.github_repos.sample_contents` c 21 | JOIN ( 22 | SELECT 23 | id 24 | FROM 25 | `bigquery-public-data.github_repos.sample_files` 26 | WHERE 27 | path = "config/routes.rb" ) f 28 | ON 29 | f.id = c.id ) routes, 30 | UNNEST(route) AS route 31 | WHERE 32 | route IS NOT NULL 33 | GROUP BY 34 | route 35 | ORDER BY 36 | count DESC 37 | LIMIT 38 | {{limit}} -------------------------------------------------------------------------------- /data/sql/github/rails-routes.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMPORARY FUNCTION parseRoutes(routesCode STRING) 2 | RETURNS ARRAY LANGUAGE js AS """ 3 | 4 | var regex = /("|')[a-zA-Z_0-9\\/\\:!@$%^&*()+=]*('|")/mgi; 5 | if (routesCode) { 6 | var result = routesCode.match(regex); 7 | } else { 8 | var result = []; 9 | } 10 | return result; 11 | """; 12 | 13 | SELECT 14 | route, 15 | COUNT(route) AS count 16 | FROM ( 17 | SELECT 18 | parseRoutes(c.content) AS route 19 | FROM 20 | `bigquery-public-data.github_repos.contents` c 21 | JOIN ( 22 | SELECT 23 | id 24 | FROM 25 | `bigquery-public-data.github_repos.files` 26 | WHERE 27 | path = "config/routes.rb" ) f 28 | ON 29 | f.id = c.id ) routes, 30 | UNNEST(route) AS route 31 | WHERE 32 | route IS NOT NULL 33 | GROUP BY 34 | route 35 | ORDER BY 36 | count DESC 37 | LIMIT 38 | {{limit}} -------------------------------------------------------------------------------- /data/sql/github/tomcat-routes-test.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMPORARY FUNCTION parseRoutes(routesCode STRING) 2 | RETURNS ARRAY LANGUAGE js AS """ 3 | 4 | var regex = /("|')[a-zA-Z_0-9\\/\\:!@$%^&*()+=]*('|")/mgi; 5 | if (routesCode) { 6 | var result = routesCode.match(regex); 7 | } else { 8 | var result = []; 9 | } 10 | return result; 11 | """; 12 | 13 | SELECT 14 | route, 15 | COUNT(route) AS count 16 | FROM ( 17 | SELECT 18 | parseRoutes(c.content) AS route 19 | FROM 20 | `bigquery-public-data.github_repos.sample_contents` c 21 | JOIN ( 22 | SELECT 23 | id 24 | FROM 25 | `bigquery-public-data.github_repos.sample_files` 26 | WHERE 27 | path = "config/routes.rb" ) f 28 | ON 29 | f.id = c.id ) routes, 30 | UNNEST(route) AS route 31 | WHERE 32 | route IS NOT NULL 33 | GROUP BY 34 | route 35 | ORDER BY 36 | count DESC 37 | LIMIT 38 | {{limit}} -------------------------------------------------------------------------------- /data/sql/github/tomcat-routes.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assetnote/commonspeak2/ba241100335281873f14f4e6cdaba6dd10cd669b/data/sql/github/tomcat-routes.sql -------------------------------------------------------------------------------- /data/sql/github/words-with-ext.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | path, 3 | COUNT(*) count 4 | FROM 5 | `bigquery-public-data.github_repos.files` 6 | WHERE 7 | REGEXP_CONTAINS (path, r'({{extensions}})$') 8 | GROUP BY 9 | path 10 | ORDER BY 11 | count DESC 12 | LIMIT 13 | {{limit}}; -------------------------------------------------------------------------------- /data/sql/hackernews/subdomains.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMPORARY FUNCTION getSubdomain(x STRING) 2 | RETURNS STRING 3 | LANGUAGE js AS """ 4 | function getSubdomain(s) { 5 | try { 6 | return URI(s).subdomain(); 7 | } catch (ex) { 8 | return s; 9 | } 10 | } 11 | return getSubdomain(x); 12 | """ 13 | OPTIONS ( 14 | library="gs://commonspeak-udf/URI.min.js" 15 | ); 16 | 17 | SELECT 18 | getSubdomain(url) AS subdomain, 19 | count(url) as count 20 | FROM 21 | `bigquery-public-data.hacker_news.full` 22 | GROUP BY 23 | subdomain 24 | ORDER BY 25 | count DESC 26 | LIMIT 27 | {{limit}}; -------------------------------------------------------------------------------- /data/sql/http-archive/apiroutes.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMPORARY FUNCTION 2 | getFP(x STRING) 3 | RETURNS STRING 4 | LANGUAGE js AS 5 | """ 6 | var path=URI(x).pathname(); 7 | if (path.startsWith("/api/") || path.startsWith("/v1/") || path.startsWith("/v2/") || path.startsWith("/rest/")){ 8 | res=path; 9 | }else{ 10 | res = ""; 11 | } 12 | 13 | return res; 14 | """ 15 | OPTIONS 16 | ( library="gs://commonspeak-udf/URI.min.js" ); 17 | SELECT 18 | getFP(url) AS fullpath, 19 | COUNT(url) AS count 20 | FROM 21 | `httparchive.requests.{{date}}_desktop` 22 | GROUP BY 23 | fullpath 24 | ORDER BY 25 | count DESC 26 | LIMIT {{limit}}; -------------------------------------------------------------------------------- /data/sql/http-archive/directories.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMPORARY FUNCTION 2 | getDir(x STRING) 3 | RETURNS STRING 4 | LANGUAGE js AS """ 5 | function getDir(s) { 6 | try { 7 | return URI(s).directory(); 8 | } catch (ex) { 9 | return s; 10 | } 11 | } 12 | return getDir(x); 13 | """ 14 | OPTIONS 15 | ( library="gs://commonspeak-udf/URI.min.js" ); 16 | SELECT 17 | getDir(url) AS url, 18 | COUNT(url) AS count 19 | FROM 20 | `httparchive.requests.{{date}}_desktop` 21 | GROUP BY 22 | url 23 | ORDER BY 24 | count DESC 25 | LIMIT {{limit}}; -------------------------------------------------------------------------------- /data/sql/http-archive/parameters.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMPORARY FUNCTION 2 | getQuery(x STRING) 3 | RETURNS ARRAY 4 | LANGUAGE js AS 5 | """ 6 | var query=URI(x).search(true); 7 | var keys = []; 8 | for(var k in query) keys.push(k); 9 | return keys; 10 | """ 11 | OPTIONS 12 | ( library="gs://commonspeak-udf/URI.min.js" ); 13 | SELECT 14 | COUNT(parameter) AS paramCount, 15 | parameter, 16 | FROM 17 | `httparchive.requests.{{date}}_desktop`, 18 | UNNEST(getQuery(url)) as parameter 19 | GROUP BY 20 | parameter 21 | ORDER BY 22 | paramCount DESC 23 | LIMIT {{limit}}; -------------------------------------------------------------------------------- /data/sql/http-archive/subdomains.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMPORARY FUNCTION 2 | getSubdomain(x STRING) 3 | RETURNS STRING 4 | LANGUAGE js AS """ 5 | function getSubdomain(s) { 6 | try { 7 | return URI(s).subdomain(); 8 | } catch (ex) { 9 | return s; 10 | } 11 | } 12 | return getSubdomain(x); 13 | """ 14 | OPTIONS 15 | ( library="gs://commonspeak-udf/URI.min.js" ); 16 | SELECT 17 | getSubdomain(url) AS subdomain, 18 | COUNT(url) AS count 19 | FROM 20 | `httparchive.requests.{{date}}_desktop` 21 | GROUP BY 22 | subdomain 23 | ORDER BY 24 | count DESC 25 | LIMIT {{limit}}; -------------------------------------------------------------------------------- /data/sql/http-archive/technologies.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | url 3 | FROM 4 | `httparchive.technologies.{{date}}_desktop` 5 | WHERE 6 | app = '{{technology}}' 7 | LIMIT 8 | {{limit}} -------------------------------------------------------------------------------- /data/sql/http-archive/words-with-ext.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMPORARY FUNCTION 2 | getFilename(x STRING) 3 | RETURNS STRING 4 | LANGUAGE js AS """ 5 | function getFilename(s) { 6 | try { 7 | return URI(s).filename(); 8 | } catch (ex) { 9 | return s; 10 | } 11 | } 12 | return getFilename(x); 13 | """ 14 | OPTIONS 15 | ( library="gs://commonspeak-udf/URI.min.js" ); 16 | SELECT 17 | getFilename(url) AS url, 18 | COUNT(url) AS count 19 | FROM 20 | `httparchive.requests.{{date}}_desktop` 21 | WHERE REGEXP_CONTAINS (url, r'({{extensions}})$') 22 | GROUP BY 23 | url 24 | ORDER BY 25 | count DESC 26 | LIMIT {{limit}}; -------------------------------------------------------------------------------- /glide.lock: -------------------------------------------------------------------------------- 1 | hash: 07b9d471890321eed015f70d2a87828dd054c50b3ccec7a66cabffa91ccbfc61 2 | updated: 2018-08-13T20:18:37.157138171+10:00 3 | imports: 4 | - name: cloud.google.com/go 5 | version: c23afc06f11560eb1e93425b849aee2581c6dcfa 6 | subpackages: 7 | - bigquery 8 | - civil 9 | - compute/metadata 10 | - internal 11 | - internal/atomiccache 12 | - internal/fields 13 | - internal/optional 14 | - internal/trace 15 | - internal/version 16 | - name: github.com/corpix/uarand 17 | version: 2b8494104d86337cdd41d0a49cbed8e4583c0ab4 18 | - name: github.com/go-bindata/go-bindata 19 | version: d266f3a456685e7541abc9f010d46fff146c7858 20 | - name: github.com/golang/protobuf 21 | version: 9eb2c01ac278a5d89ce4b2be68fe4500955d8179 22 | subpackages: 23 | - proto 24 | - ptypes 25 | - ptypes/any 26 | - ptypes/duration 27 | - ptypes/timestamp 28 | - name: github.com/googleapis/gax-go 29 | version: 1ef592c90f479e3ab30c6c2312e20e13881b7ea6 30 | - name: github.com/icrowley/fake 31 | version: 4178557ae428460c3780a381c824a1f3aceb6325 32 | - name: github.com/sirupsen/logrus 33 | version: e54a77765aca7bbdd8e56c1c54f60579968b2dc9 34 | - name: github.com/urfave/cli 35 | version: 8e01ec4cd3e2d84ab2fe90d8210528ffbb06d8ff 36 | - name: github.com/valyala/bytebufferpool 37 | version: e746df99fe4a3986f4d4f79e13c1e0117ce9c2f7 38 | - name: github.com/valyala/fasttemplate 39 | version: dcecefd839c4193db0d35b88ec65b4c12d360ab0 40 | - name: go.opencensus.io 41 | version: d2694f19d26a511651863404fc63fa480551fa48 42 | subpackages: 43 | - exporter/stackdriver/propagation 44 | - internal 45 | - internal/tagencoding 46 | - plugin/ochttp 47 | - plugin/ochttp/propagation/b3 48 | - stats 49 | - stats/internal 50 | - stats/view 51 | - tag 52 | - trace 53 | - trace/internal 54 | - trace/propagation 55 | - name: golang.org/x/crypto 56 | version: a49355c7e3f8fe157a85be2f77e6e269a0f89602 57 | subpackages: 58 | - ssh/terminal 59 | - name: golang.org/x/net 60 | version: ed29d75add3d7c4bf7ca65aac0c6df3d1420216f 61 | subpackages: 62 | - context 63 | - context/ctxhttp 64 | - http/httpguts 65 | - http2 66 | - http2/hpack 67 | - idna 68 | - internal/timeseries 69 | - trace 70 | - name: golang.org/x/oauth2 71 | version: ef147856a6ddbb60760db74283d2424e98c87bff 72 | subpackages: 73 | - google 74 | - internal 75 | - jws 76 | - jwt 77 | - name: golang.org/x/sys 78 | version: 151529c776cdc58ddbe7963ba9af779f3577b419 79 | subpackages: 80 | - unix 81 | - windows 82 | - name: golang.org/x/text 83 | version: c0fe8dde8a10c9b32154bd9bdf080b8b3d635127 84 | subpackages: 85 | - secure/bidirule 86 | - transform 87 | - unicode/bidi 88 | - unicode/norm 89 | - name: google.golang.org/api 90 | version: e0f3bfad25321f7b0777b3ab35a0503dcb221744 91 | subpackages: 92 | - bigquery/v2 93 | - gensupport 94 | - googleapi 95 | - googleapi/internal/uritemplates 96 | - googleapi/transport 97 | - internal 98 | - iterator 99 | - option 100 | - transport/http 101 | - name: google.golang.org/appengine 102 | version: b1f26356af11148e710935ed1ac8a7f5702c7612 103 | subpackages: 104 | - internal 105 | - internal/app_identity 106 | - internal/base 107 | - internal/datastore 108 | - internal/log 109 | - internal/modules 110 | - internal/remote_api 111 | - internal/urlfetch 112 | - urlfetch 113 | - name: google.golang.org/genproto 114 | version: ff3583edef7de132f219f0efc00e097cabcc0ec0 115 | subpackages: 116 | - googleapis/rpc/code 117 | - googleapis/rpc/status 118 | - name: google.golang.org/grpc 119 | version: 40cd6b15e2880b88deb091b0fcb091694285fcb0 120 | subpackages: 121 | - balancer 122 | - balancer/base 123 | - balancer/roundrobin 124 | - codes 125 | - connectivity 126 | - credentials 127 | - encoding 128 | - encoding/proto 129 | - grpclog 130 | - internal 131 | - internal/backoff 132 | - internal/channelz 133 | - internal/envconfig 134 | - internal/grpcrand 135 | - keepalive 136 | - metadata 137 | - naming 138 | - peer 139 | - resolver 140 | - resolver/dns 141 | - resolver/passthrough 142 | - stats 143 | - status 144 | - tap 145 | - transport 146 | testImports: [] 147 | -------------------------------------------------------------------------------- /glide.yaml: -------------------------------------------------------------------------------- 1 | package: . 2 | import: 3 | - package: "github.com/urfave/cli" 4 | - package: "github.com/valyala/fasttemplate" 5 | - package: "github.com/go-bindata/go-bindata" 6 | - package: "github.com/sirupsen/logrus" 7 | - package: "cloud.google.com/go/bigquery" 8 | - package: "google.golang.org/api/iterator" 9 | - package: "google.golang.org/api/option" 10 | - package: "github.com/icrowley/fake" -------------------------------------------------------------------------------- /log/log.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package log 18 | 19 | import ( 20 | "github.com/sirupsen/logrus" 21 | ) 22 | 23 | var ( 24 | Error = logrus.Error 25 | Errorf = logrus.Errorf 26 | Errorln = logrus.Errorln 27 | Fatal = logrus.Fatal 28 | Fatalf = logrus.Fatalf 29 | Fatalln = logrus.Fatalln 30 | Panic = logrus.Panic 31 | Panicf = logrus.Panicf 32 | Panicln = logrus.Panicln 33 | Print = logrus.Print 34 | Printf = logrus.Printf 35 | Println = logrus.Println 36 | Debug = logrus.Debug 37 | Debugf = logrus.Debugf 38 | Debugln = logrus.Debugln 39 | Warn = logrus.Warn 40 | Warnf = logrus.Warnf 41 | Warnln = logrus.Warnln 42 | Info = logrus.Info 43 | Infof = logrus.Infof 44 | Infoln = logrus.Infoln 45 | ) 46 | 47 | type Fields logrus.Fields 48 | 49 | func WithFields(f Fields) *logrus.Entry { 50 | return logrus.WithFields(logrus.Fields(f)) 51 | } 52 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "github.com/urfave/cli" 21 | "os" 22 | ) 23 | 24 | func main() { 25 | 26 | app := cli.NewApp() 27 | app.Name = Name 28 | app.Version = Version 29 | app.Author = "Assetnote" 30 | app.Usage = "Generate wordlists using BigQuery by analysing datasets that evolve constantly." 31 | 32 | app.Flags = GlobalFlags 33 | app.Commands = Commands 34 | app.CommandNotFound = CommandNotFound 35 | 36 | app.Run(os.Args) 37 | } 38 | -------------------------------------------------------------------------------- /noisey/noisey.go: -------------------------------------------------------------------------------- 1 | package noisey 2 | 3 | import "regexp" 4 | 5 | func IsNotNoisey(inputString string) bool { 6 | isMD5, _ := regexp.MatchString("^[0-9a-fA-F]{32}$", inputString) 7 | isSHA1, _ := regexp.MatchString("^[a-fA-F0-9]{40}$", inputString) 8 | isSHA256, _ := regexp.MatchString("^[A-Fa-f0-9]{64}$", inputString) 9 | isSHA512, _ := regexp.MatchString("^[A-Fa-f0-9]{128}$", inputString) 10 | isNoisy, _ := regexp.MatchString("[\\!(,%]", inputString) 11 | is100, _ := regexp.MatchString(".{100,}", inputString) 12 | isId, _ := regexp.MatchString("[0-9]{4,}", inputString) 13 | isIdLast3, _ := regexp.MatchString("[0-9]{3,}$", inputString) 14 | isNumberNoisy, _ := regexp.MatchString("[0-9]+[A-Z0-9]{5,}", inputString) 15 | isDirsDeep, _ := regexp.MatchString("\\/.*\\/.*\\/.*\\/.*\\/.*\\/.*\\/", inputString) 16 | isUUID, _ := regexp.MatchString("\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}", inputString) 17 | isMultiNumLetter, _ := regexp.MatchString("[0-9]+[a-zA-Z]+[0-9]+[a-zA-Z]+[0-9]+", inputString) 18 | isLowValueFileType, _ := regexp.MatchString("\\.(png|jpg|jpeg|gif|svg|bmp|ttf|avif|wav|mp4|aac|ajax|css|all|)$", inputString) 19 | if !isMD5 && !isSHA1 && !isSHA256 && !isSHA512 && !isNoisy && !is100 && 20 | !isId && !isIdLast3 && !isNumberNoisy && !isDirsDeep && !isUUID && !isMultiNumLetter && !isLowValueFileType { 21 | return true 22 | } else { 23 | return false 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /version.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Assetnote 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | const Name string = "Commonspeak 2" 20 | const Version string = "0.1.0" 21 | --------------------------------------------------------------------------------