{"id":21245822,"url":"https://github.com/wishtack/modsecurity-exception-factory","last_synced_at":"2025-07-30T11:33:11.930Z","repository":{"id":68024487,"uuid":"47113016","full_name":"wishtack/modsecurity-exception-factory","owner":"wishtack","description":"👴🏻 The only tool that parses your ModSecurity audit logs to generate exceptions automagically ;)","archived":false,"fork":false,"pushed_at":"2015-11-30T11:02:10.000Z","size":192,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-05T18:06:36.932Z","etag":null,"topics":["infosec","legacy","modsecurity","waf"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wishtack.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-30T11:01:52.000Z","updated_at":"2025-03-12T10:06:06.000Z","dependencies_parsed_at":"2023-03-10T16:12:53.341Z","dependency_job_id":null,"html_url":"https://github.com/wishtack/modsecurity-exception-factory","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/wishtack/modsecurity-exception-factory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wishtack%2Fmodsecurity-exception-factory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wishtack%2Fmodsecurity-exception-factory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wishtack%2Fmodsecurity-exception-factory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wishtack%2Fmodsecurity-exception-factory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wishtack","download_url":"https://codeload.github.com/wishtack/modsecurity-exception-factory/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wishtack%2Fmodsecurity-exception-factory/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267858704,"owners_count":24155941,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["infosec","legacy","modsecurity","waf"],"created_at":"2024-11-21T02:00:29.774Z","updated_at":"2025-07-30T11:33:11.891Z","avatar_url":"https://github.com/wishtack.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"ModSecurity Exception Generator\n###############################\n\n**ModSecurity Exception Generator** is a tool that generates **ModSecurity** exception rules by automatically analyzing ModSecurity audit logs. This is very useful and almost essential to avoid false positives and rejecting legitimate clients.\n\nInstallation\n************\n\n.. code-block:: bash\n\n pip install modsecurity-exception-generator\n\nUsage\n*****\n\nCommand options\n===============\n\n-d\n--\n SQL URL of the data store where the **ModSecurity** audit log parsed data will be stored and loaded from.\n\n *Example: 'sqlite:////tmp/modsecurity-exception-factory.db'.*\n\n-i [Optional]\n-------------\n Path to the ModSecurity audit log file to parse.\n\n One can use '-' as a value for this parameter to read the audit log data from standard input.\n\n-c [Optional]\n-------------\n Path of the optional configuration file. \n\nBasic examples\n==============\n\n.. code-block:: bash\n    \n    modsecurity-exception-generator \\\n        -i /path/to/modsec_audit.log \\\n        -d \"sqlite:////tmp/service.db\" \\\n    \u003e modsecurity_crs_15_exceptions.conf\n\n.. code-block:: bash\n    \n    zcat modsec_audit.log.*.gz \\\n    | modsecurity-exception-generator \\\n        -i - \\\n        -d \"sqlite:////tmp/service.db\" \\\n    \u003e modsecurity_crs_15_exceptions.conf\n\nWARNING\n*******\n\n The produced exceptions must be loaded BEFORE the rules they are applied to.\n\nRemoving superfluous exceptions\n===============================\n\nGenerating exceptions by simply running the '**modsecurity-exception-generator**' program, as in the basic examples, might generate some superfluous exception rules. Thus we need some advanced options to obtain smarter results. That's where the YAML configuration file given using the '**-c**' option comes in handy.\n\nThe YAML configuration file supports the following directives:\n\nignore\n------\n\nIndicates which logs most be ignored by the exception generator.\n\nexample\n^^^^^^^\n\nTo ignore any log message produced by the rule with the id 981176.\n\n.. code-block::\n     \n     ignore:\n        rule_id: [981176]\n\nThis can also be applied to other variables like '**host_name**' *(targeted host name)*, '**request_filename**' *(targeted url)* or '**payload_container**' *(the variable that matched the rule)*.\n\nminimum_occurrence_count_threshold\n----------------------------------\n\nIgnore exceptions that affect less than **minimum_occurence_count_threshold** log message occurrences.\n\nmaximum_value_count_threshold\n-----------------------------\n\nSometimes, exceptions rules can have conditions with too many values like the following example.\n\n.. code-block::\n    \n    SecRule REQUEST_FILENAME \"@rx ^(/foo_bar|/blabla|/test_2/|...)$\" ...\n\nThis condition can be ignored by setting **maximum_value_count_threshold** to a value lesser than the number of values in the regular expression.\n\nConfiguration example for the Core Rule Set\n===========================================\n\n.. code-block::\n    \n    ignore:\n        rule_id: [981174, 981176, 981203, 981200, 981201, 981202, 981203, 981204, 981205, 981220]\n    \n    minimum_occurrence_count_threshold: 1000\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwishtack%2Fmodsecurity-exception-factory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwishtack%2Fmodsecurity-exception-factory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwishtack%2Fmodsecurity-exception-factory/lists"}