├── .gitignore ├── LICENSE ├── README.md ├── corpora.toml ├── crawler.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | download -------------------------------------------------------------------------------- /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 | # OSS-Fuzz Public Corpora Crawler 2 | This tool downloads corpora published by [OSS-Fuzz](https://github.com/google/oss-fuzz). 3 | 4 | The code was tested with `Python 3.8.16` under `Ubuntu 20.04`. 5 | 6 | Contributions are welcomed :) 7 | 8 | ## Usage 9 | 1. get the code 10 | ```shell 11 | git clone https://github.com/VoodooChild99/oss-fuzz-crawler.git 12 | ``` 13 | 14 | 2. install dependencies 15 | ```shell 16 | pip install -r requirements.txt 17 | ``` 18 | **OR** 19 | ```shell 20 | pip install requests toml rich 21 | ``` 22 | 23 | 3. run `crawler.py` 24 | ```shell 25 | usage: crawler.py [-h] [-s] -d DIRECTORY [-m MAX_RETRIES] corpuses 26 | 27 | OSS-Fuzz Public Corpora Crawler 28 | 29 | positional arguments: 30 | corpuses The TOML file containing corpuses to download 31 | 32 | optional arguments: 33 | -h, --help show this help message and exit 34 | -s, --skip-existed Download corpuses only when it's not in local 35 | -d DIRECTORY, --directory DIRECTORY 36 | Directory where the corpuses are stored locally 37 | -m MAX_RETRIES, --max-retries MAX_RETRIES 38 | Max retires when downloading corpuses, always retry if not specified 39 | ``` 40 | 41 | ## Target Corpora 42 | [corpora.toml](./corpora.toml) already covers several [OSS-Fuzz](https://github.com/google/oss-fuzz) projects used by [FuzzBench](https://github.com/google/fuzzbench). 43 | 44 | You can add more corpuses into [corpora.toml](./corpora.toml) as follows: 45 | ```toml 46 | project = [ "target1", "target2" ] 47 | ``` 48 | 49 | -------------------------------------------------------------------------------- /corpora.toml: -------------------------------------------------------------------------------- 1 | arduinojson = ["msgpack_fuzzer", "json_fuzzer"] 2 | bloaty = ["fuzz_target"] 3 | boost-json = ["fuzz_parse", "fuzz_parser", "fuzz_basic_parser"] 4 | cjson = ["cjson_read_fuzzer"] 5 | curl = [ 6 | "curl_fuzzer_smtp", 7 | "curl_fuzzer_ftp", 8 | "curl_fuzzer_pop3", 9 | "curl_fuzzer_gopher", 10 | "curl_fuzzer_file", 11 | "curl_fuzzer_rtsp", 12 | "curl_fuzzer", 13 | "curl_fuzzer_imap", 14 | "fuzz_url", 15 | "curl_fuzzer_ws", 16 | "curl_fuzzer_ldap", 17 | "curl_fuzzer_sftp", 18 | "curl_fuzzer_https", 19 | "curl_fuzzer_scp", 20 | "curl_fuzzer_http", 21 | "curl_fuzzer_smb", 22 | "curl_fuzzer_mqtt", 23 | "curl_fuzzer_rtmp", 24 | "curl_fuzzer_tftp", 25 | "curl_fuzzer_dict", 26 | ] 27 | eigen = ["basicstuff_fuzzer", "solver_fuzzer"] 28 | envoy = [ 29 | "original_src_fuzz_test", 30 | "h2_capture_fuzz_test", 31 | "h2_capture_direct_response_persistent_fuzz_test", 32 | "http_inspector_fuzz_test", 33 | "verify_signature_fuzz_test", 34 | "utility_fuzz_test", 35 | "least_request_load_balancer_fuzz_test", 36 | "substitution_formatter_fuzz_test", 37 | "filter_fuzz_test", 38 | "udp_fuzz", 39 | "ext_authz_fuzz_test", 40 | "symbol_table_fuzz_test", 41 | "round_robin_load_balancer_fuzz_test", 42 | "listener_filter_buffer_fuzz_test", 43 | "h1_capture_persistent_fuzz_test", 44 | "uri_template_fuzz_test", 45 | "local_ratelimit_fuzz_test", 46 | "parser_fuzz_test", 47 | "path_normalizer_fuzz_test", 48 | "h1_capture_fuzz_test", 49 | "tls_inspector_fuzz_test", 50 | "health_check_fuzz_test", 51 | "http2_codec_impl_fuzz_test", 52 | "hash_fuzz_test", 53 | "stat_merger_fuzz_test", 54 | "conn_manager_impl_fuzz_test", 55 | "ext_proc_grpc_fuzz_test", 56 | "xray_fuzz_test", 57 | "xds_fuzz_test", 58 | "dns_filter_fuzz_test", 59 | "evaluator_fuzz_test", 60 | "h1_capture_direct_response_fuzz_test", 61 | "header_map_impl_fuzz_test", 62 | "route_fuzz_test", 63 | "proxy_protocol_fuzz_test", 64 | "http2_connection_fuzz_test", 65 | "http1_codec_impl_fuzz_test", 66 | "path_utility_fuzz_test", 67 | "network_readfilter_fuzz_test.dict", 68 | "network_readfilter_fuzz_test", 69 | "substitution_formatter_fuzz_test.dict", 70 | "config_fuzz_test", 71 | "response_header_fuzz_test", 72 | "h1_capture_direct_response_persistent_fuzz_test", 73 | "compressor_fuzz_test", 74 | "request_header_fuzz_test", 75 | "codec_fuzz_test", 76 | "jwt_authn_fuzz_test", 77 | "h2_capture_persistent_fuzz_test", 78 | "network_writefilter_fuzz_test", 79 | "random_load_balancer_fuzz_test", 80 | "get_sha_256_digest_fuzz_test", 81 | "json_fuzz_test", 82 | "hpack_fuzz_test", 83 | "json_sanitizer_fuzz_test", 84 | "h2_capture_direct_response_fuzz_test", 85 | "verify_signature_fuzz_test.dict", 86 | "original_dst_fuzz_test", 87 | "header_parser_fuzz_test", 88 | "buffer_fuzz_test", 89 | "server_fuzz_test", 90 | ] 91 | exiv2 = ["fuzz-read-print-write"] 92 | freetype2 = [ 93 | "windowsfnt", 94 | "gzip", 95 | "type1-render-ftengine", 96 | "bdf-render", 97 | "bdf", 98 | "pcf-render", 99 | "type1-tar", 100 | "glyphs-bitmaps-pcf", 101 | "ftfuzzer", 102 | "truetype-render-i38", 103 | "type1-ftengine", 104 | "cff-render-ftengine", 105 | "bzip2", 106 | "windowsfnt-render", 107 | "cff-ftengine", 108 | "cidtype1", 109 | "lzw", 110 | "colrv1", 111 | "glyphs-outlines", 112 | "truetype", 113 | "pcf", 114 | "cff-render", 115 | "type1-render-tar", 116 | "truetype-render-i35", 117 | "type42-render", 118 | "type42", 119 | "cff", 120 | "truetype-render", 121 | "cidtype1-ftengine", 122 | "type1", 123 | "cidtype1-render-ftengine", 124 | "cidtype1-render", 125 | "type1-render", 126 | ] 127 | giflib = ["dgif_protobuf_target", "dgif_target", "egif_target"] 128 | grpc-httpjson-transcoding = [ 129 | "message_reader_fuzz_test", 130 | "http_template_fuzz_test", 131 | ] 132 | gstreamer = ["typefind", "gst-discoverer"] 133 | h2o = [ 134 | "h2o-fuzzer-http1", 135 | "h2o-fuzzer-http3", 136 | "h2o-fuzzer-url", 137 | "h2o-fuzzer-http2", 138 | ] 139 | haproxy = ["fuzz_hpack_decode", "fuzz_cfg_parser"] 140 | harfbuzz = [ 141 | "hb-draw-fuzzer", 142 | "hb-shape-fuzzer", 143 | "hb-subset-fuzzer", 144 | "hb-repacker-fuzzer", 145 | "hb-set-fuzzer", 146 | ] 147 | json = [ 148 | "parse_bson_fuzzer", 149 | "parse_bjdata_fuzzer", 150 | "parse_msgpack_fuzzer", 151 | "parse_afl_fuzzer", 152 | "parse_ubjson_fuzzer", 153 | "parse_cbor_fuzzer", 154 | ] 155 | json-c = ["tokener_parse_ex_fuzzer"] 156 | jsoncons = [ 157 | "fuzz_csv_encoder", 158 | "fuzz_ubjson_parser_max", 159 | "fuzz_parse", 160 | "fuzz_msgpack_parser_max", 161 | "fuzz_json_encoder", 162 | "fuzz_bson", 163 | "fuzz_bson_encoder", 164 | "fuzz_ubjson", 165 | "fuzz_ubjson_encoder", 166 | "fuzz_json_parser_max", 167 | "fuzz_msgpack_encoder", 168 | "fuzz_msgpack", 169 | "fuzz_bson_parser_max", 170 | "fuzz_json_cursor", 171 | "fuzz_cbor_encoder", 172 | "fuzz_csv", 173 | "fuzz_cbor", 174 | "fuzz_cbor_parser_max", 175 | ] 176 | jsoncpp = ["jsoncpp_fuzzer", "jsoncpp_proto_fuzzer"] 177 | jsonnet = [ 178 | "convert_jsonnet_fuzzer_stream", 179 | "convert_jsonnet_fuzzer_regular", 180 | "convert_jsonnet_fuzzer_multi", 181 | ] 182 | lame = ["fuzzer-encoder"] 183 | lcms = [ 184 | "cms_universal_transform_fuzzer", 185 | "cms_transform_all_fuzzer", 186 | "cms_profile_fuzzer", 187 | "cms_transform_extended_fuzzer", 188 | "cmsIT8_load_fuzzer", 189 | "cms_transform_fuzzer", 190 | "cms_overwrite_transform_fuzzer", 191 | ] 192 | libarchive = ["libarchive_fuzzer"] 193 | libavc = ["avc_dec_fuzzer", "svc_enc_fuzzer", "svc_dec_fuzzer"] 194 | libbpf = ["bpf-object-fuzzer"] 195 | libjpeg-turbo = [ 196 | "cjpeg_fuzzer_2_1_x", 197 | "libjpeg_turbo_fuzzer_2_0_x", 198 | "libjpeg_turbo_fuzzer", 199 | "compress_fuzzer_2_1_x", 200 | "compress_yuv_fuzzer_2_1_x", 201 | "decompress_yuv_fuzzer", 202 | "compress_yuv_fuzzer_2_0_x", 203 | "transform_fuzzer_2_1_x", 204 | "compress_yuv_fuzzer", 205 | "compress16_lossless_fuzzer", 206 | "decompress_yuv_fuzzer_2_0_x", 207 | "compress12_fuzzer", 208 | "libjpeg_turbo_fuzzer_2_1_x", 209 | "transform_fuzzer_2_0_x", 210 | "transform_fuzzer", 211 | "cjpeg_fuzzer_2_0_x", 212 | "compress_fuzzer", 213 | "decompress_yuv_fuzzer_2_1_x", 214 | "compress_fuzzer_2_0_x", 215 | "compress_lossless_fuzzer", 216 | "cjpeg_fuzzer", 217 | "compress12_lossless_fuzzer", 218 | ] 219 | libpcap = ["fuzz_both", "fuzz_pcap", "fuzz_filter"] 220 | libpng = ["libpng_read_fuzzer"] 221 | libtiff = ["tiff_read_rgba_fuzzer"] 222 | libxml2 = ["html", "xpath", "uri", "xml", "schema", "regexp"] 223 | libxslt = ["xpath", "xslt"] 224 | libzip = ["zip_read_fuzzer"] 225 | lua = ["fuzz_lua"] 226 | mbedtls = [ 227 | "fuzz_x509crl", 228 | "fuzz_pubkey", 229 | "fuzz_client", 230 | "fuzz_server", 231 | "fuzz_x509crt", 232 | "fuzz_pkcs7", 233 | "fuzz_privkey", 234 | "fuzz_dtlsserver", 235 | "fuzz_dtlsclient", 236 | "fuzz_x509csr", 237 | ] 238 | mruby = ["mruby_fuzzer", "mruby_proto_fuzzer"] 239 | openh264 = ["decoder_fuzzer"] 240 | openjpeg = ["opj_decompress_fuzzer_JP2", "opj_decompress_fuzzer_J2K"] 241 | openssl = [ 242 | "cms_111", 243 | "cms_30", 244 | "bignum", 245 | "bignum_30", 246 | "crl_30", 247 | "cms", 248 | "asn1_111", 249 | "x509", 250 | "client_111", 251 | "x509_30", 252 | "bndiv", 253 | "asn1_30", 254 | "bignum_111", 255 | "bndiv_30", 256 | "asn1parse", 257 | "ct", 258 | "server_30", 259 | "conf", 260 | "bndiv_111", 261 | "conf_111", 262 | "ct_111", 263 | "cmp_30", 264 | "client", 265 | "ct_30", 266 | "server", 267 | "crl_111", 268 | "asn1parse_111", 269 | "client_30", 270 | "punycode", 271 | "x509_111", 272 | "server_111", 273 | "conf_30", 274 | "asn1", 275 | "asn1parse_30", 276 | "crl", 277 | "cmp", 278 | ] 279 | openthread = [ 280 | "ot-ncp-hdlc-received-fuzzer", 281 | "ot-cli-received-fuzzer", 282 | "ot-ip6-send-fuzzer", 283 | "ot-radio-receive-done-fuzzer", 284 | ] 285 | pcre2 = ["pcre2_fuzzer"] 286 | php = [ 287 | "php-fuzz-exif", 288 | "php-fuzz-json", 289 | "php-fuzz-execute", 290 | "php-fuzz-unserializehash", 291 | "php-fuzz-parser", 292 | "php-fuzz-function-jit", 293 | "php-fuzz-unserialize", 294 | "php-fuzz-tracing-jit", 295 | ] 296 | poppler = [ 297 | "doc_fuzzer", 298 | "find_text_fuzzer", 299 | "qt_textbox_fuzzer", 300 | "pdf_fuzzer", 301 | "qt_annot_fuzzer", 302 | "util_fuzzer", 303 | "pdf_draw_fuzzer", 304 | "label_fuzzer", 305 | "qt_search_fuzzer", 306 | "page_label_fuzzer", 307 | "annot_fuzzer", 308 | "pdf_file_fuzzer", 309 | "qt_pdf_fuzzer", 310 | "qt_label_fuzzer", 311 | "doc_attr_fuzzer", 312 | "page_search_fuzzer", 313 | ] 314 | proj4 = ["proj_crs_to_crs_fuzzer"] 315 | rapidjson = ["fuzzer"] 316 | rdkit = [ 317 | "smiles_string_to_mol_fuzzer", 318 | "mol_data_stream_to_mol_fuzzer", 319 | "mol_deserialization_fuzzer", 320 | ] 321 | re2 = ["re2_fuzzer"] 322 | simdjson = [ 323 | "fuzz_utf8", 324 | "fuzz_minifyimpl", 325 | "fuzz_dump_raw_tape", 326 | "fuzz_padded", 327 | "fuzz_atpointer", 328 | "fuzz_ndjson", 329 | "fuzz_parser", 330 | "fuzz_ondemand", 331 | "fuzz_implementations", 332 | "fuzz_print_json", 333 | "fuzz_minify", 334 | "fuzz_element", 335 | "fuzz_dump", 336 | ] 337 | skia = [ 338 | "region_set_path", 339 | "api_ddl_threading", 340 | "skjson", 341 | "skottie_json", 342 | "libvk_swiftshader.so", 343 | "skmeshspecification", 344 | "android_codec", 345 | "path_deserialize", 346 | "api_draw_functions", 347 | "api_gradients", 348 | "region_deserialize", 349 | "api_null_canvas", 350 | "api_skparagraph", 351 | "animated_image_decode", 352 | "jpeg_encoder", 353 | "api_triangulation", 354 | "cubic_quad_roots", 355 | "api_mock_gpu_canvas", 356 | "png_encoder", 357 | "skruntimeeffect", 358 | "colrv1", 359 | "api_polyutils", 360 | "image_filter_deserialize", 361 | "skp", 362 | "api_path_measure", 363 | "webp_encoder", 364 | "api_raster_n32_canvas", 365 | "sksl2metal", 366 | "image_decode_incremental", 367 | "api_create_ddl", 368 | "skdescriptor_deserialize", 369 | "api_image_filter", 370 | "sksl2spirv", 371 | "textblob_deserialize", 372 | "sksl2pipeline", 373 | "api_svg_canvas", 374 | "api_pathop", 375 | "svg_dom", 376 | "image_decode", 377 | "sksl2glsl", 378 | "image_filter_deserialize_width", 379 | "api_regionop", 380 | ] 381 | spotify-json = ["fuzz_decode"] 382 | sqlite3 = ["ossfuzz"] 383 | stb = ["stb_png_read_fuzzer", "stbi_read_fuzzer"] 384 | systemd = [ 385 | "fuzz-bus-label", 386 | "fuzz-etc-hosts", 387 | "fuzz-resource-record", 388 | "fuzz-nspawn-settings", 389 | "fuzz-dhcp6-client", 390 | "fuzz-dhcp-server", 391 | "fuzz-bus-message", 392 | "fuzz-systemctl-parse-argv", 393 | "fuzz-catalog", 394 | "fuzz-network-parser", 395 | "fuzz-ndisc-rs", 396 | "fuzz-journald-kmsg", 397 | "fuzz-journald-stream", 398 | "fuzz-dhcp-server-relay", 399 | "fuzz-unit-file", 400 | "fuzz-bus-match", 401 | "fuzz-time-util", 402 | "fuzz-efi-string", 403 | "fuzz-xdg-desktop", 404 | "fuzz-calendarspec", 405 | "fuzz-json", 406 | "fuzz-hostname-setup", 407 | "fuzz-lldp-rx", 408 | "fuzz-journald-audit", 409 | "fuzz-netdev-parser", 410 | "fuzz-bootspec", 411 | "fuzz-compress", 412 | "fuzz-fido-id-desc", 413 | "fuzz-journal-remote", 414 | "fuzz-varlink", 415 | "fuzz-udev-rule-parse-value", 416 | "fuzz-efi-printf", 417 | "fuzz-dns-packet", 418 | "fuzz-link-parser", 419 | "fuzz-dhcp-client", 420 | "fuzz-env-file", 421 | "fuzz-udev-database", 422 | "fuzz-udev-rules", 423 | "fuzz-journald-native-fd", 424 | "fuzz-nspawn-oci", 425 | "fuzz-bcd", 426 | "fuzz-journald-syslog", 427 | "fuzz-journald-native", 428 | ] 429 | valijson = ["fuzzer"] 430 | vorbis = ["decode_fuzzer"] 431 | w3m = ["fuzz_conv"] 432 | woff2 = ["convert_woff2ttf_fuzzer", "convert_woff2ttf_fuzzer_new_entry"] 433 | xpdf = ["fuzz_zxdoc", "fuzz_pdfload", "fuzz_JBIG2"] 434 | zlib = [ 435 | "example_flush_fuzzer", 436 | "minigzip_fuzzer", 437 | "example_large_fuzzer", 438 | "checksum_fuzzer", 439 | "example_dict_fuzzer", 440 | "zlib_uncompress2_fuzzer", 441 | "example_small_fuzzer", 442 | "zlib_uncompress_fuzzer", 443 | "compress_fuzzer", 444 | ] 445 | -------------------------------------------------------------------------------- /crawler.py: -------------------------------------------------------------------------------- 1 | import os 2 | import toml 3 | import argparse 4 | import requests 5 | 6 | from pathlib import Path 7 | from rich.progress import ( 8 | BarColumn, 9 | DownloadColumn, 10 | Progress, 11 | TextColumn, 12 | TimeRemainingColumn, 13 | TransferSpeedColumn 14 | ) 15 | 16 | 17 | URL_TEMPLATE = "https://storage.googleapis.com/{0}-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/{1}/public.zip" 18 | 19 | progress = Progress( 20 | TextColumn("[bold blue]{task.fields[filename]}", justify="right"), 21 | BarColumn(bar_width=None), 22 | "[progress.percentage]{task.percentage:>3.1f}%", 23 | "•", 24 | DownloadColumn(), 25 | "•", 26 | TransferSpeedColumn(), 27 | "•", 28 | TimeRemainingColumn(), 29 | ) 30 | 31 | def log(msg): 32 | progress.console.log(msg) 33 | 34 | class Crawler: 35 | def __init__(self, skip_existed, dir, max_retries, corpuses, task_id) -> None: 36 | self.skip_existed = skip_existed 37 | self.dir = dir 38 | self.local_corpus_path_template = dir + '/{0}/{1}-corpus.zip' 39 | self.local_corpus_dir_template = dir + '/{0}' 40 | self.max_retries = max_retries 41 | self.session = requests.Session() 42 | self.task_id = task_id 43 | with open(corpuses, 'r') as f: 44 | self.corpuses = toml.load(f) 45 | 46 | def __get_corpus(self, url, filepath): 47 | retry_num = -1 48 | while True: 49 | try: 50 | corpus = self.session.get(url, stream=True) 51 | if corpus.status_code != 200: 52 | log("[x] Failed to download corpus {}: {}".format(self.cur_target, corpus.content)) 53 | return None 54 | progress.update(self.task_id, total=int(corpus.headers['content-length'])) 55 | with open(filepath, 'wb') as f: 56 | for data in corpus.iter_content(chunk_size=1024): 57 | f.write(data) 58 | progress.update(self.task_id, advance=len(data)) 59 | log("[o] Downloaded corpus {}".format(self.cur_target)) 60 | return 61 | except KeyboardInterrupt as KI: 62 | raise KeyboardInterrupt(KI) 63 | except Exception as err: 64 | retry_num += 1 65 | if (self.max_retries is not None) and (retry_num >= self.max_retries): 66 | log("[x] Max retries exceeded when downloading corpus {}: {}".format(self.cur_target, err)) 67 | return None 68 | 69 | def __download_one(self, proj: str): 70 | local_corpus = Path( 71 | self.local_corpus_path_template.format(proj, self.cur_target)) 72 | url = URL_TEMPLATE.format(proj, self.cur_target) 73 | 74 | if local_corpus.exists(): 75 | if self.skip_existed: 76 | log("[*] Skipping corpus {}: already exist".format(self.cur_target)) 77 | return 78 | else: 79 | self.__get_corpus(url, local_corpus) 80 | else: 81 | self.__get_corpus(url, local_corpus) 82 | 83 | def run(self): 84 | for proj in self.corpuses: 85 | local_corpus_dir = Path( 86 | self.local_corpus_dir_template.format(proj)) 87 | if not local_corpus_dir.exists(): 88 | os.mkdir(local_corpus_dir) 89 | for fuzzer in self.corpuses[proj]: 90 | self.cur_target = fuzzer 91 | if not fuzzer.startswith(proj + '_'): 92 | self.cur_target = proj + '_' + fuzzer 93 | progress.update(self.task_id, filename=self.cur_target) 94 | self.__download_one(proj) 95 | progress.reset(self.task_id) 96 | 97 | 98 | def __to_absolute_path(path: str) -> str: 99 | p = Path(path) 100 | if not p.exists(): 101 | raise argparse.ArgumentTypeError('path {} does not exist'.format(p)) 102 | return str(p.resolve()) 103 | 104 | def __to_absolute_path_create_if_not_existed(path: str) -> str: 105 | p = Path(path) 106 | if not p.exists(): 107 | os.mkdir(p) 108 | return str(p.resolve()) 109 | 110 | 111 | def __to_uint(num: str) -> int: 112 | try: 113 | int_num = int(num) 114 | except Exception as err: 115 | raise argparse.ArgumentTypeError( 116 | 'Failed to parse max retries: {}'.format(err)) 117 | if int_num < 0: 118 | raise argparse.ArgumentTypeError('max retries must not be negative') 119 | return int_num 120 | 121 | 122 | def main(args): 123 | task_id = progress.add_task("download", filename="", start=True) 124 | c = Crawler(args.skip_existed, args.directory, args.max_retries, args.corpuses, task_id) 125 | try: 126 | c.run() 127 | except KeyboardInterrupt: 128 | print("[:)] bye") 129 | finally: 130 | progress.remove_task(task_id) 131 | 132 | 133 | if __name__ == "__main__": 134 | parser = argparse.ArgumentParser( 135 | description="OSS-Fuzz Public Corpora Crawler") 136 | parser.add_argument('-s', "--skip-existed", 137 | action="store_true", 138 | help="Download corpuses only when it's not in local") 139 | parser.add_argument('-d', "--directory", 140 | required=True, 141 | type=__to_absolute_path_create_if_not_existed, 142 | help="Directory where the corpuses are stored locally") 143 | parser.add_argument('-m', "--max-retries", 144 | type=__to_uint, 145 | help="Max retires when downloading corpuses, always retry if not specified") 146 | parser.add_argument('corpuses', 147 | type=__to_absolute_path, 148 | help="The TOML file containing corpuses to download") 149 | args = parser.parse_args() 150 | with progress: 151 | main(args) 152 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2022.12.7 2 | charset-normalizer==3.0.1 3 | idna==3.4 4 | markdown-it-py==2.1.0 5 | mdurl==0.1.2 6 | Pygments==2.14.0 7 | requests==2.28.2 8 | rich==13.3.1 9 | toml==0.10.2 10 | typing_extensions==4.5.0 11 | urllib3==1.26.14 12 | --------------------------------------------------------------------------------