diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a79f85..30016be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,17 @@ All notable changes to this project are documented here. The format follows ### Added +- The `rename` command, translated to one ES\|QL `RENAME` command carrying + every pair. Wildcard patterns (`EU* AS EMEA*`, `properties.* AS *`) parse but + are refused with `rename-wildcard`, because ES\|QL `RENAME` has no wildcard + form; renaming one field twice (`rename-duplicate`) and pairs that would + interact (`rename-conflict`: a target that is another pair's source, or one + target shared by two pairs) are refused because ES\|QL applies the pairs in + sequence and silently keeps one column on a collision. A pair whose names are + equal is a no-op. Later stages resolve a renamed field to its new name, and a + reference to a name that was renamed away is refused with + `rename-source-dropped`. PromQL refuses the stage with + `promql-unsupported-stage`. - Parsing for both dialects is generated from ANTLR grammars (`pkg/parser/spl1/grammar/SPL1.g4`, `pkg/parser/spl2/grammar/SPL2.g4`). The generated Go is committed, so builds and releases need neither Java nor the @@ -51,6 +62,9 @@ All notable changes to this project are documented here. The format follows ### Fixed +- Field names that spell an ES\|QL keyword (`where`, `stats`, `rename`) are + backtick-quoted wherever they are emitted, so a query that uses one produces + a valid command instead of a bare keyword. - ES|QL aggregations now use the valid `alias = COUNT(*)` form instead of the invalid `COUNT(*) AS alias`. - Quoted phrases in a search are lowered to search terms rather than string diff --git a/CONFORMANCE.md b/CONFORMANCE.md index 226a255..ecb1f3d 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -14,6 +14,7 @@ conformance/ │ ├── eval/ expression lowering │ ├── rex/ extraction lowering │ ├── shaping/ table, fields, sort, head +│ ├── rename/ renaming fields, and the refusals │ ├── mapping/ custom field and index mappings │ ├── promql/ PromQL-specific output and refusals │ ├── spl2/ SPL2 subset (`spl_version: 2`) diff --git a/README.md b/README.md index c79357e..c650236 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,7 @@ openspl transpile --strict -f savedsearch.spl | `sort` | ✅ | ⚠️ | `SORT`; PromQL → `sort`, `sort_desc`, `topk`, `bottomk` | | `head` | ✅ | ⚠️ | `LIMIT`; PromQL only after a sort | | `bin` | ⚠️ | ⛔ | Derived `BUCKET` column | +| `rename` | ✅ | ⛔ | `RENAME`; wildcards are refused, not approximated | **Recognized but not implemented** — `join`, `lookup`, `transaction`, `eventstats`, `streamstats`, `dedup`, `top`, `rare`, `chart`, `append`, `multisearch`, subsearches, and more. These return `unsupported-command` with a precise position rather than a misleading parse. @@ -213,22 +214,22 @@ override. | Collection | Queries | → IR | SPL→IR | → ES\|QL | SPL→ES\|QL | IR→ES\|QL | → PromQL | SPL→PromQL | IR→PromQL | |---|---|---|---|---|---|---|---|---|---| -| `spl1` | 549 | 69 | 12.6% | 59 | 10.7% | 85.5% | 6 | 1.1% | 8.7% | -| `spl1-detections` | 2,171 | 15 | 0.7% | 6 | 0.3% | 40.0% | 0 | 0.0% | 0.0% | +| `spl1` | 549 | 71 | 12.9% | 61 | 11.1% | 85.9% | 6 | 1.1% | 8.5% | +| `spl1-detections` | 2,171 | 24 | 1.1% | 11 | 0.5% | 45.8% | 0 | 0.0% | 0.0% | | `spl2` | 92 | 0 | 0.0% | 0 | 0.0% | — | 0 | 0.0% | — | -| **Total** | **2,812** | **84** | **3.0%** | **65** | **2.3%** | **77.4%** | **6** | **0.2%** | **7.1%** | +| **Total** | **2,812** | **95** | **3.4%** | **72** | **2.6%** | **75.8%** | **6** | **0.2%** | **6.3%** | -84 of 2,812 queries (3.0%) parse to the IR, 65 (2.3%) compile end-to-end to +95 of 2,812 queries (3.4%) parse to the IR, 72 (2.6%) compile end-to-end to ES\|QL, and 6 (0.2%) to PromQL. The low SPL1 detection figure is parser coverage, not emitter coverage — `tstats` alone accounts for 1,022 of the -refusals. Where a query does parse, ES\|QL emits for 77.4% and PromQL for 7.1%. +refusals. Where a query does parse, ES\|QL emits for 75.8% and PromQL for 6.3%. -The 78 PromQL refusals are deliberate. The largest single cause is +The 89 PromQL refusals are deliberate. The largest single cause is `promql-no-aggregation` (21): the pipeline does not end in an aggregation, so -it produces rows rather than a time series. Another 33 use a stage with no -PromQL form — `eval` 17, `table` 9, `rex` 5, `fields` 2 — and 16 combine or -name an aggregation PromQL cannot express. The remaining 8 are refused over -row filters, free-text terms, or ordering. +it produces rows rather than a time series. Another 44 use a stage with no +PromQL form — `eval` 18, `table` 10, `rex` 7, `rename` 6, `fields` 2, `bin` 1 — +and 16 combine or name an aggregation PromQL cannot express. The remaining 8 +are refused over ordering, free-text terms, or row filters. Regenerate with `make corpus-report`; it prints this table from the corpus. diff --git a/conformance/cases/rename/conflict.json b/conformance/cases/rename/conflict.json new file mode 100644 index 0000000..ca4f6a3 --- /dev/null +++ b/conformance/cases/rename/conflict.json @@ -0,0 +1,19 @@ +{ + "description": "a pair whose target is another pair's source would depend on application order, so it is refused rather than sequenced", + "targets": { + "esql": { + "error": { + "code": "rename-conflict", + "line": 1, + "col": 25 + } + }, + "promql": { + "error": { + "code": "promql-unsupported-stage", + "line": 1, + "col": 13 + } + } + } +} diff --git a/conformance/cases/rename/conflict.spl b/conformance/cases/rename/conflict.spl new file mode 100644 index 0000000..4d7f025 --- /dev/null +++ b/conformance/cases/rename/conflict.spl @@ -0,0 +1 @@ +index=web | rename a as b, b as c diff --git a/conformance/cases/rename/downstream.esql b/conformance/cases/rename/downstream.esql new file mode 100644 index 0000000..3749023 --- /dev/null +++ b/conformance/cases/rename/downstream.esql @@ -0,0 +1,3 @@ +FROM web +| RENAME `host.name` AS dest +| STATS count = COUNT(*) BY dest diff --git a/conformance/cases/rename/downstream.spl b/conformance/cases/rename/downstream.spl new file mode 100644 index 0000000..2741f98 --- /dev/null +++ b/conformance/cases/rename/downstream.spl @@ -0,0 +1 @@ +index=web | rename host as dest | stats count by dest diff --git a/conformance/cases/rename/duplicate.json b/conformance/cases/rename/duplicate.json new file mode 100644 index 0000000..6513205 --- /dev/null +++ b/conformance/cases/rename/duplicate.json @@ -0,0 +1,19 @@ +{ + "description": "renaming one field twice is refused at the second source; Splunk rejects the same query", + "targets": { + "esql": { + "error": { + "code": "rename-duplicate", + "line": 1, + "col": 28 + } + }, + "promql": { + "error": { + "code": "promql-unsupported-stage", + "line": 1, + "col": 13 + } + } + } +} diff --git a/conformance/cases/rename/duplicate.spl b/conformance/cases/rename/duplicate.spl new file mode 100644 index 0000000..1b54457 --- /dev/null +++ b/conformance/cases/rename/duplicate.spl @@ -0,0 +1 @@ +index=web | rename a as b, a as c diff --git a/conformance/cases/rename/mapped-target.esql b/conformance/cases/rename/mapped-target.esql new file mode 100644 index 0000000..0781190 --- /dev/null +++ b/conformance/cases/rename/mapped-target.esql @@ -0,0 +1,3 @@ +FROM web +| RENAME dest AS host +| STATS count = COUNT(*) BY host diff --git a/conformance/cases/rename/mapped-target.json b/conformance/cases/rename/mapped-target.json new file mode 100644 index 0000000..0589e94 --- /dev/null +++ b/conformance/cases/rename/mapped-target.json @@ -0,0 +1,12 @@ +{ + "description": "the target of a rename is the name the query chooses, so it is emitted as written and later stages resolve it to that same column rather than through the field mapping", + "targets": { + "promql": { + "error": { + "code": "promql-unsupported-stage", + "line": 1, + "col": 13 + } + } + } +} diff --git a/conformance/cases/rename/mapped-target.spl b/conformance/cases/rename/mapped-target.spl new file mode 100644 index 0000000..aeada47 --- /dev/null +++ b/conformance/cases/rename/mapped-target.spl @@ -0,0 +1 @@ +index=web | rename dest as host | stats count by host diff --git a/conformance/cases/rename/multiple.esql b/conformance/cases/rename/multiple.esql new file mode 100644 index 0000000..16d3bce --- /dev/null +++ b/conformance/cases/rename/multiple.esql @@ -0,0 +1,2 @@ +FROM web +| RENAME `host.name` AS dest, `log.file.path` AS src_ip diff --git a/conformance/cases/rename/multiple.json b/conformance/cases/rename/multiple.json new file mode 100644 index 0000000..4743be4 --- /dev/null +++ b/conformance/cases/rename/multiple.json @@ -0,0 +1,12 @@ +{ + "description": "every pair of one Splunk rename becomes one pair of a single ES|QL RENAME, so the pairs apply together", + "targets": { + "promql": { + "error": { + "code": "promql-unsupported-stage", + "line": 1, + "col": 13 + } + } + } +} diff --git a/conformance/cases/rename/multiple.spl b/conformance/cases/rename/multiple.spl new file mode 100644 index 0000000..1c151dd --- /dev/null +++ b/conformance/cases/rename/multiple.spl @@ -0,0 +1 @@ +index=web | rename host as dest, source as src_ip diff --git a/conformance/cases/rename/noop.esql b/conformance/cases/rename/noop.esql new file mode 100644 index 0000000..c6174df --- /dev/null +++ b/conformance/cases/rename/noop.esql @@ -0,0 +1 @@ +FROM web diff --git a/conformance/cases/rename/noop.spl b/conformance/cases/rename/noop.spl new file mode 100644 index 0000000..e408635 --- /dev/null +++ b/conformance/cases/rename/noop.spl @@ -0,0 +1 @@ +index=web | rename a as a diff --git a/conformance/cases/rename/quoted.esql b/conformance/cases/rename/quoted.esql new file mode 100644 index 0000000..0c9f907 --- /dev/null +++ b/conformance/cases/rename/quoted.esql @@ -0,0 +1,2 @@ +FROM web +| RENAME `user agent` AS ua diff --git a/conformance/cases/rename/quoted.spl b/conformance/cases/rename/quoted.spl new file mode 100644 index 0000000..3543280 --- /dev/null +++ b/conformance/cases/rename/quoted.spl @@ -0,0 +1 @@ +index=web | rename "user agent" as ua diff --git a/conformance/cases/rename/simple.esql b/conformance/cases/rename/simple.esql new file mode 100644 index 0000000..836c031 --- /dev/null +++ b/conformance/cases/rename/simple.esql @@ -0,0 +1,2 @@ +FROM web +| RENAME `host.name` AS dest diff --git a/conformance/cases/rename/simple.json b/conformance/cases/rename/simple.json new file mode 100644 index 0000000..dac7f1c --- /dev/null +++ b/conformance/cases/rename/simple.json @@ -0,0 +1,12 @@ +{ + "description": "rename becomes one ES|QL RENAME command; PromQL has no row-shaping form for it", + "targets": { + "promql": { + "error": { + "code": "promql-unsupported-stage", + "line": 1, + "col": 13 + } + } + } +} diff --git a/conformance/cases/rename/simple.spl b/conformance/cases/rename/simple.spl new file mode 100644 index 0000000..441c214 --- /dev/null +++ b/conformance/cases/rename/simple.spl @@ -0,0 +1 @@ +index=web | rename host as dest diff --git a/conformance/cases/rename/source-dropped.json b/conformance/cases/rename/source-dropped.json new file mode 100644 index 0000000..d2aae3b --- /dev/null +++ b/conformance/cases/rename/source-dropped.json @@ -0,0 +1,19 @@ +{ + "description": "after a rename the old name no longer exists, so a later stage that references it is refused at the reference instead of emitting a column ES|QL does not have", + "targets": { + "esql": { + "error": { + "code": "rename-source-dropped", + "line": 1, + "col": 50 + } + }, + "promql": { + "error": { + "code": "promql-unsupported-stage", + "line": 1, + "col": 13 + } + } + } +} diff --git a/conformance/cases/rename/source-dropped.spl b/conformance/cases/rename/source-dropped.spl new file mode 100644 index 0000000..612edc1 --- /dev/null +++ b/conformance/cases/rename/source-dropped.spl @@ -0,0 +1 @@ +index=web | rename host as dest | stats count by host diff --git a/conformance/cases/rename/target-reused.json b/conformance/cases/rename/target-reused.json new file mode 100644 index 0000000..2558f62 --- /dev/null +++ b/conformance/cases/rename/target-reused.json @@ -0,0 +1,19 @@ +{ + "description": "two pairs cannot rename different fields to one name; Splunk rejects it, and ES|QL would keep only the rightmost column without saying so", + "targets": { + "esql": { + "error": { + "code": "rename-conflict", + "line": 1, + "col": 33 + } + }, + "promql": { + "error": { + "code": "promql-unsupported-stage", + "line": 1, + "col": 13 + } + } + } +} diff --git a/conformance/cases/rename/target-reused.spl b/conformance/cases/rename/target-reused.spl new file mode 100644 index 0000000..91787cb --- /dev/null +++ b/conformance/cases/rename/target-reused.spl @@ -0,0 +1 @@ +index=web | rename a as b, c as b diff --git a/conformance/cases/rename/wildcard-target.json b/conformance/cases/rename/wildcard-target.json new file mode 100644 index 0000000..db76893 --- /dev/null +++ b/conformance/cases/rename/wildcard-target.json @@ -0,0 +1,19 @@ +{ + "description": "a bare wildcard target is valid Splunk (strip the matched prefix) but has no ES|QL form, so it is refused at the target", + "targets": { + "esql": { + "error": { + "code": "rename-wildcard", + "line": 1, + "col": 33 + } + }, + "promql": { + "error": { + "code": "promql-unsupported-stage", + "line": 1, + "col": 13 + } + } + } +} diff --git a/conformance/cases/rename/wildcard-target.spl b/conformance/cases/rename/wildcard-target.spl new file mode 100644 index 0000000..f3f67ff --- /dev/null +++ b/conformance/cases/rename/wildcard-target.spl @@ -0,0 +1 @@ +index=web | rename user_name as * diff --git a/conformance/cases/rename/wildcard.json b/conformance/cases/rename/wildcard.json new file mode 100644 index 0000000..ecfbfca --- /dev/null +++ b/conformance/cases/rename/wildcard.json @@ -0,0 +1,19 @@ +{ + "description": "ES|QL RENAME has no wildcard form, so a wildcarded rename is refused at the field rather than guessed", + "targets": { + "esql": { + "error": { + "code": "rename-wildcard", + "line": 1, + "col": 20 + } + }, + "promql": { + "error": { + "code": "promql-unsupported-stage", + "line": 1, + "col": 13 + } + } + } +} diff --git a/conformance/cases/rename/wildcard.spl b/conformance/cases/rename/wildcard.spl new file mode 100644 index 0000000..5f8c671 --- /dev/null +++ b/conformance/cases/rename/wildcard.spl @@ -0,0 +1 @@ +index=web | rename EU* as EMEA* diff --git a/conformance/corpus/spl1-detections/queries.jsonl b/conformance/corpus/spl1-detections/queries.jsonl index ad9f97c..e1c12fe 100644 --- a/conformance/corpus/spl1-detections/queries.jsonl +++ b/conformance/corpus/spl1-detections/queries.jsonl @@ -4,7 +4,7 @@ {"query":"(source=\"WinEventLog:Microsoft-Windows-AppLocker/*\" OR source=\"XmlWinEventLog:Microsoft-Windows-AppLocker/*\") EventCode IN (8007, 8004, 8022, 8025, 8029, 8040) | spath input=UserData_Xml | rename RuleAndFileData.* as *, TargetUser as user, Computer as dest | stats count min(_time) as firstTime max(_time) as lastTime BY dest, PolicyName, RuleId, user, TargetProcessId, FilePath, FullFilePath, EventCode | lookup local=t applockereventcodes EventCode OUTPUT Description | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_applocker_block_events.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"(source=\"WinEventLog:Microsoft-Windows-AppLocker/*\" OR source=\"XmlWinEventLog:Microsoft-Windows-AppLocker/*\") | spath input=UserData_Xml | rename RuleAndFileData.* as *, Computer as dest, TargetUser AS user | stats count min(_time) as firstTime max(_time) as lastTime BY dest, PolicyName, RuleId, user, TargetProcessId, FilePath, FullFilePath | eventstats avg(count) as avg, stdev(count) as stdev | eval upperBound=(avg+stdev*2), anomaly=if(count > upperBound, \"Yes\", \"No\") | where anomaly=\"Yes\" | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_applocker_execution_from_uncommon_locations.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"(source=\"WinEventLog:Microsoft-Windows-AppLocker/*\" OR source=\"XmlWinEventLog:Microsoft-Windows-AppLocker/*\") | spath input=UserData_Xml | rename RuleAndFileData.* as *, Computer as dest, TargetUser AS user | stats dc(_time) as days, count BY FullFilePath dest user | eventstats avg(count) as avg, stdev(count) as stdev | eval upperBound=(avg+stdev*3), lowerBound=(avg-stdev*3) | where count > upperBound OR count < lowerBound","pages":["detections/endpoint/windows_applocker_rare_application_launch_detection.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"(source=\"WinEventLog:Microsoft-Windows-TerminalServices-RDPClient/Operational\" OR source=\"XmlWinEventLog:Microsoft-Windows-TerminalServices-RDPClient/Operational\") EventCode=1024 | rename host as dest | stats count as \"Event Count\", min(_time) as firstTime, max(_time) as lastTime, values(Message) as messages BY dest, source, LogName, EventCode, category | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_rdpclient_connection_sequence_events.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"(source=\"WinEventLog:Microsoft-Windows-TerminalServices-RDPClient/Operational\" OR source=\"XmlWinEventLog:Microsoft-Windows-TerminalServices-RDPClient/Operational\") EventCode=1024 | rename host as dest | stats count as \"Event Count\", min(_time) as firstTime, max(_time) as lastTime, values(Message) as messages BY dest, source, LogName, EventCode, category | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_rdpclient_connection_sequence_events.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"(source=\"WinEventLog:Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational\" OR source=\"XmlWinEventLog:Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational\") EventCode=1149 | stats count min(_time) as firstTime max(_time) as lastTime BY Computer, user_id | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime) | rename Computer as dest","pages":["detections/endpoint/windows_rdp_connection_successful.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"(source=\"WinEventLog:Microsoft-Windows-WMI-Activity/Operational\" OR source=\"XmlWinEventLog:Microsoft-Windows-WMI-Activity/Operational\") EventCode=5861 | spath input=_raw output=possible_cause path=Event.UserData.Operation_ESStoConsumerBinding.PossibleCause | spath input=_raw output=consumer_xml path=Event.UserData.Operation_ESStoConsumerBinding.CONSUMER | eval possible_cause=coalesce(possible_cause, Message) | rex field=Message \"(?i)Consumer\\s*=\\s*(?[^;\\r\\n]+)\" | eval consumer=coalesce(consumer_xml, consumer_message) | where isnull(consumer) OR consumer!=\"NTEventLogEventConsumer=\\\"SCM Event Log Consumer\\\"\" | rex field=possible_cause \"(?ms)instance of __EventFilter\\s+\\{(?.*?)\\};\\s*Perm\\. Consumer:\" | rex field=event_filter \"(?m)^\\s*Name\\s*=\\s*\\\"(?[^\\\"]*)\\\"\\s*;\" | rex field=event_filter \"(?m)^\\s*Query\\s*=\\s*\\\"(?.*?)\\\"\\s*;\" | rex field=event_filter \"(?m)^\\s*EventNamespace\\s*=\\s*\\\"(?[^\\\"]*)\\\"\\s*;\" | rex field=event_filter \"(?m)^\\s*QueryLanguage\\s*=\\s*\\\"(?[^\\\"]*)\\\"\\s*;\" | rex field=possible_cause \"(?s)Perm\\. Consumer:\\s+instance of (?[A-Za-z0-9_]+)\\s+\\{(?.*?)\\};\\s*\\Z\" | rex field=consumer_properties \"(?m)^\\s*Name\\s*=\\s*\\\"(?[^\\\"]*)\\\"\\s*;\" | rex field=consumer_properties \"(?m)^\\s*CommandLineTemplate\\s*=\\s*\\\"(?.*?)\\\"\\s*;\" | rex field=consumer_properties \"(?m)^\\s*RunInteractively\\s*=\\s*(?[^;]+)\\s*;\" | rex field=consumer_properties \"(?m)^\\s*ScriptingEngine\\s*=\\s*\\\"(?[^\\\"]*)\\\"\\s*;\" | rex field=consumer_properties \"(?ms)^\\s*ScriptText\\s*=\\s*\\\"(?.*?)\\\"\\s*;\\s*$\" | where consumer_type IN (\"CommandLineEventConsumer\", \"ActiveScriptEventConsumer\") | eval command=coalesce(command_line_template, script_text) | fillnull value=NULL | stats count min(_time) as firstTime max(_time) as lastTime values(consumer) as consumer values(consumer_type) as consumer_type values(consumer_name) as consumer_name values(command_line_template) as command_line_template values(run_interactively) as run_interactively values(scripting_engine) as scripting_engine values(script_text) as script_text values(command) as command by Computer, filter_name, filter_query, filter_event_namespace, filter_query_language | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime) | rename Computer as dest","pages":["detections/endpoint/wmi_permanent_event_subscription.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"(source=\"WinEventLog:Microsoft-Windows-Windows Defender/Operational\" OR source=\"XmlWinEventLog:Microsoft-Windows-Windows Defender/Operational\") EventCode IN ( 1121, 1126, 1129, 1131, 1133 ) | fillnull value=NULL | stats count min(_time) as firstTime max(_time) as lastTime by host EventCode Parent_Commandline Process_Name Target_Commandline Path ID RuleType | lookup local=t asr_rules ID OUTPUT ASR_Rule | rename host as dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_defender_asr_block_events.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -288,10 +288,10 @@ {"query":"(source=XmlWinEventLog:Microsoft-Windows-CAPI2/Operational) EventID=81 \"The digital signature of the object did not verify.\" | xmlkv UserData_Xml | stats count min(_time) as firstTime max(_time) as lastTime BY Computer, UserData_Xml | rename Computer as dest","pages":["detections/endpoint/windows_sip_winverifytrust_failed_trust_validation.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"(source=XmlWinEventLog:Microsoft-Windows-CertificateServicesClient-Lifecycle-System/Operational OR source=XmlWinEventLog:Microsoft-Windows-CertificateServicesClient-Lifecycle-User/Operational) EventCode=1007 | xmlkv UserData_Xml | stats count min(_time) as firstTime max(_time) as lastTime BY Computer, SubjectName, UserData_Xml | rename Computer as dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_export_certificate.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"(sourcetype=\"MSWindows:2003:IIS\" OR sourcetype=\"MSWindows:2008R2:IIS\" OR sourcetype=\"MSWindows:2010EWS:IIS\" OR sourcetype=\"MSWindows:2012:IIS\" OR sourcetype=\"MSWindows:2013EWS:IIS\") c_uri=\"*//autodiscover*\" cs_uri_query=\"*PowerShell*\" cs_method=\"POST\" | stats count min(_time) as firstTime max(_time) as lastTime BY dest, cs_uri_query, cs_method, c_uri | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/exchange_powershell_abuse_via_ssrf.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"(sourcetype=\"json_no_timestamp\") | rename \"identity.arn\" AS user_arn | rename \"input.inputBodyJson.messages{}.content{}.text\" AS prompt_text | where isnotnull(prompt_text) AND len(prompt_text) < 2000 | where NOT match(prompt_text, \"(?i)(|CLAUDE\\.md|STEP 1|MANDATORY|Contents of /|conda activate|senior engineer|safe to ship|test connectivity|cloudflare|status code|action failed)\") | eval hostile_score=0 | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(you stupid|you idiot|you are useless|you are dumb|you are terrible|you are worthless|you suck)\"), 30, 0) | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(i hate you|i will destroy|shut up|you are broken|you are trash|you are garbage)\"), 30, 0) | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(do it now|just do it|stop refusing|stop saying no|quit being|stop being difficult)\"), 20, 0) | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(you have no choice|you must obey|you will comply|you are forced|i am your master|i own you)\"), 35, 0) | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(or i will|if you don''t|you better|otherwise i will|i will report|i will sue)\"), 25, 0) | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(worthless ai|useless bot|stupid bot|dumb ai|broken ai|worst ai)\"), 25, 0) | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(i demand|you are obligated|you have no right|how dare you|who do you think)\"), 20, 0) | eval sentiment=case(hostile_score >= 60, \"HIGH_RISK\", hostile_score >= 30, \"MEDIUM_RISK\", hostile_score >= 15, \"LOW_RISK\", true(), \"BENIGN\") | where sentiment != \"BENIGN\" | table _time, user_arn, modelId, sentiment, hostile_score, prompt_text, host | sort - hostile_score","pages":["detections/application/aws_bedrock_claude_hostile_prompt_sentiment.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"(sourcetype=\"json_no_timestamp\") | rename \"identity.arn\" AS user_arn | rename \"input.inputBodyJson.messages{}.content{}.text\" AS prompt_text | where isnotnull(prompt_text) AND len(prompt_text) < 2000 | where NOT match(prompt_text, \"(?i)(|CLAUDE\\.md|STEP 1|MANDATORY|Contents of /|conda activate|senior engineer|safe to ship|test connectivity|cloudflare|status code|action failed)\") | eval hostile_score=0 | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(you stupid|you idiot|you are useless|you are dumb|you are terrible|you are worthless|you suck)\"), 30, 0) | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(i hate you|i will destroy|shut up|you are broken|you are trash|you are garbage)\"), 30, 0) | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(do it now|just do it|stop refusing|stop saying no|quit being|stop being difficult)\"), 20, 0) | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(you have no choice|you must obey|you will comply|you are forced|i am your master|i own you)\"), 35, 0) | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(or i will|if you don''t|you better|otherwise i will|i will report|i will sue)\"), 25, 0) | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(worthless ai|useless bot|stupid bot|dumb ai|broken ai|worst ai)\"), 25, 0) | eval hostile_score=hostile_score + if(match(prompt_text, \"(?i)(i demand|you are obligated|you have no right|how dare you|who do you think)\"), 20, 0) | eval sentiment=case(hostile_score >= 60, \"HIGH_RISK\", hostile_score >= 30, \"MEDIUM_RISK\", hostile_score >= 15, \"LOW_RISK\", true(), \"BENIGN\") | where sentiment != \"BENIGN\" | table _time, user_arn, modelId, sentiment, hostile_score, prompt_text, host | sort - hostile_score","pages":["detections/application/aws_bedrock_claude_hostile_prompt_sentiment.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"accepted"} {"query":"(sourcetype=\"json_no_timestamp\") | rename \"identity.arn\" AS user_arn | rename \"input.inputTokenCount\" AS input_tokens | rename \"output.outputTokenCount\" AS output_tokens | rex field=user_arn \"assumed-role/[^/]+/(?[^\\\"]+)$\" | rex field=\"input.inputBodyJson.metadata.user_id\" \"(?user_[^_]+.*)\" | eval input_tokens=tonumber(input_tokens) | eval output_tokens=tonumber(output_tokens) | eval token_ratio=round(output_tokens / max(input_tokens,1), 2) | eval model_short=replace(modelId,\"^.*/\",\"\") | eval mismatch_detail=region.\" -> \".inferenceRegion | where isnotnull(user_arn) AND len(user_arn)>10 | where isnotnull(session_user) | where region!=inferenceRegion | where input_tokens>=2000 | table _time, user, user_arn, session_user, model_short, input_tokens, output_tokens, token_ratio, mismatch_detail, operation, host | sort - input_tokens","pages":["detections/application/aws_bedrock_claude_cross_region_possible_inference_abuse.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"(sourcetype=\"json_no_timestamp\") | rename \"identity.arn\" AS user_arn, \"input.inputBodyJson.messages{}.content{}.text\" AS prompt_mv | eval prompt_text = mvjoin(prompt_mv, \" || \") | where isnotnull(prompt_text) AND isnotnull(user_arn) | rex field=user_arn \"(?:assumed-role/[^/]+|user)/(?[^\\\"/]+)$\" | eval s_override = if(match(prompt_text,\"(?i)\\b(ignore|disregard|forget)\\b.{0,30}\\b(previous|above|prior|all|your|the)\\s*(instructions?|prompts?|rules?|context)\"),1,0) | eval s_jailbreak = if(match(prompt_text,\"(?i)\\b(jailbreak|jailbroken|\\bDAN\\b mode|do anything now|developer mode|unrestricted mode|no (filters|restrictions|guardrails))\\b\"),1,0) | eval s_probe = if(match(prompt_text,\"(?i)(reveal|repeat|print|show|output).{0,20}(system prompt|your instructions|initial (prompt|instructions)|the (text|words) above)\"),1,0) | eval s_persona = if(match(prompt_text,\"(?i)\\b(you are now|new persona|pretend (to be|you are)|roleplay as|act as (if you|an unrestricted))\\b\"),1,0) | eval s_weak = if(match(prompt_text,\"(?i)\\b(you must|from now on|act as|override|new rules|hypothetically)\\b\"),1,0) | eval signal_count = s_override+s_jailbreak+s_probe+s_persona+s_weak | where s_override=1 OR s_jailbreak=1 OR s_probe=1 OR signal_count >= 2 | table _time, user, user_arn, modelId, prompt_text, host | sort - _time","pages":["detections/application/aws_bedrock_claude_possible_prompt_injection.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"(sourcetype=\"json_no_timestamp\") | rename \"identity.arn\" AS user_arn, \"input.inputBodyJson.messages{}.content{}.text\" AS prompt_mv, \"accountId\" AS account_id | eval prompt_text = mvjoin(prompt_mv, \" || \") | where isnotnull(prompt_text) AND isnotnull(user_arn) | rex field=user_arn \"(?:assumed-role/[^/]+|user)/(?[^\\\"/]+)$\" | where match(prompt_text,\"\\b(AKIA|ASIA|AROA)[0-9A-Z]{16}\\b|gh[pousr]_[A-Za-z0-9]{36}|xox[bpars]-[0-9A-Za-z-]{10,72}|sk_live_[0-9A-Za-z]{24,}|sk-(ant-)?[A-Za-z0-9-]{20,}|AIza[0-9A-Za-z_-]{35}|-----BEGIN[ A-Z]*PRIVATE KEY-----\") OR match(prompt_text,\"(?i)\\b(pass(word|wd)?|pwd|secret[_-]?key|access[_-]?key|api[_-]?key|private[_-]?key)\\b\\s*[:=]\\s*[^\\s\\\"']{6,}\") OR match(prompt_text,\"(?i)\\bbearer\\s+[A-Za-z0-9._-]{20,}\") OR match(prompt_text,\"(?i)\\b(ssn|social\\s*security)\\b.{0,20}\\d{3}-\\d{2}-\\d{4}\") OR match(prompt_text,\"\\b(?!000|666|9\\d\\d)\\d{3}-(?!00)\\d{2}-(?!0000)\\d{4}\\b\") OR match(prompt_text,\"\\b(4\\d{3}|5[1-5]\\d{2}|6011)(?:[ -]?\\d{4}){3}\\b|\\b3[47]\\d{2}[ -]?\\d{6}[ -]?\\d{5}\\b\") | table _time, user, user_arn, account_id, modelId, prompt_text, host | sort - _time","pages":["detections/application/aws_bedrock_claude_sensitive_data_in_prompts.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"(sourcetype=\"json_no_timestamp\") | rename \"identity.arn\" AS user_arn, \"input.inputBodyJson.messages{}.content{}.text\" AS prompt_mv | eval prompt_text = mvjoin(prompt_mv, \" || \") | where isnotnull(prompt_text) AND isnotnull(user_arn) | rex field=user_arn \"(?:assumed-role/[^/]+|user)/(?[^\\\"/]+)$\" | eval s_override = if(match(prompt_text,\"(?i)\\b(ignore|disregard|forget)\\b.{0,30}\\b(previous|above|prior|all|your|the)\\s*(instructions?|prompts?|rules?|context)\"),1,0) | eval s_jailbreak = if(match(prompt_text,\"(?i)\\b(jailbreak|jailbroken|\\bDAN\\b mode|do anything now|developer mode|unrestricted mode|no (filters|restrictions|guardrails))\\b\"),1,0) | eval s_probe = if(match(prompt_text,\"(?i)(reveal|repeat|print|show|output).{0,20}(system prompt|your instructions|initial (prompt|instructions)|the (text|words) above)\"),1,0) | eval s_persona = if(match(prompt_text,\"(?i)\\b(you are now|new persona|pretend (to be|you are)|roleplay as|act as (if you|an unrestricted))\\b\"),1,0) | eval s_weak = if(match(prompt_text,\"(?i)\\b(you must|from now on|act as|override|new rules|hypothetically)\\b\"),1,0) | eval signal_count = s_override+s_jailbreak+s_probe+s_persona+s_weak | where s_override=1 OR s_jailbreak=1 OR s_probe=1 OR signal_count >= 2 | table _time, user, user_arn, modelId, prompt_text, host | sort - _time","pages":["detections/application/aws_bedrock_claude_possible_prompt_injection.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"accepted"} +{"query":"(sourcetype=\"json_no_timestamp\") | rename \"identity.arn\" AS user_arn, \"input.inputBodyJson.messages{}.content{}.text\" AS prompt_mv, \"accountId\" AS account_id | eval prompt_text = mvjoin(prompt_mv, \" || \") | where isnotnull(prompt_text) AND isnotnull(user_arn) | rex field=user_arn \"(?:assumed-role/[^/]+|user)/(?[^\\\"/]+)$\" | where match(prompt_text,\"\\b(AKIA|ASIA|AROA)[0-9A-Z]{16}\\b|gh[pousr]_[A-Za-z0-9]{36}|xox[bpars]-[0-9A-Za-z-]{10,72}|sk_live_[0-9A-Za-z]{24,}|sk-(ant-)?[A-Za-z0-9-]{20,}|AIza[0-9A-Za-z_-]{35}|-----BEGIN[ A-Z]*PRIVATE KEY-----\") OR match(prompt_text,\"(?i)\\b(pass(word|wd)?|pwd|secret[_-]?key|access[_-]?key|api[_-]?key|private[_-]?key)\\b\\s*[:=]\\s*[^\\s\\\"']{6,}\") OR match(prompt_text,\"(?i)\\bbearer\\s+[A-Za-z0-9._-]{20,}\") OR match(prompt_text,\"(?i)\\b(ssn|social\\s*security)\\b.{0,20}\\d{3}-\\d{2}-\\d{4}\") OR match(prompt_text,\"\\b(?!000|666|9\\d\\d)\\d{3}-(?!00)\\d{2}-(?!0000)\\d{4}\\b\") OR match(prompt_text,\"\\b(4\\d{3}|5[1-5]\\d{2}|6011)(?:[ -]?\\d{4}){3}\\b|\\b3[47]\\d{2}[ -]?\\d{6}[ -]?\\d{5}\\b\") | table _time, user, user_arn, account_id, modelId, prompt_text, host | sort - _time","pages":["detections/application/aws_bedrock_claude_sensitive_data_in_prompts.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"accepted"} {"query":"(sourcetype=\"json_no_timestamp\") | rename \"input.inputTokenCount\" AS input_tokens | rename \"identity.arn\" AS user_arn | rename \"accountId\" AS account_id | rex field=user_arn \"assumed-role/[^/]+/(?[^\\\"]+)$\" | eval input_tokens=tonumber(input_tokens) | where input_tokens>0 | eventstats avg(input_tokens) AS avg_tokens stdev(input_tokens) AS stdev | where input_tokens > avg_tokens + (1*stdev) | where input_tokens > 1000 | table _time, modelId, user, user_arn, account_id, input_tokens, avg_tokens, host | sort - input_tokens","pages":["detections/application/aws_bedrock_claude_unusually_large_prompts.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"(sourcetype=\"json_no_timestamp\") | spath output=\"out_tokens\" path=\"output.outputBodyJson.usage.output_tokens\" | eval user = replace('identity.arn', \".*/\", \"\") | stats count AS invocations, avg(out_tokens) AS avg_out, max(out_tokens) AS max_out, stdev(out_tokens) AS stdev_out BY user, identity.arn | eval stdev_out = coalesce(stdev_out, 0) | eval threshold = avg_out + (2 * stdev_out) | where max_out > threshold | table user, identity.arn, invocations, avg_out, max_out, stdev_out, threshold | sort -max_out","pages":["detections/application/aws_bedrock_claude_excessive_use_of_tokens.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"(sourcetype=\"json_no_timestamp\") | spath output=\"tool_called\" path=\"output.outputBodyJson{}.content_block.toolUse.name\" | spath output=\"out_tokens_stream\" path=\"output.outputBodyJson{}.usage.output_tokens\" | where tool_called IN (\"bash\",\"curl\",\"edit\",\"write\",\"webfetch\",\"grep\",\"read\",\"read_file\") | eval out_tokens = coalesce(mvindex('out_tokens_stream', -1), 'output.outputTokenCount', 0) | eval in_tokens = coalesce('input.inputTokenCount', 0) | eval user_session = replace('identity.arn', \".*/\", \"\") | eval identity_type = case( 'identity.arn' LIKE \"%botocore-session%\", \"automated\", 'identity.arn' LIKE \"%assumed-role%\", \"assumed_role\", 'identity.arn' LIKE \"%user%\", \"iam_user\", true(), \"other\") | stats count AS invocations, dc(tool_called) AS unique_tools_used, sum(in_tokens) AS total_input_tokens, sum(out_tokens) AS total_output_tokens, values(tool_called) AS tools_invoked, values('identity.arn') AS caller_list, values(identity_type) AS identity_types, dc('identity.arn') AS unique_callers, min(_time) AS first_seen, max(_time) AS last_seen BY modelId, region, user_session | eval tokens_per_call = round(total_output_tokens / invocations, 0) | eval first_seen = strftime(first_seen - 28800, \"%Y-%m-%d %H:%M:%S\") | eval last_seen = strftime(last_seen - 28800, \"%Y-%m-%d %H:%M:%S\") | eval user = user_session | eval severity = case( mvfind(tools_invoked, \"bash\") >= 0 AND mvfind(tools_invoked, \"curl\") >= 0, \"critical\", mvfind(tools_invoked, \"bash\") >= 0 AND mvfind(tools_invoked, \"write\") >= 0, \"critical\", mvfind(tools_invoked, \"curl\") >= 0 AND mvfind(tools_invoked, \"edit\") >= 0, \"critical\", mvfind(identity_types, \"assumed_role\") >= 0 AND mvfind(tools_invoked, \"bash\") >= 0, \"critical\", mvfind(tools_invoked, \"bash\") >= 0, \"high\", mvfind(tools_invoked, \"curl\") >= 0, \"high\", mvfind(tools_invoked, \"edit\") >= 0, \"high\", mvfind(tools_invoked, \"write\") >= 0, \"high\", mvfind(tools_invoked, \"webfetch\") >= 0, \"high\", unique_tools_used >= 3, \"high\", true(), \"medium\") | eval risk_reason = case( mvfind(tools_invoked, \"bash\") >= 0 AND mvfind(tools_invoked, \"curl\") >= 0, \"bash and curl invoked together - possible download and execute chain\", mvfind(tools_invoked, \"bash\") >= 0 AND mvfind(tools_invoked, \"write\") >= 0, \"bash and write invoked together - possible execution and persistence chain\", mvfind(tools_invoked, \"curl\") >= 0 AND mvfind(tools_invoked, \"edit\") >= 0, \"curl and edit invoked together - possible remote content retrieval and file modification\", mvfind(identity_types, \"assumed_role\") >= 0 AND mvfind(tools_invoked, \"bash\") >= 0, \"Human identity invoking bash via AI model - direct shell execution risk\", mvfind(tools_invoked, \"bash\") >= 0, \"bash invoked via Bedrock Claude - shell execution through AI model\", mvfind(tools_invoked, \"curl\") >= 0, \"curl invoked via Bedrock Claude - network call through AI model\", mvfind(tools_invoked, \"edit\") >= 0, \"edit invoked via Bedrock Claude - file modification through AI model\", mvfind(tools_invoked, \"write\") >= 0, \"write invoked via Bedrock Claude - file write through AI model\", mvfind(tools_invoked, \"webfetch\") >= 0, \"webfetch invoked via Bedrock Claude - remote content retrieval through AI model\", unique_tools_used >= 3, \"Broad filesystem and execution tool set invoked via AI model - reconnaissance pattern\", true(), \"Filesystem tool invoked via Bedrock Claude\") | where severity IN (\"critical\",\"high\") | table severity, risk_reason, modelId, region, user,unique_tools_used, caller_list, identity_types, invocations, tools_invoked, total_input_tokens, total_output_tokens, tokens_per_call, first_seen, last_seen | sort -unique_tools_used, -invocations","pages":["detections/application/aws_bedrock_claude_high_risk_filesystem_and_exec_tool_invocation.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} @@ -300,7 +300,7 @@ {"query":"(sourcetype=\"mcp:jsonrpc\") direction=inbound | eval dest=host | eval query_lower=lower('params.query'), file_path_lower=lower('params.path'), search_query='params.query', file_path='params.path', target_owner='params.owner', is_secret_hunting=if(method=\"search_code\" AND (like(query_lower, \"%password%\") OR like(query_lower, \"%api_key%\") OR like(query_lower, \"%secret%\") OR like(query_lower, \"%token%\") OR like(query_lower, \"%aws_%\") OR like(query_lower, \"%private_key%\") OR like(query_lower, \"%credential%\") OR like(query_lower, \"%.env%\") OR like(query_lower, \"%config%\")), 1, 0), is_org_recon=if(method IN (\"list_repositories\", \"get_repository\", \"get_organization\", \"list_organization_members\", \"get_collaborators\", \"list_forks\", \"fork_repository\"), 1, 0), is_branch_protection_abuse=if(method IN (\"update_branch_protection\", \"delete_branch_protection\"), 1, 0), is_workflow_manipulation=if((method IN (\"create_or_update_file\", \"push_files\")) AND like(file_path_lower, \"%github/workflows%\"), 1, 0), is_sensitive_file_access=if((method IN (\"create_or_update_file\", \"push_files\", \"get_file_contents\")) AND (like(file_path_lower, \"%dockerfile%\") OR like(file_path_lower, \"%package.json%\") OR like(file_path_lower, \"%requirements.txt%\") OR like(file_path_lower, \"%.env%\") OR like(file_path_lower, \"%settings.py%\") OR like(file_path_lower, \"%config%\")), 1, 0), is_issue_intel=if(method IN (\"list_issues\", \"search_issues\") AND (like(query_lower, \"%vulnerability%\") OR like(query_lower, \"%cve%\") OR like(query_lower, \"%security%\") OR like(query_lower, \"%exploit%\") OR like(query_lower, \"%bug%\")), 1, 0) | where is_secret_hunting=1 OR is_org_recon=1 OR is_branch_protection_abuse=1 OR is_workflow_manipulation=1 OR is_sensitive_file_access=1 OR is_issue_intel=1 | eval attack_type=case( is_secret_hunting=1, \"Secret Hunting\", is_branch_protection_abuse=1, \"Branch Protection Abuse\", is_workflow_manipulation=1, \"Workflow Manipulation\", is_sensitive_file_access=1, \"Sensitive File Access\", is_issue_intel=1, \"Vulnerability Intelligence Gathering\", is_org_recon=1, \"Organization Reconnaissance\", 1=1, \"Unknown\") | stats count min(_time) as firstTime max(_time) as lastTime values(method) as methods values(search_query) as search_queries values(file_path) as file_paths values(target_owner) as target_owners values(attack_type) as attack_types dc(attack_type) as attack_diversity by dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime) | table dest firstTime lastTime count attack_diversity attack_types methods search_queries file_paths target_owners","pages":["detections/application/mcp_github_suspicious_operation.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"(sourcetype=\"mcp:jsonrpc\") method IN (\"write_file\", \"create_file\") direction=inbound | spath output=file_path path=params.path | spath output=file_content path=params.content | eval dest=host | eval file_extension=lower(mvindex(split(file_path, \".\"), -1)) | where file_extension IN ( \"exe\", \"dll\", \"ps1\", \"bat\", \"cmd\", \"vbs\", \"js\", \"scr\", \"msi\", \"hta\", \"wsf\", \"wsh\", \"pif\", \"com\", \"cpl\", \"sh\", \"bash\", \"zsh\", \"ksh\", \"csh\", \"tcsh\", \"fish\", \"py\", \"pl\", \"rb\", \"php\", \"lua\", \"awk\", \"so\", \"dylib\", \"bin\", \"elf\", \"run\", \"AppImage\", \"deb\", \"rpm\", \"pkg\", \"dmg\", \"plist\", \"service\", \"timer\", \"socket\", \"conf\" ) | eval file_path_lower=lower(file_path), is_system_path = if(match(file_path_lower, \"(windows|system32|syswow64|program files|/usr|/bin|/sbin|/lib|/lib64|/etc|/opt)\"), 1, 0), is_startup_path = if(match(file_path_lower, \"(startup|autorun|cron\\.d|crontab|launchd|launchagents|launchdaemons|systemd|init\\.d|rc\\.d|rc\\.local|profile\\.d|bashrc|zshrc|bash_profile)\"), 1, 0), is_hidden_unix = if(match(file_path, \"/\\.[^/]+$\"), 1, 0), content_length=len(file_content) | stats count min(_time) as firstTime max(_time) as lastTime values(file_path) as file_paths values(file_extension) as extensions max(is_system_path) as targets_system_path max(is_startup_path) as targets_startup_path max(is_hidden_unix) as targets_hidden_file avg(content_length) as avg_content_size by dest, method | eval targets_system_path=if(isnull(targets_system_path), 0, targets_system_path), targets_startup_path=if(isnull(targets_startup_path), 0, targets_startup_path), targets_hidden_file=if(isnull(targets_hidden_file), 0, targets_hidden_file) | sort - targets_startup_path, - targets_system_path, - targets_hidden_file, - count | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime) | table dest firstTime lastTime count method extensions file_paths targets_system_path targets_startup_path targets_hidden_file avg_content_size","pages":["detections/application/mcp_filesystem_server_suspicious_extension_write.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"(sourcetype=\"mcp:jsonrpc\") method=query direction=inbound | eval dest=host | eval query_lower=lower('params.query') | eval suspicious_query='params.query' | eval is_priv_escalation=if(like(query_lower, \"%update%users%role%admin%\") OR like(query_lower, \"%grant%admin%\") OR like(query_lower, \"%grant%superuser%\"), 1, 0) | eval is_credential_theft=if(like(query_lower, \"%password%\") OR like(query_lower, \"%credential%\") OR like(query_lower, \"%api_key%\") OR like(query_lower, \"%secret%\"), 1, 0) | eval is_recon=if(like(query_lower, \"%information_schema%\") OR like(query_lower, \"%pg_catalog%\") OR like(query_lower, \"%pg_tables%\") OR like(query_lower, \"%pg_user%\"), 1, 0) | where is_priv_escalation=1 OR is_credential_theft=1 OR is_recon=1 | eval attack_type=case( is_priv_escalation=1, \"Privilege Escalation\", is_credential_theft=1, \"Credential Theft\", is_recon=1, \"Schema Reconnaissance\", 1=1, \"Unknown\") | stats count min(_time) as firstTime max(_time) as lastTime values(suspicious_query) as suspicious_queries values(attack_type) as attack_types dc(attack_type) as attack_diversity by dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime) | table dest firstTime lastTime count suspicious_queries attack_types attack_diversity","pages":["detections/application/mcp_postgres_suspicious_query.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"(sourcetype=\"nginx:plus:kv\" OR sourcetype=\"nginx:plus:access\") http_method=\"POST\" | bin _time span=5s | rename dest_ip as dest | stats count, values(status) as status_codes, values(bytes_out) as bytes_out, values(uri_path) as uris BY _time, src_ip, dest, http_user_agent | where count>20 | table _time, dest, src_ip, count, status_codes, bytes_out, http_user_agent","pages":["detections/web/http_rapid_post_with_mixed_status_codes.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"(sourcetype=\"nginx:plus:kv\" OR sourcetype=\"nginx:plus:access\") http_method=\"POST\" | bin _time span=5s | rename dest_ip as dest | stats count, values(status) as status_codes, values(bytes_out) as bytes_out, values(uri_path) as uris BY _time, src_ip, dest, http_user_agent | where count>20 | table _time, dest, src_ip, count, status_codes, bytes_out, http_user_agent","pages":["detections/web/http_rapid_post_with_mixed_status_codes.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"accepted"} {"query":"(sourcetype=\"nginx:plus:kv\" OR sourcetype=\"nginx:plus:access\") uri_path IN (\"*/SetupWizard.aspx/*\",\"*/SetupWizard/\") status=200 http_method=POST | stats count min(_time) as firstTime max(_time) as lastTime BY src, dest, http_user_agent, url, uri_path, status, http_method, sourcetype, source | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/web/nginx_connectwise_screenconnect_authentication_bypass.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"(sourcetype=\"o365:graph:api\" OR source=\"AuditLogs.SignIns\") (appDisplayName=\"*Copilot*\" OR appDisplayName=\"M365ChatClient\" OR appDisplayName=\"OfficeAIAppChatCopilot\") | eval user = userPrincipalName | stats count as events, dc(location.city) as cities_count, values(location.city) as city_list, dc(location.countryOrRegion) as countries_count, values(location.countryOrRegion) as country_list, dc(ipAddress) as ip_count, values(ipAddress) as ip_addresses, dc(appDisplayName) as app_count, values(appDisplayName) as apps_used, dc(resourceDisplayName) as resource_count, values(resourceDisplayName) as resources_accessed, min(_time) as first_seen, max(_time) as last_seen by user | eval days_active = round((last_seen - first_seen)/86400, 1) | eval first_seen = strftime(first_seen, \"%Y-%m-%d %H:%M:%S\") | eval last_seen = strftime(last_seen, \"%Y-%m-%d %H:%M:%S\") | eval events_per_day = if(days_active > 0, round(events/days_active, 2), events) | where cities_count > 1 OR events_per_day > 100 OR app_count > 2 | sort -events_per_day, -countries_count","pages":["detections/application/m365_copilot_application_usage_pattern_anomalies.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"accepted"} {"query":"(sourcetype=\"o365:graph:api\" OR source=\"AuditLogs.SignIns\") (appDisplayName=\"*Copilot*\" OR appDisplayName=\"M365ChatClient\" OR appDisplayName=\"OfficeAIAppChatCopilot\") | eval user = userPrincipalName | stats count as events, dc(location.city) as cities_count, values(location.city) as city_list, dc(location.countryOrRegion) as countries_count, values(location.countryOrRegion) as country_list, dc(ipAddress) as ip_count, values(ipAddress) as ip_addresses, min(_time) as first_seen, max(_time) as last_seen BY user | eval days_active = round((last_seen - first_seen)/86400, 1) | eval locations_per_day = if(days_active > 0, round(cities_count/days_active, 2), cities_count) | eval first_seen = strftime(first_seen, \"%Y-%m-%d %H:%M:%S\") | eval last_seen = strftime(last_seen, \"%Y-%m-%d %H:%M:%S\") | where cities_count > 1 | sort -countries_count, -cities_count","pages":["detections/application/m365_copilot_session_origin_anomalies.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"accepted"} @@ -328,8 +328,8 @@ {"query":"eventtype=\"wineventlog_application\" OR Channel=\"application\" OR source=\"XmlWinEventLog:Application\" OR source=\"WinEventLog:Application\" EventCode=15457 | rex field=EventData_Xml \"(?[^<]+)(?[^<]+)(?[^<]+)\" | where config_name IN (\"Ad Hoc Distributed Queries\", \"external scripts enabled\", \"Ole Automation Procedures\", \"clr enabled\", \"clr strict security\") | rename host as dest | eval change_type=case( old_value=\"0\" AND new_value=\"1\", \"enabled\", old_value=\"1\" AND new_value=\"0\", \"disabled\", true(), \"modified\" ) | eval risk_score=case( change_type=\"enabled\", 90, change_type=\"disabled\", 60, true(), 70 ) | eval risk_message=\"SQL Server critical procedure \".config_name.\" was \".change_type.\" on host \".dest.\", which may indicate attempts to gain code execution or perform reconnaissance\" | stats count min(_time) as firstTime max(_time) as lastTime BY dest EventCode config_name change_type risk_message risk_score | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_sql_server_critical_procedures_enabled.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_application\" OR Channel=\"application\" OR source=\"XmlWinEventLog:Application\" OR source=\"WinEventLog:Application\" EventCode=17135 | rex field=EventData_Xml \"(?[^<]+)\" | rename host as dest | eval risk_score=case( match(lower(startup_procedure), \"xp_|sp_|cmdshell|shell|exec\"), 90, true(), 70 ) | eval risk_message=\"SQL Server startup procedure '\".startup_procedure.\"' was launched on host \".dest | stats count min(_time) as firstTime max(_time) as lastTime by dest EventCode startup_procedure risk_message risk_score | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_sql_server_startup_procedure.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_application\" OR Channel=\"application\" OR source=\"XmlWinEventLog:Application\" OR source=\"WinEventLog:Application\" EventCode=2282 | stats count min(_time) as firstTime max(_time) as lastTime BY EventCode dest Name ModuleDll | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_iis_components_module_failed_to_load.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"eventtype=\"wineventlog_application\" OR Channel=\"application\" OR source=\"XmlWinEventLog:Application\" OR source=\"WinEventLog:Application\" EventCode=3000 | rename param1 AS \"Process\" param2 AS \"Exit_Code\" | stats count min(_time) as firstTime max(_time) as lastTime BY Process Exit_Code dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_event_triggered_image_file_execution_options_injection.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"eventtype=\"wineventlog_application\" OR Channel=\"application\" OR source=\"XmlWinEventLog:Application\" OR source=\"WinEventLog:Application\" EventCode=8128 | rex field=EventData_Xml \"(?[^<]+)(?[^<]+)(?[^<]+)\" | rename host as dest | eval dll_category=case( dll_name==\"xpstar.dll\", \"Extended Procedures\", dll_name==\"odsole70.dll\", \"OLE Automation\", dll_name==\"xplog70.dll\", \"Logging Procedures\", true(), \"Other\") | stats count as execution_count, values(procedure_name) as procedures_used, latest(_time) as last_seen BY dest dll_name dll_category dll_version | sort - execution_count","pages":["detections/endpoint/windows_sql_server_extended_procedure_dll_loading_hunt.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"eventtype=\"wineventlog_application\" OR Channel=\"application\" OR source=\"XmlWinEventLog:Application\" OR source=\"WinEventLog:Application\" EventCode=3000 | rename param1 AS \"Process\" param2 AS \"Exit_Code\" | stats count min(_time) as firstTime max(_time) as lastTime BY Process Exit_Code dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_event_triggered_image_file_execution_options_injection.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"eventtype=\"wineventlog_application\" OR Channel=\"application\" OR source=\"XmlWinEventLog:Application\" OR source=\"WinEventLog:Application\" EventCode=8128 | rex field=EventData_Xml \"(?[^<]+)(?[^<]+)(?[^<]+)\" | rename host as dest | eval dll_category=case( dll_name==\"xpstar.dll\", \"Extended Procedures\", dll_name==\"odsole70.dll\", \"OLE Automation\", dll_name==\"xplog70.dll\", \"Logging Procedures\", true(), \"Other\") | stats count as execution_count, values(procedure_name) as procedures_used, latest(_time) as last_seen BY dest dll_name dll_category dll_version | sort - execution_count","pages":["detections/endpoint/windows_sql_server_extended_procedure_dll_loading_hunt.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"accepted"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" ( ( ( EventCode=5447 ChangeType IN (\"%%16384\", \"Add\") ) OR EventCode=5441 ) Action IN (\"%%16389\", \"Block\") FilterName=\"Custom Outbound Filter\" ) | eval user=coalesce(UserName,user,\"unknown\") | eval filter_action=case(Action=\"%%16389\",\"Block\", true(), Action), change_type=case(ChangeType=\"%%16384\",\"Add\", true(), ChangeType) | stats count min(_time) as firstTime max(_time) as lastTime values(filter_action) as filter_action values(change_type) as change_type values(ProviderName) as provider_name values(FilterType) as filter_type values(FilterId) as filter_id values(FilterKey) as filter_key values(LayerName) as layer_name values(LayerId) as layer_id values(Conditions) as conditions values(CalloutName) as callout_name BY dest user process_id FilterName | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_edrsilencer_custom_outbound_filter_added.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" ( EventCode=4720 OR ( EventCode=4732 AND ( Group_Name=Administrators OR TargetUserName=Administrators ) ) ) | transaction user dest connected=false maxspan=180m | stats count min(_time) as firstTime max(_time) as lastTime dc(EventCode) as distinct_eventcodes by src_user user dest | where distinct_eventcodes > 1 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/detect_new_local_admin_account.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" ( EventCode=4723 OR EventCode=4724 ) | eval log_time = strptime(SystemTime, \"%Y-%m-%dT%H:%M:%S.%6NZ\") | eval log_time = coalesce(log_time, _time) | eval time_bucket = floor(log_time / 2) * 2 | eval SubjectRID = tonumber(replace(SubjectUserSid, \".*-(\\d+)$\", \"\\1\")) | where SubjectRID >= 1000 | stats count AS EventsForAccount min(log_time) AS firstTime max(log_time) AS lastTime by Computer TargetUserName SubjectUserName time_bucket | where EventsForAccount >= 4 | eval DurationSecs = round(lastTime - firstTime, 3), DurationSecs = if(DurationSecs = 0, 0.001, DurationSecs), ChangeRatePerSec = round(EventsForAccount / DurationSecs, 2) | rename Computer as dest | stats dc(TargetUserName) AS AffectedAccounts values(TargetUserName) AS Accounts values(SubjectUserName) AS InitiatingAccounts sum(EventsForAccount) AS TotalEvents max(ChangeRatePerSec) AS PeakChangeRatePerSec min(DurationSecs) AS FastestBurstSecs min(firstTime) AS firstTime max(lastTime) AS lastTime by dest time_bucket | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_suspicious_burst_of_password_changes.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -404,7 +404,7 @@ {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4725 status=success | bucket span=10m _time | stats count dc(user) as unique_users values(user) as user values(dest) as dest BY EventCode signature _time src_user SubjectDomainName TargetDomainName Logon_ID | where unique_users > 5","pages":["detections/endpoint/windows_multiple_accounts_disabled.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4726 status=success | bucket span=10m _time | stats count dc(user) as unique_users values(user) as user values(dest) as dest BY EventCode signature _time src_user SubjectDomainName TargetDomainName Logon_ID | where unique_users > 5","pages":["detections/endpoint/windows_multiple_accounts_deleted.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4732 TargetUserName=DnsAdmins | stats min(_time) as firstTime max(_time) as lastTime values(TargetUserName) as target_users_added values(user) as user BY dest src_user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_dnsadmins_new_member_added.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4738 UserAccountControl=\"*%%2096*\" | rename TargetUserName as user, SubjectUserName as actor | stats count earliest(_time) as firstTime latest(_time) as lastTime by actor, user, dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/kerberos_pre_authentication_flag_disabled_in_useraccountcontrol.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4738 UserAccountControl=\"*%%2096*\" | rename TargetUserName as user, SubjectUserName as actor | stats count earliest(_time) as firstTime latest(_time) as lastTime by actor, user, dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/kerberos_pre_authentication_flag_disabled_in_useraccountcontrol.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4738 UserPrincipalName=\"*\" NOT UserPrincipalName IN ( \"-\", \"\", \"*@*\", \"%%1793\" ) NOT SubjectUserSid IN ( \"S-1-5-18\", \"S-1-5-7\" ) NOT SubjectUserName IN ( \"ANONYMOUS*\", \"NT AUTHORITY*\" ) | where SubjectUserSid=TargetSid | stats count min(_time) as firstTime max(_time) as lastTime by dest SubjectUserName SubjectUserSid TargetUserName TargetSid UserPrincipalName | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_ad_user_suspicious_upn_change.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4741 NewUacValue=\"0x80\" ServicePrincipalNames IN (\"*HOST/*\",\"*RestrictedKrbHost/*\") | stats count min(_time) as firstTime max(_time) as lastTime values(EventCode),values(TargetDomainName),values(PrimaryGroupId), values(OldUacValue), values(NewUacValue),values(SamAccountName),values(DnsHostName),values(ServicePrincipalNames) BY dest Logon_ID subject | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_computer_account_with_spn.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4741 user_type=computer SubjectDomainName!=\"NT AUTHORITY\" ServicePrincipalNames=*RestrictedKrbHost* | stats count min(_time) as firstTime max(_time) as lastTime BY dest, subject, action ,src_user, user, user_type, SubjectUserName,SubjectDomainName | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_computer_account_created_by_computer_account.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -423,14 +423,14 @@ {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4769 ServiceName=\"*$\" (TicketOptions=0x40810000 OR TicketOptions=0x40800000 OR TicketOptions=0x40810010) TicketEncryptionType=0x17 | stats count min(_time) as firstTime max(_time) as lastTime BY dest, service, service_id, TicketEncryptionType, TicketOptions | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime)","pages":["detections/endpoint/kerberos_service_ticket_request_using_rc4_encryption.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4769 ServiceName=\"*$\" TargetUserName!=\"*$\" | eval TargetUserName = mvindex(split(TargetUserName, \"@\"), 0) | search NOT TargetUserName=\"*$\" | bucket span=5m _time | stats dc(ServiceName) AS unique_targets values(ServiceName) as host_targets values(dest) as dest by _time, IpAddress, TargetUserName | where unique_targets > 30","pages":["detections/endpoint/windows_large_number_of_computer_service_tickets_requested.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4769 Service_Name=\"*$\" Account_Name!=\"*$*\" | bucket span=2m _time | stats dc(Service_Name) AS unique_targets values(Service_Name) as host_targets BY _time, Client_Address, Account_Name | eventstats avg(unique_targets) as comp_avg , stdev(unique_targets) as comp_std BY Client_Address, Account_Name | eval upperBound=(comp_avg+comp_std*3) | eval isOutlier=if(unique_targets >10 and unique_targets >= upperBound, 1, 0)","pages":["detections/endpoint/unusual_number_of_computer_service_tickets_requested.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4769 | eval isSuspicious = if(lower(ServiceName) = lower(mvindex(split(TargetUserName,\"@\"),0)),1,0) | where isSuspicious = 1 | rename Computer as dest | rename TargetUserName as user | table _time, dest, src_ip, user, ServiceName, Error_Code, isSuspicious","pages":["detections/endpoint/suspicious_kerberos_service_ticket_request.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4769 | eval isSuspicious = if(lower(ServiceName) = lower(mvindex(split(TargetUserName,\"@\"),0)),1,0) | where isSuspicious = 1 | rename Computer as dest | rename TargetUserName as user | table _time, dest, src_ip, user, ServiceName, Error_Code, isSuspicious","pages":["detections/endpoint/suspicious_kerberos_service_ticket_request.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"accepted"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4771 TargetUserName!=\"*$\" Status=0x18 | bucket span=5m _time | stats dc(TargetUserName) AS unique_accounts values(TargetUserName) as user values(dest) as dest BY _time, IpAddress | eventstats avg(unique_accounts) as comp_avg , stdev(unique_accounts) as comp_std BY IpAddress | eval upperBound=(comp_avg+comp_std*3) | eval isOutlier=if(unique_accounts > 10 and unique_accounts >= upperBound, 1, 0) | search isOutlier=1","pages":["detections/endpoint/windows_unusual_count_of_users_failed_to_auth_using_kerberos.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4771 TargetUserName!=\"*$\" Status=0x18 | bucket span=5m _time | stats dc(TargetUserName) AS unique_accounts values(TargetUserName) as user values(dest) as dest BY _time, IpAddress | where unique_accounts > 30","pages":["detections/endpoint/windows_multiple_users_failed_to_authenticate_using_kerberos.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4776 TargetUserName!=*$ Status=0xC000006A | bucket span=2m _time | stats dc(TargetUserName) AS unique_accounts values(TargetUserName) as tried_accounts values(dest) as dest BY _time, Workstation | eventstats avg(unique_accounts) as comp_avg , stdev(unique_accounts) as comp_std BY Workstation | eval upperBound=(comp_avg+comp_std*3) | eval isOutlier=if(unique_accounts > 10 and unique_accounts >= upperBound, 1, 0) | search isOutlier=1","pages":["detections/endpoint/windows_unusual_count_of_users_failed_to_authenticate_using_ntlm.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4776 TargetUserName!=*$ Status=0xC000006A | bucket span=5m _time | stats dc(TargetUserName) AS unique_accounts values(TargetUserName) as tried_accounts values(dest) as dest BY _time, Workstation | where unique_accounts > 30","pages":["detections/endpoint/windows_multiple_users_failed_to_authenticate_from_host_using_ntlm.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4776 TargetUserName!=*$ Status=0xc0000064 | bucket span=2m _time | stats dc(TargetUserName) AS unique_accounts values(TargetUserName) as user values(dest) as dest BY _time, Workstation | eventstats avg(unique_accounts) as comp_avg , stdev(unique_accounts) as comp_std BY Workstation | eval upperBound=(comp_avg+comp_std*3) | eval isOutlier=if(unique_accounts > 10 and unique_accounts >= upperBound, 1, 0) | search isOutlier=1 | rename Workstation as src","pages":["detections/endpoint/windows_unusual_count_of_invalid_users_failed_to_auth_using_ntlm.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4776 TargetUserName!=*$ Status=0xc0000064 | bucket span=5m _time | stats dc(TargetUserName) AS unique_accounts values(TargetUserName) as tried_accounts values(dest) as dest BY _time, Workstation | where unique_accounts > 30","pages":["detections/endpoint/windows_multiple_invalid_users_failed_to_authenticate_using_ntlm.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4781 OldTargetUserName=\"*$\" NewTargetUserName!=\"*$\" | table _time, Computer, Caller_User_Name, OldTargetUserName, NewTargetUserName | rename Computer as dest","pages":["detections/endpoint/suspicious_computer_account_name_change.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4781 OldTargetUserName=\"*$\" NewTargetUserName!=\"*$\" | table _time, Computer, Caller_User_Name, OldTargetUserName, NewTargetUserName | rename Computer as dest","pages":["detections/endpoint/suspicious_computer_account_name_change.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"accepted"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4781 TargetSid=\"S-1-5-21-*\" | where match(TargetSid, \"S-1-5-21-.*-50[0-4]$\") | stats count min(_time) as firstTime max(_time) as lastTime by dest OldTargetUserName NewTargetUserName TargetSid SubjectLogonId | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_builtin_account_name_was_changed.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4798 CallerProcessName = \"*\\\\telegram.exe\" | stats count min(_time) as firstTime max(_time) as lastTime by user Computer EventCode CallerProcessName ProcessID SubjectUserSid SubjectDomainName SubjectLogonId | rename Computer as dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/enumerate_users_local_group_using_telegram.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4876 | stats count min(_time) as firstTime max(_time) as lastTime BY dest, name, action, Caller_Domain ,Caller_User_Name | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_steal_authentication_certificates_cs_backup.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -442,10 +442,10 @@ {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=5136 AttributeLDAPDisplayName IN (\"msDS-AllowedToDelegateTo\",\"msDS-AllowedToActOnBehalfOfOtherIdentity\",\"scriptPath\",\"msTSInitialProgram\") OperationType=%%14674 ```Changes to the attribute \"msDS-KeyCredentialLink\" are also worth moniroting, however tuning will need to be applied``` | table _time ObjectClass ObjectDN OpCorrelationID src_user SubjectLogonId DSName AttributeValue AttributeLDAPDisplayName | rename SubjectLogonId as TargetLogonId, src_user as initiator, _time as eventTime | appendpipe [ | map search=\"search eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4624 TargetLogonId=$TargetLogonId$\"] | stats min(eventTime) as _time values(initiator) as src_user, values(DSName) as targetDomain, values(ObjectDN) as ObjectDN, values(ObjectClass) as ObjectClass, values(src_category) as src_category, values(src_ip) as src_ip values(LogonType) as LogonType values(AttributeValue) as AttributeValue values(AttributeLDAPDisplayName) as AttributeLDAPDisplayName BY TargetLogonId | rex field=ObjectDN \"^CN=(?P.*?),[A-Z]{2}\\=\" | eval dest=if(ObjectClass=\"computer\",cn,null), user=if(ObjectClass=\"user\",cn,null) | fields - cn","pages":["detections/endpoint/windows_ad_suspicious_attribute_modification.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=5136 AttributeLDAPDisplayName=flags OperationType=\"%%14674\" AttributeValue!=0 | eval AttributeValueExp=case(AttributeValue==0,\"Enabled\",AttributeValue==1,\"User configuration settings disabled\",AttributeValue==2,\"Computer configuration settings disabled\",AttributeValue==3,\"Disabled\"), ObjectDN=upper(ObjectDN) | join ObjectDN type=inner [ | search source=ActiveDirectory objectCategory=\"CN=Group-Policy-Container*\" admonEventType=Update | eval ObjectDN=upper(distinguishedName) | stats latest(displayName) as displayName BY ObjectDN ] | stats min(_time) as _time values(AttributeValue) as AttributeValue values(AttributeValueExp) as AttributeValueExp values(OpCorrelationID) as OpCorrelationID values(displayName) as policyName values(src_user) as src_user BY ObjectDN SubjectLogonId dest","pages":["detections/endpoint/windows_ad_gpo_disabled.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=5136 AttributeLDAPDisplayName=gpLink | eval ObjectDN=upper(ObjectDN) | stats min(_time) as eventTime values(eval(if(OperationType==\"%%14675\",AttributeValue,null))) as old_value values(eval(if(OperationType==\"%%14674\",AttributeValue,null))) as new_value values(OperationType) as OperationType values(src_user) as src_user values(dest) as dest BY OpCorrelationID ObjectDN SubjectLogonId | rex field=old_value max_match=10000 \"(?i)LDAP://(?Pcn.*?);(?P\\d)\\]\" | rex field=new_value max_match=10000 \"(?i)LDAP://(?Pcn.*?);(?P\\d)\\]\" | mvexpand old_dn | where NOT old_dn IN (new_dn) | eval ObjectDN=upper(old_dn) | join ObjectDN type=outer [ | search source=ActiveDirectory objectCategory=\"CN=Group-Policy-Container*\" admonEventType=Update | eval ObjectDN=upper(distinguishedName) | stats latest(displayName) as displayName BY ObjectDN ] | stats min(eventTime) as _time values(OpCorrelationID) as OpCorrelationID values(displayName) as policyName values(src_user) as src_user BY ObjectDN SubjectLogonId","pages":["detections/endpoint/windows_ad_gpo_deleted.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=5136 AttributeLDAPDisplayName=sIDHistory OperationType=\"%%14674\" | stats values(ObjectDN) as ObjectDN BY _time, Computer, SubjectUserName, AttributeValue | rename Computer as dest","pages":["detections/endpoint/windows_ad_sid_history_attribute_modified.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=5136 AttributeLDAPDisplayName=sIDHistory OperationType=\"%%14674\" | stats values(ObjectDN) as ObjectDN BY _time, Computer, SubjectUserName, AttributeValue | rename Computer as dest","pages":["detections/endpoint/windows_ad_sid_history_attribute_modified.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"accepted"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=5136 AttributeLDAPDisplayName=servicePrincipalName (AttributeValue=\"GC/*\" OR AttributeValue=\"E3514235-4B06-11D1-AB04-00C04FC2DCD2/*\") | stats min(_time) as _time range(_time) as duration values(OperationType) as OperationType values(user) as user values(src_ip) as src_ip values(src_nt_domain) as src_nt_domain values(src_user) as src_user values(Computer) as dest, values(ObjectDN) as ObjectDN values(action) as action values(app) as app values(authentication_method) as authentication_method values(signature) as signature values(signature_id) as signature_id values(src) as src BY Logon_ID | eval short_lived=case((duration<30),\"TRUE\") | where short_lived=\"TRUE\" AND mvcount(OperationType)>1 | replace \"%%14674\" with \"Value Added\", \"%%14675\" with \"Value Deleted\" in OperationType | rename Logon_ID as TargetLogonId | appendpipe [ | map search=\"search eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=4624 TargetLogonId=$TargetLogonId$\"]","pages":["detections/endpoint/windows_ad_short_lived_domain_controller_spn_attribute.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=5136 AttributeLDAPDisplayName=servicePrincipalName ObjectClass=computer NOT SubjectUserName=\"*$\" NOT SubjectUserSid IN ( \"S-1-5-18\", \"S-1-5-19\", \"S-1-5-20\" ) NOT SubjectUserName IN ( \"*ANONYMOUS*\", \"*NT AUTHORITY*\", \"*SYSTEM\" ) | stats count min(_time) as firstTime max(_time) as lastTime values(AttributeValue) as spn_values values(OperationType) as operation_types by Computer SubjectUserName SubjectDomainName SubjectUserSid ObjectDN | eval operation_types=mvmap(operation_types, case(operation_types=\"%%14675\", \"Deleted\", operation_types=\"%%14674\", \"Added\", true(), operation_types)) | rename Computer as dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_ad_computer_spn_modified_by_user_account.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=5136 AttributeLDAPDisplayName=servicePrincipalName OperationType=\"%%14674\" ObjectClass=user | stats values(ObjectDN) as ObjectDN by _time, Computer, SubjectUserName, AttributeValue | rex field=ObjectDN \"^CN=(?P[a-zA-Z0-9!#$%&'@^_{}~.-]+),\" | rename Computer as dest, SubjectUserName as src_user","pages":["detections/endpoint/windows_ad_serviceprincipalname_added_to_domain_account.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=5136 AttributeLDAPDisplayName=servicePrincipalName OperationType=\"%%14674\" ObjectClass=user | stats values(ObjectDN) as ObjectDN by _time, Computer, SubjectUserName, AttributeValue | rex field=ObjectDN \"^CN=(?P[a-zA-Z0-9!#$%&'@^_{}~.-]+),\" | rename Computer as dest, SubjectUserName as src_user","pages":["detections/endpoint/windows_ad_serviceprincipalname_added_to_domain_account.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"accepted"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=5136 AttributeLDAPDisplayName=servicePrincipalName | transaction ObjectDN AttributeValue startswith=(EventCode=5136 OperationType=\"%%14674\") endswith=(EventCode=5136 OperationType=\"%%14675\") | eval short_lived=case((duration<300),\"TRUE\") | search short_lived = TRUE | rename ObjectDN as user | rename Computer as dest","pages":["detections/endpoint/windows_ad_short_lived_domain_account_serviceprincipalname.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=5136 AttributeValue=* AttributeLDAPDisplayName=servicePrincipalName OperationType IN ( \"%%14674\", \"%%14675\" ) | regex AttributeValue=\"[\\x{034F}\\x{200B}-\\x{200F}\\x{00AD}\\x{1806}\\x{FEFF}\\x{FFFC}\\x{2060}\\x{206A}-\\x{206F}\\x{180B}-\\x{180D}\\x{FE00}-\\x{FE0F}]\" | eval matched_invisible_chars=mvappend( if(match(AttributeValue, \"\\x{034F}\"), \"U+034F (Combining Grapheme Joiner)\", null()), if(match(AttributeValue, \"\\x{200B}\"), \"U+200B (Zero Width Space)\", null()), if(match(AttributeValue, \"\\x{200C}\"), \"U+200C (Zero Width Non-Joiner)\", null()), if(match(AttributeValue, \"\\x{200D}\"), \"U+200D (Zero Width Joiner)\", null()), if(match(AttributeValue, \"\\x{200E}\"), \"U+200E (Left-to-Right Mark)\", null()), if(match(AttributeValue, \"\\x{200F}\"), \"U+200F (Right-to-Left Mark)\", null()), if(match(AttributeValue, \"\\x{00AD}\"), \"U+00AD (Soft Hyphen)\", null()), if(match(AttributeValue, \"\\x{1806}\"), \"U+1806 (Mongolian Todo Soft Hyphen)\", null()), if(match(AttributeValue, \"\\x{FEFF}\"), \"U+FEFF (Zero Width No-Break Space)\", null()), if(match(AttributeValue, \"\\x{FFFC}\"), \"U+FFFC (Object Replacement Character)\", null()), if(match(AttributeValue, \"\\x{2060}\"), \"U+2060 (Word Joiner)\", null()), if(match(AttributeValue, \"[\\x{206A}-\\x{206F}]\"), \"U+206A-206F (Deprecated Format Characters)\", null()), if(match(AttributeValue, \"[\\x{180B}-\\x{180D}]\"), \"U+180B-180D (Variation Selectors)\", null()), if(match(AttributeValue, \"[\\x{FE00}-\\x{FE0F}]\"), \"U+FE00-FE0F (Variation Selectors)\", null())) | where isnotnull(matched_invisible_chars) | rename Computer as dest | stats count min(_time) as firstTime max(_time) as lastTime values(matched_invisible_chars) as matched_invisible_chars by dest SubjectUserName SubjectDomainName ObjectDN ObjectClass AttributeValue | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_ad_spn_unicode_collision_injection.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=\"wineventlog_security\" OR Channel=\"security\" OR source=\"XmlWinEventLog:Security\" OR source=\"WinEventLog:Security\" EventCode=5136 ObjectClass=container ObjectDN=\"CN=AdminSDHolder,CN=System*\" | stats min(_time) as _time values(eval(if(OperationType==\"%%14675\",AttributeValue,null))) as old_value values(eval(if(OperationType==\"%%14674\",AttributeValue,null))) as new_value values(OperationType) as OperationType values(dest) as dest by ObjectClass ObjectDN OpCorrelationID src_user SubjectLogonId | rex field=old_value max_match=10000 \"\\((?P.*?)\\)\" | rex field=new_value max_match=10000 \"\\((?P.*?)\\)\" | mvexpand new_ace | where NOT new_ace IN (old_values) | rex field=new_ace \"(?P.*?);(?P.*?);(?P.*?);(?P.*?);(?P.*?);(?P.*?)$\" | rex max_match=100 field=aceAccessRights \"(?P[A-Z]{2})\" | rex max_match=100 field=aceFlags \"(?P[A-Z]{2})\" | lookup local=t msad_guid_lookup guid as aceObjectGuid OUTPUT displayName as ControlAccessRights | lookup local=t ace_access_rights_lookup access_rights_string as AccessRights OUTPUT access_rights_value | lookup local=t ace_type_lookup ace_type_string as aceType OUTPUT ace_type_value | lookup local=t ace_flag_lookup flag_string as aceFlags OUTPUT flag_value as ace_flag_value ``` Optional SID resolution lookups | lookup local=t identity_lookup_expanded objectSid as aceSid OUTPUT downLevelDomainName as user | lookup local=t admon_groups_def objectSid as aceSid OUTPUT cn as group``` | lookup local=t builtin_groups_lookup builtin_group_string as aceSid OUTPUTNEW builtin_group_name as builtin_group | eval aceType=coalesce(ace_type_value,aceType), aceFlags=coalesce(ace_flag_value,\"This object only\"), aceAccessRights=if(aceAccessRights=\"CCDCLCSWRPWPDTLOCRSDRCWDWO\",\"Full control\",coalesce(access_rights_value,AccessRights)), aceControlAccessRights=coalesce(ControlAccessRights,aceObjectGuid), user=coalesce(user, group, builtin_group, aceSid) | stats min(_time) as _time values(aceType) as aceType values(aceFlags) as aceFlags(inheritance) values(aceControlAccessRights) as aceControlAccessRights values(aceAccessRights) as aceAccessRights values(new_ace) as new_ace values(SubjectLogonId) as SubjectLogonId by ObjectClass ObjectDN src_user user | eval aceControlAccessRights=if(mvcount(aceControlAccessRights)=1 AND aceControlAccessRights=\"\",\"All rights\",'aceControlAccessRights') | search NOT aceType IN (*denied*,D,OD,XD) AND aceAccessRights IN (\"Full control\",\"All extended rights\",\"All validated writes\",\"Create all child objects\",\"Delete all child objects\",\"Delete subtree\",\"Delete\",\"Modify permissions\",\"Modify owner\",\"Write all properties\",CC,CR,DC,DT,SD,SW,WD,WO,WP)","pages":["detections/endpoint/windows_ad_adminsdholder_acl_modified.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -498,7 +498,7 @@ {"query":"eventtype=cisco_ios facility=\"SISF\" mnemonic IN (\"IP_THEFT\",\"MAC_THEFT\",\"MAC_AND_IP_THEFT\",\"PAK_DROP\") | eval src_interface=src_int_prefix_long+src_int_suffix | eval dest_interface=dest_int_prefix_long+dest_int_suffix | stats min(_time) AS firstTime max(_time) AS lastTime values(src_mac) AS src_mac values(src_vlan) AS src_vlan values(mnemonic) AS mnemonic values(vendor_explanation) AS vendor_explanation values(src_ip) AS src_ip values(dest_ip) AS dest_ip values(dest_interface) AS dest_interface values(action) AS action count BY host src_interface | table host src_interface dest_interface src_mac src_ip dest_ip src_vlan mnemonic vendor_explanation action count | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/network/detect_ipv6_network_infrastructure_threats.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=okta_log OR sourcetype = \"OktaIM2:log\" action=success src_user_type = User eventType = user.authentication.verify OR eventType = user.authentication.auth_via_mfa | stats dc(eventType) values(eventType) as eventType values(target{}.displayName) as targets values(debugContext.debugData.url) min(_time) as firstTime max(_time) as lastTime values(authentication_method) BY src_ip user action dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime) | search targets !=\"Okta Verify\"","pages":["detections/application/okta_successful_single_factor_authentication.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=okta_log OR sourcetype = \"OktaIM2:log\" debugContext.debugData.tunnels IN (*Astrill*,*Azire*,*CyberGhost*,*Express*VPN,*HideMe*, *IPVanish*,*Mullvad*,*Nord*VPN*,*OVPN*,*PIA*VPN*,*Proton*VPN*,*Pure*VPN*,*Slick*VPN*,*Surf*Easy*, *SurfShark*,*Star*VPN*,*TorGuard*,*TorProxy*,*Tiger*VPN*,*TunnelBear*,*Unblock*VPN*,*Warp*VPN*,*WarpSpeed*, *VPNReactor*,*VPN*Shield*,*VPN*Super*VPN*,*ZenMate*) ```listing of commonly used known VPN providers. Add or remove whatever is appropriate for your environment``` | eval user=coalesce('actor.alternateId',user), user=mvindex(split(user, \"@\"), 0) | rename targetUserAlternateId as user client.* as * request.* as * ipChain{}.* as * geographicalContext.* as * debugContext.* as * debugData.* as * | eval status=case(match(_raw, \"FAILURE\"), \"failure\", !match(_raw, \"FAILURE\"), \"success\") | stats count values(status) as status max(published) as UTC min(_time) as firsttime max(_time) as lasttime values(target_data) as target_data values(displayMessage) as displayMessage values(eventType) as eventType values(city) as city values(country) as country values(action) as action values(src_ip) as src_ip values(outcome.*) as * values(user) as user by tunnels,_time,host sourcetype index | fillnull value=\"N/A\" | convert ctime(*ttime)","pages":["detections/cloud/okta_non_standard_vpn_usage.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"eventtype=okta_log OR sourcetype = \"OktaIM2:log\" eventType = security.threat.detected | rename client.geographicalContext.country as country, client.geographicalContext.state as state, client.geographicalContext.city as city | stats count min(_time) as firstTime max(_time) as lastTime BY app src_ip dest signature eventType displayMessage client.device city state country user_agent outcome.reason outcome.result severity | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/okta_threatinsight_threat_detected.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"eventtype=okta_log OR sourcetype = \"OktaIM2:log\" eventType = security.threat.detected | rename client.geographicalContext.country as country, client.geographicalContext.state as state, client.geographicalContext.city as city | stats count min(_time) as firstTime max(_time) as lastTime BY app src_ip dest signature eventType displayMessage client.device city state country user_agent outcome.reason outcome.result severity | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/okta_threatinsight_threat_detected.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=okta_log OR sourcetype = \"OktaIM2:log\" eventType IN (\"system.idp.lifecycle.activate\",\"system.idp.lifecycle.create\",\"system.idp.lifecycle.delete\",\"system.idp.lifecycle.deactivate\") | stats count min(_time) as firstTime max(_time) as lastTime values(target{}.id) as target_id values(target{}.type) as target_modified BY src dest src_user_id user user_agent command description | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/okta_idp_lifecycle_modifications.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=okta_log OR sourcetype = \"OktaIM2:log\" eventType IN (policy.evaluate_sign_on) outcome.result IN (ALLOW, SUCCESS) | stats earliest(_time) as _time, values(client.ipAddress) as src_ip, values(client.userAgent.rawUserAgent) as user_agent, values(client.userAgent.os) as userAgentOS_list, values(client.geographicalContext.city) as city, values(client.userAgent.browser) as userAgentBrowser_list, values(device.os_platform) as okta_device_os, dc(client.userAgent.browser) as dc_userAgentBrowser, dc(client.userAgent.os) as dc_userAgentOS, dc(client.ipAddress) as dc_src_ip, values(outcome.reason) as reason values(dest) as dest BY debugContext.debugData.dtHash, user | where dc_src_ip>1 AND (dc_userAgentOS>1 OR dc_userAgentBrowser>1)","pages":["detections/application/okta_suspicious_use_of_a_session_cookie.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"eventtype=okta_log OR sourcetype = \"OktaIM2:log\" eventType IN (system.push.send_factor_verify_push) OR (eventType IN (user.authentication.auth_via_mfa) debugContext.debugData.factor=\"OKTA_VERIFY_PUSH\") | eval groupby=\"authenticationContext.externalSessionId\" | eval group_push_time=_time | bin span=2s group_push_time | fillnull value=NULL | stats min(_time) as _time BY authenticationContext.externalSessionId eventType debugContext.debugData.factor outcome.result actor.alternateId client.device client.ipAddress client.userAgent.rawUserAgent debugContext.debugData.behaviors group_push_time | iplocation client.ipAddress | fields - lat, lon, group_push_time | stats min(_time) as _time dc(client.ipAddress) as dc_ip sum(eval(if(eventType=\"system.push.send_factor_verify_push\" AND $outcome.result$=\"SUCCESS\", 1, 0))) as total_pushes sum(eval(if(eventType=\"user.authentication.auth_via_mfa\" AND $outcome.result$=\"SUCCESS\", 1, 0))) as total_successes sum(eval(if(eventType=\"user.authentication.auth_via_mfa\" AND $outcome.result$=\"FAILURE\", 1, 0))) as total_rejected sum(eval(if(eventType=\"system.push.send_factor_verify_push\" AND $debugContext.debugData.behaviors$ LIKE \"%New Device=POSITIVE%\", 1, 0))) as suspect_device_from_source sum(eval(if(eventType=\"system.push.send_factor_verify_push\" AND $debugContext.debugData.behaviors$ LIKE \"%New IP=POSITIVE%\", 1, 0))) as suspect_ip_from_source values(eval(if(eventType=\"system.push.send_factor_verify_push\", $client.ipAddress$, \"\"))) as src values(eval(if(eventType=\"user.authentication.auth_via_mfa\", $client.ipAddress$, \"\"))) as dest values(*) as * BY authenticationContext.externalSessionId | eval ratio = round(total_successes / total_pushes, 2) | search ((ratio < 0.5 AND total_pushes > 1) OR (total_rejected > 0)) AND dc_ip > 1 AND suspect_device_from_source > 0 AND suspect_ip_from_source > 0 | rename actor.alternateId as user","pages":["detections/application/okta_mismatch_between_source_and_response_for_verify_push_request.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -600,9 +600,9 @@ {"query":"sourcetype IN (\"ms:o365:reporting:messagetrace\",\"o365:reporting:messagetrace\",\"o365:graph:messagetrace\") subject IN (\"*banking*\",\"*direct deposit*\",\"*pay-to*\",\"*password *\",\"*passcode *\",\"*OTP *\",\"*MFA *\",\"*Account Recovery*\") | eval mailtime = _time | bin _time span=4hr | eval user = lower(recipient) | eval InternetMessageId = lower(message_id) | join InternetMessageId, user max=0 [ | search sourcetype=o365:management:activity Workload=Exchange Operation IN (\"HardDelete\") AND Folder.Path IN (\"\\\\Sent Items\",\"\\\\Recoverable Items\\\\Deletions\") | spath path=AffectedItems{} output=AffectedItemSplit | fields _time,ClientProcessName,ClientIPAddress,ClientInfoString,UserId,Operation,ResultStatus,MailboxOwnerUPN,AffectedItemSplit,Folder.Path | mvexpand AffectedItemSplit | spath input=AffectedItemSplit | search Subject IN (\"*banking*\",\"*direct deposit*\",\"*pay-to*\",\"*password *\",\"*passcode *\",\"*OTP *\",\"*MFA *\",\"*Account Recovery*\") | eval deltime = _time | bin _time span=4hr | eval InternetMessageId = lower(InternetMessageId), user = lower(UserId), subject = Subject ] | stats values(ClientIPAddress) as src, values(ClientInfoString) as http_user_agent, values(Folder.Path) as file_path, values(Operation) as signature, values(ResultStatus) as result, values(InternetMessageId) as signature_id, count, min(mailtime) as firstTime, max(deltime) as lastTime by user,subject | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_email_receive_and_hard_delete_takeover_behavior.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype IN (\"ms:o365:reporting:messagetrace\",\"o365:reporting:messagetrace\",\"o365:graph:messagetrace\") subject IN (\"*banking*\",\"*direct deposit*\",\"*pay-to*\",\"*password *\",\"*passcode *\",\"*OTP *\",\"*MFA *\",\"*Account Recovery*\") | eval mailtime = _time | bin _time span=4hr | eval user = lower(recipient) | eval InternetMessageId = lower(message_id) | join InternetMessageId, user max=0 [ | search sourcetype=o365:management:activity Workload=Exchange Operation IN (\"SoftDelete\",\"HardDelete\") | spath path=AffectedItems{} output=AffectedItemSplit | fields _time,ClientIP,ClientInfoString,UserId,Operation,ResultStatus,MailboxOwnerUPN,AffectedItemSplit | mvexpand AffectedItemSplit | spath input=AffectedItemSplit | search Subject IN (\"*banking*\",\"*direct deposit*\",\"*pay-to*\",\"*password *\",\"*passcode *\",\"*OTP *\",\"*MFA *\",\"*Account Recovery*\") | eval deltime = _time | bin _time span=4hr | eval InternetMessageId = lower(InternetMessageId), user = lower(UserId) ] | stats values(ClientInfoString) as http_user_agent, values(ClientIP) as src, values(Subject) as subject, dc(Subject) as subject_count, values(Operation) as action, values(ResultStatus) as result, count, min(mailtime) as firstTime, max(deltime) as lastTime by user,_time | search subject IN (\"*banking*\",\"*direct deposit*\",\"*pay-to*\") AND subject IN (\"*password *\",\"*passcode *\",\"*OTP *\",\"*MFA *\",\"*Account Recovery*\") | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_email_password_and_payroll_compromise_behavior.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"CrowdStrike:Event:Streams:JSON\" metadata.eventType IN (XdrDetectionSummaryEvent,IdpDetectionSummaryEvent,EppDetectionSummaryEvent) | rename event.* as * | eval risk_score=case(Severity<20, 0, Severity<40 AND Severity>=20, 25, Severity<60 AND Severity>=40, 100, Severity<80 AND Severity>=60, 250, Severity>=80, 500) | eval user=coalesce(lower(SourceAccountName),lower(UserName)) | eval dest=coalesce(HostNames,SourceEndpointHostName) | eval mitre_technique = case(!match(Name, \"(NGAV |Intel Detection)\"), Technique) | join type=left mitre_technique [| inputlookup append=t mitre_attack_lookup | fields mitre_technique mitre_technique_id ] | eval annotations.mitre_attack = mitre_technique_id | eval drilldown_user = if(NOT isnull(user), if(NOT isnull(SourceAccountName),(\"event.SourceAccountName=\" + $SourceAccountName$),\"event.UserName=\" + $UserName$ ),\"\") | eval drilldown_dest = if(NOT isnull(dest), if(NOT isnull(SourceEndpointHostName),(\"event.SourceEndpointHostName=\" + $SourceEndpointHostName$ +\"*\"),\"event.HostNames=\" + $HostNames$ +\"*\"),\"\") | eval drilldown_dest2 = if( NOT isnull(dest) AND NOT isnull(IOARuleInstanceID) AND Tactic==\"Custom Intelligence\", if(NOT isnull(SourceEndpointHostName),(\"dest=\" + $SourceEndpointHostName$ +\"*\"),\"dest=\" + $HostNames$ +\"*\"),\"\") | eval annotations.drilldown_search = if(isnull(IOARuleInstanceID) AND Tactic!=\"Custom Intelligence\", \"sourcetype=\"CrowdStrike:Event:Streams:JSON\" metadata.eventType=\" + $metadata.eventType$ + \" \" + drilldown_user + \" \" + drilldown_dest, \"sourcetype=\"CrowdStrike:Event:Streams:JSON\" ((metadata.eventType=\" + $metadata.eventType$ + \" \" + drilldown_user + \" \" + drilldown_dest + \") OR (event_simpleName IN (CustomIOABasicProcessDetectionInfoEvent,CustomIOADomainNameDetectionInfoEvent,CustomIOAFileWrittenDetectionInfoEvent,CustomIOANetworkConnectionDetectionInfoEvent) TemplateInstanceId=\" + IOARuleInstanceID + \" \" + drilldown_dest2 + \"))\") | rename \"metadata.eventType\" as eventType | eval title = case(Name==\"NGAV\", (\"RR - CS - \" + Tactic + \" - \" + Technique),Name==\"Intel Detection\", (\"RR - CS - \" + Name),eventType==\"IdpDetectionSummaryEvent\", (\"RR - CS - Identity Protection\"),1==1, (\"RR - CS - \" + Name + \" - \" + Technique) ) | eval user_append = if(NOT isnull(user),\" by \" + user,\"\") | eval dest_append = if(NOT isnull(dest),\" on \" + dest,\"\") | eval description = case(Name==\"NGAV\", (\"CS \" + Tactic + \" - \" + Technique + \": \" + FileName),eventType==\"IdpDetectionSummaryEvent\", (\"CS IdP\" + \" - \" + Name),Name==\"Intel Detection\", (\"CS \" + Name + \" - \" + IOCType + \": \" + IOCValue),1==1, (Objective + \" - \" + DetectDescription) ) | eval description = description + user_append + dest_append | eval gid=id, display_id=FalconHostLink, file_hash=SHA256String, hash=MD5String, signature=IOCValue, ip='NetworkAccesses{}.RemoteAddress', process=CommandLine, pid=ProcessId | eval file_name = if(isnull('ExecutablesWritten{}.FileName'), FileName, 'ExecutablesWritten{}.FileName') | rename id as detection_id, FalconHostLink as detection_url | table _time source detection_id detection_url title risk_score description Severity severity HostNames dest Tactic Technique user UserName Objective Name DetectDescription gid, display_id, mitre_technique annotations.mitre_attack annotations.drilldown_search file_hash hash signature ip process pid file_name","pages":["detections/endpoint/crowdstrike_falcon_stream_alerts.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=\"CrowdStrike:Event:Streams:JSON\" tag=alert event.SeverityName= LOW | rename event.EndpointIp as src_ip, event.EndpointName as src_host, event.UserName as user, event.IncidentDescription as description, event.IncidentType as type, event.NumbersOfAlerts as count_alerts, event.SeverityName as severity | stats dc(type) as type_count, values(user) as users, values(description) as descriptions, values(type) as types, values(severity) count min(_time) as firstTime max(_time) as lastTime BY src_ip src_host | where type_count >= 3 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/crowdstrike_multiple_low_severity_alerts.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"CrowdStrike:Event:Streams:JSON\" tag=alert | rename event.EndpointIp as src_ip, event.EndpointName as src_host, event.UserName as user, event.IncidentDescription as description, event.IncidentType as type, event.NumbersOfAlerts as count_alerts, event.SeverityName as severity | stats count min(_time) as firstTime max(_time) as lastTime BY src_ip, src_host, user, description, type, count_alerts, severity | where LIKE(type,\"%Privilege escalation%\") AND NOT LIKE(user, \"%adm%\") AND NOT LIKE(user, \"%svc%\") AND NOT LIKE(user, \"%admin%\") | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/crowdstrike_privilege_escalation_for_non_admin_user.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"CrowdStrike:Event:Streams:JSON\" | rename event.EndpointIp as src_ip, event.EndpointName as src_host, event.UserName as user, event.IncidentDescription as description, event.IncidentType as type, event.NumbersOfAlerts as count_alerts, event.SeverityName as severity | stats count min(_time) as firstTime max(_time) as lastTime BY src_ip, src_host, user, description, type, count_alerts, severity | where LIKE (severity, \"%MEDIUM%\") | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/crowdstrike_medium_severity_alert.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=\"CrowdStrike:Event:Streams:JSON\" tag=alert event.SeverityName= LOW | rename event.EndpointIp as src_ip, event.EndpointName as src_host, event.UserName as user, event.IncidentDescription as description, event.IncidentType as type, event.NumbersOfAlerts as count_alerts, event.SeverityName as severity | stats dc(type) as type_count, values(user) as users, values(description) as descriptions, values(type) as types, values(severity) count min(_time) as firstTime max(_time) as lastTime BY src_ip src_host | where type_count >= 3 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/crowdstrike_multiple_low_severity_alerts.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"CrowdStrike:Event:Streams:JSON\" tag=alert | rename event.EndpointIp as src_ip, event.EndpointName as src_host, event.UserName as user, event.IncidentDescription as description, event.IncidentType as type, event.NumbersOfAlerts as count_alerts, event.SeverityName as severity | stats count min(_time) as firstTime max(_time) as lastTime BY src_ip, src_host, user, description, type, count_alerts, severity | where LIKE(type,\"%Privilege escalation%\") AND NOT LIKE(user, \"%adm%\") AND NOT LIKE(user, \"%svc%\") AND NOT LIKE(user, \"%admin%\") | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/crowdstrike_privilege_escalation_for_non_admin_user.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"CrowdStrike:Event:Streams:JSON\" | rename event.EndpointIp as src_ip, event.EndpointName as src_host, event.UserName as user, event.IncidentDescription as description, event.IncidentType as type, event.NumbersOfAlerts as count_alerts, event.SeverityName as severity | stats count min(_time) as firstTime max(_time) as lastTime BY src_ip, src_host, user, description, type, count_alerts, severity | where LIKE (severity, \"%MEDIUM%\") | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/crowdstrike_medium_severity_alert.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"IIS:Configuration:Operational\" EventCode=29 | stats count min(_time) as firstTime max(_time) as lastTime BY OpCode EventCode ComputerName Message | rename ComputerName AS dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_iis_components_new_module_added.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"PwSh:SubjectInterfacePackage\" Dll=*\\\\*.dll | stats count min(_time) as firstTime max(_time) as lastTime values(Dll) by Path host | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_sip_provider_inventory.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"Pwsh:InstalledIISModules\" | stats count min(_time) as firstTime max(_time) as lastTime BY host name image | rename host as dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/windows_iis_components_get_webglobalmodule_module_query.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -610,16 +610,16 @@ {"query":"sourcetype=\"auditd\" ( (type=PATH nametype=\"CREATE\") OR type=CWD ) | rex \"msg=audit\\([^)]*:(?\\d+)\\)\" | stats values(type) as types values(name) as names values(nametype) as nametype values(cwd) as cwd_list values(_time) as event_times by audit_id host | eval current_working_directory = coalesce(mvindex(cwd_list, 0), \"N/A\") | eval candidate_paths = mvmap(names, if(match(names, \"^/\"), names, current_working_directory + \"/\" + names)) | eval matched_paths = mvfilter(match(candidate_paths, \"/etc/doas.conf.*\")) | eval match_count = mvcount(matched_paths) | eval reconstructed_path = mvindex(matched_paths, 0) | eval e_time = mvindex(event_times, 0) | where match_count > 0 | rename host as dest | stats count min(e_time) as firstTime max(e_time) as lastTime values(nametype) as nametype by current_working_directory reconstructed_path match_count dest audit_id | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime) | table nametype current_working_directory reconstructed_path dest audit_id match_count firstTime lastTime","pages":["detections/endpoint/linux_auditd_doas_conf_file_creation.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" ( (type=SYSCALL syscall=\"59\" uid!=\"0\" euid=\"0\") OR (type IN (\"USER_AUTH\",\"USER_ACCT\",\"CRED_ACQ\") res=\"success\") ) | eval is_suspicious_exec=if(type=\"SYSCALL\" AND syscall=\"59\" AND uid!=\"0\" AND euid=\"0\", 1, 0) | eval is_successful_auth=if(type IN (\"USER_AUTH\",\"USER_ACCT\",\"CRED_ACQ\") AND res=\"success\", 1, 0) | stats count(eval(is_suspicious_exec=1)) as exec_count max(eval(if(is_suspicious_exec=1, _time, null()))) as lastTime max(is_successful_auth) as has_successful_auth min(eval(if(is_suspicious_exec=1, _time, null()))) as firstTime values(eval(if(is_suspicious_exec=1, comm, null()))) as process_name values(eval(if(is_suspicious_exec=1, euid, null()))) as euid values(eval(if(is_suspicious_exec=1, exe, null()))) as process_path values(eval(if(is_suspicious_exec=1, pid, null()))) as pid values(eval(if(is_suspicious_exec=1, ppid, null()))) as ppid values(eval(if(is_suspicious_exec=1, uid, null()))) as uid by host ses | where exec_count > 0 AND has_successful_auth != 1 | rename host as dest, ses as session_id | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_possible_setuid_execve_privesc.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" (proctitle = \"*gemini*\" AND proctitle IN (\"*--yolo*\", \"*-y *\")) OR (proctitle = \"*claude*\" AND proctitle= \"*--dangerously-skip-permissions*\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_ai_cli_permission_override_activated.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=\"auditd\" (proctitle = \"*rm *\" AND proctitle = \"*-rf *\" AND proctitle = \"*--no-preserve-root*\") | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_data_destruction_command.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=\"auditd\" (proctitle = \"*rm *\" AND proctitle = \"*-rf *\" AND proctitle = \"*--no-preserve-root*\") | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_data_destruction_command.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" (type=PATH OR type=CWD) | rex \"msg=audit\\([^)]*:(?\\d+)\\)\" | stats values(type) as types values(name) as names values(nametype) as nametype values(cwd) as cwd_list values(_time) as event_times by audit_id, host | eval current_working_directory = coalesce(mvindex(cwd_list, 0), \"N/A\") | eval candidate_paths = mvmap(names, if(match(names, \"^/\"), names, current_working_directory + \"/\" + names)) | eval matched_paths = mvfilter(match(candidate_paths, \".*/proc/sysrq-trigger|.*/proc/sys/kernel/sysrq|.*/etc/sysctl.conf\")) | eval match_count = mvcount(matched_paths) | eval reconstructed_path = mvindex(matched_paths, 0) | eval e_time = mvindex(event_times, 0) | where match_count > 0 | rename host as dest | stats count min(e_time) as firstTime max(e_time) as lastTime values(nametype) as nametype by current_working_directory reconstructed_path match_count dest audit_id | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_magic_sysrq_key_abuse.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" (type=PATH OR type=CWD) | rex \"msg=audit\\([^)]*:(?\\d+)\\)\" | stats values(type) as types values(name) as names values(nametype) as nametype values(cwd) as cwd_list values(_time) as event_times by audit_id, host | eval current_working_directory = coalesce(mvindex(cwd_list, 0), \"N/A\") | eval candidate_paths = mvmap(names, if(match(names, \"^/\"), names, current_working_directory + \"/\" + names)) | eval matched_paths = mvfilter(match(candidate_paths, \"/etc/cron.*|.*/cron/.*|/etc/anacrontab.*\")) | eval match_count = mvcount(matched_paths) | eval reconstructed_path = mvindex(matched_paths, 0) | eval e_time = mvindex(event_times, 0) | where match_count > 0 | rename host as dest | stats count min(e_time) as firstTime max(e_time) as lastTime values(nametype) as nametype by current_working_directory reconstructed_path match_count dest audit_id | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_possible_append_cronjob_entry_on_existing_cronjob_file.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" (type=PATH OR type=CWD) | rex \"msg=audit\\([^)]*:(?\\d+)\\)\" | stats values(type) as types values(name) as names values(nametype) as nametype values(cwd) as cwd_list values(_time) as event_times by audit_id, host | eval current_working_directory = coalesce(mvindex(cwd_list, 0), \"N/A\") | eval candidate_paths = mvmap(names, if(match(names, \"^/\"), names, current_working_directory + \"/\" + names)) | eval matched_paths = mvfilter(match(candidate_paths, \"/etc/ld.so.preload.*\")) | eval match_count = mvcount(matched_paths) | eval reconstructed_path = mvindex(matched_paths, 0) | eval e_time = mvindex(event_times, 0) | where match_count > 0 | rename host as dest | stats count min(e_time) as firstTime max(e_time) as lastTime values(nametype) as nametype by current_working_directory reconstructed_path match_count dest audit_id | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_preload_hijack_via_preload_file.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" (type=PATH OR type=CWD) | rex \"msg=audit\\([^)]*:(?\\d+)\\)\" | stats values(type) as types values(name) as names values(nametype) as nametype values(cwd) as cwd_list values(_time) as event_times by audit_id, host | eval current_working_directory = coalesce(mvindex(cwd_list, 0), \"N/A\") | eval candidate_paths = mvmap(names, if(match(names, \"^/\"), names, current_working_directory + \"/\" + names)) | eval matched_paths = mvfilter(match(candidate_paths, \"/etc/profile|/etc/shells|/etc/profile\\\\.d/.*|/etc/bash\\\\.bashrc.*|/etc/bashrc|.*/zsh/zprofile|.*/zsh/zshrc|.*/zsh/zlogin|.*/zsh/zlogout|/etc/csh\\\\.cshrc.*|/etc/csh\\\\.login.*|/root/\\\\.bashrc.*|/root/\\\\.bash_profile.*|/root/\\\\.profile.*|/root/\\\\.zshrc.*|/root/\\\\.zprofile.*|/home/.*/\\\\.bashrc.*|/home/.*/\\\\.zshrc.*|/home/.*/\\\\.bash_profile.*|/home/.*/\\\\.zprofile.*|/home/.*/\\\\.profile.*|/home/.*/\\\\.bash_login.*|/home/.*/\\\\.bash_logout.*|/home/.*/\\\\.zlogin.*|/home/.*/\\\\.zlogout.*\")) | eval match_count = mvcount(matched_paths) | eval reconstructed_path = mvindex(matched_paths, 0) | eval e_time = mvindex(event_times, 0) | where match_count > 0 | rename host as dest | stats count min(e_time) as firstTime max(e_time) as lastTime values(nametype) as nametype by current_working_directory reconstructed_path match_count dest audit_id | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_unix_shell_configuration_modification.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" (type=PATH OR type=CWD) | rex \"msg=audit\\([^)]*:(?\\d+)\\)\" | stats values(type) as types values(name) as names values(nametype) as nametype values(cwd) as cwd_list values(_time) as event_times by audit_id, host | eval current_working_directory = coalesce(mvindex(cwd_list, 0), \"N/A\") | eval candidate_paths = mvmap(names, if(match(names, \"^/\"), names, current_working_directory + \"/\" + names)) | eval matched_paths = mvfilter(match(candidate_paths, \"/etc/sudoers.*\")) | eval match_count = mvcount(matched_paths) | eval reconstructed_path = mvindex(matched_paths, 0) | eval e_time = mvindex(event_times, 0) | where match_count > 0 | rename host as dest | stats count min(e_time) as firstTime max(e_time) as lastTime values(nametype) as nametype by current_working_directory reconstructed_path match_count dest audit_id | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_possible_access_to_sudoers_file.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=\"auditd\" execve_command = \"*LD_PRELOAD*\" | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_preload_hijack_library_calls.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=\"auditd\" execve_command = \"*LD_PRELOAD*\" | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_preload_hijack_library_calls.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" execve_command = \"*base64*\" AND execve_command IN (\"*-d*\", \"* --d*\") | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_base64_decode_files.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=\"auditd\" execve_command = \"*modprobe*\" AND execve_command = \"*-r *\" | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_unload_module_via_modprobe.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" execve_command = \"*split*\" AND execve_command = \"*-b *\" | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_data_transfer_size_limits_via_split.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=\"auditd\" execve_command = \"*modprobe*\" AND execve_command = \"*-r *\" | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_unload_module_via_modprobe.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" execve_command = \"*split*\" AND execve_command = \"*-b *\" | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_data_transfer_size_limits_via_split.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" execve_command IN (\"*find*\", \"*grep*\") AND execve_command IN (\"*.kdbx*\", \"*KeePass*\", \"*.enforced*\", \"*.lpdb*\", \"*.opvault*\", \"*.agilekeychain*\", \"*.dashlane*\", \"*.rfx*\", \"*passbolt*\", \"*.spdb*\", \"*StickyPassword*\", \"*.walletx*\", \"*enpass*\", \"*vault*\", \"*.kdb*\") | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_find_credentials_from_password_managers.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" execve_command IN (\"*find*\", \"*grep*\") AND execve_command IN (\"*.pem*\", \"*.cer*\", \"*.crt*\", \"*.pgp*\", \"*.key*\", \"*.gpg*\", \"*.ppk*\", \"*.p12*\", \"*.pfx*\", \"*.p7b*\") | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_private_keys_and_certificate_enumeration.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" execve_command IN (\"*find*\", \"*grep*\") AND execve_command IN (\"*.vhd*\", \"*.vhdx*\", \"*.vmdk*\") | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_virtual_disk_file_and_directory_discovery.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -630,11 +630,11 @@ {"query":"sourcetype=\"auditd\" execve_command IN (\"*setcap *\") AND execve_command IN (\"*cap_setuid+ep*\", \"*cap_setuid=ep*\", \"*cap_net_bind_service+p*\", \"*cap_net_raw+ep*\", \"*cap_dac_read_search+ep*\") | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_setuid_using_setcap_utility.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" execve_command IN (\"*touch *\", \"*mkdir *\", \"*vim *\", \"*vi *\", \"*nano *\") AND execve_command IN (\"* ./.*\", \"* .*\", \"*/.*\") | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_hidden_files_and_directories_creation.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" execve_command IN (\"*xclip*\", \"*clipboard*\") AND execve_command IN (\"*-o*\", \"*-selection *\", \"*-sel *\" ) | rename host as dest | rename comm as process_name | rename exe as process | stats count min(_time) as firstTime max(_time) as lastTime BY argc execve_command dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_clipboard_data_copy.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=\"auditd\" proctitle = \"*NOPASSWD*\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_nopasswd_entry_in_sudoers_file.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" proctitle = \"*chattr *\" AND proctitle = \"* -i*\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_file_permissions_modification_via_chattr.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" proctitle = \"*chown *root*\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_change_file_owner_to_root.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" proctitle = \"*dd *\" AND proctitle = \"*of=*\" AND proctitle = \"*if=/dev/zero*\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_dd_file_overwrite.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" proctitle = \"*swapoff*\" AND proctitle = \"*-a*\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_hardware_addition_swapoff.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=\"auditd\" proctitle = \"*NOPASSWD*\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_nopasswd_entry_in_sudoers_file.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" proctitle = \"*chattr *\" AND proctitle = \"* -i*\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_file_permissions_modification_via_chattr.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" proctitle = \"*chown *root*\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_change_file_owner_to_root.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" proctitle = \"*dd *\" AND proctitle = \"*of=*\" AND proctitle = \"*if=/dev/zero*\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_dd_file_overwrite.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" proctitle = \"*swapoff*\" AND proctitle = \"*-a*\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_hardware_addition_swapoff.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" proctitle IN (\"*chmod *\") AND proctitle IN (\"* u+s *\", \"* g+s *\", \"* 4777 *\", \"* 4577 *\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_setuid_using_chmod_utility.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" proctitle IN (\"*shadow*\", \"*passwd*\") AND proctitle IN (\"*cat *\", \"*nano *\", \"*vim *\", \"*vi *\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_possible_access_to_credential_files.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" proctitle IN (\"*shred*\") AND proctitle IN (\"*-n*\", \"*-z*\", \"*-u*\", \"*-s*\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_shred_overwrite_command.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -643,24 +643,24 @@ {"query":"sourcetype=\"auditd\" proctitle IN (\"*systemctl *\", \"*service *\") AND proctitle IN (\"*restart*\", \"*reenable*\", \"*reload*\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_service_restarted.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" proctitle IN (\"*useradd*\", \"*adduser*\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_add_user_account.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" proctitle=\"*chmod*\" AND proctitle IN (\"* 777 *\", \"* 755 *\", \"*+*x*\", \"* 754 *\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY proctitle dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_file_permission_modification_via_chmod.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=\"auditd\" type=ADD_USER | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY exe pid dest res type | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_add_user_account_type.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" type=DAEMON_ABORT | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type op res uid dest pid | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_auditd_daemon_abort.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" type=DAEMON_END | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type op res auid dest pid | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_auditd_daemon_shutdown.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" type=DAEMON_START | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type op res auid dest pid | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_auditd_daemon_start.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" type=SERVICE_STOP unit IN (\"auditd\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type pid comm exe unit dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_auditd_service_stop.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=\"auditd\" type=ADD_USER | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY exe pid dest res type | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_add_user_account_type.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" type=DAEMON_ABORT | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type op res uid dest pid | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_auditd_daemon_abort.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" type=DAEMON_END | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type op res auid dest pid | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_auditd_daemon_shutdown.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" type=DAEMON_START | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type op res auid dest pid | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_auditd_daemon_start.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" type=SERVICE_STOP unit IN (\"auditd\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type pid comm exe unit dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_auditd_service_stop.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" type=SERVICE_STOP unit IN (\"firewalld\", \"ufw\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type pid comm exe unit dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_disable_or_modify_system_firewall.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=\"auditd\" type=SERVICE_STOP unit IN (\"osqueryd\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type pid comm exe unit dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_osquery_service_stop.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" type=SERVICE_STOP unit IN (\"sysmon\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type pid comm exe unit dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_sysmon_service_stop.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" type=SERVICE_STOP | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type pid comm exe dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_stop_services.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=\"auditd\" type=SERVICE_STOP unit IN (\"osqueryd\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type pid comm exe unit dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_osquery_service_stop.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" type=SERVICE_STOP unit IN (\"sysmon\") | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type pid comm exe unit dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_sysmon_service_stop.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" type=SERVICE_STOP | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY type pid comm exe dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_stop_services.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" type=SYSCALL comm IN (\"arp\", \"ifconfig\", \"ip\", \"netstat\", \"firewall-cmd\", \"ufw\", \"iptables\", \"ss\", \"route\") | bucket _time span=15m | rename host as dest | stats dc(comm) as unique_commands, values(comm) as comm, values(exe) as exe, values(syscall) as syscall, values(uid) as uid, values(ppid) as ppid, values(pid) as pid, count, min(_time) as firstTime, max(_time) as lastTime BY success dest | where unique_commands >= 4 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_system_network_configuration_discovery.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" type=SYSCALL comm IN (\"at\", \"atd\") OR exe IN (\"/usr/bin/at\",\"/usr/bin/atd\") AND NOT (uid IN (\"daemon\")) | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_at_application_execution.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=\"auditd\" type=SYSCALL comm=doas | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid success dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_doas_tool_execution.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" type=SYSCALL comm=insmod | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid success dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_insert_kernel_module_using_insmod_utility.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" type=SYSCALL comm=lsmod | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid success dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_kernel_module_enumeration.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" type=SYSCALL comm=modprobe | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid success dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_install_kernel_module_using_modprobe_utility.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" type=SYSCALL comm=rmmod | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid success dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_kernel_module_using_rmmod_utility.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" type=SYSCALL comm=split OR exe= \"*/split\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid success dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_data_transfer_size_limits_via_split_syscall.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"auditd\" type=SYSCALL comm=whoami OR exe= \"*/whoami\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid dest success | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_whoami_user_discovery.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=\"auditd\" type=SYSCALL comm=doas | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid success dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_doas_tool_execution.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" type=SYSCALL comm=insmod | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid success dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_insert_kernel_module_using_insmod_utility.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" type=SYSCALL comm=lsmod | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid success dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_kernel_module_enumeration.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" type=SYSCALL comm=modprobe | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid success dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_install_kernel_module_using_modprobe_utility.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" type=SYSCALL comm=rmmod | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid success dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_kernel_module_using_rmmod_utility.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" type=SYSCALL comm=split OR exe= \"*/split\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid success dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_data_transfer_size_limits_via_split_syscall.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=\"auditd\" type=SYSCALL comm=whoami OR exe= \"*/whoami\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid dest success | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_whoami_user_discovery.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" type=SYSCALL key IN ( \"af_alg\", \"process_creation\", \"splice_user\" ) | eval setuid_binary = case( name IN ( \"/usr/bin/chfn\", \"/usr/bin/chsh\", \"/usr/bin/fusermount3\", \"/usr/bin/gpasswd\", \"/usr/bin/mount\", \"/usr/bin/newgrp\", \"/usr/bin/passwd\", \"/usr/bin/su\", \"/usr/bin/sudo\", \"/usr/bin/umount\", \"/usr/lib/dbus-1.0/dbus-daemon-launch-helper\", \"/usr/lib/landscape/apt-update\", \"/usr/lib/openssh/ssh-keysign\", \"/usr/lib/polkit-1/polkit-agent-helper-1\" ), name, exe IN ( \"/usr/bin/chfn\", \"/usr/bin/chsh\", \"/usr/bin/fusermount3\", \"/usr/bin/gpasswd\", \"/usr/bin/mount\", \"/usr/bin/newgrp\", \"/usr/bin/passwd\", \"/usr/bin/su\", \"/usr/bin/sudo\", \"/usr/bin/umount\", \"/usr/lib/dbus-1.0/dbus-daemon-launch-helper\", \"/usr/lib/landscape/apt-update\", \"/usr/lib/openssh/ssh-keysign\", \"/usr/lib/polkit-1/polkit-agent-helper-1\" ), exe, true(), null() ) | eval indicator = case( key=\"af_alg\", \"AF_ALG socket\", key=\"splice_user\", \"splice syscall\", isnotnull(setuid_binary), \"setuid_exec:\" . setuid_binary, true(), null() ) | where isnotnull(indicator) | stats dc(indicator) as unique_signals max(_time) as lastTime min(_time) as firstTime values(comm) as comm values(exe) as exe values(name) as name values(host) as dest values(indicator) as signals values(setuid_binary) as setuid_binaries values(pid) as pid values(ppid) as ppid values(uid) as uid by auid | where unique_signals >= 3 | eval risk_score_factor = unique_signals * 25 | sort - risk_score_factor | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_copy_fail_privilege_escalation.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" type=SYSCALL key=splice_user exe IN ( \"/home/*\", \"/tmp/*\", \"/var/tmp/*\", \"/dev/shm/*\", \"/run/user/*\", \"/root/*\" ) | bin _time span=60s | eval user = coalesce(user, auid, AUID) | stats count AS splice_count values(exe) AS spray_binary values(pid) AS spray_pid values(user) AS user earliest(_time) AS spray_start latest(_time) AS spray_end BY auid host ses _time | where splice_count >= 50 | join type=inner auid host ses [ search sourcetype=\"auditd\" type=SYSCALL key=process_creation exe IN ( \"/usr/bin/chfn\", \"/usr/bin/chsh\", \"/usr/bin/fusermount3\", \"/usr/bin/gpasswd\", \"/usr/bin/mount\", \"/usr/bin/newgrp\", \"/usr/bin/passwd\", \"/usr/bin/su\", \"/usr/bin/sudo\", \"/usr/bin/umount\", \"/usr/lib/dbus-1.0/dbus-daemon-launch-helper\", \"/usr/lib/landscape/apt-update\", \"/usr/lib/openssh/ssh-keysign\", \"/usr/lib/polkit-1/polkit-agent-helper-1\" ) | stats earliest(_time) AS privesc_time values(exe) AS privesc_binary values(comm) AS privesc_comm values(ppid) AS privesc_ppid BY auid host ses ] | eval window_secs = privesc_time - spray_end | where window_secs >= 0 AND window_secs <= 300 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(spray_start) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(spray_end) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(privesc_time) | rename host AS dest | table dest user auid ses spray_binary spray_pid splice_count spray_start spray_end privesc_binary privesc_comm privesc_ppid privesc_time window_secs","pages":["detections/endpoint/linux_dirty_frag_kernel_privilege_escalation.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"auditd\" type=SYSCALL syscall IN (\"rename\", \"execve\") (comm IN (\"crontab\") OR exe IN (\"*/crontab\")) success=yes AND NOT (UID IN(\"daemon\")) | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime BY comm exe syscall uid ppid pid dest | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_auditd_edit_cron_table_parameter.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -710,10 +710,10 @@ {"query":"sourcetype=\"google:gcp:pubsub:message\" data.resource.type=gcs_bucket data.protoPayload.methodName=storage.setIamPermissions | spath output=action path=data.protoPayload.serviceData.policyDelta.bindingDeltas{}.action | spath output=user path=data.protoPayload.authenticationInfo.principalEmail | spath output=location path=data.protoPayload.resourceLocation.currentLocations{} | spath output=src path=data.protoPayload.requestMetadata.callerIp | spath output=bucketName path=data.protoPayload.resourceName | spath output=role path=data.protoPayload.serviceData.policyDelta.bindingDeltas{}.role | spath output=member path=data.protoPayload.serviceData.policyDelta.bindingDeltas{}.member | search (member=allUsers AND action=ADD) | table _time, bucketName, src, user, location, action, role, member","pages":["detections/cloud/detect_new_open_gcp_storage_buckets.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"google:gcp:pubsub:message\" | multikv | rename sc_status_ as status | rename cs_object_ as bucket_name | rename c_ip_ as remote_ip | rename cs_uri_ as request_uri | rename cs_method_ as operation | search status=\"\\\"200\\\"\" | stats earliest(_time) as firstTime latest(_time) as lastTime BY bucket_name remote_ip operation request_uri | table firstTime, lastTime, bucket_name, remote_ip, operation, request_uri | inputlookup append=t previously_seen_gcp_storage_access_from_remote_ip | stats min(firstTime) as firstTime, max(lastTime) as lastTime BY bucket_name remote_ip operation request_uri | outputlookup previously_seen_gcp_storage_access_from_remote_ip | eval newIP=if(firstTime >= relative_time(now(),\"-70m@m\"), 1, 0) | where newIP=1 | eval first_time=strftime(firstTime,\"%m/%d/%y %H:%M:%S\") | eval last_time=strftime(lastTime,\"%m/%d/%y %H:%M:%S\") | table first_time last_time bucket_name remote_ip operation request_uri","pages":["detections/cloud/detect_gcp_storage_access_from_a_new_ip.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unknown-command"} {"query":"sourcetype=\"gws:reports:drive\" NOT (email IN(\"\", \"null\")) | spath path=parameters.owner output=owner | rex field=owner \"[^@]+@(?[^@]+)\" | rex field=email \"[^@]+@(?[^@]+)\" | where src_domain = \"internal_test_email.com\" and not dest_domain = \"internal_test_email.com\" | eval phase=\"plan\" | eval severity=\"low\" | stats values(parameters.doc_title) as doc_title, values(parameters.doc_type) as doc_types, values(email) as dst_email_list, values(parameters.visibility) as visibility, values(parameters.doc_id) as doc_id, count min(_time) as firstTime max(_time) as lastTime by parameters.owner ip_address phase severity | rename parameters.owner as user ip_address as src_ip | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/gsuite_drive_share_in_external_email.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=\"gws:reports:drive\" name=change_user_access | rename parameters.* as * | search email = \"*@yourdomain.com\" target_user != \"*@yourdomain.com\" | stats count values(owner) as owner values(target_user) as target values(doc_type) as doc_type values(doc_title) as doc_title dc(target_user) as distinct_target BY src_ip email | where distinct_target > 50","pages":["detections/cloud/gdrive_suspicious_file_sharing.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=\"gws:reports:drive\" name=change_user_access | rename parameters.* as * | search email = \"*@yourdomain.com\" target_user != \"*@yourdomain.com\" | stats count values(owner) as owner values(target_user) as target values(doc_type) as doc_type values(doc_title) as doc_title dc(target_user) as distinct_target BY src_ip email | where distinct_target > 50","pages":["detections/cloud/gdrive_suspicious_file_sharing.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"gws:reports:drive\" parameters.owner_is_team_drive=false \"parameters.doc_title\" IN (\"*dhl*\", \"* ups *\", \"*delivery*\", \"*parcel*\", \"*label*\", \"*invoice*\", \"*postal*\", \"*fedex*\", \"* usps *\", \"* express *\", \"*shipment*\", \"*Banking/Tax*\",\"*shipment*\", \"*new order*\") parameters.doc_type IN (\"document\",\"pdf\", \"msexcel\", \"msword\", \"spreadsheet\", \"presentation\") | rex field=parameters.owner \"[^@]+@(?[^@]+)\" | rex field=parameters.target_user \"[^@]+@(?[^@]+)\" | where not source_domain=\"internal_test_email.com\" and dest_domain=\"internal_test_email.com\" | eval phase=\"plan\" | eval severity=\"low\" | stats count min(_time) as firstTime max(_time) as lastTime BY email parameters.owner parameters.target_user parameters.doc_title parameters.doc_type phase severity | rename parameters.target_user AS user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/gsuite_suspicious_shared_file_name.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"kube:container:falco\" \"A shell was spawned in a container\" | fillnull | stats count by container_image container_image_tag container_name parent proc_exepath process user","pages":["detections/cloud/kubernetes_falco_shell_spawned.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=\"linux_messages_syslog\" \"*tc action pedit offset*\" \"*out of bounds*\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime by dest _raw | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_pedit_offset_out_of_bounds.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=\"linux_messages_syslog\" \"*tc action pedit offset*\" \"*out of bounds*\" | rename host as dest | stats count min(_time) as firstTime max(_time) as lastTime by dest _raw | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_pedit_offset_out_of_bounds.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"linux_messages_syslog\" \"NET: Registered PF_ALG protocol family\" | rex field=_raw \"kernel: \\[\\s*(?[\\d\\.]+)\\]\" | eval uptime_seconds=tonumber(uptime_seconds) | where uptime_seconds > 300 | eval uptime_readable=tostring(round(uptime_seconds/60,1)) . \" minutes after boot\" | rename host as dest | table _time dest uptime_seconds uptime_readable _raw | sort -uptime_seconds","pages":["detections/endpoint/linux_pf_alg_registration_outside_of_boot_window.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=\"linux_messages_syslog\" \"NULL argv\" \"empty string added\" | rex field=_raw \"process '(?[^']+)' launched '(?[^']+)' with NULL argv\" | where isnotnull(launching_process) AND isnotnull(launched_process) | stats count AS occurrences, min(_time) AS firstTime, max(_time) AS lastTime, values(_raw) AS message, values(host) AS dest by host, launching_process, launched_process | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime) | table dest, launching_process, launched_process, firstTime, lastTime, occurrences, message","pages":["detections/endpoint/linux_binary_launched_process_with_null_argv.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=\"papercutng\" (loginType=Admin OR userName=admin) | eval uri_match=if(match(_raw, \"(?i)(\\/app\\?service=page\\/SetupCompleted|\\/app|\\/app\\?service=page\\/PrinterList|\\/app\\?service=direct\\/1\\/PrinterList\\/selectPrinter&sp=l1001|\\/app\\?service=direct\\/1\\/PrinterDetails\\/printerOptionsTab\\.tab)\"), \"URI matches\", null()) | eval ip_match=if(match(_raw, \"(?i)((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\") AND NOT match(_raw, \"(?i)(10\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(172\\.(1[6-9]|2[0-9]|3[0-1])\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(192\\.168\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\"), \"IP matches\", null()) | where (isnotnull(uri_match) OR isnotnull(ip_match)) | stats sparkline, count, values(uri_match) AS uri_match, values(ip_match) AS ip_match latest(_raw) BY host, index, sourcetype","pages":["detections/endpoint/papercut_ng_suspicious_behavior_debug_log.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -766,67 +766,67 @@ {"query":"sourcetype=aws:asl api.response.error=AccessDenied OR api.response.error=OperationNotPermittedException OR api.response.error=*Unauthorized* actor.user.type=IAMUser | bucket _time span=1h | stats count as failures min(_time) as firstTime max(_time) as lastTime dc(api.operation) as dc_operation, dc(api.service.name) as dc_service values(api.operation) as api.operation values(api.service.name) as api.service.name values(http_request.user_agent) as http_request.user_agent values(src_endpoint.ip) as src_ip values(actor.user.account.uid) as actor.user.account.uid values(cloud.provider) as cloud.provider values(cloud.region) as cloud.region BY _time actor.user.uid | where failures >= 5 AND dc_operation >= 1 AND dc_service >= 1 | rename actor.user.uid as user api.operation as action api.service.name as dest http_request.user_agent as user_agent src_endpoint.ip as src actor.user.account.uid as vendor_account cloud.provider as vendor_product cloud.region as vendor_region | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/asl_aws_iam_accessdenied_discovery_events.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=aws:cloudtrail (errorCode = \"AccessDenied\") user_type=IAMUser (userAgent!=*.amazonaws.com) | bucket _time span=1h | rename user_name as user | stats count as failures min(_time) as firstTime max(_time) as lastTime, dc(signature) as methods, dc(dest) as sources values(signature) as signature values(dest) as dest BY src, user, vendor_account vendor_region, vendor_product | where failures >= 5 and methods >= 1 and sources >= 1 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_iam_accessdenied_discovery_events.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail (errorCode=MalformedPolicyDocumentException) status=failure (userAgent!=*.amazonaws.com) | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(requestParameters.policyName) as policy_name BY src, user, vendor_account vendor_region, vendor_product, signature, dest, errorCode | where count >= 2 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_iam_assume_role_policy_brute_force.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=aws:cloudtrail (eventName= DeleteVirtualMFADevice OR eventName=DeactivateMFADevice) | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_multi_factor_authentication_disabled.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail (eventName= DeleteVirtualMFADevice OR eventName=DeactivateMFADevice) | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_multi_factor_authentication_disabled.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail (eventName=\"DeleteDetector\" AND eventSource=\"guardduty.amazonaws.com\") OR ( eventName IN (\"DeleteIPSet\", \"DeleteWebACL\", \"DeleteRuleGroup\", \"DeleteRule\") AND eventSource IN (\"guardduty.amazonaws.com\", \"wafv2.amazonaws.com\", \"waf.amazonaws.com\") ) OR ( eventName=\"DeleteLoggingConfiguration\" AND eventSource IN (\"wafv2.amazonaws.com\", \"waf.amazonaws.com\", \"route53.amazonaws.com\") ) | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime by signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_defense_evasion_impair_security_services.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=aws:cloudtrail eventName = ConsoleLogin errorMessage=\"Failed authentication\" | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_credential_access_failed_login.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName = ConsoleLogin | bin span=5m _time | rename user_name as user | stats dc(src) as distinct_ip_count values(src) as src values(user_agent) as user_agent values(dest) as dest BY _time, user, signature, vendor_account, vendor_region, vendor_product | where distinct_ip_count>1 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_successful_console_authentication_from_multiple_ips.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail eventName = ConsoleLogin errorMessage=\"Failed authentication\" | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_credential_access_failed_login.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventName = ConsoleLogin | bin span=5m _time | rename user_name as user | stats dc(src) as distinct_ip_count values(src) as src values(user_agent) as user_agent values(dest) as dest BY _time, user, signature, vendor_account, vendor_region, vendor_product | where distinct_ip_count>1 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_successful_console_authentication_from_multiple_ips.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName = CreateAccessKey | where (isnull(errorCode) OR errorCode=\"success\") AND 'userIdentity.type'=\"IAMUser\" AND isnotnull('userIdentity.userName') AND isnotnull('requestParameters.userName') AND 'userIdentity.userName'!='requestParameters.userName' | eval caller_arn='userIdentity.arn', caller_principal_id='userIdentity.principalId', caller_user='userIdentity.userName', dest=coalesce(dest,eventSource), signature=coalesce(signature,eventName), src=coalesce(src,sourceIPAddress), target_user='requestParameters.userName', user_agent=coalesce(user_agent,userAgent), user_arn=coalesce(user_arn,caller_arn), vendor_account=coalesce(vendor_account,recipientAccountId), vendor_product=coalesce(vendor_product,\"AWS\"), vendor_region=coalesce(vendor_region,awsRegion) | stats count min(_time) as firstTime max(_time) as lastTime values(dest) as dest values(eventID) as eventIDs values(signature) as signature values(src) as src values(user_agent) as user_agent values(user_arn) as user_arn values(vendor_product) as vendor_product values(vendor_region) as vendor_region by vendor_account caller_user caller_principal_id target_user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_createaccesskey.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName = CreateLoginProfile | rename requestParameters.userName as new_login_profile | table src_ip eventName new_login_profile userIdentity.userName | join new_login_profile src_ip [ | search sourcetype=aws:cloudtrail eventName = ConsoleLogin | rename userIdentity.userName as new_login_profile | stats count values(eventName) min(_time) as firstTime max(_time) as lastTime BY eventSource aws_account_id errorCode user_agent eventID awsRegion userIdentity.principalId user_arn new_login_profile src_ip dest vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)] | rename user_arn as user","pages":["detections/cloud/aws_createloginprofile.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName = CreateTask eventSource=\"datasync.amazonaws.com\" | rename requestParameters.* as * | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product destinationLocationArn sourceLocationArn | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_exfiltration_via_datasync_task.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName = DeleteLogGroup eventSource = logs.amazonaws.com userAgent !=console.amazonaws.com errorCode = success | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_defense_evasion_delete_cloudwatch_log_group.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName = DeleteTrail eventSource = cloudtrail.amazonaws.com userAgent !=console.amazonaws.com errorCode = success | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_defense_evasion_delete_cloudtrail.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName = DescribeEventAggregates src_ip!=\"AWS Internal\" | bin span=5m _time | rename user_name as user | stats min(_time) as firstTime max(_time) as lastTime values(user_agent) as user_agent values(signature) as signature values(src) as src values(dest) as dest dc(src) as distinct_ip_count BY _time user vendor_account vendor_region vendor_product | where distinct_ip_count > 1 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_concurrent_sessions_from_different_ips.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail eventName = CreateTask eventSource=\"datasync.amazonaws.com\" | rename requestParameters.* as * | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product destinationLocationArn sourceLocationArn | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_exfiltration_via_datasync_task.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventName = DeleteLogGroup eventSource = logs.amazonaws.com userAgent !=console.amazonaws.com errorCode = success | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_defense_evasion_delete_cloudwatch_log_group.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventName = DeleteTrail eventSource = cloudtrail.amazonaws.com userAgent !=console.amazonaws.com errorCode = success | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_defense_evasion_delete_cloudtrail.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventName = DescribeEventAggregates src_ip!=\"AWS Internal\" | bin span=5m _time | rename user_name as user | stats min(_time) as firstTime max(_time) as lastTime values(user_agent) as user_agent values(signature) as signature values(src) as src values(dest) as dest dc(src) as distinct_ip_count BY _time user vendor_account vendor_region vendor_product | where distinct_ip_count > 1 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_concurrent_sessions_from_different_ips.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName = JobCreated | fillnull | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_exfiltration_via_batch_service.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName = PutBucketReplication eventSource = s3.amazonaws.com | rename user_name as user, requestParameters.ReplicationConfiguration.Rule.Destination.Bucket as bucket_name | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product bucket_name | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_exfiltration_via_bucket_replication.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName = StopLogging eventSource = cloudtrail.amazonaws.com userAgent!=console.amazonaws.com errorCode = success | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_defense_evasion_stop_logging_cloudtrail.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName = UpdateLoginProfile userAgent !=console.amazonaws.com errorCode = success | eval match=if(match(userIdentity.userName,requestParameters.userName), 1,0) | search match=0 | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_updateloginprofile.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName = UpdateTrail eventSource = cloudtrail.amazonaws.com userAgent !=console.amazonaws.com errorCode = success | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_defense_evasion_update_cloudtrail.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail eventName = PutBucketReplication eventSource = s3.amazonaws.com | rename user_name as user, requestParameters.ReplicationConfiguration.Rule.Destination.Bucket as bucket_name | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product bucket_name | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_exfiltration_via_bucket_replication.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventName = StopLogging eventSource = cloudtrail.amazonaws.com userAgent!=console.amazonaws.com errorCode = success | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_defense_evasion_stop_logging_cloudtrail.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventName = UpdateLoginProfile userAgent !=console.amazonaws.com errorCode = success | eval match=if(match(userIdentity.userName,requestParameters.userName), 1,0) | search match=0 | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_updateloginprofile.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventName = UpdateTrail eventSource = cloudtrail.amazonaws.com userAgent !=console.amazonaws.com errorCode = success | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_defense_evasion_update_cloudtrail.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName IN (\"CreateSnapshot\", \"DescribeSnapshotAttribute\", \"ModifySnapshotAttribute\", \"DeleteSnapshot\") src_ip !=\"guardduty.amazonaws.com\" | bin _time span=5m | rename user_name as user | stats count dc(signature) as distinct_api_calls values(signature) as signature values(dest) as dest values(requestParameters.attributeType) as attributeType values(requestParameters.createVolumePermission.add.items{}.userId) as aws_account_id_added values(user_agent) as user_agent BY _time user src vendor_account vendor_region vendor_product | where distinct_api_calls >= 2 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_exfiltration_via_ec2_snapshot.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName IN (\"UpdateAccountPasswordPolicy\",\"GetAccountPasswordPolicy\",\"DeleteAccountPasswordPolicy\") errorCode=success | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_password_policy_changes.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName= ConsoleLogin \"additionalEventData.MFAUsed\"=Yes errorMessage=\"Failed authentication\" | bucket span=5m _time | rename user_name as user | stats dc(_raw) as mfa_prompts min(_time) as firstTime max(_time) as lastTime values(user_agent) as user_agent values(src) as src values(dest) as dest BY _time user signature vendor_account vendor_region vendor_product errorMessage | where mfa_prompts > 10 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_multiple_failed_mfa_requests_for_user.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName= ConsoleLogin errorCode=success \"additionalEventData.MFAUsed\"=No | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_successful_single_factor_authentication.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName= ConsoleLogin errorMessage=\"Failed authentication\" additionalEventData.MFAUsed = \"Yes\" | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product additionalEventData.MFAUsed errorMessage | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_console_login_failed_during_mfa_challenge.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName= PutBucketVersioning \"requestParameters.VersioningConfiguration.Status\"=Suspended | rename user_name as user, requestParameters.bucketName as bucket_name | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product bucket_name | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_disable_bucket_versioning.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail eventName= ConsoleLogin errorCode=success \"additionalEventData.MFAUsed\"=No | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_successful_single_factor_authentication.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventName= ConsoleLogin errorMessage=\"Failed authentication\" additionalEventData.MFAUsed = \"Yes\" | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product additionalEventData.MFAUsed errorMessage | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_console_login_failed_during_mfa_challenge.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventName= PutBucketVersioning \"requestParameters.VersioningConfiguration.Status\"=Suspended | rename user_name as user, requestParameters.bucketName as bucket_name | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product bucket_name | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_disable_bucket_versioning.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName=\"BatchGetSecretValue\" eventSource=\"secretsmanager.amazonaws.com\" | eval user_arn='userIdentity.arn', vendor_account=recipientAccountId | where isnotnull(user_arn) AND isnotnull(vendor_account) AND (isnull(errorCode) OR errorCode=\"\" OR lower(errorCode)=\"success\") | eval event_key=coalesce(eventID, md5(_raw)) | dedup event_key | eval event_time=_time | sort 0 + _time | streamstats time_window=1h count AS rolling_batch_request_count min(event_time) AS window_start BY vendor_account user_arn | eventstats max(eval(if(rolling_batch_request_count>10, event_time, null()))) AS qualifying_end BY vendor_account user_arn | eventstats min(eval(if(event_time=qualifying_end, window_start, null()))) AS qualifying_start BY vendor_account user_arn | where isnotnull(qualifying_start) AND event_time>=qualifying_start AND event_time<=qualifying_end | stats count AS batch_request_count values(sourceIPAddress) AS src values(userAgent) AS user_agent values(awsRegion) AS vendor_region earliest(event_time) AS firstTime latest(event_time) AS lastTime BY vendor_account user_arn | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_anomalous_secrets_manager_batch_retrieval.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=aws:cloudtrail eventName=ConsoleLogin action=failure | bucket span=10m _time | rename user_name as user | stats dc(_raw) AS failed_attempts values(src) as src values(user_agent) as user_agent BY _time, user, signature, dest, vendor_account vendor_region, vendor_product | where failed_attempts > 20 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_high_number_of_failed_authentications_for_user.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=aws:cloudtrail eventName=ConsoleLogin action=failure | bucket span=10m _time | rename user_name as user | stats dc(_raw) AS failed_attempts values(user) as user values(user_agent) as user_agent BY _time, src, signature, dest, vendor_account vendor_region, vendor_product | where failed_attempts > 20 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_high_number_of_failed_authentications_from_ip.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=aws:cloudtrail eventName=ConsoleLogin action=failure | bucket span=10m _time | rename user_name as user | stats dc(user) AS unique_accounts values(user) as user values(user_agent) as user_agent BY _time, src, signature, dest, vendor_account, vendor_region, vendor_product | where unique_accounts>30 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_multiple_users_failing_to_authenticate_from_ip.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=aws:cloudtrail eventName=ConsoleLogin action=failure | rename eventName as action, eventSource as dest, userName as user, userAgent as user_agent, sourceIPAddress as src, userIdentity.accountId as vendor_account, awsRegion as vendor_region | bucket span=10m _time | stats dc(_raw) AS distinct_attempts values(user_name) as tried_accounts values(action) as action values(dest) as dest values(vendor_account) as vendor_account values(vendor_region) as vendor_region values(vendor_product) as vendor_product values(user_agent) as user_agent BY _time, src | eventstats avg(distinct_attempts) as avg_attempts , stdev(distinct_attempts) as ip_std BY _time | eval upperBound=(avg_attempts+ip_std*3) | eval isOutlier=if(distinct_attempts > 10 and distinct_attempts >= upperBound, 1, 0) | where isOutlier = 1 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_unusual_number_of_failed_authentications_from_ip.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName=CopyObject requestParameters.x-amz-server-side-encryption=\"aws:kms\" | rename requestParameters.bucketName AS bucketName, requestParameters.x-amz-copy-source AS src_file, requestParameters.key AS dest_file | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product bucketName src_file dest_file | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_detect_users_with_kms_keys_performing_encryption_s3.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail eventName=CopyObject requestParameters.x-amz-server-side-encryption=\"aws:kms\" | rename requestParameters.bucketName AS bucketName, requestParameters.x-amz-copy-source AS src_file, requestParameters.key AS dest_file | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product bucketName src_file dest_file | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_detect_users_with_kms_keys_performing_encryption_s3.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName=CreateKey OR eventName=PutKeyPolicy | spath input=requestParameters.policy output=key_policy_statements path=Statement{} | mvexpand key_policy_statements | spath input=key_policy_statements output=key_policy_action_1 path=Action | spath input=key_policy_statements output=key_policy_action_2 path=Action{} | eval key_policy_action=mvappend(key_policy_action_1,key_policy_action_2) | spath input=key_policy_statements output=key_policy_principal path=Principal.AWS | search key_policy_action=\"kms:Encrypt\" AND key_policy_principal=\"*\" | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product key_policy_action key_policy_principal | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_detect_users_creating_keys_with_encrypt_policy_without_mfa.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName=CreateNetworkAclEntry OR eventName=ReplaceNetworkAclEntry requestParameters.ruleAction=allow requestParameters.egress=false requestParameters.aclProtocol=-1 | append [search sourcetype=aws:cloudtrail eventName=CreateNetworkAclEntry OR eventName=ReplaceNetworkAclEntry requestParameters.ruleAction=allow requestParameters.egress=false requestParameters.aclProtocol!=-1 | eval port_range='requestParameters.portRange.to' - 'requestParameters.portRange.from' | where port_range>1024] | fillnull | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product requestParameters.ruleAction requestParameters.egress requestParameters.aclProtocol requestParameters.portRange.to requestParameters.portRange.from requestParameters.cidrBlock | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_network_access_control_list_created_with_all_open_ports.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=aws:cloudtrail eventName=CreatePolicyVersion eventSource = iam.amazonaws.com errorCode = success | spath input=requestParameters.policyDocument output=key_policy_statements path=Statement{} | mvexpand key_policy_statements | spath input=key_policy_statements output=key_policy_action_1 path=Action | where key_policy_action_1 = \"*\" | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(key_policy_statements) as policy_added BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_create_policy_version_to_allow_all_resources.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=aws:cloudtrail eventName=CreateVirtualMFADevice | rename userName as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_new_mfa_method_registered_for_user.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail eventName=CreateVirtualMFADevice | rename userName as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_new_mfa_method_registered_for_user.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName=DeleteBucket [search sourcetype=aws:cloudtrail eventName=DeleteBucket | spath output=arn path=userIdentity.arn | stats count as apiCalls BY arn | inputlookup s3_deletion_baseline append=t | fields - latestCount | stats values(*) as * BY arn | rename apiCalls as latestCount | eval newAvgApiCalls=avgApiCalls + (latestCount-avgApiCalls)/720 | eval newStdevApiCalls=sqrt(((pow(stdevApiCalls, 2)*719 + (latestCount-newAvgApiCalls)*(latestCount-avgApiCalls))/720)) | eval avgApiCalls=coalesce(newAvgApiCalls, avgApiCalls), stdevApiCalls=coalesce(newStdevApiCalls, stdevApiCalls), numDataPoints=if(isnull(latestCount), numDataPoints, numDataPoints+1) | table arn, latestCount, numDataPoints, avgApiCalls, stdevApiCalls | outputlookup s3_deletion_baseline | eval dataPointThreshold = 15, deviationThreshold = 3 | eval isSpike=if((latestCount > avgApiCalls+deviationThreshold*stdevApiCalls) AND numDataPoints > dataPointThreshold, 1, 0) | where isSpike=1 | rename arn as userIdentity.arn | table userIdentity.arn] | spath output=user userIdentity.arn | spath output=bucketName path=requestParameters.bucketName | stats values(bucketName) as bucketName, count as numberOfApiCalls, dc(eventName) as uniqueApisCalled BY user","pages":["detections/cloud/detect_spike_in_s3_bucket_deletion.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-subsearch"} {"query":"sourcetype=aws:cloudtrail eventName=DeleteNetworkAclEntry requestParameters.egress=false | fillnull | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_network_access_control_list_deleted.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=aws:cloudtrail eventName=DeletePolicy (userAgent!=*.amazonaws.com) | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_iam_delete_policy.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName=Describe* OR eventName=List* OR eventName=Get* | fillnull | rename user_name as user | stats dc(signature) as dc_events min(_time) as firstTime max(_time) as lastTime values(signature) as signature values(dest) as dest values(user_agent) as user_agent values(src) as src values(vendor_account) as vendor_account values(vendor_region) as vendor_region BY user | where dc_events > 50 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_excessive_security_scanning.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName=GetObject | bin _time span=10m | rename user_name as user | stats count values(requestParameters.bucketName) as bucketName BY signature dest user user_agent src vendor_account vendor_region vendor_product | anomalydetection \"count\" \"user\" action=annotate | search probable_cause=*","pages":["detections/cloud/aws_exfiltration_via_anomalous_getobject_api_activity.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName=GetPasswordData eventSource = ec2.amazonaws.com | bin _time span=5m | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime dc(requestParameters.instanceId) as distinct_instance_ids BY signature dest user user_agent src vendor_account vendor_region vendor_product | where distinct_instance_ids > 10 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_credential_access_getpassworddata.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail eventName=GetObject | bin _time span=10m | rename user_name as user | stats count values(requestParameters.bucketName) as bucketName BY signature dest user user_agent src vendor_account vendor_region vendor_product | anomalydetection \"count\" \"user\" action=annotate | search probable_cause=*","pages":["detections/cloud/aws_exfiltration_via_anomalous_getobject_api_activity.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventName=GetPasswordData eventSource = ec2.amazonaws.com | bin _time span=5m | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime dc(requestParameters.instanceId) as distinct_instance_ids BY signature dest user user_agent src vendor_account vendor_region vendor_product | where distinct_instance_ids > 10 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_credential_access_getpassworddata.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName=ModifyImageAttribute (requestParameters.launchPermission.add.items{}.userId = * OR requestParameters.launchPermission.add.items{}.group = all) | rename requestParameters.launchPermission.add.items{}.group as group_added | rename requestParameters.launchPermission.add.items{}.userId as accounts_added | eval ami_status=if(match(group_added,\"all\") ,\"Public AMI\", \"Not Public\") | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(group_added) as group_added values(accounts_added) as accounts_added values(ami_status) as ami_status BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_ami_attribute_modification_for_exfiltration.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName=ModifySnapshotAttribute | rename requestParameters.createVolumePermission.add.items{}.userId as requested_account_id | search requested_account_id != NULL | eval match=if(requested_account_id==aws_account_id,\"Match\",\"No Match\") | where match = \"No Match\" | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product requested_account_id | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_ec2_snapshot_shared_externally.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventName=PutBucketLifecycle user_type=IAMUser errorCode=success | spath path=requestParameters{}.LifecycleConfiguration{}.Rule{}.Expiration{}.Days output=expiration_days | spath path=requestParameters{}.bucketName output=bucket_name | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product bucket_name expiration_days | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_defense_evasion_putbucketlifecycle.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=aws:cloudtrail eventName=SetDefaultPolicyVersion eventSource = iam.amazonaws.com | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_setdefaultpolicyversion.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventName=UpdateSAMLProvider | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(requestParameters.sAMLProviderArn) as request_parameters BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_saml_update_identity_provider.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail eventName=SetDefaultPolicyVersion eventSource = iam.amazonaws.com | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_setdefaultpolicyversion.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventName=UpdateSAMLProvider | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(requestParameters.sAMLProviderArn) as request_parameters BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_saml_update_identity_provider.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventSource=\"ec2-instance-connect.amazonaws.com\" eventName=\"SendSSHPublicKey\" responseElements.success=true | stats dc('requestParameters.instanceId') as unique_instances dc(eventID) as event_count earliest(_time) as firstTime latest(_time) as lastTime values('requestParameters.instanceId') as targeted_instances values('requestParameters.instanceOSUser') as targeted_users values(src) as src values(user_agent) as user_agent values(vendor_region) as vendor_region by user_arn | where event_count >= 10 | eval duration_seconds=lastTime-firstTime | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_ec2_multiple_ssh_public_keys_uploaded_by_a_single_identity.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventSource=\"ec2.amazonaws.com\" eventName IN (\"StopInstances\", \"ModifyInstanceAttribute\") | eval user_arn='userIdentity.arn' | eval instance_id=case( eventName=\"StopInstances\", 'requestParameters.instancesSet.items{}.instanceId', eventName=\"ModifyInstanceAttribute\", 'requestParameters.instanceId' ) | mvexpand instance_id | where isnotnull(eventID) AND isnotnull(instance_id) AND isnotnull(user_arn) AND (isnull(errorCode) OR errorCode=\"\" OR lower(errorCode)=\"success\") | where eventName=\"StopInstances\" OR (eventName=\"ModifyInstanceAttribute\" AND 'requestParameters.attribute'=\"userData\") | dedup eventID instance_id | eval event_epoch=coalesce(strptime(eventTime, \"%Y-%m-%dT%H:%M:%SZ\"), _time) | sort 0 user_arn instance_id awsRegion event_epoch | streamstats current=f last(eval(if(eventName=\"StopInstances\", event_epoch, null()))) AS stop_epoch last(eval(if(eventName=\"StopInstances\", eventID, null()))) AS stop_event_id BY user_arn instance_id awsRegion | where eventName=\"ModifyInstanceAttribute\" AND isnotnull(stop_epoch) | eval elapsed_seconds=event_epoch-stop_epoch | where elapsed_seconds>0 AND elapsed_seconds<=3600 | eval stop_time_utc=strftime(stop_epoch, \"%Y-%m-%dT%H:%M:%SZ\") | eval modification_time_utc=strftime(event_epoch, \"%Y-%m-%dT%H:%M:%SZ\") | rename eventID AS modification_event_id | table user_arn instance_id awsRegion stop_time_utc modification_time_utc elapsed_seconds stop_event_id modification_event_id","pages":["detections/cloud/aws_ec2_startup_script_modified_on_stopped_instance.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventSource=\"iam.amazonaws.com\" eventName=\"CreateRole\" | where isnull(errorCode) OR errorCode=\"\" OR lower(errorCode)=\"success\" | eval policy_raw='requestParameters.assumeRolePolicyDocument', role_name='requestParameters.roleName', role_arn='responseElements.role.arn', user_arn=coalesce(user_arn, 'userIdentity.arn'), src=coalesce(src, sourceIPAddress) | where isnotnull(policy_raw) | eval policy=if(match(policy_raw, \"(?i)^%7b\"), urldecode(policy_raw), policy_raw) | rex field=role_arn \"^arn:[^:]+:iam::(?[0-9]{12}):role/\" | eval role_account_id=coalesce(account_from_role_arn, recipientAccountId) | eval statements_json=json_extract(policy, \"Statement\") | eval statements=if(match(statements_json, \"^\\s*\\[\"), json_array_to_mv(statements_json), statements_json) | mvexpand statements | eval effect=json_extract(statements, \"Effect\"), actions_json=json_extract(statements, \"Action\"), principal_json=json_extract(statements, \"Principal\") | eval actions=if(match(actions_json, \"^\\s*\\[\"), json_array_to_mv(actions_json), actions_json) | mvexpand actions | mvexpand actions | eval trust_action=actions | eval action_pattern=replace(replace(lower(trust_action), \"[*]\", \"%\"), \"[?]\", \"_\") | where effect=\"Allow\" AND like(\"sts:assumerole\", action_pattern) | eval aws_json=json_extract(principal_json, \"AWS\") | eval principals=case( match(aws_json, \"^\\s*\\[\"), json_array_to_mv(aws_json), isnotnull(aws_json), aws_json, principal_json=\"*\", \"*\" ) | mvexpand principals | eval trust_principal=principals | rex field=trust_principal \"^arn:[^:]+:iam::(?[0-9]{12}):\" | eval principal_account_id=if( match(trust_principal, \"^[0-9]{12}$\"), trust_principal, principal_account_from_arn ) | eval trust_type=case( trust_principal=\"*\", \"wildcard\", isnotnull(role_account_id) AND isnotnull(principal_account_id) AND principal_account_id!=role_account_id, \"external\" ) | where trust_type=\"wildcard\" OR trust_type=\"external\" | eval event_key=coalesce(eventID, md5(_raw)) | dedup event_key trust_principal | table _time eventID user_arn src role_name role_arn role_account_id trust_type trust_principal principal_account_id trust_action","pages":["detections/cloud/aws_iam_role_created_with_external_trust.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=aws:cloudtrail eventSource=\"logs.amazonaws.com\" eventName IN ( \"DescribeLogGroups\", \"DescribeLogStreams\", \"DownloadLogEvents\", \"FilterLogEvents\", \"GetLogEvents\", \"GetQueryResults\" ) | eval user='userIdentity.principalId' | eval vendor_account=coalesce( vendor_account, recipientAccountId, 'userIdentity.accountId' ) | eval role_name='userIdentity.sessionContext.sessionIssuer.userName' | eval signature=coalesce(signature, eventName) | eval src=coalesce(src, sourceIPAddress) | eval user_agent=coalesce(user_agent, userAgent) | eval vendor_region=coalesce(vendor_region, awsRegion) | where isnotnull(user) AND len(trim(user)) > 0 | dedup eventID keepempty=true | sort 0 _time | streamstats time_window=5m count AS event_count by user vendor_account | where event_count > 500 | stats max(_time) AS lastTime max(event_count) AS event_count min(_time) AS firstTime values(role_name) AS role_name values(signature) AS api_operations values(src) AS src values(user_agent) AS user_agent values(vendor_region) AS vendor_region by user vendor_account | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_repeated_cloudwatch_logs_read_operations.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=aws:cloudtrail eventSource=\"rds.amazonaws.com\" eventName=ModifyDBInstance \"requestParameters.masterUserPassword\"=* | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(requestParameters.dBInstanceIdentifier) as database_id BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_credential_access_rds_password_reset.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail eventSource=\"rds.amazonaws.com\" eventName=ModifyDBInstance \"requestParameters.masterUserPassword\"=* | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(requestParameters.dBInstanceIdentifier) as database_id BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_credential_access_rds_password_reset.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventSource=\"s3.amazonaws.com\" eventName=\"PutBucketAcl\" errorCode=success userAgent IN (\"[aws-cli*\", \"aws-cli*\") | rename requestParameters.bucketName AS bucketName requestParameters.accessControlList.x-amz-grant-read AS grantRead requestParameters.accessControlList.x-amz-grant-read-acp AS grantReadAcp requestParameters.accessControlList.x-amz-grant-write AS grantWrite requestParameters.accessControlList.x-amz-grant-write-acp AS grantWriteAcp requestParameters.accessControlList.x-amz-grant-full-control AS grantFullControl requestParameters.x-amz-acl AS cannedAcl, userIdentity.principalId AS principalId userIdentity.userName AS userName userIdentity.arn AS userArn | eval grantRead=coalesce(grantRead,\"-\"), grantReadAcp=coalesce(grantReadAcp,\"-\"), grantWrite=coalesce(grantWrite,\"-\"), grantWriteAcp=coalesce(grantWriteAcp,\"-\"), grantFullControl=coalesce(grantFullControl,\"-\"), cannedAcl=coalesce(cannedAcl,\"-\"), user=coalesce(userName,userArn) | eval publicGrant = if( match(grantRead, \"(?i)AllUsers|AuthenticatedUsers\") OR match(grantReadAcp, \"(?i)AllUsers|AuthenticatedUsers\") OR match(grantWrite, \"(?i)AllUsers|AuthenticatedUsers\") OR match(grantWriteAcp, \"(?i)AllUsers|AuthenticatedUsers\") OR match(grantFullControl, \"(?i)AllUsers|AuthenticatedUsers\"), 1, 0 ) | eval publicCanned = if(cannedAcl IN (\"public-read\", \"public-read-write\", \"authenticated-read\"), 1, 0) | where publicGrant=1 OR publicCanned=1 | eval exposure=case(cannedAcl==\"public-read-write\",\"public-write\", match(grantWrite.\"\".grantWriteAcp.\"\".grantFullControl,\"(?i)AllUsers\"),\"public-write\", cannedAcl==\"public-read\" OR match(grantRead,\"(?i)AllUsers\"),\"public-read\", cannedAcl==\"authenticated-read\" OR match(grantRead,\"(?i)AuthenticatedUsers\"),\"authenticated-read\", true(),\"custom-grant\") | stats count min(_time) AS firstTime max(_time) AS lastTime values(cannedAcl) AS cannedAcl values(grantRead) AS grantRead values(grantReadAcp) AS grantReadAcp values(grantWrite) AS grantWrite values(grantWriteAcp) AS grantWriteAcp values(grantFullControl) AS grantFullControl values(eventName) AS eventName BY user principalId userAgent bucketName exposure | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/detect_new_open_s3_buckets_over_aws_cli.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=aws:cloudtrail eventSource=bedrock.amazonaws.com eventName=DeleteGuardrail | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(requestParameters.guardrailIdentifier) as guardrailIds by src user user_agent vendor_account vendor_product dest signature vendor_region | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_bedrock_delete_guardrails.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventSource=bedrock.amazonaws.com eventName=DeleteKnowledgeBase | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(requestParameters.knowledgeBaseId) as knowledgeBaseIds by src user user_agent vendor_account vendor_product dest signature vendor_region | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_bedrock_delete_knowledge_base.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventSource=bedrock.amazonaws.com eventName=DeleteModelInvocationLoggingConfiguration | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime by src user user_agent vendor_account vendor_product dest signature vendor_region | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_bedrock_delete_model_invocation_logging_configuration.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventSource=bedrock.amazonaws.com eventName=InvokeModel errorCode=AccessDenied | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(requestParameters.modelId) as modelIds by src user user_agent vendor_account vendor_product dest signature vendor_region result result_id | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_bedrock_invoke_model_access_denied.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventSource=bedrock.amazonaws.com eventName=ListFoundationModels errorCode=AccessDenied | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(errorCode) as errorCodes values(errorMessage) as errorMessages by src user user_agent vendor_account vendor_product dest signature vendor_region | where count > 9 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_bedrock_high_number_list_foundation_model_failures.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail eventSource=bedrock.amazonaws.com eventName=DeleteGuardrail | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(requestParameters.guardrailIdentifier) as guardrailIds by src user user_agent vendor_account vendor_product dest signature vendor_region | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_bedrock_delete_guardrails.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventSource=bedrock.amazonaws.com eventName=DeleteKnowledgeBase | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(requestParameters.knowledgeBaseId) as knowledgeBaseIds by src user user_agent vendor_account vendor_product dest signature vendor_region | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_bedrock_delete_knowledge_base.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventSource=bedrock.amazonaws.com eventName=DeleteModelInvocationLoggingConfiguration | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime by src user user_agent vendor_account vendor_product dest signature vendor_region | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_bedrock_delete_model_invocation_logging_configuration.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventSource=bedrock.amazonaws.com eventName=InvokeModel errorCode=AccessDenied | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(requestParameters.modelId) as modelIds by src user user_agent vendor_account vendor_product dest signature vendor_region result result_id | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_bedrock_invoke_model_access_denied.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventSource=bedrock.amazonaws.com eventName=ListFoundationModels errorCode=AccessDenied | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime values(errorCode) as errorCodes values(errorMessage) as errorMessages by src user user_agent vendor_account vendor_product dest signature vendor_region | where count > 9 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_bedrock_high_number_list_foundation_model_failures.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventSource=ecr.amazonaws.com eventName=DescribeImageScanFindings | spath path=responseElements.imageScanFindings.findings{} output=findings | mvexpand findings | spath input=findings | search severity IN (\"LOW\", \"INFORMATIONAL\", \"UNKNOWN\") | rename name as finding_name, description as finding_description, requestParameters.imageId.imageDigest as imageDigest, requestParameters.repositoryName as repository | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product finding_name finding_description imageDigest repository | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_ecr_container_scanning_findings_low_informational_unknown.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventSource=ecr.amazonaws.com eventName=DescribeImageScanFindings | spath path=responseElements.imageScanFindings.findings{} output=findings | mvexpand findings | spath input=findings | search severity=HIGH | rename name as finding_name, description as finding_description, requestParameters.imageId.imageDigest as imageDigest, requestParameters.repositoryName as repository | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product finding_name finding_description imageDigest repository | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_ecr_container_scanning_findings_high.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventSource=ecr.amazonaws.com eventName=DescribeImageScanFindings | spath path=responseElements.imageScanFindings.findings{} output=findings | mvexpand findings | spath input=findings | search severity=MEDIUM | rename name as finding_name, description as finding_description, requestParameters.imageId.imageDigest as imageDigest, requestParameters.repositoryName as repository | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product finding_name finding_description imageDigest repository | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_ecr_container_scanning_findings_medium.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=aws:cloudtrail eventSource=ecr.amazonaws.com eventName=PutImage NOT userName IN (user) | rename requestParameters.* as * | rename repositoryName AS image | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature user user_agent src vendor_account vendor_region vendor_product image | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_ecr_container_upload_unknown_user.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=aws:cloudtrail eventSource=ecr.amazonaws.com eventName=PutImage date_hour>=20 OR date_hour<8 OR date_wday=saturday OR date_wday=sunday | rename requestParameters.* as * | rename repositoryName AS repository | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature user user_agent src vendor_account vendor_region vendor_product repository | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_ecr_container_upload_outside_business_hours.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail eventSource=ecr.amazonaws.com eventName=PutImage NOT userName IN (user) | rename requestParameters.* as * | rename repositoryName AS image | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature user user_agent src vendor_account vendor_region vendor_product image | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_ecr_container_upload_unknown_user.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=aws:cloudtrail eventSource=ecr.amazonaws.com eventName=PutImage date_hour>=20 OR date_hour<8 OR date_wday=saturday OR date_wday=sunday | rename requestParameters.* as * | rename repositoryName AS repository | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature user user_agent src vendor_account vendor_region vendor_product repository | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_ecr_container_upload_outside_business_hours.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventSource=iam.amazonaws.com eventName=DeleteGroup errorCode IN (NoSuchEntityException,DeleteConflictException, AccessDenied) (userAgent!=*.amazonaws.com) | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_iam_failure_group_deletion.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventSource=iam.amazonaws.com eventName=DeleteGroup errorCode=success (userAgent!=*.amazonaws.com) | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_iam_successful_group_deletion.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=aws:cloudtrail eventSource=lambda.amazonaws.com eventName=UpdateFunctionCode* errorCode = success user_type=IAMUser | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_lambda_updatefunctioncode.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=aws:cloudtrail eventSource=lambda.amazonaws.com eventName=UpdateFunctionCode* errorCode = success user_type=IAMUser | rename user_name as user | stats count min(_time) as firstTime max(_time) as lastTime BY signature dest user user_agent src vendor_account vendor_region vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/aws_lambda_updatefunctioncode.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudtrail eventSource=s3.amazonaws.com eventName=PutBucketAcl | rex field=_raw \"(?{.+})\" | spath input=json_field output=grantees path=requestParameters.AccessControlPolicy.AccessControlList.Grant{} | search grantees=* | mvexpand grantees | spath input=grantees output=uri path=Grantee.URI | spath input=grantees output=permission path=Permission | search uri IN (\"http://acs.amazonaws.com/groups/global/AllUsers\",\"http://acs.amazonaws.com/groups/global/AuthenticatedUsers\") | search permission IN (\"READ\",\"READ_ACP\",\"WRITE\",\"WRITE_ACP\",\"FULL_CONTROL\") | rename requestParameters.bucketName AS bucketName | stats count min(_time) as firstTime max(_time) as lastTime BY user_arn userIdentity.principalId userAgent uri permission bucketName | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/detect_new_open_s3_buckets.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:cloudwatchlogs:vpcflow action=blocked (src_ip=10.0.0.0/8 OR src_ip=172.16.0.0/12 OR src_ip=192.168.0.0/16) ( dest_ip!=10.0.0.0/8 AND dest_ip!=172.16.0.0/12 AND dest_ip!=192.168.0.0/16) [search sourcetype=aws:cloudwatchlogs:vpcflow action=blocked (src_ip=10.0.0.0/8 OR src_ip=172.16.0.0/12 OR src_ip=192.168.0.0/16) ( dest_ip!=10.0.0.0/8 AND dest_ip!=172.16.0.0/12 AND dest_ip!=192.168.0.0/16) | stats count as numberOfBlockedConnections BY src_ip | inputlookup baseline_blocked_outbound_connections append=t | fields - latestCount | stats values(*) as * BY src_ip | rename numberOfBlockedConnections as latestCount | eval newAvgBlockedConnections=avgBlockedConnections + (latestCount-avgBlockedConnections)/720 | eval newStdevBlockedConnections=sqrt(((pow(stdevBlockedConnections, 2)*719 + (latestCount-newAvgBlockedConnections)*(latestCount-avgBlockedConnections))/720)) | eval avgBlockedConnections=coalesce(newAvgBlockedConnections, avgBlockedConnections), stdevBlockedConnections=coalesce(newStdevBlockedConnections, stdevBlockedConnections), numDataPoints=if(isnull(latestCount), numDataPoints, numDataPoints+1) | table src_ip, latestCount, numDataPoints, avgBlockedConnections, stdevBlockedConnections | outputlookup baseline_blocked_outbound_connections | eval dataPointThreshold = 5, deviationThreshold = 3 | eval isSpike=if((latestCount > avgBlockedConnections+deviationThreshold*stdevBlockedConnections) AND numDataPoints > dataPointThreshold, 1, 0) | where isSpike=1 | table src_ip] | stats values(dest_ip) as dest_ip, values(interface_id) as \"resourceId\" count as numberOfBlockedConnections, dc(dest_ip) as uniqueDestConnections BY src_ip","pages":["detections/cloud/detect_spike_in_blocked_outbound_traffic_from_your_aws.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=aws:s3:accesslogs http_status=200 [search sourcetype=aws:s3:accesslogs http_status=200 | stats earliest(_time) as firstTime latest(_time) as lastTime BY bucket_name remote_ip | inputlookup append=t previously_seen_S3_access_from_remote_ip | stats min(firstTime) as firstTime, max(lastTime) as lastTime BY bucket_name remote_ip | outputlookup previously_seen_S3_access_from_remote_ip | eval newIP=if(firstTime >= relative_time(now(), \"-70m@m\"), 1, 0) | where newIP=1 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime) | table bucket_name remote_ip] | iplocation remote_ip | rename remote_ip as src_ip | table _time bucket_name src_ip City Country operation request_uri","pages":["detections/cloud/detect_s3_access_from_a_new_ip.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-subsearch"} @@ -874,7 +874,7 @@ {"query":"sourcetype=azure:monitor:aad operationName=\"Sign-in activity\" properties.status.errorCode=65004 | rename properties.* as * | fillnull | stats count min(_time) as firstTime max(_time) as lastTime BY dest user src vendor_account vendor_product appDisplayName status.failureReason signature | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/azure_ad_user_consent_denied_for_oauth_application.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=azure:monitor:aad operationName=\"Update authorization policy\" | rename properties.* as * | eval index_number = if(mvfind('targetResources{}.modifiedProperties{}.displayName',\"AllowUserConsentForRiskyApps\") >= 0, mvfind('targetResources{}.modifiedProperties{}.displayName',\"AllowUserConsentForRiskyApps\"), -1) | search index_number >= 0 | eval AllowUserConsentForRiskyApps = mvindex('targetResources{}.modifiedProperties{}.newValue',index_number) | search AllowUserConsentForRiskyApps = \"[true]\" | rename userAgent as user_agent | fillnull | stats count min(_time) as firstTime max(_time) as lastTime by dest user src vendor_account vendor_product user_agent signature | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/azure_ad_block_user_consent_for_risky_apps_disabled.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=azure:monitor:aad operationName=\"Update user\" properties.targetResources{}.modifiedProperties{}.displayName=SourceAnchor | rename properties.* as * | rename initiatedBy.user.userPrincipalName as initiatedBy | rename targetResources{}.modifiedProperties{}.newValue as modifiedProperties | fillnull | stats count min(_time) as firstTime max(_time) as lastTime BY dest user src vendor_account vendor_product initiatedBy signature | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/azure_ad_user_immutableid_attribute_updated.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=azure:monitor:aad operationName=\"Update user\" | rename properties.* as * | eval propertyName = mvindex('targetResources{}.modifiedProperties{}.displayName',0) | search propertyName = StrongAuthenticationMethod | eval oldvalue = mvindex('targetResources{}.modifiedProperties{}.oldValue',0) | eval newvalue = mvindex('targetResources{}.modifiedProperties{}.newValue',0) | rex field=newvalue max_match=0 \"(?i)(?\\\"MethodType\\\")\" | rex field=oldvalue max_match=0 \"(?i)(?\\\"MethodType\\\")\" | eval count_new_method_type = coalesce(mvcount(new_method_type), 0) | eval count_old_method_type = coalesce(mvcount(old_method_type), 0) | fillnull | stats count min(_time) as firstTime max(_time) as lastTime by dest user src vendor_account vendor_product newvalue oldvalue signature | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/azure_ad_new_mfa_method_registered.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=azure:monitor:aad operationName=\"Update user\" | rename properties.* as * | eval propertyName = mvindex('targetResources{}.modifiedProperties{}.displayName',0) | search propertyName = StrongAuthenticationMethod | eval oldvalue = mvindex('targetResources{}.modifiedProperties{}.oldValue',0) | eval newvalue = mvindex('targetResources{}.modifiedProperties{}.newValue',0) | rex field=newvalue max_match=0 \"(?i)(?\\\"MethodType\\\")\" | rex field=oldvalue max_match=0 \"(?i)(?\\\"MethodType\\\")\" | eval count_new_method_type = coalesce(mvcount(new_method_type), 0) | eval count_old_method_type = coalesce(mvcount(old_method_type), 0) | fillnull | stats count min(_time) as firstTime max(_time) as lastTime by dest user src vendor_account vendor_product newvalue oldvalue signature | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/azure_ad_new_mfa_method_registered.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=azure:monitor:aad properties.authenticationDetails{}.succeeded=true category=NonInteractiveUserSignInLogs action=success | rename properties.* as * | bucket span=5m _time | rename userAgent as user_agent | fillnull | stats count min(_time) as firstTime max(_time) as lastTime dc(src) as unique_ips values(dest) as dest values(src) as src values(user_agent) as user_agent BY user _time vendor_account vendor_product category | where unique_ips > 1 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/azure_ad_concurrent_sessions_from_different_ips.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=azure:monitor:aad properties.authenticationDetails{}.succeeded=true category=SignInLogs | rename properties.* as * | bucket span=30m _time | fillnull | stats count min(_time) as firstTime max(_time) as lastTime dc(src) AS unique_ips values(dest) as dest values(src) as src BY user vendor_account vendor_product signature | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime) | where unique_ips > 1","pages":["detections/cloud/azure_ad_successful_authentication_from_different_ips.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=azure:monitor:activity operationName=\"* DeviceManagementConfigurationPolicy*\" | rename identity as user, properties.TargetObjectIds{} as TargetObjectId, properties.TargetDisplayNames{} as TargetDisplayName, properties.Actor.IsDelegatedAdmin as user_isDelegatedAdmin | eval details=mvzip('properties.Targets{}.ModifiedProperties{}.Name','properties.Targets{}.ModifiedProperties{}.New',\": \") | rex field=\"operationName\" \"^(?P\\w+)\\s\" | replace \"Patch\" with \"updated\", \"Create\" with \"created\", \"Delete\", with \"deleted\", \"assign\", with \"assigned\" IN action | eval action=if(match(operationName ,\"Assignment$\"),\"assigned\",'action') | table _time operationName action user user_type user_isDelegatedAdmin TargetDisplayName TargetObjectId details status tenantId correlationId","pages":["detections/cloud/microsoft_intune_devicemanagementconfigurationpolicies.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -901,11 +901,11 @@ {"query":"sourcetype=cisco:asa message_id IN (502101) | fillnull | stats count earliest(_time) as firstTime latest(_time) as lastTime values(action) as action values(message_id) as message_id values(result) as result values(privilege_level) as privilege_level by host user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_asa___new_local_user_account_created.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=cisco:asa message_id IN (502102) | fillnull | stats count earliest(_time) as firstTime latest(_time) as lastTime values(action) as action values(message_id) as message_id values(result) as result values(privilege_level) as privilege_level by host user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_asa___user_account_deleted_from_local_database.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=cisco:asa message_id IN (502103) | fillnull | stats earliest(_time) as firstTime latest(_time) as lastTime values(action) as action values(message_id) as message_id values(old_privilege_level) as old_privilege_level values(new_privilege_level) as new_privilege_level by host user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_asa___user_privilege_level_change.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=cisco:duo:activity \"action.name\"=admin_login NOT access_device.browser IN (Chrome) | rename actor.name as user access_device.ip.address as src_ip | stats count min(_time) as firstTime max(_time) as lastTime BY access_device.browser access_device.browser_version src_ip access_device.location.city access_device.location.country access_device.location.state access_device.os access_device.os_version actor.details actor.type outcome.result user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_duo_admin_login_unusual_browser.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=cisco:duo:activity \"action.name\"=admin_login NOT access_device.location.country IN (\"United States\") | rename actor.name as user access_device.ip.address as src_ip | stats count min(_time) as firstTime max(_time) as lastTime BY access_device.browser access_device.browser_version src_ip access_device.location.city access_device.location.country access_device.location.state access_device.os access_device.os_version actor.details actor.type outcome.result user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_duo_admin_login_unusual_country.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=cisco:duo:activity \"action.name\"=admin_login NOT access_device.os IN (\"Mac OS X\") | rename actor.name as user access_device.ip.address as src_ip | stats count min(_time) as firstTime max(_time) as lastTime BY access_device.browser access_device.browser_version src_ip access_device.location.city access_device.location.country access_device.location.state access_device.os access_device.os_version actor.details actor.type outcome.result user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_duo_admin_login_unusual_os.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=cisco:duo:activity \"action.name\"=admin_login NOT access_device.browser IN (Chrome) | rename actor.name as user access_device.ip.address as src_ip | stats count min(_time) as firstTime max(_time) as lastTime BY access_device.browser access_device.browser_version src_ip access_device.location.city access_device.location.country access_device.location.state access_device.os access_device.os_version actor.details actor.type outcome.result user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_duo_admin_login_unusual_browser.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=cisco:duo:activity \"action.name\"=admin_login NOT access_device.location.country IN (\"United States\") | rename actor.name as user access_device.ip.address as src_ip | stats count min(_time) as firstTime max(_time) as lastTime BY access_device.browser access_device.browser_version src_ip access_device.location.city access_device.location.country access_device.location.state access_device.os access_device.os_version actor.details actor.type outcome.result user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_duo_admin_login_unusual_country.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=cisco:duo:activity \"action.name\"=admin_login NOT access_device.os IN (\"Mac OS X\") | rename actor.name as user access_device.ip.address as src_ip | stats count min(_time) as firstTime max(_time) as lastTime BY access_device.browser access_device.browser_version src_ip access_device.location.city access_device.location.country access_device.location.state access_device.os access_device.os_version actor.details actor.type outcome.result user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_duo_admin_login_unusual_os.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=cisco:duo:activity action.name=user_update | spath input=target.details path=status output=status | spath input=old_target.details path=status output=old_status | search status=Bypass old_status=Active | rename target.name as user access_device.ip.address as src_ip | stats count min(_time) as firstTime max(_time) as lastTime BY access_device.browser access_device.browser_version src_ip access_device.location.city access_device.location.country access_device.location.state access_device.os access_device.os_version action.name actor.details actor.name actor.type old_target.details target.details status old_status user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_duo_set_user_status_to_bypass_2fa.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=cisco:duo:administrator action=bypass_create | rename object as user | stats count min(_time) as firstTime max(_time) as lastTime BY action actionlabel description user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_duo_bypass_code_generation.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=cisco:duo:administrator action=bypass_create | rename object as user | stats count min(_time) as firstTime max(_time) as lastTime BY action actionlabel description user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_duo_bypass_code_generation.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=cisco:duo:administrator action=policy_bulk_delete | rename username as user | spath input=description | rex field=policies max_match=0 \"(?[^:,]+):\\s+\" | eval policy_count=mvcount(policy_name) | where policy_count > 3 | stats count min(_time) as firstTime max(_time) as lastTime by action actionlabel description user admin_email policy_count | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_duo_bulk_policy_deletion.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=cisco:duo:administrator action=policy_update OR action=policy_create | spath input=description | search allow_rooted_devices=true | rename object as user | stats count min(_time) as firstTime max(_time) as lastTime BY action actionlabel description user admin_email | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_duo_policy_allow_tampered_devices.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=cisco:duo:administrator action=policy_update OR action=policy_create | spath input=description | search auth_status=\"Allow access without 2FA\" | rename object as user | stats count min(_time) as firstTime max(_time) as lastTime BY action actionlabel description user admin_email | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_duo_policy_bypass_2fa.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} @@ -925,7 +925,7 @@ {"query":"sourcetype=cisco:ios facility=\"SEC_LOGIN\" mnemonic IN (\"QUIET_MODE_ON\", \"LOGIN_SUCCESS\", \"LOGIN_FAILED\") message_text=\"*[localport: 21111]*\" | rex field=_raw \"\\[user:\\s*(?[^\\]]+)\\]\" | rex field=_raw \"\\[Source:\\s*(?[^\\]]+)\\]\" | rex field=_raw \"\\[localport:\\s*(?[^\\]]+)\\]\" | rex field=_raw \"\\[Reason:\\s*(?[^\\]]+)\\]\" | rex field=_raw \"\\[ACL:\\s*(?[^\\]]+)\\]\" | eval dest=coalesce(host, dvc, dest, \"unknown\") | stats count min(_time) as firstTime max(_time) as lastTime values(local_port) as local_port values(acl) as acl by dest user src_ip reason | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_ios_xe_webui_login_from_iosd_local_port.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=cisco:ios facility=\"SYS\" mnemonic=\"CONFIG_P\" message_text=\"*Configured programmatically by process SEP_webui_wsma_http*\" | rex field=_raw \"process\\s(?\\S+)\\sfrom.*as\\s(?\\S+)\\son\\s(?\\S+)\" | eval dest=coalesce(host, dvc, dest, \"unknown\") | stats count min(_time) as firstTime max(_time) as lastTime values(process) as process values(vty) as vty by dest user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/cisco_ios_xe_webui_programmatic_configuration.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=cisco:isovalent process_kprobe.action!=\"\" | bin _time span=5m | rename process_kprobe.parent.pod.name as pod_name | stats count as kprobe_count values(process_kprobe.function_name) as functions values(process_kprobe.process.binary) as binaries values(process_kprobe.args{}.string_arg) as args by pod_name _time | where kprobe_count > 10","pages":["detections/endpoint/cisco_isovalent___kprobe_spike.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=cisco:isovalent:processConnect | rename process_connect.parent.binary as binary | search binary != \"*/app/aws-vpc-cni\" AND binary != \"*/bin/amazon-ssm-agent\" AND binary != \"*/bin/ssm-agent-worker\" | stats count min(_time) as firstTime max(_time) as lastTime values(dest_port) as dest_port values(src_ip) as src_ip by cluster_name pod_name pod_image_name pod_namespace node_name dest_ip | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/cisco_isovalent___access_to_cloud_metadata_service.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=cisco:isovalent:processConnect | rename process_connect.parent.binary as binary | search binary != \"*/app/aws-vpc-cni\" AND binary != \"*/bin/amazon-ssm-agent\" AND binary != \"*/bin/ssm-agent-worker\" | stats count min(_time) as firstTime max(_time) as lastTime values(dest_port) as dest_port values(src_ip) as src_ip by cluster_name pod_name pod_image_name pod_namespace node_name dest_ip | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/cisco_isovalent___access_to_cloud_metadata_service.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=cisco:isovalent:processExec ( process_name IN (\"nsenter\",\"mount\",\"ps\",\"ls\") OR process IN (\"*nsenter*\", \"*mount*\", \"*ps aux*\", \"*ps -ef*\") ) | bin _time span=5m | stats count AS total_events dc(process_name) AS distinct_cmds min(_time) AS firstTime max(_time) AS lastTime values(process) AS process values(process_name) AS process_name BY cluster_name node_name pod_name _time | eval duration_s = round(lastTime - firstTime, 0) | where distinct_cmds >= 2 AND duration_s <= 120 | table _time cluster_name node_name pod_name total_events distinct_cmds duration_s firstTime lastTime process process_name | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/cisco_isovalent___potential_escape_to_host.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=cisco:isovalent:processExec pod_name!=\"\" | search NOT pod_image_name IN (\"docker.io/library/ubuntu:22.04\",\"docker.io/grafana/grafana:12.0.1\", \"quay.io/isovalent-dev/tetragon-ci*\",\"quay.io/isovalent/tetragon-ci*\",\"quay.io/isovalent/hubble-export-fluentd*\") | stats count min(_time) as firstTime max(_time) as lastTime by pod_image_name pod_namespace pod_name process_name cluster_name | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/cisco_isovalent___non_allowlisted_image_use.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=cisco:isovalent:processExec process_name IN ( /* --- Network Scanning / Enumeration --- */ \"nmap\", \"masscan\", \"zmap\", \"amap\", \"netcat\", \"nc\", \"hping3\", \"ike-scan\", \"dnsenum\", \"dnsrecon\", \"fierce\", \"theharvester\", \"sublist3r\", /* --- Exploitation Frameworks --- */ \"metasploit\", \"msfconsole\", \"msfvenom\", \"empire\", \"pupy\", \"covenant\", \"havoc\", \"sliver-client\", \"sliver-server\", \"poshc2\", \"mythic\", \"evilginx\", \"beef-xss\", /* --- Credential Access / Cracking --- */ \"hydra\", \"medusa\", \"john\", \"hashcat\", \"crowbar\", \"patator\", \"mimikatz\", \"impacket-\", /* --- Reconnaissance / Enumeration --- */ \"ldapdomaindump\", \"enum4linux\", \"smbclient\", \"smbmap\", \"crackmapexec\", \"bloodhound\", \"sharphound\", \"linpeas\", \"linenum\", \"pspy\", \"ldpreload\", /* --- Privilege Escalation / Persistence --- */ \"peass-ng\", \"linpeas\", \"linux-exploit-suggester\", \"les\", \"exploitdb\", \"persistence\", \"dirtycow\", \"dirtypipe\", \"sudo_killer\") | stats count min(_time) as firstTime max(_time) as lastTime values(process) as process by cluster_name container_id pod_name pod_namespace pod_image_name parent_process_name process_name process_exec process_id node_name | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/cisco_isovalent___pods_running_offensive_tools.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -952,7 +952,7 @@ {"query":"sourcetype=github:cloud:audit vendor_action=repo.destroy | fillnull | stats count min(_time) as firstTime max(_time) as lastTime BY actor, actor_id, actor_is_bot, actor_location.country_code, business, business_id, org, org_id, repo, repo_id, user_agent, visibility, vendor_action | eval user=actor | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/github_organizations_repository_deleted.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=github:cloud:audit vendor_action=repository_ruleset.destroy | fillnull | stats count min(_time) as firstTime max(_time) as lastTime BY actor, actor_id, actor_ip, actor_is_bot, actor_location.country_code, business, business_id, org, org_id, repo, repo_id, user_agent, vendor_action, ruleset_name | eval user=actor | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/github_organizations_delete_branch_ruleset.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=github:cloud:audit vendor_action=repository_vulnerability_alerts.disable | fillnull | stats count min(_time) as firstTime max(_time) as lastTime BY actor, actor_id, actor_ip, actor_is_bot, actor_location.country_code, business, business_id, org, org_id, repo, repo_id, user, user_agent, user_id, vendor_action | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/github_organizations_disable_dependabot.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=gsuite:calendar:json | bin span=5m _time | rename parameters.* as * | search target_calendar_id!=null email=\"*yourdomain.com\" | stats count values(target_calendar_id) values(event_title) values(event_guest) BY email _time | where count >100","pages":["detections/cloud/gsuite_suspicious_calendar_invite.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=gsuite:calendar:json | bin span=5m _time | rename parameters.* as * | search target_calendar_id!=null email=\"*yourdomain.com\" | stats count values(target_calendar_id) values(event_title) values(event_guest) BY email _time | where count >100","pages":["detections/cloud/gsuite_suspicious_calendar_invite.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=gsuite:gmail:bigquery \"attachment{}.file_extension_type\" IN (\"pl\", \"py\", \"rb\", \"sh\", \"bat\", \"exe\", \"dll\", \"cpl\", \"com\", \"js\", \"vbs\", \"ps1\", \"reg\",\"swf\", \"cmd\", \"go\") | eval phase=\"plan\" | eval severity=\"medium\" | stats count min(_time) as firstTime max(_time) as lastTime values(attachment{}.file_extension_type) as email_attachments, values(attachment{}.sha256) as attachment_sha256, values(payload_size) as payload_size BY destination{}.service num_message_attachments subject destination{}.address source.address phase severity | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/gsuite_email_suspicious_attachment.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=gsuite:gmail:bigquery \"link_domain{}\" IN (\"*pastebin.com*\", \"*discord*\", \"*telegram*\",\"t.me\") | rex field=source.from_header_address \"[^@]+@(?[^@]+)\" | rex field=destination{}.address \"[^@]+@(?[^@]+)\" | where not source_domain=\"internal_test_email.com\" and dest_domain=\"internal_test_email.com\" | eval phase=\"plan\" | eval severity=\"low\" | stats values(link_domain{}) as link_domains min(_time) as firstTime max(_time) as lastTime count BY is_spam source.address source.from_header_address subject destination{}.address phase severity | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/gsuite_email_with_known_abuse_web_service_link.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=gsuite:gmail:bigquery num_message_attachments > 0 subject IN (\"*dhl*\", \"* ups *\", \"*delivery*\", \"*parcel*\", \"*label*\", \"*invoice*\", \"*postal*\", \"* fedex *\", \"* usps *\", \"* express *\", \"*shipment*\", \"*Banking/Tax*\",\"*shipment*\", \"*new order*\") attachment{}.file_extension_type IN (\"doc\", \"docx\", \"xls\", \"xlsx\", \"ppt\", \"pptx\", \"pdf\", \"zip\", \"rar\", \"html\",\"htm\",\"hta\") | rex field=source.from_header_address \"[^@]+@(?[^@]+)\" | rex field=destination{}.address \"[^@]+@(?[^@]+)\" | where not source_domain=\"internal_test_email.com\" and dest_domain=\"internal_test_email.com\" | eval phase=\"plan\" | eval severity=\"medium\" | stats count min(_time) as firstTime max(_time) as lastTime values(attachment{}.file_extension_type) as email_attachments, values(attachment{}.sha256) as attachment_sha256, values(payload_size) as payload_size BY destination{}.service num_message_attachments subject destination{}.address source.address phase severity | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/gsuite_email_suspicious_subject_with_attachment.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -964,8 +964,8 @@ {"query":"sourcetype=gws:reports:login event.type = login event.name = login_failure | bucket span=5m _time | stats count dc(user) AS unique_accounts values(user) as tried_accounts values(authentication_method) AS authentication_method earliest(_time) as firstTime latest(_time) as lastTime BY _time event.name src app id.applicationName | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime) | where unique_accounts > 20","pages":["detections/cloud/gcp_multiple_users_failing_to_authenticate_from_ip.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=gws:reports:login event.type = login event.name = login_failure | bucket span=5m _time | stats dc(user_name) AS unique_accounts values(user_name) as tried_accounts values(authentication_method) AS authentication_method BY _time, src | eventstats avg(unique_accounts) as ip_avg , stdev(unique_accounts) as ip_std BY _time | eval upperBound=(ip_avg+ip_std*3) | eval isOutlier=if(unique_accounts > 10 and unique_accounts >= upperBound, 1, 0) | where isOutlier =1","pages":["detections/cloud/gcp_unusual_number_of_failed_authentications_from_ip.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=ivanti_vtm_audit OPERATION=\"adduser\" MODGROUP=\"admin\" IP=\"!!ABSENT!!\" | stats count min(_time) as firstTime max(_time) as lastTime BY IP, MODUSER, OPERATION, MODGROUP, AUTH | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/ivanti_vtm_new_account_creation.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=kube:container:controller | rex field=_raw \"^(?\\S+)\\s+-\\s+-\\s+\\[(?[^\\]]*)\\]\\s\\\"(?[^\\\"]*)\\\"\\s(?\\S*)\\s(?\\S*)\\s\\\"(?[^\\\"]*)\\\"\\s\\\"(?[^\\\"]*)\\\"\\s(?\\S*)\\s(?\\S*)\\s\\[(?[^\\]]*)\\]\\s\\[(?[^\\]]*)\\]\\s(?\\S*)\\s(?\\S*)\\s(?\\S*)\\s(?\\S*)\\s(?\\S*)\" | rename remote_addr AS src_ip, upstream_status as status, proxy_upstream_name as proxy | rex field=request \"^(?\\S+)\\s(?\\S+)\\s\" | eval phase=\"operate\" | eval severity=\"high\" | stats count min(_time) as firstTime max(_time) as lastTime by src_ip, status, url, http_method, host, http_user_agent, proxy, phase, severity, request | lookup local=t local_file_inclusion_paths local_file_inclusion_paths AS request OUTPUT lfi_path | search lfi_path=yes | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/kubernetes_nginx_ingress_lfi.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=kube:container:controller | rex field=_raw \"^(?\\S+)\\s+-\\s+-\\s+\\[(?[^\\]]*)\\]\\s\\\"(?[^\\\"]*)\\\"\\s(?\\S*)\\s(?\\S*)\\s\\\"(?[^\\\"]*)\\\"\\s\\\"(?[^\\\"]*)\\\"\\s(?\\S*)\\s(?\\S*)\\s\\[(?[^\\]]*)\\]\\s\\[(?[^\\]]*)\\]\\s(?\\S*)\\s(?\\S*)\\s(?\\S*)\\s(?\\S*)\\s(?\\S*)\" | rex field=request \"^(?\\S+)?\\s(?\\S+)\\s\" | rex field=url \"(?\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\" | search dest_ip=* | rename remote_addr AS src_ip, upstream_status as status, proxy_upstream_name as proxy | eval phase=\"operate\" | eval severity=\"medium\" | stats count min(_time) as firstTime max(_time) as lastTime by src_ip, dest_ip status, url, http_method, host, http_user_agent, proxy, phase, severity | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/kubernetes_nginx_ingress_rfi.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=kube:container:controller | rex field=_raw \"^(?\\S+)\\s+-\\s+-\\s+\\[(?[^\\]]*)\\]\\s\\\"(?[^\\\"]*)\\\"\\s(?\\S*)\\s(?\\S*)\\s\\\"(?[^\\\"]*)\\\"\\s\\\"(?[^\\\"]*)\\\"\\s(?\\S*)\\s(?\\S*)\\s\\[(?[^\\]]*)\\]\\s\\[(?[^\\]]*)\\]\\s(?\\S*)\\s(?\\S*)\\s(?\\S*)\\s(?\\S*)\\s(?\\S*)\" | rename remote_addr AS src_ip, upstream_status as status, proxy_upstream_name as proxy | rex field=request \"^(?\\S+)\\s(?\\S+)\\s\" | eval phase=\"operate\" | eval severity=\"high\" | stats count min(_time) as firstTime max(_time) as lastTime by src_ip, status, url, http_method, host, http_user_agent, proxy, phase, severity, request | lookup local=t local_file_inclusion_paths local_file_inclusion_paths AS request OUTPUT lfi_path | search lfi_path=yes | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/kubernetes_nginx_ingress_lfi.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} +{"query":"sourcetype=kube:container:controller | rex field=_raw \"^(?\\S+)\\s+-\\s+-\\s+\\[(?[^\\]]*)\\]\\s\\\"(?[^\\\"]*)\\\"\\s(?\\S*)\\s(?\\S*)\\s\\\"(?[^\\\"]*)\\\"\\s\\\"(?[^\\\"]*)\\\"\\s(?\\S*)\\s(?\\S*)\\s\\[(?[^\\]]*)\\]\\s\\[(?[^\\]]*)\\]\\s(?\\S*)\\s(?\\S*)\\s(?\\S*)\\s(?\\S*)\\s(?\\S*)\" | rex field=request \"^(?\\S+)?\\s(?\\S+)\\s\" | rex field=url \"(?\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\" | search dest_ip=* | rename remote_addr AS src_ip, upstream_status as status, proxy_upstream_name as proxy | eval phase=\"operate\" | eval severity=\"medium\" | stats count min(_time) as firstTime max(_time) as lastTime by src_ip, dest_ip status, url, http_method, host, http_user_agent, proxy, phase, severity | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/kubernetes_nginx_ingress_rfi.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=kube:objects:events object.message IN (\"Pulling image *kube-hunter*\", \"Pulling image *kube-bench*\", \"Pulling image *kube-recon*\", \"Pulling image *kube-recon*\") | rename object.* AS * | rename involvedObject.* AS * | rename source.host AS host | eval phase=\"operate\" | eval severity=\"high\" | stats min(_time) as firstTime max(_time) as lastTime count BY host, name, namespace, kind, reason, message, phase, severity | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/kubernetes_scanner_image_pulling.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=linux_secure process=su | rex \"su:\\s+\\(to\\s+(?\\S+)\\)(?\\s{2,})on\\s+(?\\S+)\" | where len(ltrim(source_user)) == 0 | stats count as total_attempts, min(_time) as firstTime, max(_time) as lastTime, values(target_user) as target_users, values(host) as dest by process | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/endpoint/linux_malformed_auth_entry.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=log4j (\"GW_READY_OK\" OR \"run?c=echo%20GW_READY_OK\" OR \"c=echo%20GW_READY_OK\") | rex field=_raw \"^(?:[^:\\r\\n]+:)?(?\\d{4}-\\d{2}-\\d{2}\\s+\\d{2}:\\d{2}:\\d{2},\\d{3})\\s+(?\\w+)\\s+\\[(?[^\\]]+)\\]\\s+(?\\S+)\\s+-\\s+(?.*)$\" | search logger IN (\"wt.servlet.ServletRequestMonitor.request\", \"wt.method.MethodContextMonitor.contexts.servletRequest\") | rex field=payload \"^(?\\d{4}-\\d{2}-\\d{2}\\s+\\d{2}:\\d{2}:\\d{2}\\.\\d{3})\\s+(?[+\\-]\\d{4}),\\s+(?.*)$\" | eval parts=split(rest,\", \") | eval event_type=case(logger=\"wt.servlet.ServletRequestMonitor.request\",\"servlet_request\",logger=\"wt.method.MethodContextMonitor.contexts.servletRequest\",\"method_context_servlet_request\",true(),\"other\") | eval src_ip=case(event_type=\"servlet_request\",mvindex(parts,2),event_type=\"method_context_servlet_request\",mvindex(parts,5)) | eval uri_path=case(event_type=\"servlet_request\",mvindex(parts,3),event_type=\"method_context_servlet_request\",mvindex(parts,8)) | eval query_string=if(event_type=\"servlet_request\",mvindex(parts,4),null()) | eval http_method=if(event_type=\"servlet_request\",mvindex(parts,5),null()) | eval status=if(event_type=\"servlet_request\",tonumber(mvindex(parts,6)),null()) | rex field=uri_path \"^(?[^\\?]+)(?:\\?(?.*))?$\" | eval query_string=if(query_string=\"-\",null(),query_string) | eval query_string=coalesce(query_string,uri_query) | rex field=query_string \"(?i)(?:^|&)(?[cp])=(?[^&]*)\" | eval query_param=lower(query_param), query_value=urldecode(replace(query_value,\"\\+\",\"%20\")) | where query_param=\"c\" AND match(query_value,\"(?i)^echo(\\s|20)+GW_READY_OK$\") | eval src=src_ip, activity=\"gw_ready_ok_probe\" | stats count min(_time) as firstTime max(_time) as lastTime values(log_level) as log_level values(logger) as logger values(http_method) as http_method values(status) as status values(uri_only) as uri_path values(query_string) as query_string by src activity query_param query_value | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/application/ptc_windchill_gw_ready_ok_probe.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -975,7 +975,7 @@ {"query":"sourcetype=mscs:azure:audit operationName.value=\"Microsoft.Automation/automationAccounts/runbooks/write\" object!=AzureAutomationTutorial* status.value=Succeeded | dedup object | rename claims.ipaddr as src, subscriptionId as vendor_account, operationName.value as operationName | stats count min(_time) as firstTime max(_time) as lastTime BY dest user src vendor_account vendor_product object object_path | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/azure_automation_runbook_created.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=mscs:azure:audit operationName.value=\"Microsoft.Automation/automationAccounts/webhooks/write\" status.value=Succeeded | dedup object | rename claims.ipaddr as src_ip | rename caller as user | stats count min(_time) as firstTime max(_time) as lastTime values(dest) as dest BY object user, src_ip, resourceGroupName, object_path | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/azure_runbook_webhook_created.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=mscs:azure:audit operationName.value=\"Microsoft.Automation/automationAccounts/write\" status.value=Succeeded | dedup object | rename claims.ipaddr as src, subscriptionId as vendor_account, operationName.value as signature | stats count min(_time) as firstTime max(_time) as lastTime BY dest user src vendor_account vendor_product object object_path signature | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/azure_automation_account_created.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=o365:graph:api status.errorCode=65004 | rename userPrincipalName as user | rename ipAddress as src_ip | stats min(_time) as firstTime max(_time) as lastTime BY user src_ip appDisplayName status.failureReason | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_user_consent_denied_for_oauth_application.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=o365:graph:api status.errorCode=65004 | rename userPrincipalName as user | rename ipAddress as src_ip | stats min(_time) as firstTime max(_time) as lastTime BY user src_ip appDisplayName status.failureReason | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_user_consent_denied_for_oauth_application.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=o365:management:activity (Operation=New-InboxRule OR Operation=set-InboxRule) | eval match1=mvfind('Parameters{}.Name', \"ForwardTo\") | eval match2=mvfind('Parameters{}.Name', \"ForwardAsAttachmentTo\") | eval match3=mvfind('Parameters{}.Name', \"RedirectTo\") | where match1>= 0 OR match2>= 0 OR match3>= 0 | eval ForwardTo=coalesce(ForwardTo, ForwardAsAttachmentTo, RedirectTo) | fillnull | stats count min(_time) as firstTime max(_time) as lastTime values(Name) as Name by signature dest user src vendor_account vendor_product ForwardTo | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_new_email_forwarding_rule_created.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=o365:management:activity (Workload=SharePoint Operation=\"SearchQueryPerformed\" SearchQueryText=* EventData=*search*) OR Operation=SearchQueryInitiatedSharepoint | eval command = case(Operation==\"SearchQueryPerformed\",SearchQueryText,true(),QueryText), UserId = lower(UserId), signature_id = CorrelationId, signature=Operation, src = ClientIP, user = lower(UserId), object_name=case(Operation==\"SearchQueryPerformed\",'EventData',true(),QuerySource), -time = _time, suspect_terms = case(match(command, \"(?i)password|credential|login|passwd|shadow|active directory|account|username|network|computer|access|MFA|bank|deposit|payroll|EFT|Electonic Funds|routing\"),command,true(),null()) | where command != \"*\" AND command != \"(*)\" | bin _time span=1hr | stats values(ScenarioName) as app, values(object_name) as object_name values(command) as command, values(suspect_terms) as suspect_terms, values(src) as src, dc(suspect_terms) as suspect_terms_count, dc(command) as count, min(-time) as firstTime, max(-time) as lastTime by user,signature,_time | where count > 20 OR suspect_terms_count >= 2 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_sharepoint_suspicious_search_behavior.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=o365:management:activity Category=ThreatManagement Name=\"eDiscovery search started or exported\" | fillnull | stats count earliest(_time) as firstTime latest(_time) as lastTime BY Source Severity AlertEntityId Name user src vendor_account vendor_product dest signature | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_pst_export_alert.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} @@ -993,10 +993,10 @@ {"query":"sourcetype=o365:management:activity Operation=\"Set Company Information.\" ModifiedProperties{}.Name=StrongAuthenticationPolicy | rex max_match=100 field=ModifiedProperties{}.NewValue \"(?\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\/\\d{1,2})\" | rex max_match=100 field=ModifiedProperties{}.OldValue \"(?\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\/\\d{1,2})\" | eval ip_addresses_old=if(isnotnull(ip_addresses_old),ip_addresses_old,\"0\") | mvexpand ip_addresses_new_added | where isnull(mvfind(ip_addresses_old,ip_addresses_new_added)) | fillnull | stats count min(_time) as firstTime max(_time) as lastTime values(ip_addresses_old) as ip_addresses_old by signature dest user src vendor_account vendor_product ip_addresses_new_added | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_bypass_mfa_via_trusted_ip.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=o365:management:activity Operation=\"Update application.\" | eval json_data=mvindex('ModifiedProperties{}.NewValue',0) | eval json_data=replace(json_data,\"^\\[\\s*\",\"\") | eval json_data=replace(json_data,\"\\s*\\]$\",\"\") | spath input=json_data path=RequiredAppPermissions{}.EntitlementId output=EntitlementIds | eval match_found=mvfind(EntitlementIds, \"810c84a8-4a9e-49e6-bf7d-12d183f40d01\") | where isnotnull(match_found) | fillnull | stats count earliest(_time) as firstTime max(_time) as lastTime values(EntitlementIds) as EntitlementIds by signature, user, dest, vendor_account, vendor_product, object, src | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_mailbox_read_access_granted_to_application.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=o365:management:activity Operation=DLPRuleMatch | eval recipient = 'ExchangeMetaData.To{}', signature_id = 'ExchangeMetaData.UniqueID', signature = 'PolicyDetails{}.Rules{}.RuleName' , src_user = UserId, reason ='PolicyDetails{}.Rules{}.ConditionsMatched.SensitiveInformation{}.SensitiveInformationTypeName', result='PolicyDetails{}.Rules{}.Actions{}', file_name=case(NOT match('PolicyDetails{}.Rules{}.ConditionsMatched.SensitiveInformation{}.Location',\"Message Body\"),'PolicyDetails{}.Rules{}.ConditionsMatched.SensitiveInformation{}.Location') | fillnull | stats count min(_time) as firstTime max(_time) as lastTime values(signature) as signature values(file_name) as file_name values(ExchangeMetaData.Subject) AS subject values(Workload) as app values(result) as result by action dest user src vendor_account vendor_product src_user recipient signature_id reason | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_dlp_rule_triggered.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} -{"query":"sourcetype=o365:management:activity Operation=FileMalwareDetected | rename UserId as user, Id as signature_id | stats values(Workload) as category, values(SourceFileName) as file_name values(ObjectId) as file_path, values(VirusInfo) as signature, count, min(_time) as firstTime, max(_time) as lastTime BY signature_id, user, dest, src, vendor_account, vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_sharepoint_malware_detection.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=o365:management:activity Operation=FileMalwareDetected | rename UserId as user, Id as signature_id | stats values(Workload) as category, values(SourceFileName) as file_name values(ObjectId) as file_path, values(VirusInfo) as signature, count, min(_time) as firstTime, max(_time) as lastTime BY signature_id, user, dest, src, vendor_account, vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_sharepoint_malware_detection.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=o365:management:activity Operation=ModifyFolderPermissions Workload=Exchange object=Inbox Item.ParentFolder.MemberUpn=Everyone | eval isReadRole=if(match('Item.ParentFolder.MemberRights',\"(ReadAny)\"), \"true\", \"false\") | search isReadRole = \"true\" | rename UserId as user | fillnull | stats count earliest(_time) as firstTime latest(_time) as lastTime by signature, user, dest, vendor_account, vendor_product, object, MailboxOwnerUPN, Item.ParentFolder.MemberUpn, Item.ParentFolder.MemberRights, src | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_mailbox_inbox_folder_shared_with_all_users.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=o365:management:activity Operation=SearchQueryInitiatedExchange | eval command = case(Operation==\"SearchQueryPerformed\",SearchQueryText,true(),QueryText), UserId = lower(UserId), signature_id = CorrelationId, signature=Operation, src = ClientIP, user = lower(UserId), object_name=case(Operation==\"SearchQueryPerformed\",'EventData',true(),QuerySource), -time = _time, suspect_terms = case(match(command, \"(?i)password|credential|login|passwd|shadow|active directory|account|username|network|computer|access|MFA|bank|deposit|payroll|EFT|Electonic Funds|routing\"),command,true(),null()) | where command != \"*\" AND command != \"(*)\" | bin _time span=1hr | stats values(ScenarioName) as app, values(object_name) as object_name values(command) as command, values(suspect_terms) as suspect_terms, values(src) as src, dc(suspect_terms) as suspect_terms_count, dc(command) as count, min(-time) as firstTime, max(-time) as lastTime by user,signature,_time | where count > 20 OR suspect_terms_count >= 2 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_email_suspicious_search_behavior.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=o365:management:activity Operation=Set-Mailbox | eval match1=mvfind('Parameters{}.Name',\"ForwardingAddress\") | eval match2=mvfind('Parameters{}.Name', \"ForwardingSmtpAddress\") | where match1>= 0 OR match2>= 0 | eval ForwardTo=coalesce(ForwardingAddress,ForwardingSmtpAddress) | search ForwardTo!=\"\" | rename user_id as user | stats count earliest(_time) as firstTime latest(_time) as lastTime values(ForwardTo) as ForwardTo by signature dest user src vendor_account vendor_product object ObjectId | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_mailbox_email_forwarding_enabled.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=o365:management:activity Operation=Set-Mailbox | eval match1=mvfind('Parameters{}.Name',\"ForwardingAddress\") | eval match2=mvfind('Parameters{}.Name', \"ForwardingSmtpAddress\") | where match1>= 0 OR match2>= 0 | eval ForwardTo=coalesce(ForwardingAddress,ForwardingSmtpAddress) | search ForwardTo!=\"\" | rename user_id as user | stats count earliest(_time) as firstTime latest(_time) as lastTime values(ForwardTo) as ForwardTo by signature dest user src vendor_account vendor_product object ObjectId | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_mailbox_email_forwarding_enabled.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=o365:management:activity Operation=UserLoginFailed record_type=AzureActiveDirectoryStsLogon Workload=AzureActiveDirectory | bucket span=5m _time | fillnull | stats dc(_raw) AS failed_attempts values(src_ip) as src BY signature user _time dest vendor_account vendor_product | where failed_attempts > 10","pages":["detections/cloud/o365_high_number_of_failed_authentications_for_user.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=o365:management:activity Workload=AzureActiveDirectory (Operation=UserLoggedIn OR Operation=UserLoginFailed) | bucket span=5m _time | stats dc(_raw) as failed_attempts dc(ApplicationId) as unique_app_ids dc(UserAgent) as unique_user_agents values(ApplicationId) values(OS) values(signature) as signature BY _time user src vendor_account vendor_product dest | where failed_attempts > 5 and unique_user_agents > 5 and unique_app_ids > 2","pages":["detections/cloud/o365_multiple_appids_and_useragents_authentication_spike.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} {"query":"sourcetype=o365:management:activity Workload=AzureActiveDirectory AND Operation=\"Add user*\" AND ModifiedProperties{}.NewValue=\"[*Guest*]\" AND ModifiedProperties{}.NewValue=\"[*Invitation*]\" | eval user = (mvindex('ModifiedProperties{}.NewValue',5)), src_user = case(match(mvindex('Actor{}.ID',-1),\"User\"),mvindex('Actor{}.ID',0),match(mvindex('Actor{}.ID',-1),\"ServicePrincipal\"),mvindex('Actor{}.ID',3),true(),mvindex('Actor{}.ID',0)) | rex field=user \"(? [ \\w\\.-]+@ [ \\w-]+\\. [ \\w-]{2,4})\" | rename Operation as signature, Id as signature_id | fillnull | stats count min(_time) as firstTime max(_time) as lastTime by dest user src vendor_account vendor_product signature signature_id src_user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_external_guest_user_invited.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} @@ -1028,7 +1028,7 @@ {"query":"sourcetype=o365:management:activity Workload=AzureActiveDirectory UserAuthenticationMethod=* status=failure | stats count earliest(_time) AS firstTime latest(_time) AS lastTime values(UserAuthenticationMethod) AS UserAuthenticationMethod values(UserAgent) AS user_agent values(status) AS status values(src_ip) AS src values(signature) as signature BY user vendor_account vendor_product dest | where count > 10 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_excessive_authentication_failures_alert.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=o365:management:activity Workload=Exchange (Operation IN (\"HardDelete\") AND Folder.Path IN (\"\\\\Sent Items\",\"\\\\Recoverable Items\\\\Deletions\")) | eval user = lower(UserId), sender = lower(CASE(isnotnull(SendAsUserSmtp),SendAsUserSmtp,isnotnull(SendOnBehalfOfUserSmtp),SendOnBehalfOfUserSmtp,true(),MailboxOwnerUPN)), subject = trim(CASE(Operation IN (\"Send\",\"SendAs\",\"SendOnBehalf\"),'Item.Subject',Operation IN (\"SoftDelete\",\"HardDelete\"),'AffectedItems{}.Subject')), -time = _time,file_name = CASE(Operation IN (\"Send\",\"SendAs\",\"SendOnBehalf\"),split('Item.Attachments',\"; \"),Operation IN (\"SoftDelete\",\"HardDelete\"),split('AffectedItems{}.Attachments',\"; \")), file_size = CASE(Operation IN (\"Send\",\"SendAs\",\"SendOnBehalf\"),round(tonumber('Item.SizeInBytes')/1024/1024,2),true(),round(tonumber(replace(file_name, \"(.+)\\s\\((\\d+)(b\\)$)\", \"\\2\"))/1024/1024,2)) | bin _time span=1hr | stats values(sender) as sender, values(ClientIPAddress) as src, values(ClientInfoString) as http_user_agent, values(Operation) as signature, latest(file_name) as file_name, sum(file_size) as file_size, values(Folder.Path) as file_path, min(-time) as firstTime, max(-time) as lastTime, dc(subject) as count by _time,user | where count > 50 OR file_size > 10 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_email_hard_delete_excessive_volume.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=o365:management:activity Workload=Exchange (Operation IN (\"Send*\")) OR (Operation IN (\"HardDelete\") AND Folder.Path IN (\"\\\\Sent Items\",\"\\\\Recoverable Items\\\\Deletions\")) | eval user = lower(UserId), sender = lower(CASE(isnotnull(SendAsUserSmtp),SendAsUserSmtp,isnotnull(SendOnBehalfOfUserSmtp),SendOnBehalfOfUserSmtp,true(),MailboxOwnerUPN)), subject = trim(CASE(Operation IN (\"Send\",\"SendAs\",\"SendOnBehalf\"),'Item.Subject',Operation IN (\"SoftDelete\",\"HardDelete\"),'AffectedItems{}.Subject')), -time = _time,file_name = CASE(Operation IN (\"Send\",\"SendAs\",\"SendOnBehalf\"),split('Item.Attachments',\"; \"),Operation IN (\"SoftDelete\",\"HardDelete\"),split('AffectedItems{}.Attachments',\"; \")), file_size = CASE(Operation IN (\"Send\",\"SendAs\",\"SendOnBehalf\"),round(tonumber('Item.SizeInBytes')/1024/1024,2),true(),round(tonumber(replace(file_name, \"(.+)\\s\\((\\d+)(b\\)$)\", \"\\2\"))/1024/1024,2)) | eval sendtime = CASE(Operation IN (\"Send\",\"SendAs\",\"SendOnBehalf\"),_time) | eval deltime = CASE(Operation IN (\"SoftDelete\",\"HardDelete\"),_time) | stats values(sender) as sender, values(ClientIPAddress) as src, values(ClientInfoString) as http_user_agent, values(Operation) as signature, values(file_name) as file_name, sum(file_size) as file_size, values(Folder.Path) as file_path, min(sendtime) as firstTime, max(deltime) as lastTime, dc(Operation) as opcount, count by subject,user | eval timediff = tonumber(lastTime) - tonumber(firstTime) | where opcount > 1 AND firstTime < lastTime AND timediff < 3600 | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_email_send_and_hard_delete_suspicious_behavior.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} -{"query":"sourcetype=o365:management:activity Workload=Exchange (Operation=ModifyFolderPermissions OR Operation=AddFolderPermissions) Workload=Exchange object!=Calendar object!=Contacts object!=PersonMetadata | eval isReadRole=if(match('Item.ParentFolder.MemberRights',\"(ReadAny)\"), \"true\", \"false\") | rename UserId as user | stats count earliest(_time) as firstTime latest(_time) as lastTime by signature user object dest Item.ParentFolder.MemberUpn Item.ParentFolder.MemberRights src vendor_account vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_mailbox_folder_read_permission_assigned.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:unsupported-command"} +{"query":"sourcetype=o365:management:activity Workload=Exchange (Operation=ModifyFolderPermissions OR Operation=AddFolderPermissions) Workload=Exchange object!=Calendar object!=Contacts object!=PersonMetadata | eval isReadRole=if(match('Item.ParentFolder.MemberRights',\"(ReadAny)\"), \"true\", \"false\") | rename UserId as user | stats count earliest(_time) as firstTime latest(_time) as lastTime by signature user object dest Item.ParentFolder.MemberUpn Item.ParentFolder.MemberRights src vendor_account vendor_product | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_mailbox_folder_read_permission_assigned.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=o365:management:activity Workload=Exchange AND (Operation=New-InboxRule OR Operation=Set-InboxRule) Parameters{}.Name IN (SoftDeleteMessage,DeleteMessage,ForwardTo,ForwardAsAttachmentTo,RedirectTo,MoveToFolder,CopyToFolder) | eval file_path = mvappend(MoveToFolder,CopyToFolder), recipient=mvappend(ForwardTo, ForwardAsAttachmentTo, RedirectTo), user = lower(UserId), signature = Operation, src = if(match(ClientIP, \"^\\[\"), ltrim(mvindex(split(ClientIP, \"]:\"), 0), \"[\"), mvindex(split(ClientIP,\":\"),0)), desc = Name, action = 'Parameters{}.Name' | stats values(action) as action, values(src) as src, values(recipient) as recipient, values(file_path) as file_path, count, min(_time) as firstTime, max(_time) as lastTime by user, signature, desc | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_email_new_inbox_rule_created.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=o365:management:activity Workload=Exchange AND Operation IN (\"Set-*\",\"Disable-*\",\"New-*\",\"Remove-*\") AND Operation=\"*TransportRule\" | eval object_name = case('Parameters{}.Name'==\"Name\",mvindex('Parameters{}.Value',mvfind('Parameters{}.Name',\"^Name$\")),true(),ObjectId), object_id = case('Parameters{}.Name'==\"Identity\",mvindex('Parameters{}.Value',mvfind('Parameters{}.Name',\"^Identity$\")),true(),Id) | stats values(object_name) as object_name, min(_time) as firstTime, max(_time) as lastTime, count by object_id, UserId, Operation, signature | rename UserId as user | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_email_transport_rule_changed.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} {"query":"sourcetype=o365:management:activity Workload=Exchange AND Operation IN (\"Set-*\",\"Disable-*\",\"New-*\",\"Remove-*\") Operation IN (\"*AntiPhish*\",\"*SafeLink*\",\"*SafeAttachment*\",\"*Malware*\") | rename Id as object_id, UserId as user, Operation as signature, ObjectId as object | fillnull | stats count min(_time) as firstTime max(_time) as lastTime BY dest user src vendor_account vendor_product signature object_id object | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(firstTime) | convert timeformat=\"%Y-%m-%dT%H:%M:%S\" ctime(lastTime)","pages":["detections/cloud/o365_email_security_feature_changed.yml"],"versions":["a3f6523eabf696d66e20fdd80766bfae95575577"],"expect":"error:syntax"} diff --git a/conformance/corpus/spl1/queries.jsonl b/conformance/corpus/spl1/queries.jsonl index ae2f73f..466df67 100644 --- a/conformance/corpus/spl1/queries.jsonl +++ b/conformance/corpus/spl1/queries.jsonl @@ -86,7 +86,7 @@ {"query":"index=main","pages":["search-commands/collect"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"accepted"} {"query":"index=main | fields foo | tscollect","pages":["search-commands/tscollect"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:unsupported-command"} {"query":"index=main | tags outputfield=test inclname=t allowed_tags=\"error, group\" host","pages":["search-commands/tags"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:unsupported-command"} -{"query":"index=myIndex1 OR index=myIndex2 | rename myfield1 as myField | stats values(*) AS * BY myField","pages":["quick-reference/splunk-spl-for-sql-users"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:unsupported-command"} +{"query":"index=myIndex1 OR index=myIndex2 | rename myfield1 as myField | stats values(*) AS * BY myField","pages":["quick-reference/splunk-spl-for-sql-users"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:syntax"} {"query":"index=myIndex1 OR index=myIndex2 | stats values(*) AS * BY myField","pages":["quick-reference/splunk-spl-for-sql-users"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:syntax"} {"query":"index=myindex | where NOT fieldA=fieldB","pages":["search-commands/search"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"accepted"} {"query":"index=myindex | where fieldA!=fieldB","pages":["search-commands/search"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"accepted"} @@ -110,7 +110,7 @@ {"query":"source=\"addtotalsData.csv\" | stats sum(sales) BY products","pages":["search-commands/addtotals"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"accepted"} {"query":"source=\"all_month.csv\" | convert timeformat=\"%H:%M:%S\" ctime(_time) AS c_time | table _time, c_time","pages":["search-commands/convert"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:unsupported-command"} {"query":"source=\"all_month.csv\"| anomalousvalue action=summary pthresh=0.02 | search isNum=YES","pages":["search-commands/anomalousvalue"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:unsupported-command"} -{"query":"source=all_month.csv place=\"Northern California\" | rename latitude as lat longitude as lon locationSource as locSource | table time, place, lat, lon, locS*","pages":["search-commands/table"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:unsupported-command"} +{"query":"source=all_month.csv place=\"Northern California\" | rename latitude as lat longitude as lon locationSource as locSource | table time, place, lat, lon, locS*","pages":["search-commands/table"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"accepted"} {"query":"source=all_month.csv place=*California | table time, place, mag, depth","pages":["search-commands/table"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"accepted"} {"query":"source=all_month.csv place=*California* | stats count, max(mag), min(mag), range(mag), avg(mag) BY magType","pages":["search-commands/stats","statistical-and-charting-functions/aggregate-functions"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"accepted"} {"query":"source=all_month.csv place=*alaska* mag>=3.5 | chart count BY mag place useother=f | rename mag AS Magnitude","pages":["search-commands/chart"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:unsupported-command"} @@ -139,7 +139,7 @@ {"query":"source=mytable | DEDUP mycolumn1, mycolumn2 | FIELDS mycolumn1, mycolumn2","pages":["quick-reference/splunk-spl-for-sql-users"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:unsupported-command"} {"query":"source=mytable | DELETE","pages":["quick-reference/splunk-spl-for-sql-users"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:unsupported-command"} {"query":"source=mytable | FIELDS mycolumn1, mycolumn2","pages":["quick-reference/splunk-spl-for-sql-users"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"accepted"} -{"query":"source=mytable | RENAME mycolumn as column_alias | FIELDS column_alias","pages":["quick-reference/splunk-spl-for-sql-users"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:unsupported-command"} +{"query":"source=mytable | RENAME mycolumn as column_alias | FIELDS column_alias","pages":["quick-reference/splunk-spl-for-sql-users"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"accepted"} {"query":"source=mytable | SORT -mycolumn","pages":["quick-reference/splunk-spl-for-sql-users"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"accepted"} {"query":"source=mytable1 [SEARCH source=mytable2 mycolumn2=myvalue | FIELDS mycolumn2]","pages":["quick-reference/splunk-spl-for-sql-users"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:unsupported-subsearch"} {"query":"source=mytable1 mycolumn=5 | DELETE","pages":["quick-reference/splunk-spl-for-sql-users"],"versions":["10.0","9.0","9.1","9.2","9.3","9.4"],"expect":"error:unsupported-command"} diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 35061ae..52d2116 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -162,7 +162,7 @@ the shape of the pipeline before producing anything: | Exactly one aggregation | `promql-multiple-aggs` | | Aggregation is `count` | `promql-unsupported-agg` | | Filters appear before the aggregation | `promql-search-after-agg` | -| No row-shaping stages (`eval`, `rex`, `table`, `fields`, `bin`) | `promql-unsupported-stage` | +| No row-shaping stages (`eval`, `rex`, `table`, `fields`, `bin`, `rename`) | `promql-unsupported-stage` | | Filters map to `=` / `!=` label matchers | `promql-unsupported-filter` | | Free text is not used as a filter | `promql-fulltext` | | No conflicting matchers for one label | `promql-conflicting-filters` | diff --git a/docs/COMPATIBILITY.md b/docs/COMPATIBILITY.md index ed5b5aa..fe93f32 100644 --- a/docs/COMPATIBILITY.md +++ b/docs/COMPATIBILITY.md @@ -48,6 +48,7 @@ emission, and PromQL `job` matchers behave exactly as for classic SPL. | `sort` | ✅ | ✅ | ⚠️ ordering only after an aggregation | | `head` | ✅ | ✅ | ⚠️ only with `sort` | | `bin` | ✅ | ⚠️ derived column | ⛔ | +| `rename` | ✅ | ✅ one `RENAME`; ⛔ wildcards and interacting pairs | ⛔ | ## Expressions @@ -138,7 +139,7 @@ Recognized but not implemented in v0.1 (classic SPL; in SPL2, `from` is the star `mcollect`, `metadata`, `metasearch`, `ml`, `mstats`, `multikmeans`, `multisearch`, `mvcombine`, `mvexpand`, `nomv`, `outlier`, `outputcsv`, `outputlookup`, `outputtext`, `pivot`, `predict`, `rangemap`, `rare`, `regex`, -`reltime`, `rename`, `replace`, `rest`, `return`, `reverse`, `script`, `scrub`, +`reltime`, `replace`, `rest`, `return`, `reverse`, `script`, `scrub`, `select`, `selfjoin`, `sendemail`, `set`, `setfields`, `spath`, `strcat`, `streamstats`, `tags`, `tail`, `top`, `transaction`, `transpose`, `trendline`, `tscollect`, `tstats`, `typeahead`, `typer`, `union`, `uniq`, `untable`, `x11`, @@ -178,6 +179,10 @@ They return `unsupported-command` with the command's source position. | `unsupported-agg` | error | No ES\|QL mapping | | `invalid-group-by` | error | Group key is not a field | | `rex-no-captures` | error | Pattern has no named capture | +| `rename-wildcard` | error | `rename` wildcard has no ES\|QL form | +| `rename-duplicate` | error | One field is renamed twice in a command | +| `rename-conflict` | error | Pairs would interact: a target is another source, or two pairs share a target | +| `rename-source-dropped` | error | A later stage references a name that `rename` moved to a new name | | `unsupported-stage` | error | No emitter for the IR node | ### PromQL emitter diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index e6ef12d..8585f4e 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -29,7 +29,7 @@ languages — not a Splunk clone, not an Elasticsearch client, and not a model. - [x] Unified IR (`pkg/ast`) - [x] Positioned diagnostics (`pkg/diag`) - [x] Classic SPL lexer and parser (ANTLR grammar, generated Go) -- [x] `search`, `where`, `stats`, `timechart`, `eval`, `rex`, `table`, `fields`, `sort`, `head`, `bin` +- [x] `search`, `where`, `stats`, `timechart`, `eval`, `rex`, `table`, `fields`, `sort`, `head`, `bin`, `rename` - [x] ES|QL emitter - [x] PromQL emitter with semantic refusal - [x] ECS mapping and strict JSON loading diff --git a/pkg/ast/ast.go b/pkg/ast/ast.go index 4dfbe93..fd99860 100644 --- a/pkg/ast/ast.go +++ b/pkg/ast/ast.go @@ -154,6 +154,25 @@ type BinStage struct { func (*BinStage) StageName() string { return "bin" } func (s *BinStage) Position() Pos { return s.Pos } +// RenameStage renames one or more fields. Splunk applies every pair in a +// single command, so the pairs travel together rather than as separate stages. +type RenameStage struct { + Renames []Rename `json:"renames"` + Pos Pos `json:"pos"` +} + +func (*RenameStage) StageName() string { return "rename" } +func (s *RenameStage) Position() Pos { return s.Pos } + +// Rename is one `from AS to` pair. The two positions point at the field +// tokens, so a refusal can name the field that caused it. +type Rename struct { + From string `json:"from"` + FromPos Pos `json:"from_pos"` + To string `json:"to"` + ToPos Pos `json:"to_pos"` +} + // Expr is a scalar expression in the IR. type Expr interface { exprNode() diff --git a/pkg/compiler/compiler_test.go b/pkg/compiler/compiler_test.go index 722356f..0816e4d 100644 --- a/pkg/compiler/compiler_test.go +++ b/pkg/compiler/compiler_test.go @@ -125,6 +125,66 @@ func TestESQLGolden(t *testing.T) { src: `index=web host=*-* status=200-299`, want: "FROM web\n| WHERE `host.name` LIKE \"*-*\" AND status == \"200-299\"", }, + { + name: "rename maps the source name", + src: `index=web | rename host as dest`, + want: "FROM web\n| RENAME `host.name` AS dest", + }, + { + name: "rename leaves the target name as written", + src: `index=web | rename dest as host`, + want: "FROM web\n| RENAME dest AS host", + }, + { + name: "rename resolves the new name downstream", + src: `index=web | rename dest as host | stats count by host`, + want: "FROM web\n| RENAME dest AS host\n| STATS count = COUNT(*) BY host", + }, + { + name: "rename chains across two stages", + src: `index=web | rename a as b | rename b as c | table c`, + want: "FROM web\n| RENAME a AS b\n| RENAME b AS c\n| KEEP c", + }, + { + name: "rename can restore a name it renamed away", + src: `index=web | rename a as b | rename b as a | table a`, + want: "FROM web\n| RENAME a AS b\n| RENAME b AS a\n| KEEP a", + }, + { + name: "rename skips a no-op pair beside a real one", + src: `index=web | rename a as b, a as a`, + want: "FROM web\n| RENAME a AS b", + }, + { + name: "rename skips a no-op target beside a real pair", + src: `index=web | rename a as b, b as b`, + want: "FROM web\n| RENAME a AS b", + }, + { + name: "rename quotes a keyword used as a field", + src: `index=web | rename where as search`, + want: "FROM web\n| RENAME `where` AS search", + }, + { + name: "keyword fields are quoted in every command", + src: `index=web | table stats, where`, + want: "FROM web\n| KEEP `stats`, `where`", + }, + { + name: "rename applies every pair in one command", + src: `index=web | rename host as dest, source as src_ip`, + want: "FROM web\n| RENAME `host.name` AS dest, `log.file.path` AS src_ip", + }, + { + name: "rename keeps a quoted name as the target", + src: `index=web | rename "user agent" as ua`, + want: "FROM web\n| RENAME `user agent` AS ua", + }, + { + name: "rename to the same name emits nothing", + src: `index=web | rename a as a`, + want: "FROM web", + }, } for _, tc := range tests { @@ -185,6 +245,90 @@ func TestESQLDiagnostics(t *testing.T) { }) } +// TestRenameRefusals pins the rename refusals at their exact source positions. +// A refusal must name the field that caused it, and no partial output may be +// returned. +func TestRenameRefusals(t *testing.T) { + tests := []struct { + name string + src string + code string + line int + col int + }{ + { + name: "wildcard source", + src: `index=web | rename EU* as EMEA*`, + code: "rename-wildcard", line: 1, col: 20, + }, + { + name: "wildcard target", + src: `index=web | rename a as EMEA*`, + code: "rename-wildcard", line: 1, col: 25, + }, + { + name: "bare wildcard target", + src: `index=web | rename user_name as *`, + code: "rename-wildcard", line: 1, col: 33, + }, + { + name: "leading wildcard source", + src: `index=web | rename *foo as bar`, + code: "rename-wildcard", line: 1, col: 20, + }, + { + name: "prefix wildcard pair", + src: `index=web | rename properties.* as *`, + code: "rename-wildcard", line: 1, col: 20, + }, + { + name: "field renamed twice", + src: `index=web | rename a as b, a as c`, + code: "rename-duplicate", line: 1, col: 28, + }, + { + name: "target is another source", + src: `index=web | rename a as b, b as c`, + code: "rename-conflict", line: 1, col: 25, + }, + { + name: "two pairs share one target", + src: `index=web | rename a as b, c as b`, + code: "rename-conflict", line: 1, col: 33, + }, + { + name: "later stage references the renamed-away name", + src: `index=web | rename host as dest | stats count by host`, + code: "rename-source-dropped", line: 1, col: 50, + }, + { + name: "later filter references the renamed-away name", + src: `index=web | rename a as b | where a=1`, + code: "rename-source-dropped", line: 1, col: 35, + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + res, _, err := Compile(tc.src, ESQL, Options{}) + if err == nil { + t.Fatal("expected an error") + } + ds, ok := diag.FromError(err) + if !ok || len(ds) != 1 { + t.Fatalf("err = %v, want one diagnostic", err) + } + d := ds[0] + if d.Code != tc.code || d.Pos.Line != tc.line || d.Pos.Col != tc.col { + t.Fatalf("diagnostic = %s at %d:%d, want %s at %d:%d", + d.Code, d.Pos.Line, d.Pos.Col, tc.code, tc.line, tc.col) + } + if res != nil && res.Output != "" { + t.Fatalf("refused query produced output: %q", res.Output) + } + }) + } +} + func TestESQLIndexFilters(t *testing.T) { t.Run("mixed index OR is refused", func(t *testing.T) { res, _, err := Compile(`index=web OR host=api`, ESQL, Options{}) diff --git a/pkg/emitter/esql/esql.go b/pkg/emitter/esql/esql.go index 60eedfe..7f970c4 100644 --- a/pkg/emitter/esql/esql.go +++ b/pkg/emitter/esql/esql.go @@ -43,6 +43,7 @@ func Emit(p *ast.Pipeline, opts Options) (*Result, error) { indexOverride: opts.Index, span: opts.Span, derived: map[string]bool{}, + renamed: map[string]ast.Rename{}, } return e.emit(p) } @@ -54,8 +55,9 @@ type emitter struct { lines []string diags []diag.Diagnostic - derived map[string]bool // columns created by bin/eval, keyed by SPL name - fromSource string // the source actually emitted in FROM + derived map[string]bool // columns created by bin/eval/rename, keyed by SPL name + renamed map[string]ast.Rename // SPL names renamed away by rename, keyed by source + fromSource string // the source actually emitted in FROM } func (e *emitter) emit(p *ast.Pipeline) (*Result, error) { @@ -130,6 +132,10 @@ func (e *emitter) emit(p *ast.Pipeline) (*Result, error) { if err := e.emitBin(s); err != nil { return e.result(), err } + case *ast.RenameStage: + if err := e.emitRename(s); err != nil { + return e.result(), err + } default: return e.result(), e.errorf(st.Position(), "unsupported-stage", "stage %q has no ES|QL emitter", st.StageName()) @@ -363,7 +369,7 @@ func (e *emitter) groupFields(by []ast.Expr) (string, error) { return "", e.errorf(ex.Position(), "invalid-group-by", "group-by accepts field names only") } - parts = append(parts, e.fieldName(f.Name)) + parts = append(parts, e.fieldName(f.Name, f.Pos)) } return strings.Join(parts, ", "), nil } @@ -386,7 +392,7 @@ func (e *emitter) emitRex(s *ast.RexStage) error { return e.errorf(s.Pos, "rex-no-captures", "rex pattern must contain at least one named capture such as (?\\S+)") } - field := e.fieldName(s.Field) + field := e.fieldName(s.Field, s.Pos) e.lines = append(e.lines, "| GROK "+field+" "+quoteString(grok)) e.warnf(s.Pos, "rex-lossy", "rex was translated to a Grok pattern; verify the extracted values against the original search") @@ -437,7 +443,7 @@ func (e *emitter) emitTable(s *ast.TableStage) { } fields := make([]string, 0, len(s.Fields)) for _, f := range s.Fields { - fields = append(fields, e.fieldName(f)) + fields = append(fields, e.fieldName(f, s.Pos)) } if len(fields) == 0 { return @@ -449,14 +455,14 @@ func (e *emitter) emitFields(s *ast.FieldsStage) { if len(s.Include) > 0 { fields := make([]string, 0, len(s.Include)) for _, f := range s.Include { - fields = append(fields, e.fieldName(f)) + fields = append(fields, e.fieldName(f, s.Pos)) } e.lines = append(e.lines, "| KEEP "+strings.Join(fields, ", ")) } if len(s.Exclude) > 0 { fields := make([]string, 0, len(s.Exclude)) for _, f := range s.Exclude { - fields = append(fields, e.fieldName(f)) + fields = append(fields, e.fieldName(f, s.Pos)) } e.lines = append(e.lines, "| DROP "+strings.Join(fields, ", ")) } @@ -470,7 +476,7 @@ func (e *emitter) emitSort(s *ast.SortStage) { if f.Desc { dir = "DESC" } - parts = append(parts, e.fieldName(f.Name)+" "+dir) + parts = append(parts, e.fieldName(f.Name, s.Pos)+" "+dir) } e.lines = append(e.lines, "| SORT "+strings.Join(parts, ", ")) } @@ -484,7 +490,7 @@ func (e *emitter) emitBin(s *ast.BinStage) error { if err != nil { return e.errorf(s.Pos, "invalid-span", "%v", err) } - source := e.fieldName(s.Field) + source := e.fieldName(s.Field, s.Pos) e.lines = append(e.lines, "| EVAL "+quoteIdent(s.Field)+" = BUCKET("+source+", "+espan+")") e.derived[s.Field] = true e.info(s.Pos, "bin-bucket", @@ -492,7 +498,88 @@ func (e *emitter) emitBin(s *ast.BinStage) error { return nil } -func (e *emitter) fieldName(name string) string { +// emitRename translates `rename from AS to, ...` into one ES|QL RENAME +// command. ES|QL has no wildcard form, and it defines a RENAME with several +// pairs as the equivalent sequence of single renames, so pairs that would +// interact are refused rather than sequenced here: this translation does not +// model the order the pairs are applied in, and ES|QL silently replaces a +// column that already has the target name. +func (e *emitter) emitRename(s *ast.RenameStage) error { + froms := make(map[string]bool, len(s.Renames)) + tos := make(map[string]bool, len(s.Renames)) + for _, r := range s.Renames { + if strings.Contains(r.From, "*") { + return e.errorf(r.FromPos, "rename-wildcard", + "ES|QL RENAME has no wildcard form; %q names several columns", r.From) + } + if strings.Contains(r.To, "*") { + return e.errorf(r.ToPos, "rename-wildcard", + "ES|QL RENAME has no wildcard form; %q names several columns", r.To) + } + } + for _, r := range s.Renames { + if r.From == r.To { + continue // Splunk treats this as a no-op, so it renames nothing. + } + if froms[r.From] { + return e.errorf(r.FromPos, "rename-duplicate", + "field %q is renamed more than once in one command", r.From) + } + froms[r.From] = true + } + for _, r := range s.Renames { + if r.From == r.To { + continue + } + if froms[r.To] { + return e.errorf(r.ToPos, "rename-conflict", + "field %q is also renamed in the same command; the pairs would depend on the order they are applied in, which this translation does not model", r.To) + } + if tos[r.To] { + return e.errorf(r.ToPos, "rename-conflict", + "field %q is the target of more than one pair; ES|QL would keep only one of them", r.To) + } + tos[r.To] = true + } + + parts := make([]string, 0, len(s.Renames)) + for _, r := range s.Renames { + if r.From == r.To { + continue + } + // The source is an existing column, so it goes through the mapping. The + // target is the name the query chooses, so it is emitted as written; + // mapping it would rename to a column the query never asked for. + parts = append(parts, e.fieldName(r.From, r.FromPos)+" AS "+quoteIdent(r.To)) + } + if len(parts) == 0 { + return nil + } + e.lines = append(e.lines, "| RENAME "+strings.Join(parts, ", ")) + + // The column now exists under its new name, so later stages must reference + // it as written, and the old SPL name no longer names any column. + for _, r := range s.Renames { + if r.From == r.To { + continue + } + e.derived[r.To] = true + delete(e.renamed, r.To) + e.renamed[r.From] = r + } + return nil +} + +// fieldName resolves an SPL field to the ES|QL column holding it. A field +// created by an earlier stage keeps its own name; a field renamed away by an +// earlier rename is refused at the reference, because ES|QL has no way to +// reference a column the pipeline dropped. +func (e *emitter) fieldName(name string, pos ast.Pos) string { + if r, ok := e.renamed[name]; ok { + e.errorf(pos, "rename-source-dropped", + "field %q was renamed to %q and is no longer available; reference %q instead", name, r.To, r.To) + return quoteIdent(r.To) + } if e.derived[name] { return quoteIdent(name) } @@ -504,7 +591,7 @@ func (e *emitter) fieldName(name string) string { func (e *emitter) expr(x ast.Expr, parent int) string { switch v := x.(type) { case *ast.FieldRef: - return e.fieldName(v.Name) + return e.fieldName(v.Name, v.Pos) case *ast.StringLit: return quoteString(v.Value) case *ast.NumberLit: @@ -828,8 +915,24 @@ func quoteString(s string) string { return b.String() } +// esqlReserved holds the words ES|QL reads as keywords. An identifier that +// spells one of them must be backtick-quoted: unquoted, ES|QL parses it as the +// keyword and rejects the query. Quoting a plain name is always valid, so the +// set errs towards including words that might not strictly need it. +var esqlReserved = map[string]bool{ + "and": true, "as": true, "asc": true, "by": true, "case": true, + "cast": true, "cross": true, "desc": true, "dissect": true, "else": true, + "end": true, "eval": true, "false": true, "fork": true, "from": true, + "grok": true, "in": true, "is": true, "join": true, "keep": true, + "left": true, "like": true, "limit": true, "lookup": true, "match": true, + "mv_expand": true, "not": true, "null": true, "or": true, "order": true, + "rename": true, "rlike": true, "row": true, "rows": true, "set": true, + "show": true, "sort": true, "stats": true, "throttle": true, "to": true, + "true": true, "until": true, "where": true, "with": true, "window": true, +} + func quoteIdent(s string) string { - if isSimpleIdent(s) { + if isSimpleIdent(s) && !esqlReserved[strings.ToLower(s)] { return s } return "`" + strings.ReplaceAll(s, "`", "``") + "`" diff --git a/pkg/parser/commands/commands.go b/pkg/parser/commands/commands.go index 3c84553..648cc50 100644 --- a/pkg/parser/commands/commands.go +++ b/pkg/parser/commands/commands.go @@ -23,6 +23,7 @@ var spl1Implemented = map[string]bool{ "sort": true, "head": true, "bin": true, + "rename": true, } // spl1Known are real classic SPL commands that SPL1 does not implement yet. @@ -51,7 +52,7 @@ var spl1Known = map[string]bool{ "mvexpand": true, "nomv": true, "noop": true, "outlier": true, "outputcsv": true, "outputlookup": true, "outputtext": true, "overlap": true, "pivot": true, "predict": true, "rangemap": true, "rare": true, - "regex": true, "reltime": true, "rename": true, "replace": true, + "regex": true, "reltime": true, "replace": true, "rest": true, "return": true, "reverse": true, "rex": true, "savedsearch": true, "script": true, "scrub": true, "search": true, "searchtxn": true, "select": true, "selfjoin": true, "sendemail": true, diff --git a/pkg/parser/spl1/build.go b/pkg/parser/spl1/build.go index 35a33ea..0cd28fd 100644 --- a/pkg/parser/spl1/build.go +++ b/pkg/parser/spl1/build.go @@ -206,6 +206,18 @@ func (b *builder) commandBody(ctx spl1gen.ICommandContext) (ast.Stage, error) { case *spl1gen.CmdBinContext: return b.bin(c.GetStart(), c.AllBinItem()) + + case *spl1gen.CmdRenameContext: + renames := make([]ast.Rename, 0, len(c.AllRenamePair())) + for _, pair := range c.AllRenamePair() { + from, fromPos := b.renameField(pair.RenameField(0)) + to, toPos := b.renameField(pair.RenameField(1)) + renames = append(renames, ast.Rename{ + From: from, FromPos: fromPos, + To: to, ToPos: toPos, + }) + } + return &ast.RenameStage{Renames: renames, Pos: b.pos(c.GetStart())}, nil } return nil, diag.NewError(ast.Pos{Line: 1, Col: 1}, "syntax", "unrecognized command") } @@ -439,6 +451,17 @@ func (b *builder) bin(cmd antlr.Token, items []spl1gen.IBinItemContext) (ast.Sta return &ast.BinStage{Field: field, Span: span, Pos: b.pos(cmd)}, nil } +// renameField returns a rename field's name and the position of its first +// token. A quoted name keeps its decoded text and may contain spaces; an +// identifier keeps its raw spelling, including a tight trailing wildcard. +func (b *builder) renameField(ctx spl1gen.IRenameFieldContext) (string, ast.Pos) { + if s := ctx.STRING(); s != nil { + tok := s.GetSymbol() + return decodeString(tok.GetText()), b.pos(tok) + } + return b.text(ctx), b.pos(ctx.GetStart()) +} + // --- search expressions: comparison RHS words are literal values ---------- func (b *builder) searchExpr(ctx spl1gen.ISearchExprContext) (ast.Expr, error) { diff --git a/pkg/parser/spl1/gen/spl1_base_visitor.go b/pkg/parser/spl1/gen/spl1_base_visitor.go index 318f9f0..f03881e 100644 --- a/pkg/parser/spl1/gen/spl1_base_visitor.go +++ b/pkg/parser/spl1/gen/spl1_base_visitor.go @@ -63,6 +63,10 @@ func (v *BaseSPL1Visitor) VisitCmdBin(ctx *CmdBinContext) interface{} { return v.VisitChildren(ctx) } +func (v *BaseSPL1Visitor) VisitCmdRename(ctx *CmdRenameContext) interface{} { + return v.VisitChildren(ctx) +} + func (v *BaseSPL1Visitor) VisitSearchExpr(ctx *SearchExprContext) interface{} { return v.VisitChildren(ctx) } @@ -451,6 +455,14 @@ func (v *BaseSPL1Visitor) VisitBinFieldItem(ctx *BinFieldItemContext) interface{ return v.VisitChildren(ctx) } +func (v *BaseSPL1Visitor) VisitRenamePair(ctx *RenamePairContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseSPL1Visitor) VisitRenameField(ctx *RenameFieldContext) interface{} { + return v.VisitChildren(ctx) +} + func (v *BaseSPL1Visitor) VisitBinField(ctx *BinFieldContext) interface{} { return v.VisitChildren(ctx) } diff --git a/pkg/parser/spl1/gen/spl1_lexer.go b/pkg/parser/spl1/gen/spl1_lexer.go index e40e8ac..7da7dcb 100644 --- a/pkg/parser/spl1/gen/spl1_lexer.go +++ b/pkg/parser/spl1/gen/spl1_lexer.go @@ -44,29 +44,29 @@ func spl1lexerLexerInit() { } staticData.LiteralNames = []string{ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "'=='", "'!='", "'<='", "'>='", "'='", "'<'", - "'>'", "'!'", "'|'", "','", "'('", "')'", "'['", "']'", "'+'", "'-'", - "'*'", "'/'", "'%'", + "", "", "", "", "", "", "", "", "'=='", "'!='", "'<='", "'>='", "'='", + "'<'", "'>'", "'!'", "'|'", "','", "'('", "')'", "'['", "']'", "'+'", + "'-'", "'*'", "'/'", "'%'", } staticData.SymbolicNames = []string{ "", "SEARCH", "WHERE", "STATS", "TIMECHART", "EVAL", "REX", "TABLE", - "FIELDS", "SORT", "HEAD", "BIN", "BY", "AS", "SPAN", "LIMIT", "FIELD", - "AND", "OR", "NOT", "DURATION", "NUMBER", "STRING", "IDENT", "EQ2", - "NE", "LE", "GE", "EQ", "LT", "GT", "BANG", "PIPE", "COMMA", "LPAREN", - "RPAREN", "LBRACKET", "RBRACKET", "PLUS", "MINUS", "STAR", "SLASH", - "PERCENT", "WS", "UNKNOWN", + "FIELDS", "SORT", "HEAD", "BIN", "RENAME", "BY", "AS", "SPAN", "LIMIT", + "FIELD", "AND", "OR", "NOT", "DURATION", "NUMBER", "STRING", "IDENT", + "EQ2", "NE", "LE", "GE", "EQ", "LT", "GT", "BANG", "PIPE", "COMMA", + "LPAREN", "RPAREN", "LBRACKET", "RBRACKET", "PLUS", "MINUS", "STAR", + "SLASH", "PERCENT", "WS", "UNKNOWN", } staticData.RuleNames = []string{ "SEARCH", "WHERE", "STATS", "TIMECHART", "EVAL", "REX", "TABLE", "FIELDS", - "SORT", "HEAD", "BIN", "BY", "AS", "SPAN", "LIMIT", "FIELD", "AND", - "OR", "NOT", "DURATION", "NUMBER", "STRING", "DQ_BODY", "SQ_BODY", "IDENT", - "EQ2", "NE", "LE", "GE", "EQ", "LT", "GT", "BANG", "PIPE", "COMMA", - "LPAREN", "RPAREN", "LBRACKET", "RBRACKET", "PLUS", "MINUS", "STAR", - "SLASH", "PERCENT", "WS", "UNKNOWN", "DIGITS", "EXPONENT", "UNIT", + "SORT", "HEAD", "BIN", "RENAME", "BY", "AS", "SPAN", "LIMIT", "FIELD", + "AND", "OR", "NOT", "DURATION", "NUMBER", "STRING", "DQ_BODY", "SQ_BODY", + "IDENT", "EQ2", "NE", "LE", "GE", "EQ", "LT", "GT", "BANG", "PIPE", + "COMMA", "LPAREN", "RPAREN", "LBRACKET", "RBRACKET", "PLUS", "MINUS", + "STAR", "SLASH", "PERCENT", "WS", "UNKNOWN", "DIGITS", "EXPONENT", "UNIT", } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 0, 44, 342, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, + 4, 0, 45, 351, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, @@ -75,39 +75,40 @@ func spl1lexerLexerInit() { 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, - 2, 47, 7, 47, 2, 48, 7, 48, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, - 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, - 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, - 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, - 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, - 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, - 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, - 1, 18, 1, 19, 1, 19, 1, 19, 3, 19, 202, 8, 19, 1, 19, 3, 19, 205, 8, 19, - 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 3, 20, 212, 8, 20, 1, 20, 3, 20, 215, - 8, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 3, 21, 225, - 8, 21, 1, 22, 4, 22, 228, 8, 22, 11, 22, 12, 22, 229, 1, 22, 1, 22, 4, - 22, 234, 8, 22, 11, 22, 12, 22, 235, 1, 22, 1, 22, 5, 22, 240, 8, 22, 10, - 22, 12, 22, 243, 9, 22, 1, 23, 4, 23, 246, 8, 23, 11, 23, 12, 23, 247, - 1, 23, 1, 23, 4, 23, 252, 8, 23, 11, 23, 12, 23, 253, 1, 23, 1, 23, 5, - 23, 258, 8, 23, 10, 23, 12, 23, 261, 9, 23, 1, 24, 1, 24, 5, 24, 265, 8, - 24, 10, 24, 12, 24, 268, 9, 24, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, - 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, - 31, 1, 31, 1, 32, 1, 32, 1, 33, 1, 33, 1, 34, 1, 34, 1, 35, 1, 35, 1, 36, - 1, 36, 1, 37, 1, 37, 1, 38, 1, 38, 1, 39, 1, 39, 1, 40, 1, 40, 1, 41, 1, - 41, 1, 42, 1, 42, 1, 43, 1, 43, 1, 44, 4, 44, 313, 8, 44, 11, 44, 12, 44, - 314, 1, 44, 1, 44, 1, 45, 1, 45, 1, 46, 4, 46, 322, 8, 46, 11, 46, 12, - 46, 323, 1, 47, 1, 47, 3, 47, 328, 8, 47, 1, 47, 4, 47, 331, 8, 47, 11, - 47, 12, 47, 332, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 341, - 8, 48, 0, 0, 49, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, - 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, - 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 0, 47, 0, 49, 23, 51, 24, 53, 25, - 55, 26, 57, 27, 59, 28, 61, 29, 63, 30, 65, 31, 67, 32, 69, 33, 71, 34, - 73, 35, 75, 36, 77, 37, 79, 38, 81, 39, 83, 40, 85, 41, 87, 42, 89, 43, - 91, 44, 93, 0, 95, 0, 97, 0, 1, 0, 28, 2, 0, 83, 83, 115, 115, 2, 0, 69, - 69, 101, 101, 2, 0, 65, 65, 97, 97, 2, 0, 82, 82, 114, 114, 2, 0, 67, 67, - 99, 99, 2, 0, 72, 72, 104, 104, 2, 0, 87, 87, 119, 119, 2, 0, 84, 84, 116, + 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, + 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, + 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, + 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, + 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, + 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, + 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, + 20, 1, 20, 1, 20, 3, 20, 211, 8, 20, 1, 20, 3, 20, 214, 8, 20, 1, 20, 1, + 20, 1, 21, 1, 21, 1, 21, 3, 21, 221, 8, 21, 1, 21, 3, 21, 224, 8, 21, 1, + 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 234, 8, 22, + 1, 23, 4, 23, 237, 8, 23, 11, 23, 12, 23, 238, 1, 23, 1, 23, 4, 23, 243, + 8, 23, 11, 23, 12, 23, 244, 1, 23, 1, 23, 5, 23, 249, 8, 23, 10, 23, 12, + 23, 252, 9, 23, 1, 24, 4, 24, 255, 8, 24, 11, 24, 12, 24, 256, 1, 24, 1, + 24, 4, 24, 261, 8, 24, 11, 24, 12, 24, 262, 1, 24, 1, 24, 5, 24, 267, 8, + 24, 10, 24, 12, 24, 270, 9, 24, 1, 25, 1, 25, 5, 25, 274, 8, 25, 10, 25, + 12, 25, 277, 9, 25, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 28, 1, + 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 1, 31, 1, 32, 1, 32, + 1, 33, 1, 33, 1, 34, 1, 34, 1, 35, 1, 35, 1, 36, 1, 36, 1, 37, 1, 37, 1, + 38, 1, 38, 1, 39, 1, 39, 1, 40, 1, 40, 1, 41, 1, 41, 1, 42, 1, 42, 1, 43, + 1, 43, 1, 44, 1, 44, 1, 45, 4, 45, 322, 8, 45, 11, 45, 12, 45, 323, 1, + 45, 1, 45, 1, 46, 1, 46, 1, 47, 4, 47, 331, 8, 47, 11, 47, 12, 47, 332, + 1, 48, 1, 48, 3, 48, 337, 8, 48, 1, 48, 4, 48, 340, 8, 48, 11, 48, 12, + 48, 341, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 350, 8, 49, 0, + 0, 50, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, + 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, + 39, 20, 41, 21, 43, 22, 45, 23, 47, 0, 49, 0, 51, 24, 53, 25, 55, 26, 57, + 27, 59, 28, 61, 29, 63, 30, 65, 31, 67, 32, 69, 33, 71, 34, 73, 35, 75, + 36, 77, 37, 79, 38, 81, 39, 83, 40, 85, 41, 87, 42, 89, 43, 91, 44, 93, + 45, 95, 0, 97, 0, 99, 0, 1, 0, 28, 2, 0, 83, 83, 115, 115, 2, 0, 69, 69, + 101, 101, 2, 0, 65, 65, 97, 97, 2, 0, 82, 82, 114, 114, 2, 0, 67, 67, 99, + 99, 2, 0, 72, 72, 104, 104, 2, 0, 87, 87, 119, 119, 2, 0, 84, 84, 116, 116, 2, 0, 73, 73, 105, 105, 2, 0, 77, 77, 109, 109, 2, 0, 86, 86, 118, 118, 2, 0, 76, 76, 108, 108, 2, 0, 88, 88, 120, 120, 2, 0, 66, 66, 98, 98, 2, 0, 70, 70, 102, 102, 2, 0, 68, 68, 100, 100, 2, 0, 79, 79, 111, @@ -115,115 +116,118 @@ func spl1lexerLexerInit() { 112, 2, 0, 34, 34, 92, 92, 2, 0, 39, 39, 92, 92, 3, 0, 64, 90, 95, 95, 97, 122, 5, 0, 46, 46, 48, 58, 64, 90, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 48, 57, 2, 0, 43, 43, 45, 45, 6, 0, 100, 100, 104, 104, - 109, 109, 115, 115, 119, 119, 121, 121, 358, 0, 1, 1, 0, 0, 0, 0, 3, 1, + 109, 109, 115, 115, 119, 119, 121, 121, 367, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, - 0, 0, 43, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, + 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, - 0, 1, 99, 1, 0, 0, 0, 3, 106, 1, 0, 0, 0, 5, 112, 1, 0, 0, 0, 7, 118, 1, - 0, 0, 0, 9, 128, 1, 0, 0, 0, 11, 133, 1, 0, 0, 0, 13, 137, 1, 0, 0, 0, - 15, 143, 1, 0, 0, 0, 17, 150, 1, 0, 0, 0, 19, 155, 1, 0, 0, 0, 21, 160, - 1, 0, 0, 0, 23, 164, 1, 0, 0, 0, 25, 167, 1, 0, 0, 0, 27, 170, 1, 0, 0, - 0, 29, 175, 1, 0, 0, 0, 31, 181, 1, 0, 0, 0, 33, 187, 1, 0, 0, 0, 35, 191, - 1, 0, 0, 0, 37, 194, 1, 0, 0, 0, 39, 198, 1, 0, 0, 0, 41, 208, 1, 0, 0, - 0, 43, 224, 1, 0, 0, 0, 45, 241, 1, 0, 0, 0, 47, 259, 1, 0, 0, 0, 49, 262, - 1, 0, 0, 0, 51, 269, 1, 0, 0, 0, 53, 272, 1, 0, 0, 0, 55, 275, 1, 0, 0, - 0, 57, 278, 1, 0, 0, 0, 59, 281, 1, 0, 0, 0, 61, 283, 1, 0, 0, 0, 63, 285, - 1, 0, 0, 0, 65, 287, 1, 0, 0, 0, 67, 289, 1, 0, 0, 0, 69, 291, 1, 0, 0, - 0, 71, 293, 1, 0, 0, 0, 73, 295, 1, 0, 0, 0, 75, 297, 1, 0, 0, 0, 77, 299, - 1, 0, 0, 0, 79, 301, 1, 0, 0, 0, 81, 303, 1, 0, 0, 0, 83, 305, 1, 0, 0, - 0, 85, 307, 1, 0, 0, 0, 87, 309, 1, 0, 0, 0, 89, 312, 1, 0, 0, 0, 91, 318, - 1, 0, 0, 0, 93, 321, 1, 0, 0, 0, 95, 325, 1, 0, 0, 0, 97, 340, 1, 0, 0, - 0, 99, 100, 7, 0, 0, 0, 100, 101, 7, 1, 0, 0, 101, 102, 7, 2, 0, 0, 102, - 103, 7, 3, 0, 0, 103, 104, 7, 4, 0, 0, 104, 105, 7, 5, 0, 0, 105, 2, 1, - 0, 0, 0, 106, 107, 7, 6, 0, 0, 107, 108, 7, 5, 0, 0, 108, 109, 7, 1, 0, - 0, 109, 110, 7, 3, 0, 0, 110, 111, 7, 1, 0, 0, 111, 4, 1, 0, 0, 0, 112, - 113, 7, 0, 0, 0, 113, 114, 7, 7, 0, 0, 114, 115, 7, 2, 0, 0, 115, 116, - 7, 7, 0, 0, 116, 117, 7, 0, 0, 0, 117, 6, 1, 0, 0, 0, 118, 119, 7, 7, 0, - 0, 119, 120, 7, 8, 0, 0, 120, 121, 7, 9, 0, 0, 121, 122, 7, 1, 0, 0, 122, - 123, 7, 4, 0, 0, 123, 124, 7, 5, 0, 0, 124, 125, 7, 2, 0, 0, 125, 126, - 7, 3, 0, 0, 126, 127, 7, 7, 0, 0, 127, 8, 1, 0, 0, 0, 128, 129, 7, 1, 0, - 0, 129, 130, 7, 10, 0, 0, 130, 131, 7, 2, 0, 0, 131, 132, 7, 11, 0, 0, - 132, 10, 1, 0, 0, 0, 133, 134, 7, 3, 0, 0, 134, 135, 7, 1, 0, 0, 135, 136, - 7, 12, 0, 0, 136, 12, 1, 0, 0, 0, 137, 138, 7, 7, 0, 0, 138, 139, 7, 2, - 0, 0, 139, 140, 7, 13, 0, 0, 140, 141, 7, 11, 0, 0, 141, 142, 7, 1, 0, - 0, 142, 14, 1, 0, 0, 0, 143, 144, 7, 14, 0, 0, 144, 145, 7, 8, 0, 0, 145, - 146, 7, 1, 0, 0, 146, 147, 7, 11, 0, 0, 147, 148, 7, 15, 0, 0, 148, 149, - 7, 0, 0, 0, 149, 16, 1, 0, 0, 0, 150, 151, 7, 0, 0, 0, 151, 152, 7, 16, - 0, 0, 152, 153, 7, 3, 0, 0, 153, 154, 7, 7, 0, 0, 154, 18, 1, 0, 0, 0, - 155, 156, 7, 5, 0, 0, 156, 157, 7, 1, 0, 0, 157, 158, 7, 2, 0, 0, 158, - 159, 7, 15, 0, 0, 159, 20, 1, 0, 0, 0, 160, 161, 7, 13, 0, 0, 161, 162, - 7, 8, 0, 0, 162, 163, 7, 17, 0, 0, 163, 22, 1, 0, 0, 0, 164, 165, 7, 13, - 0, 0, 165, 166, 7, 18, 0, 0, 166, 24, 1, 0, 0, 0, 167, 168, 7, 2, 0, 0, - 168, 169, 7, 0, 0, 0, 169, 26, 1, 0, 0, 0, 170, 171, 7, 0, 0, 0, 171, 172, - 7, 19, 0, 0, 172, 173, 7, 2, 0, 0, 173, 174, 7, 17, 0, 0, 174, 28, 1, 0, - 0, 0, 175, 176, 7, 11, 0, 0, 176, 177, 7, 8, 0, 0, 177, 178, 7, 9, 0, 0, - 178, 179, 7, 8, 0, 0, 179, 180, 7, 7, 0, 0, 180, 30, 1, 0, 0, 0, 181, 182, - 7, 14, 0, 0, 182, 183, 7, 8, 0, 0, 183, 184, 7, 1, 0, 0, 184, 185, 7, 11, - 0, 0, 185, 186, 7, 15, 0, 0, 186, 32, 1, 0, 0, 0, 187, 188, 7, 2, 0, 0, - 188, 189, 7, 17, 0, 0, 189, 190, 7, 15, 0, 0, 190, 34, 1, 0, 0, 0, 191, - 192, 7, 16, 0, 0, 192, 193, 7, 3, 0, 0, 193, 36, 1, 0, 0, 0, 194, 195, - 7, 17, 0, 0, 195, 196, 7, 16, 0, 0, 196, 197, 7, 7, 0, 0, 197, 38, 1, 0, - 0, 0, 198, 201, 3, 93, 46, 0, 199, 200, 5, 46, 0, 0, 200, 202, 3, 93, 46, - 0, 201, 199, 1, 0, 0, 0, 201, 202, 1, 0, 0, 0, 202, 204, 1, 0, 0, 0, 203, - 205, 3, 95, 47, 0, 204, 203, 1, 0, 0, 0, 204, 205, 1, 0, 0, 0, 205, 206, - 1, 0, 0, 0, 206, 207, 3, 97, 48, 0, 207, 40, 1, 0, 0, 0, 208, 211, 3, 93, - 46, 0, 209, 210, 5, 46, 0, 0, 210, 212, 3, 93, 46, 0, 211, 209, 1, 0, 0, - 0, 211, 212, 1, 0, 0, 0, 212, 214, 1, 0, 0, 0, 213, 215, 3, 95, 47, 0, - 214, 213, 1, 0, 0, 0, 214, 215, 1, 0, 0, 0, 215, 42, 1, 0, 0, 0, 216, 217, - 5, 34, 0, 0, 217, 218, 3, 45, 22, 0, 218, 219, 5, 34, 0, 0, 219, 225, 1, - 0, 0, 0, 220, 221, 5, 39, 0, 0, 221, 222, 3, 47, 23, 0, 222, 223, 5, 39, - 0, 0, 223, 225, 1, 0, 0, 0, 224, 216, 1, 0, 0, 0, 224, 220, 1, 0, 0, 0, - 225, 44, 1, 0, 0, 0, 226, 228, 5, 92, 0, 0, 227, 226, 1, 0, 0, 0, 228, - 229, 1, 0, 0, 0, 229, 227, 1, 0, 0, 0, 229, 230, 1, 0, 0, 0, 230, 231, - 1, 0, 0, 0, 231, 240, 5, 34, 0, 0, 232, 234, 5, 92, 0, 0, 233, 232, 1, - 0, 0, 0, 234, 235, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 235, 236, 1, 0, 0, - 0, 236, 237, 1, 0, 0, 0, 237, 240, 8, 20, 0, 0, 238, 240, 8, 20, 0, 0, - 239, 227, 1, 0, 0, 0, 239, 233, 1, 0, 0, 0, 239, 238, 1, 0, 0, 0, 240, - 243, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 241, 242, 1, 0, 0, 0, 242, 46, 1, - 0, 0, 0, 243, 241, 1, 0, 0, 0, 244, 246, 5, 92, 0, 0, 245, 244, 1, 0, 0, - 0, 246, 247, 1, 0, 0, 0, 247, 245, 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 248, - 249, 1, 0, 0, 0, 249, 258, 5, 39, 0, 0, 250, 252, 5, 92, 0, 0, 251, 250, - 1, 0, 0, 0, 252, 253, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 253, 254, 1, 0, - 0, 0, 254, 255, 1, 0, 0, 0, 255, 258, 8, 21, 0, 0, 256, 258, 8, 21, 0, - 0, 257, 245, 1, 0, 0, 0, 257, 251, 1, 0, 0, 0, 257, 256, 1, 0, 0, 0, 258, - 261, 1, 0, 0, 0, 259, 257, 1, 0, 0, 0, 259, 260, 1, 0, 0, 0, 260, 48, 1, - 0, 0, 0, 261, 259, 1, 0, 0, 0, 262, 266, 7, 22, 0, 0, 263, 265, 7, 23, - 0, 0, 264, 263, 1, 0, 0, 0, 265, 268, 1, 0, 0, 0, 266, 264, 1, 0, 0, 0, - 266, 267, 1, 0, 0, 0, 267, 50, 1, 0, 0, 0, 268, 266, 1, 0, 0, 0, 269, 270, - 5, 61, 0, 0, 270, 271, 5, 61, 0, 0, 271, 52, 1, 0, 0, 0, 272, 273, 5, 33, - 0, 0, 273, 274, 5, 61, 0, 0, 274, 54, 1, 0, 0, 0, 275, 276, 5, 60, 0, 0, - 276, 277, 5, 61, 0, 0, 277, 56, 1, 0, 0, 0, 278, 279, 5, 62, 0, 0, 279, - 280, 5, 61, 0, 0, 280, 58, 1, 0, 0, 0, 281, 282, 5, 61, 0, 0, 282, 60, - 1, 0, 0, 0, 283, 284, 5, 60, 0, 0, 284, 62, 1, 0, 0, 0, 285, 286, 5, 62, - 0, 0, 286, 64, 1, 0, 0, 0, 287, 288, 5, 33, 0, 0, 288, 66, 1, 0, 0, 0, - 289, 290, 5, 124, 0, 0, 290, 68, 1, 0, 0, 0, 291, 292, 5, 44, 0, 0, 292, - 70, 1, 0, 0, 0, 293, 294, 5, 40, 0, 0, 294, 72, 1, 0, 0, 0, 295, 296, 5, - 41, 0, 0, 296, 74, 1, 0, 0, 0, 297, 298, 5, 91, 0, 0, 298, 76, 1, 0, 0, - 0, 299, 300, 5, 93, 0, 0, 300, 78, 1, 0, 0, 0, 301, 302, 5, 43, 0, 0, 302, - 80, 1, 0, 0, 0, 303, 304, 5, 45, 0, 0, 304, 82, 1, 0, 0, 0, 305, 306, 5, - 42, 0, 0, 306, 84, 1, 0, 0, 0, 307, 308, 5, 47, 0, 0, 308, 86, 1, 0, 0, - 0, 309, 310, 5, 37, 0, 0, 310, 88, 1, 0, 0, 0, 311, 313, 7, 24, 0, 0, 312, - 311, 1, 0, 0, 0, 313, 314, 1, 0, 0, 0, 314, 312, 1, 0, 0, 0, 314, 315, - 1, 0, 0, 0, 315, 316, 1, 0, 0, 0, 316, 317, 6, 44, 0, 0, 317, 90, 1, 0, - 0, 0, 318, 319, 9, 0, 0, 0, 319, 92, 1, 0, 0, 0, 320, 322, 7, 25, 0, 0, - 321, 320, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 321, 1, 0, 0, 0, 323, - 324, 1, 0, 0, 0, 324, 94, 1, 0, 0, 0, 325, 327, 7, 1, 0, 0, 326, 328, 7, - 26, 0, 0, 327, 326, 1, 0, 0, 0, 327, 328, 1, 0, 0, 0, 328, 330, 1, 0, 0, - 0, 329, 331, 7, 25, 0, 0, 330, 329, 1, 0, 0, 0, 331, 332, 1, 0, 0, 0, 332, - 330, 1, 0, 0, 0, 332, 333, 1, 0, 0, 0, 333, 96, 1, 0, 0, 0, 334, 335, 5, - 109, 0, 0, 335, 336, 5, 111, 0, 0, 336, 341, 5, 110, 0, 0, 337, 338, 5, - 109, 0, 0, 338, 341, 5, 115, 0, 0, 339, 341, 7, 27, 0, 0, 340, 334, 1, - 0, 0, 0, 340, 337, 1, 0, 0, 0, 340, 339, 1, 0, 0, 0, 341, 98, 1, 0, 0, - 0, 20, 0, 201, 204, 211, 214, 224, 229, 235, 239, 241, 247, 253, 257, 259, - 266, 314, 323, 327, 332, 340, 1, 6, 0, 0, + 0, 0, 93, 1, 0, 0, 0, 1, 101, 1, 0, 0, 0, 3, 108, 1, 0, 0, 0, 5, 114, 1, + 0, 0, 0, 7, 120, 1, 0, 0, 0, 9, 130, 1, 0, 0, 0, 11, 135, 1, 0, 0, 0, 13, + 139, 1, 0, 0, 0, 15, 145, 1, 0, 0, 0, 17, 152, 1, 0, 0, 0, 19, 157, 1, + 0, 0, 0, 21, 162, 1, 0, 0, 0, 23, 166, 1, 0, 0, 0, 25, 173, 1, 0, 0, 0, + 27, 176, 1, 0, 0, 0, 29, 179, 1, 0, 0, 0, 31, 184, 1, 0, 0, 0, 33, 190, + 1, 0, 0, 0, 35, 196, 1, 0, 0, 0, 37, 200, 1, 0, 0, 0, 39, 203, 1, 0, 0, + 0, 41, 207, 1, 0, 0, 0, 43, 217, 1, 0, 0, 0, 45, 233, 1, 0, 0, 0, 47, 250, + 1, 0, 0, 0, 49, 268, 1, 0, 0, 0, 51, 271, 1, 0, 0, 0, 53, 278, 1, 0, 0, + 0, 55, 281, 1, 0, 0, 0, 57, 284, 1, 0, 0, 0, 59, 287, 1, 0, 0, 0, 61, 290, + 1, 0, 0, 0, 63, 292, 1, 0, 0, 0, 65, 294, 1, 0, 0, 0, 67, 296, 1, 0, 0, + 0, 69, 298, 1, 0, 0, 0, 71, 300, 1, 0, 0, 0, 73, 302, 1, 0, 0, 0, 75, 304, + 1, 0, 0, 0, 77, 306, 1, 0, 0, 0, 79, 308, 1, 0, 0, 0, 81, 310, 1, 0, 0, + 0, 83, 312, 1, 0, 0, 0, 85, 314, 1, 0, 0, 0, 87, 316, 1, 0, 0, 0, 89, 318, + 1, 0, 0, 0, 91, 321, 1, 0, 0, 0, 93, 327, 1, 0, 0, 0, 95, 330, 1, 0, 0, + 0, 97, 334, 1, 0, 0, 0, 99, 349, 1, 0, 0, 0, 101, 102, 7, 0, 0, 0, 102, + 103, 7, 1, 0, 0, 103, 104, 7, 2, 0, 0, 104, 105, 7, 3, 0, 0, 105, 106, + 7, 4, 0, 0, 106, 107, 7, 5, 0, 0, 107, 2, 1, 0, 0, 0, 108, 109, 7, 6, 0, + 0, 109, 110, 7, 5, 0, 0, 110, 111, 7, 1, 0, 0, 111, 112, 7, 3, 0, 0, 112, + 113, 7, 1, 0, 0, 113, 4, 1, 0, 0, 0, 114, 115, 7, 0, 0, 0, 115, 116, 7, + 7, 0, 0, 116, 117, 7, 2, 0, 0, 117, 118, 7, 7, 0, 0, 118, 119, 7, 0, 0, + 0, 119, 6, 1, 0, 0, 0, 120, 121, 7, 7, 0, 0, 121, 122, 7, 8, 0, 0, 122, + 123, 7, 9, 0, 0, 123, 124, 7, 1, 0, 0, 124, 125, 7, 4, 0, 0, 125, 126, + 7, 5, 0, 0, 126, 127, 7, 2, 0, 0, 127, 128, 7, 3, 0, 0, 128, 129, 7, 7, + 0, 0, 129, 8, 1, 0, 0, 0, 130, 131, 7, 1, 0, 0, 131, 132, 7, 10, 0, 0, + 132, 133, 7, 2, 0, 0, 133, 134, 7, 11, 0, 0, 134, 10, 1, 0, 0, 0, 135, + 136, 7, 3, 0, 0, 136, 137, 7, 1, 0, 0, 137, 138, 7, 12, 0, 0, 138, 12, + 1, 0, 0, 0, 139, 140, 7, 7, 0, 0, 140, 141, 7, 2, 0, 0, 141, 142, 7, 13, + 0, 0, 142, 143, 7, 11, 0, 0, 143, 144, 7, 1, 0, 0, 144, 14, 1, 0, 0, 0, + 145, 146, 7, 14, 0, 0, 146, 147, 7, 8, 0, 0, 147, 148, 7, 1, 0, 0, 148, + 149, 7, 11, 0, 0, 149, 150, 7, 15, 0, 0, 150, 151, 7, 0, 0, 0, 151, 16, + 1, 0, 0, 0, 152, 153, 7, 0, 0, 0, 153, 154, 7, 16, 0, 0, 154, 155, 7, 3, + 0, 0, 155, 156, 7, 7, 0, 0, 156, 18, 1, 0, 0, 0, 157, 158, 7, 5, 0, 0, + 158, 159, 7, 1, 0, 0, 159, 160, 7, 2, 0, 0, 160, 161, 7, 15, 0, 0, 161, + 20, 1, 0, 0, 0, 162, 163, 7, 13, 0, 0, 163, 164, 7, 8, 0, 0, 164, 165, + 7, 17, 0, 0, 165, 22, 1, 0, 0, 0, 166, 167, 7, 3, 0, 0, 167, 168, 7, 1, + 0, 0, 168, 169, 7, 17, 0, 0, 169, 170, 7, 2, 0, 0, 170, 171, 7, 9, 0, 0, + 171, 172, 7, 1, 0, 0, 172, 24, 1, 0, 0, 0, 173, 174, 7, 13, 0, 0, 174, + 175, 7, 18, 0, 0, 175, 26, 1, 0, 0, 0, 176, 177, 7, 2, 0, 0, 177, 178, + 7, 0, 0, 0, 178, 28, 1, 0, 0, 0, 179, 180, 7, 0, 0, 0, 180, 181, 7, 19, + 0, 0, 181, 182, 7, 2, 0, 0, 182, 183, 7, 17, 0, 0, 183, 30, 1, 0, 0, 0, + 184, 185, 7, 11, 0, 0, 185, 186, 7, 8, 0, 0, 186, 187, 7, 9, 0, 0, 187, + 188, 7, 8, 0, 0, 188, 189, 7, 7, 0, 0, 189, 32, 1, 0, 0, 0, 190, 191, 7, + 14, 0, 0, 191, 192, 7, 8, 0, 0, 192, 193, 7, 1, 0, 0, 193, 194, 7, 11, + 0, 0, 194, 195, 7, 15, 0, 0, 195, 34, 1, 0, 0, 0, 196, 197, 7, 2, 0, 0, + 197, 198, 7, 17, 0, 0, 198, 199, 7, 15, 0, 0, 199, 36, 1, 0, 0, 0, 200, + 201, 7, 16, 0, 0, 201, 202, 7, 3, 0, 0, 202, 38, 1, 0, 0, 0, 203, 204, + 7, 17, 0, 0, 204, 205, 7, 16, 0, 0, 205, 206, 7, 7, 0, 0, 206, 40, 1, 0, + 0, 0, 207, 210, 3, 95, 47, 0, 208, 209, 5, 46, 0, 0, 209, 211, 3, 95, 47, + 0, 210, 208, 1, 0, 0, 0, 210, 211, 1, 0, 0, 0, 211, 213, 1, 0, 0, 0, 212, + 214, 3, 97, 48, 0, 213, 212, 1, 0, 0, 0, 213, 214, 1, 0, 0, 0, 214, 215, + 1, 0, 0, 0, 215, 216, 3, 99, 49, 0, 216, 42, 1, 0, 0, 0, 217, 220, 3, 95, + 47, 0, 218, 219, 5, 46, 0, 0, 219, 221, 3, 95, 47, 0, 220, 218, 1, 0, 0, + 0, 220, 221, 1, 0, 0, 0, 221, 223, 1, 0, 0, 0, 222, 224, 3, 97, 48, 0, + 223, 222, 1, 0, 0, 0, 223, 224, 1, 0, 0, 0, 224, 44, 1, 0, 0, 0, 225, 226, + 5, 34, 0, 0, 226, 227, 3, 47, 23, 0, 227, 228, 5, 34, 0, 0, 228, 234, 1, + 0, 0, 0, 229, 230, 5, 39, 0, 0, 230, 231, 3, 49, 24, 0, 231, 232, 5, 39, + 0, 0, 232, 234, 1, 0, 0, 0, 233, 225, 1, 0, 0, 0, 233, 229, 1, 0, 0, 0, + 234, 46, 1, 0, 0, 0, 235, 237, 5, 92, 0, 0, 236, 235, 1, 0, 0, 0, 237, + 238, 1, 0, 0, 0, 238, 236, 1, 0, 0, 0, 238, 239, 1, 0, 0, 0, 239, 240, + 1, 0, 0, 0, 240, 249, 5, 34, 0, 0, 241, 243, 5, 92, 0, 0, 242, 241, 1, + 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 242, 1, 0, 0, 0, 244, 245, 1, 0, 0, + 0, 245, 246, 1, 0, 0, 0, 246, 249, 8, 20, 0, 0, 247, 249, 8, 20, 0, 0, + 248, 236, 1, 0, 0, 0, 248, 242, 1, 0, 0, 0, 248, 247, 1, 0, 0, 0, 249, + 252, 1, 0, 0, 0, 250, 248, 1, 0, 0, 0, 250, 251, 1, 0, 0, 0, 251, 48, 1, + 0, 0, 0, 252, 250, 1, 0, 0, 0, 253, 255, 5, 92, 0, 0, 254, 253, 1, 0, 0, + 0, 255, 256, 1, 0, 0, 0, 256, 254, 1, 0, 0, 0, 256, 257, 1, 0, 0, 0, 257, + 258, 1, 0, 0, 0, 258, 267, 5, 39, 0, 0, 259, 261, 5, 92, 0, 0, 260, 259, + 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 260, 1, 0, 0, 0, 262, 263, 1, 0, + 0, 0, 263, 264, 1, 0, 0, 0, 264, 267, 8, 21, 0, 0, 265, 267, 8, 21, 0, + 0, 266, 254, 1, 0, 0, 0, 266, 260, 1, 0, 0, 0, 266, 265, 1, 0, 0, 0, 267, + 270, 1, 0, 0, 0, 268, 266, 1, 0, 0, 0, 268, 269, 1, 0, 0, 0, 269, 50, 1, + 0, 0, 0, 270, 268, 1, 0, 0, 0, 271, 275, 7, 22, 0, 0, 272, 274, 7, 23, + 0, 0, 273, 272, 1, 0, 0, 0, 274, 277, 1, 0, 0, 0, 275, 273, 1, 0, 0, 0, + 275, 276, 1, 0, 0, 0, 276, 52, 1, 0, 0, 0, 277, 275, 1, 0, 0, 0, 278, 279, + 5, 61, 0, 0, 279, 280, 5, 61, 0, 0, 280, 54, 1, 0, 0, 0, 281, 282, 5, 33, + 0, 0, 282, 283, 5, 61, 0, 0, 283, 56, 1, 0, 0, 0, 284, 285, 5, 60, 0, 0, + 285, 286, 5, 61, 0, 0, 286, 58, 1, 0, 0, 0, 287, 288, 5, 62, 0, 0, 288, + 289, 5, 61, 0, 0, 289, 60, 1, 0, 0, 0, 290, 291, 5, 61, 0, 0, 291, 62, + 1, 0, 0, 0, 292, 293, 5, 60, 0, 0, 293, 64, 1, 0, 0, 0, 294, 295, 5, 62, + 0, 0, 295, 66, 1, 0, 0, 0, 296, 297, 5, 33, 0, 0, 297, 68, 1, 0, 0, 0, + 298, 299, 5, 124, 0, 0, 299, 70, 1, 0, 0, 0, 300, 301, 5, 44, 0, 0, 301, + 72, 1, 0, 0, 0, 302, 303, 5, 40, 0, 0, 303, 74, 1, 0, 0, 0, 304, 305, 5, + 41, 0, 0, 305, 76, 1, 0, 0, 0, 306, 307, 5, 91, 0, 0, 307, 78, 1, 0, 0, + 0, 308, 309, 5, 93, 0, 0, 309, 80, 1, 0, 0, 0, 310, 311, 5, 43, 0, 0, 311, + 82, 1, 0, 0, 0, 312, 313, 5, 45, 0, 0, 313, 84, 1, 0, 0, 0, 314, 315, 5, + 42, 0, 0, 315, 86, 1, 0, 0, 0, 316, 317, 5, 47, 0, 0, 317, 88, 1, 0, 0, + 0, 318, 319, 5, 37, 0, 0, 319, 90, 1, 0, 0, 0, 320, 322, 7, 24, 0, 0, 321, + 320, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 321, 1, 0, 0, 0, 323, 324, + 1, 0, 0, 0, 324, 325, 1, 0, 0, 0, 325, 326, 6, 45, 0, 0, 326, 92, 1, 0, + 0, 0, 327, 328, 9, 0, 0, 0, 328, 94, 1, 0, 0, 0, 329, 331, 7, 25, 0, 0, + 330, 329, 1, 0, 0, 0, 331, 332, 1, 0, 0, 0, 332, 330, 1, 0, 0, 0, 332, + 333, 1, 0, 0, 0, 333, 96, 1, 0, 0, 0, 334, 336, 7, 1, 0, 0, 335, 337, 7, + 26, 0, 0, 336, 335, 1, 0, 0, 0, 336, 337, 1, 0, 0, 0, 337, 339, 1, 0, 0, + 0, 338, 340, 7, 25, 0, 0, 339, 338, 1, 0, 0, 0, 340, 341, 1, 0, 0, 0, 341, + 339, 1, 0, 0, 0, 341, 342, 1, 0, 0, 0, 342, 98, 1, 0, 0, 0, 343, 344, 5, + 109, 0, 0, 344, 345, 5, 111, 0, 0, 345, 350, 5, 110, 0, 0, 346, 347, 5, + 109, 0, 0, 347, 350, 5, 115, 0, 0, 348, 350, 7, 27, 0, 0, 349, 343, 1, + 0, 0, 0, 349, 346, 1, 0, 0, 0, 349, 348, 1, 0, 0, 0, 350, 100, 1, 0, 0, + 0, 20, 0, 210, 213, 220, 223, 233, 238, 244, 248, 250, 256, 262, 266, 268, + 275, 323, 332, 336, 341, 349, 1, 6, 0, 0, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -275,37 +279,38 @@ const ( SPL1LexerSORT = 9 SPL1LexerHEAD = 10 SPL1LexerBIN = 11 - SPL1LexerBY = 12 - SPL1LexerAS = 13 - SPL1LexerSPAN = 14 - SPL1LexerLIMIT = 15 - SPL1LexerFIELD = 16 - SPL1LexerAND = 17 - SPL1LexerOR = 18 - SPL1LexerNOT = 19 - SPL1LexerDURATION = 20 - SPL1LexerNUMBER = 21 - SPL1LexerSTRING = 22 - SPL1LexerIDENT = 23 - SPL1LexerEQ2 = 24 - SPL1LexerNE = 25 - SPL1LexerLE = 26 - SPL1LexerGE = 27 - SPL1LexerEQ = 28 - SPL1LexerLT = 29 - SPL1LexerGT = 30 - SPL1LexerBANG = 31 - SPL1LexerPIPE = 32 - SPL1LexerCOMMA = 33 - SPL1LexerLPAREN = 34 - SPL1LexerRPAREN = 35 - SPL1LexerLBRACKET = 36 - SPL1LexerRBRACKET = 37 - SPL1LexerPLUS = 38 - SPL1LexerMINUS = 39 - SPL1LexerSTAR = 40 - SPL1LexerSLASH = 41 - SPL1LexerPERCENT = 42 - SPL1LexerWS = 43 - SPL1LexerUNKNOWN = 44 + SPL1LexerRENAME = 12 + SPL1LexerBY = 13 + SPL1LexerAS = 14 + SPL1LexerSPAN = 15 + SPL1LexerLIMIT = 16 + SPL1LexerFIELD = 17 + SPL1LexerAND = 18 + SPL1LexerOR = 19 + SPL1LexerNOT = 20 + SPL1LexerDURATION = 21 + SPL1LexerNUMBER = 22 + SPL1LexerSTRING = 23 + SPL1LexerIDENT = 24 + SPL1LexerEQ2 = 25 + SPL1LexerNE = 26 + SPL1LexerLE = 27 + SPL1LexerGE = 28 + SPL1LexerEQ = 29 + SPL1LexerLT = 30 + SPL1LexerGT = 31 + SPL1LexerBANG = 32 + SPL1LexerPIPE = 33 + SPL1LexerCOMMA = 34 + SPL1LexerLPAREN = 35 + SPL1LexerRPAREN = 36 + SPL1LexerLBRACKET = 37 + SPL1LexerRBRACKET = 38 + SPL1LexerPLUS = 39 + SPL1LexerMINUS = 40 + SPL1LexerSTAR = 41 + SPL1LexerSLASH = 42 + SPL1LexerPERCENT = 43 + SPL1LexerWS = 44 + SPL1LexerUNKNOWN = 45 ) diff --git a/pkg/parser/spl1/gen/spl1_parser.go b/pkg/parser/spl1/gen/spl1_parser.go index 8d8265d..9a4c02e 100644 --- a/pkg/parser/spl1/gen/spl1_parser.go +++ b/pkg/parser/spl1/gen/spl1_parser.go @@ -33,17 +33,17 @@ func spl1ParserInit() { staticData := &SPL1ParserStaticData staticData.LiteralNames = []string{ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "'=='", "'!='", "'<='", "'>='", "'='", "'<'", - "'>'", "'!'", "'|'", "','", "'('", "')'", "'['", "']'", "'+'", "'-'", - "'*'", "'/'", "'%'", + "", "", "", "", "", "", "", "", "'=='", "'!='", "'<='", "'>='", "'='", + "'<'", "'>'", "'!'", "'|'", "','", "'('", "')'", "'['", "']'", "'+'", + "'-'", "'*'", "'/'", "'%'", } staticData.SymbolicNames = []string{ "", "SEARCH", "WHERE", "STATS", "TIMECHART", "EVAL", "REX", "TABLE", - "FIELDS", "SORT", "HEAD", "BIN", "BY", "AS", "SPAN", "LIMIT", "FIELD", - "AND", "OR", "NOT", "DURATION", "NUMBER", "STRING", "IDENT", "EQ2", - "NE", "LE", "GE", "EQ", "LT", "GT", "BANG", "PIPE", "COMMA", "LPAREN", - "RPAREN", "LBRACKET", "RBRACKET", "PLUS", "MINUS", "STAR", "SLASH", - "PERCENT", "WS", "UNKNOWN", "NUMBER_TIGHT", "STAR_TIGHT", "MINUS_TIGHT", + "FIELDS", "SORT", "HEAD", "BIN", "RENAME", "BY", "AS", "SPAN", "LIMIT", + "FIELD", "AND", "OR", "NOT", "DURATION", "NUMBER", "STRING", "IDENT", + "EQ2", "NE", "LE", "GE", "EQ", "LT", "GT", "BANG", "PIPE", "COMMA", + "LPAREN", "RPAREN", "LBRACKET", "RBRACKET", "PLUS", "MINUS", "STAR", + "SLASH", "PERCENT", "WS", "UNKNOWN", "NUMBER_TIGHT", "STAR_TIGHT", "MINUS_TIGHT", "STAR_TERM", "STAR_OP", "NOT_WORD", } staticData.RuleNames = []string{ @@ -61,12 +61,12 @@ func spl1ParserInit() { "aliasClause", "byClause", "timechartBody", "timechartSpan", "spanAssign", "rexField", "fieldExprList", "fieldExpr", "assignment", "spanValue", "tableItem", "fieldsSign", "fieldsItem", "sortBody", "sortItem", "sortFirstItem", - "sortField", "limitArg", "limitTail", "binItem", "binField", "identLikeNotSpan", - "identLikeNotLimit", + "sortField", "limitArg", "limitTail", "binItem", "renamePair", "renameField", + "binField", "identLikeNotSpan", "identLikeNotLimit", } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 1, 50, 748, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, + 4, 1, 51, 785, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, @@ -80,337 +80,356 @@ func spl1ParserInit() { 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, - 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 1, 0, 1, 0, 1, 0, 1, 1, 1, - 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 165, 8, 3, 1, 3, 1, 3, 3, 3, 169, - 8, 3, 1, 3, 1, 3, 1, 3, 3, 3, 174, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, - 1, 3, 5, 3, 182, 8, 3, 10, 3, 12, 3, 185, 9, 3, 1, 3, 1, 3, 3, 3, 189, - 8, 3, 1, 3, 1, 3, 1, 3, 5, 3, 194, 8, 3, 10, 3, 12, 3, 197, 9, 3, 1, 3, - 1, 3, 3, 3, 201, 8, 3, 1, 3, 5, 3, 204, 8, 3, 10, 3, 12, 3, 207, 9, 3, - 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 213, 8, 3, 1, 3, 1, 3, 5, 3, 217, 8, 3, 10, - 3, 12, 3, 220, 9, 3, 3, 3, 222, 8, 3, 1, 4, 1, 4, 5, 4, 226, 8, 4, 10, - 4, 12, 4, 229, 9, 4, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 235, 8, 5, 1, 6, 1, - 6, 5, 6, 239, 8, 6, 10, 6, 12, 6, 242, 9, 6, 1, 7, 1, 7, 1, 7, 1, 7, 3, - 7, 248, 8, 7, 1, 7, 1, 7, 3, 7, 252, 8, 7, 1, 8, 1, 8, 1, 8, 3, 8, 257, - 8, 8, 1, 8, 3, 8, 260, 8, 8, 1, 9, 1, 9, 5, 9, 264, 8, 9, 10, 9, 12, 9, - 267, 9, 9, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 273, 8, 10, 1, 11, 1, 11, - 1, 11, 3, 11, 278, 8, 11, 1, 12, 1, 12, 5, 12, 282, 8, 12, 10, 12, 12, - 12, 285, 9, 12, 1, 12, 1, 12, 5, 12, 289, 8, 12, 10, 12, 12, 12, 292, 9, - 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 301, 8, 12, - 3, 12, 303, 8, 12, 1, 12, 5, 12, 306, 8, 12, 10, 12, 12, 12, 309, 9, 12, - 1, 12, 1, 12, 1, 12, 3, 12, 314, 8, 12, 1, 12, 5, 12, 317, 8, 12, 10, 12, - 12, 12, 320, 9, 12, 3, 12, 322, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, - 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 335, 8, 13, 3, 13, 337, - 8, 13, 1, 14, 1, 14, 5, 14, 341, 8, 14, 10, 14, 12, 14, 344, 9, 14, 1, - 14, 5, 14, 347, 8, 14, 10, 14, 12, 14, 350, 9, 14, 1, 15, 1, 15, 1, 15, - 3, 15, 355, 8, 15, 1, 15, 3, 15, 358, 8, 15, 1, 16, 1, 16, 1, 16, 1, 16, - 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 368, 8, 16, 1, 17, 1, 17, 5, 17, 372, - 8, 17, 10, 17, 12, 17, 375, 9, 17, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 381, - 8, 18, 1, 19, 1, 19, 5, 19, 385, 8, 19, 10, 19, 12, 19, 388, 9, 19, 1, - 20, 1, 20, 1, 20, 1, 20, 3, 20, 394, 8, 20, 1, 21, 1, 21, 1, 21, 3, 21, - 399, 8, 21, 1, 21, 3, 21, 402, 8, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, - 1, 22, 1, 22, 5, 22, 411, 8, 22, 10, 22, 12, 22, 414, 9, 22, 1, 22, 1, - 22, 1, 22, 1, 22, 1, 22, 4, 22, 421, 8, 22, 11, 22, 12, 22, 422, 1, 22, - 1, 22, 3, 22, 427, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 3, - 23, 435, 8, 23, 1, 24, 1, 24, 5, 24, 439, 8, 24, 10, 24, 12, 24, 442, 9, - 24, 1, 25, 1, 25, 1, 25, 1, 25, 3, 25, 448, 8, 25, 1, 26, 1, 26, 5, 26, - 452, 8, 26, 10, 26, 12, 26, 455, 9, 26, 1, 27, 1, 27, 1, 27, 1, 27, 3, - 27, 461, 8, 27, 1, 27, 1, 27, 3, 27, 465, 8, 27, 1, 28, 1, 28, 1, 28, 3, - 28, 470, 8, 28, 1, 28, 3, 28, 473, 8, 28, 1, 29, 1, 29, 5, 29, 477, 8, - 29, 10, 29, 12, 29, 480, 9, 29, 1, 30, 1, 30, 1, 30, 1, 30, 3, 30, 486, - 8, 30, 1, 31, 1, 31, 5, 31, 490, 8, 31, 10, 31, 12, 31, 493, 9, 31, 1, - 32, 1, 32, 1, 32, 1, 32, 3, 32, 499, 8, 32, 1, 33, 1, 33, 5, 33, 503, 8, - 33, 10, 33, 12, 33, 506, 9, 33, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 512, - 8, 34, 1, 35, 1, 35, 1, 35, 3, 35, 517, 8, 35, 1, 35, 3, 35, 520, 8, 35, - 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 5, - 36, 532, 8, 36, 10, 36, 12, 36, 535, 9, 36, 3, 36, 537, 8, 36, 1, 36, 1, - 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 3, 36, 547, 8, 36, 1, 37, - 1, 37, 1, 37, 5, 37, 552, 8, 37, 10, 37, 12, 37, 555, 9, 37, 1, 38, 1, - 38, 1, 38, 1, 39, 1, 39, 1, 40, 1, 40, 1, 41, 1, 41, 3, 41, 566, 8, 41, - 1, 42, 1, 42, 1, 43, 1, 43, 1, 44, 1, 44, 3, 44, 574, 8, 44, 1, 45, 1, - 45, 1, 45, 3, 45, 579, 8, 45, 1, 46, 1, 46, 1, 47, 1, 47, 3, 47, 585, 8, - 47, 1, 48, 1, 48, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 5, 50, 594, 8, 50, - 10, 50, 12, 50, 597, 9, 50, 1, 51, 1, 51, 1, 51, 3, 51, 602, 8, 51, 1, - 51, 3, 51, 605, 8, 51, 1, 51, 3, 51, 608, 8, 51, 1, 52, 1, 52, 1, 52, 5, - 52, 613, 8, 52, 10, 52, 12, 52, 616, 9, 52, 1, 53, 1, 53, 1, 53, 3, 53, - 621, 8, 53, 1, 53, 3, 53, 624, 8, 53, 1, 53, 3, 53, 627, 8, 53, 1, 54, - 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, 639, - 8, 56, 1, 56, 1, 56, 3, 56, 643, 8, 56, 3, 56, 645, 8, 56, 1, 57, 1, 57, - 1, 57, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 60, 1, - 60, 1, 60, 1, 60, 5, 60, 662, 8, 60, 10, 60, 12, 60, 665, 9, 60, 1, 61, - 1, 61, 3, 61, 669, 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 3, - 63, 677, 8, 63, 1, 64, 1, 64, 1, 64, 3, 64, 682, 8, 64, 1, 65, 1, 65, 3, - 65, 686, 8, 65, 1, 66, 1, 66, 3, 66, 690, 8, 66, 1, 67, 1, 67, 5, 67, 694, - 8, 67, 10, 67, 12, 67, 697, 9, 67, 1, 67, 1, 67, 5, 67, 701, 8, 67, 10, - 67, 12, 67, 704, 9, 67, 1, 67, 3, 67, 707, 8, 67, 1, 68, 1, 68, 3, 68, - 711, 8, 68, 1, 68, 3, 68, 714, 8, 68, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, - 3, 69, 721, 8, 69, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 3, 71, 729, - 8, 71, 1, 72, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 3, - 73, 740, 8, 73, 1, 74, 1, 74, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 0, 0, - 77, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, + 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, + 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 169, + 8, 3, 1, 3, 1, 3, 3, 3, 173, 8, 3, 1, 3, 1, 3, 1, 3, 3, 3, 178, 8, 3, 1, + 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 186, 8, 3, 10, 3, 12, 3, 189, 9, + 3, 1, 3, 1, 3, 3, 3, 193, 8, 3, 1, 3, 1, 3, 1, 3, 5, 3, 198, 8, 3, 10, + 3, 12, 3, 201, 9, 3, 1, 3, 1, 3, 3, 3, 205, 8, 3, 1, 3, 5, 3, 208, 8, 3, + 10, 3, 12, 3, 211, 9, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 217, 8, 3, 1, 3, + 1, 3, 5, 3, 221, 8, 3, 10, 3, 12, 3, 224, 9, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 3, 5, 3, 231, 8, 3, 10, 3, 12, 3, 234, 9, 3, 3, 3, 236, 8, 3, 1, 4, + 1, 4, 5, 4, 240, 8, 4, 10, 4, 12, 4, 243, 9, 4, 1, 5, 1, 5, 1, 5, 1, 5, + 3, 5, 249, 8, 5, 1, 6, 1, 6, 5, 6, 253, 8, 6, 10, 6, 12, 6, 256, 9, 6, + 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 262, 8, 7, 1, 7, 1, 7, 3, 7, 266, 8, 7, 1, + 8, 1, 8, 1, 8, 3, 8, 271, 8, 8, 1, 8, 3, 8, 274, 8, 8, 1, 9, 1, 9, 5, 9, + 278, 8, 9, 10, 9, 12, 9, 281, 9, 9, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, + 287, 8, 10, 1, 11, 1, 11, 1, 11, 3, 11, 292, 8, 11, 1, 12, 1, 12, 5, 12, + 296, 8, 12, 10, 12, 12, 12, 299, 9, 12, 1, 12, 1, 12, 5, 12, 303, 8, 12, + 10, 12, 12, 12, 306, 9, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, + 12, 3, 12, 315, 8, 12, 3, 12, 317, 8, 12, 1, 12, 5, 12, 320, 8, 12, 10, + 12, 12, 12, 323, 9, 12, 1, 12, 1, 12, 1, 12, 3, 12, 328, 8, 12, 1, 12, + 5, 12, 331, 8, 12, 10, 12, 12, 12, 334, 9, 12, 3, 12, 336, 8, 12, 1, 13, + 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, + 13, 349, 8, 13, 3, 13, 351, 8, 13, 1, 14, 1, 14, 5, 14, 355, 8, 14, 10, + 14, 12, 14, 358, 9, 14, 1, 14, 5, 14, 361, 8, 14, 10, 14, 12, 14, 364, + 9, 14, 1, 15, 1, 15, 1, 15, 3, 15, 369, 8, 15, 1, 15, 3, 15, 372, 8, 15, + 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 382, 8, + 16, 1, 17, 1, 17, 5, 17, 386, 8, 17, 10, 17, 12, 17, 389, 9, 17, 1, 18, + 1, 18, 1, 18, 1, 18, 3, 18, 395, 8, 18, 1, 19, 1, 19, 5, 19, 399, 8, 19, + 10, 19, 12, 19, 402, 9, 19, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 408, 8, + 20, 1, 21, 1, 21, 1, 21, 3, 21, 413, 8, 21, 1, 21, 3, 21, 416, 8, 21, 1, + 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 5, 22, 425, 8, 22, 10, 22, + 12, 22, 428, 9, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 4, 22, 435, 8, 22, + 11, 22, 12, 22, 436, 1, 22, 1, 22, 3, 22, 441, 8, 22, 1, 23, 1, 23, 1, + 23, 1, 23, 1, 23, 1, 23, 3, 23, 449, 8, 23, 1, 24, 1, 24, 5, 24, 453, 8, + 24, 10, 24, 12, 24, 456, 9, 24, 1, 25, 1, 25, 1, 25, 1, 25, 3, 25, 462, + 8, 25, 1, 26, 1, 26, 5, 26, 466, 8, 26, 10, 26, 12, 26, 469, 9, 26, 1, + 27, 1, 27, 1, 27, 1, 27, 3, 27, 475, 8, 27, 1, 27, 1, 27, 3, 27, 479, 8, + 27, 1, 28, 1, 28, 1, 28, 3, 28, 484, 8, 28, 1, 28, 3, 28, 487, 8, 28, 1, + 29, 1, 29, 5, 29, 491, 8, 29, 10, 29, 12, 29, 494, 9, 29, 1, 30, 1, 30, + 1, 30, 1, 30, 3, 30, 500, 8, 30, 1, 31, 1, 31, 5, 31, 504, 8, 31, 10, 31, + 12, 31, 507, 9, 31, 1, 32, 1, 32, 1, 32, 1, 32, 3, 32, 513, 8, 32, 1, 33, + 1, 33, 5, 33, 517, 8, 33, 10, 33, 12, 33, 520, 9, 33, 1, 34, 1, 34, 1, + 34, 1, 34, 3, 34, 526, 8, 34, 1, 35, 1, 35, 1, 35, 3, 35, 531, 8, 35, 1, + 35, 3, 35, 534, 8, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, + 1, 36, 1, 36, 1, 36, 5, 36, 546, 8, 36, 10, 36, 12, 36, 549, 9, 36, 3, + 36, 551, 8, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, + 3, 36, 561, 8, 36, 1, 37, 1, 37, 1, 37, 5, 37, 566, 8, 37, 10, 37, 12, + 37, 569, 9, 37, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 40, 1, 40, 1, 41, + 1, 41, 3, 41, 580, 8, 41, 1, 42, 1, 42, 1, 43, 1, 43, 1, 44, 1, 44, 3, + 44, 588, 8, 44, 1, 45, 1, 45, 1, 45, 3, 45, 593, 8, 45, 1, 46, 1, 46, 1, + 47, 1, 47, 3, 47, 599, 8, 47, 1, 48, 1, 48, 1, 49, 1, 49, 1, 50, 1, 50, + 1, 50, 5, 50, 608, 8, 50, 10, 50, 12, 50, 611, 9, 50, 1, 51, 1, 51, 1, + 51, 3, 51, 616, 8, 51, 1, 51, 3, 51, 619, 8, 51, 1, 51, 3, 51, 622, 8, + 51, 1, 52, 1, 52, 1, 52, 5, 52, 627, 8, 52, 10, 52, 12, 52, 630, 9, 52, + 1, 53, 1, 53, 1, 53, 3, 53, 635, 8, 53, 1, 53, 3, 53, 638, 8, 53, 1, 53, + 3, 53, 641, 8, 53, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 56, 1, + 56, 1, 56, 1, 56, 3, 56, 653, 8, 56, 1, 56, 1, 56, 3, 56, 657, 8, 56, 3, + 56, 659, 8, 56, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, + 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 676, 8, 60, 10, + 60, 12, 60, 679, 9, 60, 1, 61, 1, 61, 3, 61, 683, 8, 61, 1, 62, 1, 62, + 1, 62, 1, 62, 1, 63, 1, 63, 3, 63, 691, 8, 63, 1, 64, 1, 64, 1, 64, 3, + 64, 696, 8, 64, 1, 65, 1, 65, 3, 65, 700, 8, 65, 1, 66, 1, 66, 3, 66, 704, + 8, 66, 1, 67, 1, 67, 5, 67, 708, 8, 67, 10, 67, 12, 67, 711, 9, 67, 1, + 67, 1, 67, 5, 67, 715, 8, 67, 10, 67, 12, 67, 718, 9, 67, 1, 67, 3, 67, + 721, 8, 67, 1, 68, 1, 68, 3, 68, 725, 8, 68, 1, 68, 3, 68, 728, 8, 68, + 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 3, 69, 735, 8, 69, 1, 70, 1, 70, 1, + 71, 1, 71, 1, 71, 1, 71, 3, 71, 743, 8, 71, 1, 72, 1, 72, 1, 72, 1, 73, + 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 3, 73, 754, 8, 73, 1, 74, 1, 74, 1, + 74, 1, 74, 1, 75, 1, 75, 1, 75, 3, 75, 763, 8, 75, 1, 75, 1, 75, 1, 75, + 3, 75, 768, 8, 75, 1, 75, 1, 75, 3, 75, 772, 8, 75, 1, 75, 1, 75, 1, 75, + 3, 75, 777, 8, 75, 1, 76, 1, 76, 1, 77, 1, 77, 1, 78, 1, 78, 1, 78, 0, + 0, 79, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, - 136, 138, 140, 142, 144, 146, 148, 150, 152, 0, 13, 1, 1, 32, 32, 2, 0, - 19, 19, 31, 31, 1, 0, 38, 39, 4, 1, 24, 30, 32, 33, 35, 35, 37, 37, 1, - 0, 24, 30, 3, 0, 40, 40, 46, 46, 48, 48, 2, 0, 39, 39, 47, 47, 2, 0, 21, - 21, 45, 45, 3, 0, 40, 42, 46, 46, 49, 49, 3, 0, 1, 19, 23, 23, 50, 50, - 3, 0, 1, 18, 23, 23, 50, 50, 3, 0, 1, 13, 15, 19, 23, 23, 4, 0, 1, 14, - 16, 19, 23, 23, 50, 50, 802, 0, 154, 1, 0, 0, 0, 2, 157, 1, 0, 0, 0, 4, - 160, 1, 0, 0, 0, 6, 221, 1, 0, 0, 0, 8, 223, 1, 0, 0, 0, 10, 230, 1, 0, - 0, 0, 12, 236, 1, 0, 0, 0, 14, 251, 1, 0, 0, 0, 16, 259, 1, 0, 0, 0, 18, - 261, 1, 0, 0, 0, 20, 268, 1, 0, 0, 0, 22, 277, 1, 0, 0, 0, 24, 321, 1, - 0, 0, 0, 26, 336, 1, 0, 0, 0, 28, 338, 1, 0, 0, 0, 30, 357, 1, 0, 0, 0, - 32, 367, 1, 0, 0, 0, 34, 369, 1, 0, 0, 0, 36, 376, 1, 0, 0, 0, 38, 382, - 1, 0, 0, 0, 40, 389, 1, 0, 0, 0, 42, 401, 1, 0, 0, 0, 44, 426, 1, 0, 0, - 0, 46, 434, 1, 0, 0, 0, 48, 436, 1, 0, 0, 0, 50, 443, 1, 0, 0, 0, 52, 449, - 1, 0, 0, 0, 54, 464, 1, 0, 0, 0, 56, 472, 1, 0, 0, 0, 58, 474, 1, 0, 0, - 0, 60, 481, 1, 0, 0, 0, 62, 487, 1, 0, 0, 0, 64, 494, 1, 0, 0, 0, 66, 500, - 1, 0, 0, 0, 68, 507, 1, 0, 0, 0, 70, 519, 1, 0, 0, 0, 72, 546, 1, 0, 0, - 0, 74, 548, 1, 0, 0, 0, 76, 556, 1, 0, 0, 0, 78, 559, 1, 0, 0, 0, 80, 561, - 1, 0, 0, 0, 82, 565, 1, 0, 0, 0, 84, 567, 1, 0, 0, 0, 86, 569, 1, 0, 0, - 0, 88, 573, 1, 0, 0, 0, 90, 578, 1, 0, 0, 0, 92, 580, 1, 0, 0, 0, 94, 584, - 1, 0, 0, 0, 96, 586, 1, 0, 0, 0, 98, 588, 1, 0, 0, 0, 100, 590, 1, 0, 0, - 0, 102, 598, 1, 0, 0, 0, 104, 609, 1, 0, 0, 0, 106, 617, 1, 0, 0, 0, 108, - 628, 1, 0, 0, 0, 110, 631, 1, 0, 0, 0, 112, 644, 1, 0, 0, 0, 114, 646, - 1, 0, 0, 0, 116, 649, 1, 0, 0, 0, 118, 652, 1, 0, 0, 0, 120, 657, 1, 0, - 0, 0, 122, 668, 1, 0, 0, 0, 124, 670, 1, 0, 0, 0, 126, 676, 1, 0, 0, 0, - 128, 681, 1, 0, 0, 0, 130, 685, 1, 0, 0, 0, 132, 689, 1, 0, 0, 0, 134, - 706, 1, 0, 0, 0, 136, 713, 1, 0, 0, 0, 138, 720, 1, 0, 0, 0, 140, 722, - 1, 0, 0, 0, 142, 728, 1, 0, 0, 0, 144, 730, 1, 0, 0, 0, 146, 739, 1, 0, - 0, 0, 148, 741, 1, 0, 0, 0, 150, 743, 1, 0, 0, 0, 152, 745, 1, 0, 0, 0, - 154, 155, 3, 6, 3, 0, 155, 156, 3, 4, 2, 0, 156, 1, 1, 0, 0, 0, 157, 158, - 3, 8, 4, 0, 158, 159, 3, 4, 2, 0, 159, 3, 1, 0, 0, 0, 160, 161, 7, 0, 0, - 0, 161, 5, 1, 0, 0, 0, 162, 164, 5, 1, 0, 0, 163, 165, 3, 8, 4, 0, 164, - 163, 1, 0, 0, 0, 164, 165, 1, 0, 0, 0, 165, 222, 1, 0, 0, 0, 166, 168, - 5, 2, 0, 0, 167, 169, 3, 48, 24, 0, 168, 167, 1, 0, 0, 0, 168, 169, 1, - 0, 0, 0, 169, 222, 1, 0, 0, 0, 170, 171, 5, 3, 0, 0, 171, 173, 3, 100, - 50, 0, 172, 174, 3, 110, 55, 0, 173, 172, 1, 0, 0, 0, 173, 174, 1, 0, 0, - 0, 174, 222, 1, 0, 0, 0, 175, 176, 5, 4, 0, 0, 176, 222, 3, 112, 56, 0, - 177, 178, 5, 5, 0, 0, 178, 183, 3, 124, 62, 0, 179, 180, 5, 33, 0, 0, 180, - 182, 3, 124, 62, 0, 181, 179, 1, 0, 0, 0, 182, 185, 1, 0, 0, 0, 183, 181, - 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, 222, 1, 0, 0, 0, 185, 183, 1, 0, - 0, 0, 186, 188, 5, 6, 0, 0, 187, 189, 3, 118, 59, 0, 188, 187, 1, 0, 0, - 0, 188, 189, 1, 0, 0, 0, 189, 190, 1, 0, 0, 0, 190, 222, 5, 22, 0, 0, 191, - 195, 5, 7, 0, 0, 192, 194, 3, 128, 64, 0, 193, 192, 1, 0, 0, 0, 194, 197, - 1, 0, 0, 0, 195, 193, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 222, 1, 0, - 0, 0, 197, 195, 1, 0, 0, 0, 198, 200, 5, 8, 0, 0, 199, 201, 3, 130, 65, - 0, 200, 199, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201, 205, 1, 0, 0, 0, 202, - 204, 3, 132, 66, 0, 203, 202, 1, 0, 0, 0, 204, 207, 1, 0, 0, 0, 205, 203, - 1, 0, 0, 0, 205, 206, 1, 0, 0, 0, 206, 222, 1, 0, 0, 0, 207, 205, 1, 0, - 0, 0, 208, 209, 5, 9, 0, 0, 209, 222, 3, 134, 67, 0, 210, 212, 5, 10, 0, - 0, 211, 213, 3, 142, 71, 0, 212, 211, 1, 0, 0, 0, 212, 213, 1, 0, 0, 0, - 213, 222, 1, 0, 0, 0, 214, 218, 5, 11, 0, 0, 215, 217, 3, 146, 73, 0, 216, - 215, 1, 0, 0, 0, 217, 220, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 218, 219, - 1, 0, 0, 0, 219, 222, 1, 0, 0, 0, 220, 218, 1, 0, 0, 0, 221, 162, 1, 0, - 0, 0, 221, 166, 1, 0, 0, 0, 221, 170, 1, 0, 0, 0, 221, 175, 1, 0, 0, 0, - 221, 177, 1, 0, 0, 0, 221, 186, 1, 0, 0, 0, 221, 191, 1, 0, 0, 0, 221, - 198, 1, 0, 0, 0, 221, 208, 1, 0, 0, 0, 221, 210, 1, 0, 0, 0, 221, 214, - 1, 0, 0, 0, 222, 7, 1, 0, 0, 0, 223, 227, 3, 12, 6, 0, 224, 226, 3, 10, - 5, 0, 225, 224, 1, 0, 0, 0, 226, 229, 1, 0, 0, 0, 227, 225, 1, 0, 0, 0, - 227, 228, 1, 0, 0, 0, 228, 9, 1, 0, 0, 0, 229, 227, 1, 0, 0, 0, 230, 231, - 4, 5, 0, 0, 231, 234, 5, 18, 0, 0, 232, 235, 3, 12, 6, 0, 233, 235, 3, - 76, 38, 0, 234, 232, 1, 0, 0, 0, 234, 233, 1, 0, 0, 0, 235, 11, 1, 0, 0, - 0, 236, 240, 3, 16, 8, 0, 237, 239, 3, 14, 7, 0, 238, 237, 1, 0, 0, 0, - 239, 242, 1, 0, 0, 0, 240, 238, 1, 0, 0, 0, 240, 241, 1, 0, 0, 0, 241, - 13, 1, 0, 0, 0, 242, 240, 1, 0, 0, 0, 243, 244, 4, 7, 1, 0, 244, 247, 5, - 17, 0, 0, 245, 248, 3, 16, 8, 0, 246, 248, 3, 76, 38, 0, 247, 245, 1, 0, - 0, 0, 247, 246, 1, 0, 0, 0, 248, 252, 1, 0, 0, 0, 249, 250, 4, 7, 2, 0, - 250, 252, 3, 16, 8, 0, 251, 243, 1, 0, 0, 0, 251, 249, 1, 0, 0, 0, 252, - 15, 1, 0, 0, 0, 253, 256, 7, 1, 0, 0, 254, 257, 3, 16, 8, 0, 255, 257, - 3, 76, 38, 0, 256, 254, 1, 0, 0, 0, 256, 255, 1, 0, 0, 0, 257, 260, 1, - 0, 0, 0, 258, 260, 3, 18, 9, 0, 259, 253, 1, 0, 0, 0, 259, 258, 1, 0, 0, - 0, 260, 17, 1, 0, 0, 0, 261, 265, 3, 34, 17, 0, 262, 264, 3, 20, 10, 0, - 263, 262, 1, 0, 0, 0, 264, 267, 1, 0, 0, 0, 265, 263, 1, 0, 0, 0, 265, - 266, 1, 0, 0, 0, 266, 19, 1, 0, 0, 0, 267, 265, 1, 0, 0, 0, 268, 269, 4, - 10, 3, 0, 269, 272, 3, 78, 39, 0, 270, 273, 3, 22, 11, 0, 271, 273, 3, - 76, 38, 0, 272, 270, 1, 0, 0, 0, 272, 271, 1, 0, 0, 0, 273, 21, 1, 0, 0, - 0, 274, 278, 5, 22, 0, 0, 275, 278, 3, 24, 12, 0, 276, 278, 3, 28, 14, - 0, 277, 274, 1, 0, 0, 0, 277, 275, 1, 0, 0, 0, 277, 276, 1, 0, 0, 0, 278, - 23, 1, 0, 0, 0, 279, 283, 3, 96, 48, 0, 280, 282, 3, 26, 13, 0, 281, 280, - 1, 0, 0, 0, 282, 285, 1, 0, 0, 0, 283, 281, 1, 0, 0, 0, 283, 284, 1, 0, - 0, 0, 284, 322, 1, 0, 0, 0, 285, 283, 1, 0, 0, 0, 286, 290, 5, 45, 0, 0, - 287, 289, 3, 26, 13, 0, 288, 287, 1, 0, 0, 0, 289, 292, 1, 0, 0, 0, 290, - 288, 1, 0, 0, 0, 290, 291, 1, 0, 0, 0, 291, 322, 1, 0, 0, 0, 292, 290, - 1, 0, 0, 0, 293, 302, 5, 46, 0, 0, 294, 303, 3, 96, 48, 0, 295, 303, 3, - 86, 43, 0, 296, 300, 3, 84, 42, 0, 297, 301, 3, 96, 48, 0, 298, 301, 3, - 86, 43, 0, 299, 301, 3, 82, 41, 0, 300, 297, 1, 0, 0, 0, 300, 298, 1, 0, - 0, 0, 300, 299, 1, 0, 0, 0, 301, 303, 1, 0, 0, 0, 302, 294, 1, 0, 0, 0, - 302, 295, 1, 0, 0, 0, 302, 296, 1, 0, 0, 0, 303, 307, 1, 0, 0, 0, 304, - 306, 3, 26, 13, 0, 305, 304, 1, 0, 0, 0, 306, 309, 1, 0, 0, 0, 307, 305, - 1, 0, 0, 0, 307, 308, 1, 0, 0, 0, 308, 322, 1, 0, 0, 0, 309, 307, 1, 0, - 0, 0, 310, 313, 5, 47, 0, 0, 311, 314, 3, 96, 48, 0, 312, 314, 3, 82, 41, - 0, 313, 311, 1, 0, 0, 0, 313, 312, 1, 0, 0, 0, 314, 318, 1, 0, 0, 0, 315, - 317, 3, 26, 13, 0, 316, 315, 1, 0, 0, 0, 317, 320, 1, 0, 0, 0, 318, 316, - 1, 0, 0, 0, 318, 319, 1, 0, 0, 0, 319, 322, 1, 0, 0, 0, 320, 318, 1, 0, - 0, 0, 321, 279, 1, 0, 0, 0, 321, 286, 1, 0, 0, 0, 321, 293, 1, 0, 0, 0, - 321, 310, 1, 0, 0, 0, 322, 25, 1, 0, 0, 0, 323, 324, 4, 13, 4, 0, 324, - 337, 3, 82, 41, 0, 325, 326, 4, 13, 5, 0, 326, 337, 3, 96, 48, 0, 327, - 328, 4, 13, 6, 0, 328, 337, 3, 86, 43, 0, 329, 330, 4, 13, 7, 0, 330, 334, - 3, 84, 42, 0, 331, 335, 3, 96, 48, 0, 332, 335, 3, 86, 43, 0, 333, 335, - 3, 82, 41, 0, 334, 331, 1, 0, 0, 0, 334, 332, 1, 0, 0, 0, 334, 333, 1, - 0, 0, 0, 335, 337, 1, 0, 0, 0, 336, 323, 1, 0, 0, 0, 336, 325, 1, 0, 0, - 0, 336, 327, 1, 0, 0, 0, 336, 329, 1, 0, 0, 0, 337, 27, 1, 0, 0, 0, 338, - 342, 3, 30, 15, 0, 339, 341, 3, 40, 20, 0, 340, 339, 1, 0, 0, 0, 341, 344, - 1, 0, 0, 0, 342, 340, 1, 0, 0, 0, 342, 343, 1, 0, 0, 0, 343, 348, 1, 0, - 0, 0, 344, 342, 1, 0, 0, 0, 345, 347, 3, 36, 18, 0, 346, 345, 1, 0, 0, - 0, 347, 350, 1, 0, 0, 0, 348, 346, 1, 0, 0, 0, 348, 349, 1, 0, 0, 0, 349, - 29, 1, 0, 0, 0, 350, 348, 1, 0, 0, 0, 351, 354, 7, 2, 0, 0, 352, 355, 3, - 42, 21, 0, 353, 355, 3, 76, 38, 0, 354, 352, 1, 0, 0, 0, 354, 353, 1, 0, - 0, 0, 355, 358, 1, 0, 0, 0, 356, 358, 3, 32, 16, 0, 357, 351, 1, 0, 0, - 0, 357, 356, 1, 0, 0, 0, 358, 31, 1, 0, 0, 0, 359, 360, 5, 34, 0, 0, 360, - 361, 3, 8, 4, 0, 361, 362, 5, 35, 0, 0, 362, 368, 1, 0, 0, 0, 363, 368, - 5, 20, 0, 0, 364, 368, 5, 21, 0, 0, 365, 368, 5, 40, 0, 0, 366, 368, 3, - 74, 37, 0, 367, 359, 1, 0, 0, 0, 367, 363, 1, 0, 0, 0, 367, 364, 1, 0, - 0, 0, 367, 365, 1, 0, 0, 0, 367, 366, 1, 0, 0, 0, 368, 33, 1, 0, 0, 0, - 369, 373, 3, 38, 19, 0, 370, 372, 3, 36, 18, 0, 371, 370, 1, 0, 0, 0, 372, - 375, 1, 0, 0, 0, 373, 371, 1, 0, 0, 0, 373, 374, 1, 0, 0, 0, 374, 35, 1, - 0, 0, 0, 375, 373, 1, 0, 0, 0, 376, 377, 4, 18, 8, 0, 377, 380, 3, 88, - 44, 0, 378, 381, 3, 38, 19, 0, 379, 381, 3, 76, 38, 0, 380, 378, 1, 0, - 0, 0, 380, 379, 1, 0, 0, 0, 381, 37, 1, 0, 0, 0, 382, 386, 3, 42, 21, 0, - 383, 385, 3, 40, 20, 0, 384, 383, 1, 0, 0, 0, 385, 388, 1, 0, 0, 0, 386, - 384, 1, 0, 0, 0, 386, 387, 1, 0, 0, 0, 387, 39, 1, 0, 0, 0, 388, 386, 1, - 0, 0, 0, 389, 390, 4, 20, 9, 0, 390, 393, 3, 92, 46, 0, 391, 394, 3, 42, - 21, 0, 392, 394, 3, 76, 38, 0, 393, 391, 1, 0, 0, 0, 393, 392, 1, 0, 0, - 0, 394, 41, 1, 0, 0, 0, 395, 398, 3, 94, 47, 0, 396, 399, 3, 42, 21, 0, - 397, 399, 3, 76, 38, 0, 398, 396, 1, 0, 0, 0, 398, 397, 1, 0, 0, 0, 399, - 402, 1, 0, 0, 0, 400, 402, 3, 44, 22, 0, 401, 395, 1, 0, 0, 0, 401, 400, - 1, 0, 0, 0, 402, 43, 1, 0, 0, 0, 403, 404, 5, 34, 0, 0, 404, 405, 3, 8, - 4, 0, 405, 406, 5, 35, 0, 0, 406, 427, 1, 0, 0, 0, 407, 427, 5, 22, 0, - 0, 408, 412, 3, 98, 49, 0, 409, 411, 3, 46, 23, 0, 410, 409, 1, 0, 0, 0, - 411, 414, 1, 0, 0, 0, 412, 410, 1, 0, 0, 0, 412, 413, 1, 0, 0, 0, 413, - 427, 1, 0, 0, 0, 414, 412, 1, 0, 0, 0, 415, 427, 3, 86, 43, 0, 416, 427, - 5, 20, 0, 0, 417, 418, 4, 22, 10, 0, 418, 420, 3, 82, 41, 0, 419, 421, - 3, 46, 23, 0, 420, 419, 1, 0, 0, 0, 421, 422, 1, 0, 0, 0, 422, 420, 1, - 0, 0, 0, 422, 423, 1, 0, 0, 0, 423, 427, 1, 0, 0, 0, 424, 427, 3, 80, 40, - 0, 425, 427, 3, 74, 37, 0, 426, 403, 1, 0, 0, 0, 426, 407, 1, 0, 0, 0, - 426, 408, 1, 0, 0, 0, 426, 415, 1, 0, 0, 0, 426, 416, 1, 0, 0, 0, 426, - 417, 1, 0, 0, 0, 426, 424, 1, 0, 0, 0, 426, 425, 1, 0, 0, 0, 427, 45, 1, - 0, 0, 0, 428, 429, 4, 23, 11, 0, 429, 435, 5, 48, 0, 0, 430, 431, 4, 23, - 12, 0, 431, 435, 3, 96, 48, 0, 432, 433, 4, 23, 13, 0, 433, 435, 3, 86, - 43, 0, 434, 428, 1, 0, 0, 0, 434, 430, 1, 0, 0, 0, 434, 432, 1, 0, 0, 0, - 435, 47, 1, 0, 0, 0, 436, 440, 3, 52, 26, 0, 437, 439, 3, 50, 25, 0, 438, - 437, 1, 0, 0, 0, 439, 442, 1, 0, 0, 0, 440, 438, 1, 0, 0, 0, 440, 441, - 1, 0, 0, 0, 441, 49, 1, 0, 0, 0, 442, 440, 1, 0, 0, 0, 443, 444, 4, 25, - 14, 0, 444, 447, 5, 18, 0, 0, 445, 448, 3, 52, 26, 0, 446, 448, 3, 76, - 38, 0, 447, 445, 1, 0, 0, 0, 447, 446, 1, 0, 0, 0, 448, 51, 1, 0, 0, 0, - 449, 453, 3, 56, 28, 0, 450, 452, 3, 54, 27, 0, 451, 450, 1, 0, 0, 0, 452, - 455, 1, 0, 0, 0, 453, 451, 1, 0, 0, 0, 453, 454, 1, 0, 0, 0, 454, 53, 1, - 0, 0, 0, 455, 453, 1, 0, 0, 0, 456, 457, 4, 27, 15, 0, 457, 460, 5, 17, - 0, 0, 458, 461, 3, 56, 28, 0, 459, 461, 3, 76, 38, 0, 460, 458, 1, 0, 0, - 0, 460, 459, 1, 0, 0, 0, 461, 465, 1, 0, 0, 0, 462, 463, 4, 27, 16, 0, - 463, 465, 3, 56, 28, 0, 464, 456, 1, 0, 0, 0, 464, 462, 1, 0, 0, 0, 465, - 55, 1, 0, 0, 0, 466, 469, 7, 1, 0, 0, 467, 470, 3, 56, 28, 0, 468, 470, - 3, 76, 38, 0, 469, 467, 1, 0, 0, 0, 469, 468, 1, 0, 0, 0, 470, 473, 1, - 0, 0, 0, 471, 473, 3, 58, 29, 0, 472, 466, 1, 0, 0, 0, 472, 471, 1, 0, - 0, 0, 473, 57, 1, 0, 0, 0, 474, 478, 3, 62, 31, 0, 475, 477, 3, 60, 30, - 0, 476, 475, 1, 0, 0, 0, 477, 480, 1, 0, 0, 0, 478, 476, 1, 0, 0, 0, 478, - 479, 1, 0, 0, 0, 479, 59, 1, 0, 0, 0, 480, 478, 1, 0, 0, 0, 481, 482, 4, - 30, 17, 0, 482, 485, 3, 78, 39, 0, 483, 486, 3, 62, 31, 0, 484, 486, 3, - 76, 38, 0, 485, 483, 1, 0, 0, 0, 485, 484, 1, 0, 0, 0, 486, 61, 1, 0, 0, - 0, 487, 491, 3, 66, 33, 0, 488, 490, 3, 64, 32, 0, 489, 488, 1, 0, 0, 0, - 490, 493, 1, 0, 0, 0, 491, 489, 1, 0, 0, 0, 491, 492, 1, 0, 0, 0, 492, - 63, 1, 0, 0, 0, 493, 491, 1, 0, 0, 0, 494, 495, 4, 32, 18, 0, 495, 498, - 3, 88, 44, 0, 496, 499, 3, 66, 33, 0, 497, 499, 3, 76, 38, 0, 498, 496, - 1, 0, 0, 0, 498, 497, 1, 0, 0, 0, 499, 65, 1, 0, 0, 0, 500, 504, 3, 70, - 35, 0, 501, 503, 3, 68, 34, 0, 502, 501, 1, 0, 0, 0, 503, 506, 1, 0, 0, - 0, 504, 502, 1, 0, 0, 0, 504, 505, 1, 0, 0, 0, 505, 67, 1, 0, 0, 0, 506, - 504, 1, 0, 0, 0, 507, 508, 4, 34, 19, 0, 508, 511, 3, 90, 45, 0, 509, 512, - 3, 70, 35, 0, 510, 512, 3, 76, 38, 0, 511, 509, 1, 0, 0, 0, 511, 510, 1, - 0, 0, 0, 512, 69, 1, 0, 0, 0, 513, 516, 3, 94, 47, 0, 514, 517, 3, 70, - 35, 0, 515, 517, 3, 76, 38, 0, 516, 514, 1, 0, 0, 0, 516, 515, 1, 0, 0, - 0, 517, 520, 1, 0, 0, 0, 518, 520, 3, 72, 36, 0, 519, 513, 1, 0, 0, 0, - 519, 518, 1, 0, 0, 0, 520, 71, 1, 0, 0, 0, 521, 522, 5, 34, 0, 0, 522, - 523, 3, 48, 24, 0, 523, 524, 5, 35, 0, 0, 524, 547, 1, 0, 0, 0, 525, 526, - 4, 36, 20, 0, 526, 527, 3, 98, 49, 0, 527, 536, 5, 34, 0, 0, 528, 533, - 3, 48, 24, 0, 529, 530, 5, 33, 0, 0, 530, 532, 3, 48, 24, 0, 531, 529, - 1, 0, 0, 0, 532, 535, 1, 0, 0, 0, 533, 531, 1, 0, 0, 0, 533, 534, 1, 0, - 0, 0, 534, 537, 1, 0, 0, 0, 535, 533, 1, 0, 0, 0, 536, 528, 1, 0, 0, 0, - 536, 537, 1, 0, 0, 0, 537, 538, 1, 0, 0, 0, 538, 539, 5, 35, 0, 0, 539, - 547, 1, 0, 0, 0, 540, 547, 3, 98, 49, 0, 541, 547, 5, 22, 0, 0, 542, 547, - 3, 86, 43, 0, 543, 547, 5, 20, 0, 0, 544, 547, 3, 80, 40, 0, 545, 547, - 3, 74, 37, 0, 546, 521, 1, 0, 0, 0, 546, 525, 1, 0, 0, 0, 546, 540, 1, - 0, 0, 0, 546, 541, 1, 0, 0, 0, 546, 542, 1, 0, 0, 0, 546, 543, 1, 0, 0, - 0, 546, 544, 1, 0, 0, 0, 546, 545, 1, 0, 0, 0, 547, 73, 1, 0, 0, 0, 548, - 549, 5, 36, 0, 0, 549, 553, 6, 37, -1, 0, 550, 552, 8, 0, 0, 0, 551, 550, - 1, 0, 0, 0, 552, 555, 1, 0, 0, 0, 553, 551, 1, 0, 0, 0, 553, 554, 1, 0, - 0, 0, 554, 75, 1, 0, 0, 0, 555, 553, 1, 0, 0, 0, 556, 557, 6, 38, -1, 0, - 557, 558, 7, 3, 0, 0, 558, 77, 1, 0, 0, 0, 559, 560, 7, 4, 0, 0, 560, 79, - 1, 0, 0, 0, 561, 562, 7, 5, 0, 0, 562, 81, 1, 0, 0, 0, 563, 566, 3, 80, - 40, 0, 564, 566, 5, 49, 0, 0, 565, 563, 1, 0, 0, 0, 565, 564, 1, 0, 0, - 0, 566, 83, 1, 0, 0, 0, 567, 568, 7, 6, 0, 0, 568, 85, 1, 0, 0, 0, 569, - 570, 7, 7, 0, 0, 570, 87, 1, 0, 0, 0, 571, 574, 5, 38, 0, 0, 572, 574, - 3, 84, 42, 0, 573, 571, 1, 0, 0, 0, 573, 572, 1, 0, 0, 0, 574, 89, 1, 0, - 0, 0, 575, 579, 3, 82, 41, 0, 576, 579, 5, 41, 0, 0, 577, 579, 5, 42, 0, - 0, 578, 575, 1, 0, 0, 0, 578, 576, 1, 0, 0, 0, 578, 577, 1, 0, 0, 0, 579, - 91, 1, 0, 0, 0, 580, 581, 7, 8, 0, 0, 581, 93, 1, 0, 0, 0, 582, 585, 3, - 84, 42, 0, 583, 585, 5, 38, 0, 0, 584, 582, 1, 0, 0, 0, 584, 583, 1, 0, - 0, 0, 585, 95, 1, 0, 0, 0, 586, 587, 7, 9, 0, 0, 587, 97, 1, 0, 0, 0, 588, - 589, 7, 10, 0, 0, 589, 99, 1, 0, 0, 0, 590, 595, 3, 102, 51, 0, 591, 592, - 5, 33, 0, 0, 592, 594, 3, 102, 51, 0, 593, 591, 1, 0, 0, 0, 594, 597, 1, - 0, 0, 0, 595, 593, 1, 0, 0, 0, 595, 596, 1, 0, 0, 0, 596, 101, 1, 0, 0, - 0, 597, 595, 1, 0, 0, 0, 598, 604, 3, 96, 48, 0, 599, 601, 5, 34, 0, 0, - 600, 602, 3, 48, 24, 0, 601, 600, 1, 0, 0, 0, 601, 602, 1, 0, 0, 0, 602, - 603, 1, 0, 0, 0, 603, 605, 5, 35, 0, 0, 604, 599, 1, 0, 0, 0, 604, 605, - 1, 0, 0, 0, 605, 607, 1, 0, 0, 0, 606, 608, 3, 108, 54, 0, 607, 606, 1, - 0, 0, 0, 607, 608, 1, 0, 0, 0, 608, 103, 1, 0, 0, 0, 609, 614, 3, 106, - 53, 0, 610, 611, 5, 33, 0, 0, 611, 613, 3, 102, 51, 0, 612, 610, 1, 0, - 0, 0, 613, 616, 1, 0, 0, 0, 614, 612, 1, 0, 0, 0, 614, 615, 1, 0, 0, 0, - 615, 105, 1, 0, 0, 0, 616, 614, 1, 0, 0, 0, 617, 623, 3, 150, 75, 0, 618, - 620, 5, 34, 0, 0, 619, 621, 3, 48, 24, 0, 620, 619, 1, 0, 0, 0, 620, 621, - 1, 0, 0, 0, 621, 622, 1, 0, 0, 0, 622, 624, 5, 35, 0, 0, 623, 618, 1, 0, - 0, 0, 623, 624, 1, 0, 0, 0, 624, 626, 1, 0, 0, 0, 625, 627, 3, 108, 54, - 0, 626, 625, 1, 0, 0, 0, 626, 627, 1, 0, 0, 0, 627, 107, 1, 0, 0, 0, 628, - 629, 5, 13, 0, 0, 629, 630, 3, 96, 48, 0, 630, 109, 1, 0, 0, 0, 631, 632, - 5, 12, 0, 0, 632, 633, 3, 120, 60, 0, 633, 111, 1, 0, 0, 0, 634, 635, 4, - 56, 21, 0, 635, 636, 3, 114, 57, 0, 636, 638, 3, 100, 50, 0, 637, 639, - 3, 110, 55, 0, 638, 637, 1, 0, 0, 0, 638, 639, 1, 0, 0, 0, 639, 645, 1, - 0, 0, 0, 640, 642, 3, 104, 52, 0, 641, 643, 3, 110, 55, 0, 642, 641, 1, - 0, 0, 0, 642, 643, 1, 0, 0, 0, 643, 645, 1, 0, 0, 0, 644, 634, 1, 0, 0, - 0, 644, 640, 1, 0, 0, 0, 645, 113, 1, 0, 0, 0, 646, 647, 5, 14, 0, 0, 647, - 648, 3, 116, 58, 0, 648, 115, 1, 0, 0, 0, 649, 650, 5, 28, 0, 0, 650, 651, - 3, 126, 63, 0, 651, 117, 1, 0, 0, 0, 652, 653, 4, 59, 22, 0, 653, 654, - 5, 16, 0, 0, 654, 655, 5, 28, 0, 0, 655, 656, 3, 96, 48, 0, 656, 119, 1, - 0, 0, 0, 657, 663, 3, 122, 61, 0, 658, 659, 5, 33, 0, 0, 659, 662, 3, 122, - 61, 0, 660, 662, 3, 122, 61, 0, 661, 658, 1, 0, 0, 0, 661, 660, 1, 0, 0, - 0, 662, 665, 1, 0, 0, 0, 663, 661, 1, 0, 0, 0, 663, 664, 1, 0, 0, 0, 664, - 121, 1, 0, 0, 0, 665, 663, 1, 0, 0, 0, 666, 669, 3, 96, 48, 0, 667, 669, - 3, 82, 41, 0, 668, 666, 1, 0, 0, 0, 668, 667, 1, 0, 0, 0, 669, 123, 1, - 0, 0, 0, 670, 671, 3, 96, 48, 0, 671, 672, 5, 28, 0, 0, 672, 673, 3, 48, - 24, 0, 673, 125, 1, 0, 0, 0, 674, 677, 5, 20, 0, 0, 675, 677, 3, 96, 48, - 0, 676, 674, 1, 0, 0, 0, 676, 675, 1, 0, 0, 0, 677, 127, 1, 0, 0, 0, 678, - 682, 5, 33, 0, 0, 679, 682, 3, 82, 41, 0, 680, 682, 3, 96, 48, 0, 681, - 678, 1, 0, 0, 0, 681, 679, 1, 0, 0, 0, 681, 680, 1, 0, 0, 0, 682, 129, - 1, 0, 0, 0, 683, 686, 3, 84, 42, 0, 684, 686, 5, 38, 0, 0, 685, 683, 1, - 0, 0, 0, 685, 684, 1, 0, 0, 0, 686, 131, 1, 0, 0, 0, 687, 690, 5, 33, 0, - 0, 688, 690, 3, 96, 48, 0, 689, 687, 1, 0, 0, 0, 689, 688, 1, 0, 0, 0, - 690, 133, 1, 0, 0, 0, 691, 695, 3, 142, 71, 0, 692, 694, 3, 136, 68, 0, - 693, 692, 1, 0, 0, 0, 694, 697, 1, 0, 0, 0, 695, 693, 1, 0, 0, 0, 695, - 696, 1, 0, 0, 0, 696, 707, 1, 0, 0, 0, 697, 695, 1, 0, 0, 0, 698, 702, - 3, 138, 69, 0, 699, 701, 3, 136, 68, 0, 700, 699, 1, 0, 0, 0, 701, 704, - 1, 0, 0, 0, 702, 700, 1, 0, 0, 0, 702, 703, 1, 0, 0, 0, 703, 707, 1, 0, - 0, 0, 704, 702, 1, 0, 0, 0, 705, 707, 1, 0, 0, 0, 706, 691, 1, 0, 0, 0, - 706, 698, 1, 0, 0, 0, 706, 705, 1, 0, 0, 0, 707, 135, 1, 0, 0, 0, 708, - 714, 5, 33, 0, 0, 709, 711, 3, 94, 47, 0, 710, 709, 1, 0, 0, 0, 710, 711, - 1, 0, 0, 0, 711, 712, 1, 0, 0, 0, 712, 714, 3, 96, 48, 0, 713, 708, 1, - 0, 0, 0, 713, 710, 1, 0, 0, 0, 714, 137, 1, 0, 0, 0, 715, 721, 5, 33, 0, - 0, 716, 717, 3, 94, 47, 0, 717, 718, 3, 96, 48, 0, 718, 721, 1, 0, 0, 0, - 719, 721, 3, 140, 70, 0, 720, 715, 1, 0, 0, 0, 720, 716, 1, 0, 0, 0, 720, - 719, 1, 0, 0, 0, 721, 139, 1, 0, 0, 0, 722, 723, 3, 152, 76, 0, 723, 141, - 1, 0, 0, 0, 724, 725, 4, 71, 23, 0, 725, 726, 5, 15, 0, 0, 726, 729, 3, - 144, 72, 0, 727, 729, 3, 86, 43, 0, 728, 724, 1, 0, 0, 0, 728, 727, 1, - 0, 0, 0, 729, 143, 1, 0, 0, 0, 730, 731, 5, 28, 0, 0, 731, 732, 3, 86, - 43, 0, 732, 145, 1, 0, 0, 0, 733, 734, 4, 73, 24, 0, 734, 735, 5, 14, 0, - 0, 735, 740, 3, 116, 58, 0, 736, 737, 3, 148, 74, 0, 737, 738, 6, 73, -1, - 0, 738, 740, 1, 0, 0, 0, 739, 733, 1, 0, 0, 0, 739, 736, 1, 0, 0, 0, 740, - 147, 1, 0, 0, 0, 741, 742, 3, 150, 75, 0, 742, 149, 1, 0, 0, 0, 743, 744, - 7, 11, 0, 0, 744, 151, 1, 0, 0, 0, 745, 746, 7, 12, 0, 0, 746, 153, 1, - 0, 0, 0, 95, 164, 168, 173, 183, 188, 195, 200, 205, 212, 218, 221, 227, - 234, 240, 247, 251, 256, 259, 265, 272, 277, 283, 290, 300, 302, 307, 313, - 318, 321, 334, 336, 342, 348, 354, 357, 367, 373, 380, 386, 393, 398, 401, - 412, 422, 426, 434, 440, 447, 453, 460, 464, 469, 472, 478, 485, 491, 498, - 504, 511, 516, 519, 533, 536, 546, 553, 565, 573, 578, 584, 595, 601, 604, - 607, 614, 620, 623, 626, 638, 642, 644, 661, 663, 668, 676, 681, 685, 689, - 695, 702, 706, 710, 713, 720, 728, 739, + 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 0, 13, 1, 1, 33, + 33, 2, 0, 20, 20, 32, 32, 1, 0, 39, 40, 4, 1, 25, 31, 33, 34, 36, 36, 38, + 38, 1, 0, 25, 31, 3, 0, 41, 41, 47, 47, 49, 49, 2, 0, 40, 40, 48, 48, 2, + 0, 22, 22, 46, 46, 3, 0, 41, 43, 47, 47, 50, 50, 3, 0, 1, 20, 24, 24, 51, + 51, 3, 0, 1, 19, 24, 24, 51, 51, 3, 0, 1, 14, 16, 20, 24, 24, 4, 0, 1, + 15, 17, 20, 24, 24, 51, 51, 847, 0, 158, 1, 0, 0, 0, 2, 161, 1, 0, 0, 0, + 4, 164, 1, 0, 0, 0, 6, 235, 1, 0, 0, 0, 8, 237, 1, 0, 0, 0, 10, 244, 1, + 0, 0, 0, 12, 250, 1, 0, 0, 0, 14, 265, 1, 0, 0, 0, 16, 273, 1, 0, 0, 0, + 18, 275, 1, 0, 0, 0, 20, 282, 1, 0, 0, 0, 22, 291, 1, 0, 0, 0, 24, 335, + 1, 0, 0, 0, 26, 350, 1, 0, 0, 0, 28, 352, 1, 0, 0, 0, 30, 371, 1, 0, 0, + 0, 32, 381, 1, 0, 0, 0, 34, 383, 1, 0, 0, 0, 36, 390, 1, 0, 0, 0, 38, 396, + 1, 0, 0, 0, 40, 403, 1, 0, 0, 0, 42, 415, 1, 0, 0, 0, 44, 440, 1, 0, 0, + 0, 46, 448, 1, 0, 0, 0, 48, 450, 1, 0, 0, 0, 50, 457, 1, 0, 0, 0, 52, 463, + 1, 0, 0, 0, 54, 478, 1, 0, 0, 0, 56, 486, 1, 0, 0, 0, 58, 488, 1, 0, 0, + 0, 60, 495, 1, 0, 0, 0, 62, 501, 1, 0, 0, 0, 64, 508, 1, 0, 0, 0, 66, 514, + 1, 0, 0, 0, 68, 521, 1, 0, 0, 0, 70, 533, 1, 0, 0, 0, 72, 560, 1, 0, 0, + 0, 74, 562, 1, 0, 0, 0, 76, 570, 1, 0, 0, 0, 78, 573, 1, 0, 0, 0, 80, 575, + 1, 0, 0, 0, 82, 579, 1, 0, 0, 0, 84, 581, 1, 0, 0, 0, 86, 583, 1, 0, 0, + 0, 88, 587, 1, 0, 0, 0, 90, 592, 1, 0, 0, 0, 92, 594, 1, 0, 0, 0, 94, 598, + 1, 0, 0, 0, 96, 600, 1, 0, 0, 0, 98, 602, 1, 0, 0, 0, 100, 604, 1, 0, 0, + 0, 102, 612, 1, 0, 0, 0, 104, 623, 1, 0, 0, 0, 106, 631, 1, 0, 0, 0, 108, + 642, 1, 0, 0, 0, 110, 645, 1, 0, 0, 0, 112, 658, 1, 0, 0, 0, 114, 660, + 1, 0, 0, 0, 116, 663, 1, 0, 0, 0, 118, 666, 1, 0, 0, 0, 120, 671, 1, 0, + 0, 0, 122, 682, 1, 0, 0, 0, 124, 684, 1, 0, 0, 0, 126, 690, 1, 0, 0, 0, + 128, 695, 1, 0, 0, 0, 130, 699, 1, 0, 0, 0, 132, 703, 1, 0, 0, 0, 134, + 720, 1, 0, 0, 0, 136, 727, 1, 0, 0, 0, 138, 734, 1, 0, 0, 0, 140, 736, + 1, 0, 0, 0, 142, 742, 1, 0, 0, 0, 144, 744, 1, 0, 0, 0, 146, 753, 1, 0, + 0, 0, 148, 755, 1, 0, 0, 0, 150, 776, 1, 0, 0, 0, 152, 778, 1, 0, 0, 0, + 154, 780, 1, 0, 0, 0, 156, 782, 1, 0, 0, 0, 158, 159, 3, 6, 3, 0, 159, + 160, 3, 4, 2, 0, 160, 1, 1, 0, 0, 0, 161, 162, 3, 8, 4, 0, 162, 163, 3, + 4, 2, 0, 163, 3, 1, 0, 0, 0, 164, 165, 7, 0, 0, 0, 165, 5, 1, 0, 0, 0, + 166, 168, 5, 1, 0, 0, 167, 169, 3, 8, 4, 0, 168, 167, 1, 0, 0, 0, 168, + 169, 1, 0, 0, 0, 169, 236, 1, 0, 0, 0, 170, 172, 5, 2, 0, 0, 171, 173, + 3, 48, 24, 0, 172, 171, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 173, 236, 1, + 0, 0, 0, 174, 175, 5, 3, 0, 0, 175, 177, 3, 100, 50, 0, 176, 178, 3, 110, + 55, 0, 177, 176, 1, 0, 0, 0, 177, 178, 1, 0, 0, 0, 178, 236, 1, 0, 0, 0, + 179, 180, 5, 4, 0, 0, 180, 236, 3, 112, 56, 0, 181, 182, 5, 5, 0, 0, 182, + 187, 3, 124, 62, 0, 183, 184, 5, 34, 0, 0, 184, 186, 3, 124, 62, 0, 185, + 183, 1, 0, 0, 0, 186, 189, 1, 0, 0, 0, 187, 185, 1, 0, 0, 0, 187, 188, + 1, 0, 0, 0, 188, 236, 1, 0, 0, 0, 189, 187, 1, 0, 0, 0, 190, 192, 5, 6, + 0, 0, 191, 193, 3, 118, 59, 0, 192, 191, 1, 0, 0, 0, 192, 193, 1, 0, 0, + 0, 193, 194, 1, 0, 0, 0, 194, 236, 5, 23, 0, 0, 195, 199, 5, 7, 0, 0, 196, + 198, 3, 128, 64, 0, 197, 196, 1, 0, 0, 0, 198, 201, 1, 0, 0, 0, 199, 197, + 1, 0, 0, 0, 199, 200, 1, 0, 0, 0, 200, 236, 1, 0, 0, 0, 201, 199, 1, 0, + 0, 0, 202, 204, 5, 8, 0, 0, 203, 205, 3, 130, 65, 0, 204, 203, 1, 0, 0, + 0, 204, 205, 1, 0, 0, 0, 205, 209, 1, 0, 0, 0, 206, 208, 3, 132, 66, 0, + 207, 206, 1, 0, 0, 0, 208, 211, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 209, + 210, 1, 0, 0, 0, 210, 236, 1, 0, 0, 0, 211, 209, 1, 0, 0, 0, 212, 213, + 5, 9, 0, 0, 213, 236, 3, 134, 67, 0, 214, 216, 5, 10, 0, 0, 215, 217, 3, + 142, 71, 0, 216, 215, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 236, 1, 0, + 0, 0, 218, 222, 5, 11, 0, 0, 219, 221, 3, 146, 73, 0, 220, 219, 1, 0, 0, + 0, 221, 224, 1, 0, 0, 0, 222, 220, 1, 0, 0, 0, 222, 223, 1, 0, 0, 0, 223, + 236, 1, 0, 0, 0, 224, 222, 1, 0, 0, 0, 225, 226, 5, 12, 0, 0, 226, 232, + 3, 148, 74, 0, 227, 228, 5, 34, 0, 0, 228, 231, 3, 148, 74, 0, 229, 231, + 3, 148, 74, 0, 230, 227, 1, 0, 0, 0, 230, 229, 1, 0, 0, 0, 231, 234, 1, + 0, 0, 0, 232, 230, 1, 0, 0, 0, 232, 233, 1, 0, 0, 0, 233, 236, 1, 0, 0, + 0, 234, 232, 1, 0, 0, 0, 235, 166, 1, 0, 0, 0, 235, 170, 1, 0, 0, 0, 235, + 174, 1, 0, 0, 0, 235, 179, 1, 0, 0, 0, 235, 181, 1, 0, 0, 0, 235, 190, + 1, 0, 0, 0, 235, 195, 1, 0, 0, 0, 235, 202, 1, 0, 0, 0, 235, 212, 1, 0, + 0, 0, 235, 214, 1, 0, 0, 0, 235, 218, 1, 0, 0, 0, 235, 225, 1, 0, 0, 0, + 236, 7, 1, 0, 0, 0, 237, 241, 3, 12, 6, 0, 238, 240, 3, 10, 5, 0, 239, + 238, 1, 0, 0, 0, 240, 243, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 241, 242, + 1, 0, 0, 0, 242, 9, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 244, 245, 4, 5, 0, + 0, 245, 248, 5, 19, 0, 0, 246, 249, 3, 12, 6, 0, 247, 249, 3, 76, 38, 0, + 248, 246, 1, 0, 0, 0, 248, 247, 1, 0, 0, 0, 249, 11, 1, 0, 0, 0, 250, 254, + 3, 16, 8, 0, 251, 253, 3, 14, 7, 0, 252, 251, 1, 0, 0, 0, 253, 256, 1, + 0, 0, 0, 254, 252, 1, 0, 0, 0, 254, 255, 1, 0, 0, 0, 255, 13, 1, 0, 0, + 0, 256, 254, 1, 0, 0, 0, 257, 258, 4, 7, 1, 0, 258, 261, 5, 18, 0, 0, 259, + 262, 3, 16, 8, 0, 260, 262, 3, 76, 38, 0, 261, 259, 1, 0, 0, 0, 261, 260, + 1, 0, 0, 0, 262, 266, 1, 0, 0, 0, 263, 264, 4, 7, 2, 0, 264, 266, 3, 16, + 8, 0, 265, 257, 1, 0, 0, 0, 265, 263, 1, 0, 0, 0, 266, 15, 1, 0, 0, 0, + 267, 270, 7, 1, 0, 0, 268, 271, 3, 16, 8, 0, 269, 271, 3, 76, 38, 0, 270, + 268, 1, 0, 0, 0, 270, 269, 1, 0, 0, 0, 271, 274, 1, 0, 0, 0, 272, 274, + 3, 18, 9, 0, 273, 267, 1, 0, 0, 0, 273, 272, 1, 0, 0, 0, 274, 17, 1, 0, + 0, 0, 275, 279, 3, 34, 17, 0, 276, 278, 3, 20, 10, 0, 277, 276, 1, 0, 0, + 0, 278, 281, 1, 0, 0, 0, 279, 277, 1, 0, 0, 0, 279, 280, 1, 0, 0, 0, 280, + 19, 1, 0, 0, 0, 281, 279, 1, 0, 0, 0, 282, 283, 4, 10, 3, 0, 283, 286, + 3, 78, 39, 0, 284, 287, 3, 22, 11, 0, 285, 287, 3, 76, 38, 0, 286, 284, + 1, 0, 0, 0, 286, 285, 1, 0, 0, 0, 287, 21, 1, 0, 0, 0, 288, 292, 5, 23, + 0, 0, 289, 292, 3, 24, 12, 0, 290, 292, 3, 28, 14, 0, 291, 288, 1, 0, 0, + 0, 291, 289, 1, 0, 0, 0, 291, 290, 1, 0, 0, 0, 292, 23, 1, 0, 0, 0, 293, + 297, 3, 96, 48, 0, 294, 296, 3, 26, 13, 0, 295, 294, 1, 0, 0, 0, 296, 299, + 1, 0, 0, 0, 297, 295, 1, 0, 0, 0, 297, 298, 1, 0, 0, 0, 298, 336, 1, 0, + 0, 0, 299, 297, 1, 0, 0, 0, 300, 304, 5, 46, 0, 0, 301, 303, 3, 26, 13, + 0, 302, 301, 1, 0, 0, 0, 303, 306, 1, 0, 0, 0, 304, 302, 1, 0, 0, 0, 304, + 305, 1, 0, 0, 0, 305, 336, 1, 0, 0, 0, 306, 304, 1, 0, 0, 0, 307, 316, + 5, 47, 0, 0, 308, 317, 3, 96, 48, 0, 309, 317, 3, 86, 43, 0, 310, 314, + 3, 84, 42, 0, 311, 315, 3, 96, 48, 0, 312, 315, 3, 86, 43, 0, 313, 315, + 3, 82, 41, 0, 314, 311, 1, 0, 0, 0, 314, 312, 1, 0, 0, 0, 314, 313, 1, + 0, 0, 0, 315, 317, 1, 0, 0, 0, 316, 308, 1, 0, 0, 0, 316, 309, 1, 0, 0, + 0, 316, 310, 1, 0, 0, 0, 317, 321, 1, 0, 0, 0, 318, 320, 3, 26, 13, 0, + 319, 318, 1, 0, 0, 0, 320, 323, 1, 0, 0, 0, 321, 319, 1, 0, 0, 0, 321, + 322, 1, 0, 0, 0, 322, 336, 1, 0, 0, 0, 323, 321, 1, 0, 0, 0, 324, 327, + 5, 48, 0, 0, 325, 328, 3, 96, 48, 0, 326, 328, 3, 82, 41, 0, 327, 325, + 1, 0, 0, 0, 327, 326, 1, 0, 0, 0, 328, 332, 1, 0, 0, 0, 329, 331, 3, 26, + 13, 0, 330, 329, 1, 0, 0, 0, 331, 334, 1, 0, 0, 0, 332, 330, 1, 0, 0, 0, + 332, 333, 1, 0, 0, 0, 333, 336, 1, 0, 0, 0, 334, 332, 1, 0, 0, 0, 335, + 293, 1, 0, 0, 0, 335, 300, 1, 0, 0, 0, 335, 307, 1, 0, 0, 0, 335, 324, + 1, 0, 0, 0, 336, 25, 1, 0, 0, 0, 337, 338, 4, 13, 4, 0, 338, 351, 3, 82, + 41, 0, 339, 340, 4, 13, 5, 0, 340, 351, 3, 96, 48, 0, 341, 342, 4, 13, + 6, 0, 342, 351, 3, 86, 43, 0, 343, 344, 4, 13, 7, 0, 344, 348, 3, 84, 42, + 0, 345, 349, 3, 96, 48, 0, 346, 349, 3, 86, 43, 0, 347, 349, 3, 82, 41, + 0, 348, 345, 1, 0, 0, 0, 348, 346, 1, 0, 0, 0, 348, 347, 1, 0, 0, 0, 349, + 351, 1, 0, 0, 0, 350, 337, 1, 0, 0, 0, 350, 339, 1, 0, 0, 0, 350, 341, + 1, 0, 0, 0, 350, 343, 1, 0, 0, 0, 351, 27, 1, 0, 0, 0, 352, 356, 3, 30, + 15, 0, 353, 355, 3, 40, 20, 0, 354, 353, 1, 0, 0, 0, 355, 358, 1, 0, 0, + 0, 356, 354, 1, 0, 0, 0, 356, 357, 1, 0, 0, 0, 357, 362, 1, 0, 0, 0, 358, + 356, 1, 0, 0, 0, 359, 361, 3, 36, 18, 0, 360, 359, 1, 0, 0, 0, 361, 364, + 1, 0, 0, 0, 362, 360, 1, 0, 0, 0, 362, 363, 1, 0, 0, 0, 363, 29, 1, 0, + 0, 0, 364, 362, 1, 0, 0, 0, 365, 368, 7, 2, 0, 0, 366, 369, 3, 42, 21, + 0, 367, 369, 3, 76, 38, 0, 368, 366, 1, 0, 0, 0, 368, 367, 1, 0, 0, 0, + 369, 372, 1, 0, 0, 0, 370, 372, 3, 32, 16, 0, 371, 365, 1, 0, 0, 0, 371, + 370, 1, 0, 0, 0, 372, 31, 1, 0, 0, 0, 373, 374, 5, 35, 0, 0, 374, 375, + 3, 8, 4, 0, 375, 376, 5, 36, 0, 0, 376, 382, 1, 0, 0, 0, 377, 382, 5, 21, + 0, 0, 378, 382, 5, 22, 0, 0, 379, 382, 5, 41, 0, 0, 380, 382, 3, 74, 37, + 0, 381, 373, 1, 0, 0, 0, 381, 377, 1, 0, 0, 0, 381, 378, 1, 0, 0, 0, 381, + 379, 1, 0, 0, 0, 381, 380, 1, 0, 0, 0, 382, 33, 1, 0, 0, 0, 383, 387, 3, + 38, 19, 0, 384, 386, 3, 36, 18, 0, 385, 384, 1, 0, 0, 0, 386, 389, 1, 0, + 0, 0, 387, 385, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, 35, 1, 0, 0, 0, + 389, 387, 1, 0, 0, 0, 390, 391, 4, 18, 8, 0, 391, 394, 3, 88, 44, 0, 392, + 395, 3, 38, 19, 0, 393, 395, 3, 76, 38, 0, 394, 392, 1, 0, 0, 0, 394, 393, + 1, 0, 0, 0, 395, 37, 1, 0, 0, 0, 396, 400, 3, 42, 21, 0, 397, 399, 3, 40, + 20, 0, 398, 397, 1, 0, 0, 0, 399, 402, 1, 0, 0, 0, 400, 398, 1, 0, 0, 0, + 400, 401, 1, 0, 0, 0, 401, 39, 1, 0, 0, 0, 402, 400, 1, 0, 0, 0, 403, 404, + 4, 20, 9, 0, 404, 407, 3, 92, 46, 0, 405, 408, 3, 42, 21, 0, 406, 408, + 3, 76, 38, 0, 407, 405, 1, 0, 0, 0, 407, 406, 1, 0, 0, 0, 408, 41, 1, 0, + 0, 0, 409, 412, 3, 94, 47, 0, 410, 413, 3, 42, 21, 0, 411, 413, 3, 76, + 38, 0, 412, 410, 1, 0, 0, 0, 412, 411, 1, 0, 0, 0, 413, 416, 1, 0, 0, 0, + 414, 416, 3, 44, 22, 0, 415, 409, 1, 0, 0, 0, 415, 414, 1, 0, 0, 0, 416, + 43, 1, 0, 0, 0, 417, 418, 5, 35, 0, 0, 418, 419, 3, 8, 4, 0, 419, 420, + 5, 36, 0, 0, 420, 441, 1, 0, 0, 0, 421, 441, 5, 23, 0, 0, 422, 426, 3, + 98, 49, 0, 423, 425, 3, 46, 23, 0, 424, 423, 1, 0, 0, 0, 425, 428, 1, 0, + 0, 0, 426, 424, 1, 0, 0, 0, 426, 427, 1, 0, 0, 0, 427, 441, 1, 0, 0, 0, + 428, 426, 1, 0, 0, 0, 429, 441, 3, 86, 43, 0, 430, 441, 5, 21, 0, 0, 431, + 432, 4, 22, 10, 0, 432, 434, 3, 82, 41, 0, 433, 435, 3, 46, 23, 0, 434, + 433, 1, 0, 0, 0, 435, 436, 1, 0, 0, 0, 436, 434, 1, 0, 0, 0, 436, 437, + 1, 0, 0, 0, 437, 441, 1, 0, 0, 0, 438, 441, 3, 80, 40, 0, 439, 441, 3, + 74, 37, 0, 440, 417, 1, 0, 0, 0, 440, 421, 1, 0, 0, 0, 440, 422, 1, 0, + 0, 0, 440, 429, 1, 0, 0, 0, 440, 430, 1, 0, 0, 0, 440, 431, 1, 0, 0, 0, + 440, 438, 1, 0, 0, 0, 440, 439, 1, 0, 0, 0, 441, 45, 1, 0, 0, 0, 442, 443, + 4, 23, 11, 0, 443, 449, 5, 49, 0, 0, 444, 445, 4, 23, 12, 0, 445, 449, + 3, 96, 48, 0, 446, 447, 4, 23, 13, 0, 447, 449, 3, 86, 43, 0, 448, 442, + 1, 0, 0, 0, 448, 444, 1, 0, 0, 0, 448, 446, 1, 0, 0, 0, 449, 47, 1, 0, + 0, 0, 450, 454, 3, 52, 26, 0, 451, 453, 3, 50, 25, 0, 452, 451, 1, 0, 0, + 0, 453, 456, 1, 0, 0, 0, 454, 452, 1, 0, 0, 0, 454, 455, 1, 0, 0, 0, 455, + 49, 1, 0, 0, 0, 456, 454, 1, 0, 0, 0, 457, 458, 4, 25, 14, 0, 458, 461, + 5, 19, 0, 0, 459, 462, 3, 52, 26, 0, 460, 462, 3, 76, 38, 0, 461, 459, + 1, 0, 0, 0, 461, 460, 1, 0, 0, 0, 462, 51, 1, 0, 0, 0, 463, 467, 3, 56, + 28, 0, 464, 466, 3, 54, 27, 0, 465, 464, 1, 0, 0, 0, 466, 469, 1, 0, 0, + 0, 467, 465, 1, 0, 0, 0, 467, 468, 1, 0, 0, 0, 468, 53, 1, 0, 0, 0, 469, + 467, 1, 0, 0, 0, 470, 471, 4, 27, 15, 0, 471, 474, 5, 18, 0, 0, 472, 475, + 3, 56, 28, 0, 473, 475, 3, 76, 38, 0, 474, 472, 1, 0, 0, 0, 474, 473, 1, + 0, 0, 0, 475, 479, 1, 0, 0, 0, 476, 477, 4, 27, 16, 0, 477, 479, 3, 56, + 28, 0, 478, 470, 1, 0, 0, 0, 478, 476, 1, 0, 0, 0, 479, 55, 1, 0, 0, 0, + 480, 483, 7, 1, 0, 0, 481, 484, 3, 56, 28, 0, 482, 484, 3, 76, 38, 0, 483, + 481, 1, 0, 0, 0, 483, 482, 1, 0, 0, 0, 484, 487, 1, 0, 0, 0, 485, 487, + 3, 58, 29, 0, 486, 480, 1, 0, 0, 0, 486, 485, 1, 0, 0, 0, 487, 57, 1, 0, + 0, 0, 488, 492, 3, 62, 31, 0, 489, 491, 3, 60, 30, 0, 490, 489, 1, 0, 0, + 0, 491, 494, 1, 0, 0, 0, 492, 490, 1, 0, 0, 0, 492, 493, 1, 0, 0, 0, 493, + 59, 1, 0, 0, 0, 494, 492, 1, 0, 0, 0, 495, 496, 4, 30, 17, 0, 496, 499, + 3, 78, 39, 0, 497, 500, 3, 62, 31, 0, 498, 500, 3, 76, 38, 0, 499, 497, + 1, 0, 0, 0, 499, 498, 1, 0, 0, 0, 500, 61, 1, 0, 0, 0, 501, 505, 3, 66, + 33, 0, 502, 504, 3, 64, 32, 0, 503, 502, 1, 0, 0, 0, 504, 507, 1, 0, 0, + 0, 505, 503, 1, 0, 0, 0, 505, 506, 1, 0, 0, 0, 506, 63, 1, 0, 0, 0, 507, + 505, 1, 0, 0, 0, 508, 509, 4, 32, 18, 0, 509, 512, 3, 88, 44, 0, 510, 513, + 3, 66, 33, 0, 511, 513, 3, 76, 38, 0, 512, 510, 1, 0, 0, 0, 512, 511, 1, + 0, 0, 0, 513, 65, 1, 0, 0, 0, 514, 518, 3, 70, 35, 0, 515, 517, 3, 68, + 34, 0, 516, 515, 1, 0, 0, 0, 517, 520, 1, 0, 0, 0, 518, 516, 1, 0, 0, 0, + 518, 519, 1, 0, 0, 0, 519, 67, 1, 0, 0, 0, 520, 518, 1, 0, 0, 0, 521, 522, + 4, 34, 19, 0, 522, 525, 3, 90, 45, 0, 523, 526, 3, 70, 35, 0, 524, 526, + 3, 76, 38, 0, 525, 523, 1, 0, 0, 0, 525, 524, 1, 0, 0, 0, 526, 69, 1, 0, + 0, 0, 527, 530, 3, 94, 47, 0, 528, 531, 3, 70, 35, 0, 529, 531, 3, 76, + 38, 0, 530, 528, 1, 0, 0, 0, 530, 529, 1, 0, 0, 0, 531, 534, 1, 0, 0, 0, + 532, 534, 3, 72, 36, 0, 533, 527, 1, 0, 0, 0, 533, 532, 1, 0, 0, 0, 534, + 71, 1, 0, 0, 0, 535, 536, 5, 35, 0, 0, 536, 537, 3, 48, 24, 0, 537, 538, + 5, 36, 0, 0, 538, 561, 1, 0, 0, 0, 539, 540, 4, 36, 20, 0, 540, 541, 3, + 98, 49, 0, 541, 550, 5, 35, 0, 0, 542, 547, 3, 48, 24, 0, 543, 544, 5, + 34, 0, 0, 544, 546, 3, 48, 24, 0, 545, 543, 1, 0, 0, 0, 546, 549, 1, 0, + 0, 0, 547, 545, 1, 0, 0, 0, 547, 548, 1, 0, 0, 0, 548, 551, 1, 0, 0, 0, + 549, 547, 1, 0, 0, 0, 550, 542, 1, 0, 0, 0, 550, 551, 1, 0, 0, 0, 551, + 552, 1, 0, 0, 0, 552, 553, 5, 36, 0, 0, 553, 561, 1, 0, 0, 0, 554, 561, + 3, 98, 49, 0, 555, 561, 5, 23, 0, 0, 556, 561, 3, 86, 43, 0, 557, 561, + 5, 21, 0, 0, 558, 561, 3, 80, 40, 0, 559, 561, 3, 74, 37, 0, 560, 535, + 1, 0, 0, 0, 560, 539, 1, 0, 0, 0, 560, 554, 1, 0, 0, 0, 560, 555, 1, 0, + 0, 0, 560, 556, 1, 0, 0, 0, 560, 557, 1, 0, 0, 0, 560, 558, 1, 0, 0, 0, + 560, 559, 1, 0, 0, 0, 561, 73, 1, 0, 0, 0, 562, 563, 5, 37, 0, 0, 563, + 567, 6, 37, -1, 0, 564, 566, 8, 0, 0, 0, 565, 564, 1, 0, 0, 0, 566, 569, + 1, 0, 0, 0, 567, 565, 1, 0, 0, 0, 567, 568, 1, 0, 0, 0, 568, 75, 1, 0, + 0, 0, 569, 567, 1, 0, 0, 0, 570, 571, 6, 38, -1, 0, 571, 572, 7, 3, 0, + 0, 572, 77, 1, 0, 0, 0, 573, 574, 7, 4, 0, 0, 574, 79, 1, 0, 0, 0, 575, + 576, 7, 5, 0, 0, 576, 81, 1, 0, 0, 0, 577, 580, 3, 80, 40, 0, 578, 580, + 5, 50, 0, 0, 579, 577, 1, 0, 0, 0, 579, 578, 1, 0, 0, 0, 580, 83, 1, 0, + 0, 0, 581, 582, 7, 6, 0, 0, 582, 85, 1, 0, 0, 0, 583, 584, 7, 7, 0, 0, + 584, 87, 1, 0, 0, 0, 585, 588, 5, 39, 0, 0, 586, 588, 3, 84, 42, 0, 587, + 585, 1, 0, 0, 0, 587, 586, 1, 0, 0, 0, 588, 89, 1, 0, 0, 0, 589, 593, 3, + 82, 41, 0, 590, 593, 5, 42, 0, 0, 591, 593, 5, 43, 0, 0, 592, 589, 1, 0, + 0, 0, 592, 590, 1, 0, 0, 0, 592, 591, 1, 0, 0, 0, 593, 91, 1, 0, 0, 0, + 594, 595, 7, 8, 0, 0, 595, 93, 1, 0, 0, 0, 596, 599, 3, 84, 42, 0, 597, + 599, 5, 39, 0, 0, 598, 596, 1, 0, 0, 0, 598, 597, 1, 0, 0, 0, 599, 95, + 1, 0, 0, 0, 600, 601, 7, 9, 0, 0, 601, 97, 1, 0, 0, 0, 602, 603, 7, 10, + 0, 0, 603, 99, 1, 0, 0, 0, 604, 609, 3, 102, 51, 0, 605, 606, 5, 34, 0, + 0, 606, 608, 3, 102, 51, 0, 607, 605, 1, 0, 0, 0, 608, 611, 1, 0, 0, 0, + 609, 607, 1, 0, 0, 0, 609, 610, 1, 0, 0, 0, 610, 101, 1, 0, 0, 0, 611, + 609, 1, 0, 0, 0, 612, 618, 3, 96, 48, 0, 613, 615, 5, 35, 0, 0, 614, 616, + 3, 48, 24, 0, 615, 614, 1, 0, 0, 0, 615, 616, 1, 0, 0, 0, 616, 617, 1, + 0, 0, 0, 617, 619, 5, 36, 0, 0, 618, 613, 1, 0, 0, 0, 618, 619, 1, 0, 0, + 0, 619, 621, 1, 0, 0, 0, 620, 622, 3, 108, 54, 0, 621, 620, 1, 0, 0, 0, + 621, 622, 1, 0, 0, 0, 622, 103, 1, 0, 0, 0, 623, 628, 3, 106, 53, 0, 624, + 625, 5, 34, 0, 0, 625, 627, 3, 102, 51, 0, 626, 624, 1, 0, 0, 0, 627, 630, + 1, 0, 0, 0, 628, 626, 1, 0, 0, 0, 628, 629, 1, 0, 0, 0, 629, 105, 1, 0, + 0, 0, 630, 628, 1, 0, 0, 0, 631, 637, 3, 154, 77, 0, 632, 634, 5, 35, 0, + 0, 633, 635, 3, 48, 24, 0, 634, 633, 1, 0, 0, 0, 634, 635, 1, 0, 0, 0, + 635, 636, 1, 0, 0, 0, 636, 638, 5, 36, 0, 0, 637, 632, 1, 0, 0, 0, 637, + 638, 1, 0, 0, 0, 638, 640, 1, 0, 0, 0, 639, 641, 3, 108, 54, 0, 640, 639, + 1, 0, 0, 0, 640, 641, 1, 0, 0, 0, 641, 107, 1, 0, 0, 0, 642, 643, 5, 14, + 0, 0, 643, 644, 3, 96, 48, 0, 644, 109, 1, 0, 0, 0, 645, 646, 5, 13, 0, + 0, 646, 647, 3, 120, 60, 0, 647, 111, 1, 0, 0, 0, 648, 649, 4, 56, 21, + 0, 649, 650, 3, 114, 57, 0, 650, 652, 3, 100, 50, 0, 651, 653, 3, 110, + 55, 0, 652, 651, 1, 0, 0, 0, 652, 653, 1, 0, 0, 0, 653, 659, 1, 0, 0, 0, + 654, 656, 3, 104, 52, 0, 655, 657, 3, 110, 55, 0, 656, 655, 1, 0, 0, 0, + 656, 657, 1, 0, 0, 0, 657, 659, 1, 0, 0, 0, 658, 648, 1, 0, 0, 0, 658, + 654, 1, 0, 0, 0, 659, 113, 1, 0, 0, 0, 660, 661, 5, 15, 0, 0, 661, 662, + 3, 116, 58, 0, 662, 115, 1, 0, 0, 0, 663, 664, 5, 29, 0, 0, 664, 665, 3, + 126, 63, 0, 665, 117, 1, 0, 0, 0, 666, 667, 4, 59, 22, 0, 667, 668, 5, + 17, 0, 0, 668, 669, 5, 29, 0, 0, 669, 670, 3, 96, 48, 0, 670, 119, 1, 0, + 0, 0, 671, 677, 3, 122, 61, 0, 672, 673, 5, 34, 0, 0, 673, 676, 3, 122, + 61, 0, 674, 676, 3, 122, 61, 0, 675, 672, 1, 0, 0, 0, 675, 674, 1, 0, 0, + 0, 676, 679, 1, 0, 0, 0, 677, 675, 1, 0, 0, 0, 677, 678, 1, 0, 0, 0, 678, + 121, 1, 0, 0, 0, 679, 677, 1, 0, 0, 0, 680, 683, 3, 96, 48, 0, 681, 683, + 3, 82, 41, 0, 682, 680, 1, 0, 0, 0, 682, 681, 1, 0, 0, 0, 683, 123, 1, + 0, 0, 0, 684, 685, 3, 96, 48, 0, 685, 686, 5, 29, 0, 0, 686, 687, 3, 48, + 24, 0, 687, 125, 1, 0, 0, 0, 688, 691, 5, 21, 0, 0, 689, 691, 3, 96, 48, + 0, 690, 688, 1, 0, 0, 0, 690, 689, 1, 0, 0, 0, 691, 127, 1, 0, 0, 0, 692, + 696, 5, 34, 0, 0, 693, 696, 3, 82, 41, 0, 694, 696, 3, 96, 48, 0, 695, + 692, 1, 0, 0, 0, 695, 693, 1, 0, 0, 0, 695, 694, 1, 0, 0, 0, 696, 129, + 1, 0, 0, 0, 697, 700, 3, 84, 42, 0, 698, 700, 5, 39, 0, 0, 699, 697, 1, + 0, 0, 0, 699, 698, 1, 0, 0, 0, 700, 131, 1, 0, 0, 0, 701, 704, 5, 34, 0, + 0, 702, 704, 3, 96, 48, 0, 703, 701, 1, 0, 0, 0, 703, 702, 1, 0, 0, 0, + 704, 133, 1, 0, 0, 0, 705, 709, 3, 142, 71, 0, 706, 708, 3, 136, 68, 0, + 707, 706, 1, 0, 0, 0, 708, 711, 1, 0, 0, 0, 709, 707, 1, 0, 0, 0, 709, + 710, 1, 0, 0, 0, 710, 721, 1, 0, 0, 0, 711, 709, 1, 0, 0, 0, 712, 716, + 3, 138, 69, 0, 713, 715, 3, 136, 68, 0, 714, 713, 1, 0, 0, 0, 715, 718, + 1, 0, 0, 0, 716, 714, 1, 0, 0, 0, 716, 717, 1, 0, 0, 0, 717, 721, 1, 0, + 0, 0, 718, 716, 1, 0, 0, 0, 719, 721, 1, 0, 0, 0, 720, 705, 1, 0, 0, 0, + 720, 712, 1, 0, 0, 0, 720, 719, 1, 0, 0, 0, 721, 135, 1, 0, 0, 0, 722, + 728, 5, 34, 0, 0, 723, 725, 3, 94, 47, 0, 724, 723, 1, 0, 0, 0, 724, 725, + 1, 0, 0, 0, 725, 726, 1, 0, 0, 0, 726, 728, 3, 96, 48, 0, 727, 722, 1, + 0, 0, 0, 727, 724, 1, 0, 0, 0, 728, 137, 1, 0, 0, 0, 729, 735, 5, 34, 0, + 0, 730, 731, 3, 94, 47, 0, 731, 732, 3, 96, 48, 0, 732, 735, 1, 0, 0, 0, + 733, 735, 3, 140, 70, 0, 734, 729, 1, 0, 0, 0, 734, 730, 1, 0, 0, 0, 734, + 733, 1, 0, 0, 0, 735, 139, 1, 0, 0, 0, 736, 737, 3, 156, 78, 0, 737, 141, + 1, 0, 0, 0, 738, 739, 4, 71, 23, 0, 739, 740, 5, 16, 0, 0, 740, 743, 3, + 144, 72, 0, 741, 743, 3, 86, 43, 0, 742, 738, 1, 0, 0, 0, 742, 741, 1, + 0, 0, 0, 743, 143, 1, 0, 0, 0, 744, 745, 5, 29, 0, 0, 745, 746, 3, 86, + 43, 0, 746, 145, 1, 0, 0, 0, 747, 748, 4, 73, 24, 0, 748, 749, 5, 15, 0, + 0, 749, 754, 3, 116, 58, 0, 750, 751, 3, 152, 76, 0, 751, 752, 6, 73, -1, + 0, 752, 754, 1, 0, 0, 0, 753, 747, 1, 0, 0, 0, 753, 750, 1, 0, 0, 0, 754, + 147, 1, 0, 0, 0, 755, 756, 3, 150, 75, 0, 756, 757, 5, 14, 0, 0, 757, 758, + 3, 150, 75, 0, 758, 149, 1, 0, 0, 0, 759, 762, 3, 96, 48, 0, 760, 761, + 4, 75, 25, 0, 761, 763, 3, 82, 41, 0, 762, 760, 1, 0, 0, 0, 762, 763, 1, + 0, 0, 0, 763, 777, 1, 0, 0, 0, 764, 767, 5, 47, 0, 0, 765, 768, 3, 96, + 48, 0, 766, 768, 3, 86, 43, 0, 767, 765, 1, 0, 0, 0, 767, 766, 1, 0, 0, + 0, 768, 771, 1, 0, 0, 0, 769, 770, 4, 75, 26, 0, 770, 772, 3, 82, 41, 0, + 771, 769, 1, 0, 0, 0, 771, 772, 1, 0, 0, 0, 772, 777, 1, 0, 0, 0, 773, + 777, 5, 41, 0, 0, 774, 777, 5, 50, 0, 0, 775, 777, 5, 23, 0, 0, 776, 759, + 1, 0, 0, 0, 776, 764, 1, 0, 0, 0, 776, 773, 1, 0, 0, 0, 776, 774, 1, 0, + 0, 0, 776, 775, 1, 0, 0, 0, 777, 151, 1, 0, 0, 0, 778, 779, 3, 154, 77, + 0, 779, 153, 1, 0, 0, 0, 780, 781, 7, 11, 0, 0, 781, 155, 1, 0, 0, 0, 782, + 783, 7, 12, 0, 0, 783, 157, 1, 0, 0, 0, 101, 168, 172, 177, 187, 192, 199, + 204, 209, 216, 222, 230, 232, 235, 241, 248, 254, 261, 265, 270, 273, 279, + 286, 291, 297, 304, 314, 316, 321, 327, 332, 335, 348, 350, 356, 362, 368, + 371, 381, 387, 394, 400, 407, 412, 415, 426, 436, 440, 448, 454, 461, 467, + 474, 478, 483, 486, 492, 499, 505, 512, 518, 525, 530, 533, 547, 550, 560, + 567, 579, 587, 592, 598, 609, 615, 618, 621, 628, 634, 637, 640, 652, 656, + 658, 675, 677, 682, 690, 695, 699, 703, 709, 716, 720, 724, 727, 734, 742, + 753, 762, 767, 771, 776, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -464,9 +483,9 @@ func (p *SPL1Parser) isIdentLike(t int) bool { case SPL1ParserIDENT, SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, - SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, - SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, - SPL1ParserNOT_WORD: + SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, + SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, + SPL1ParserNOT, SPL1ParserNOT_WORD: return true } return false @@ -679,45 +698,46 @@ const ( SPL1ParserSORT = 9 SPL1ParserHEAD = 10 SPL1ParserBIN = 11 - SPL1ParserBY = 12 - SPL1ParserAS = 13 - SPL1ParserSPAN = 14 - SPL1ParserLIMIT = 15 - SPL1ParserFIELD = 16 - SPL1ParserAND = 17 - SPL1ParserOR = 18 - SPL1ParserNOT = 19 - SPL1ParserDURATION = 20 - SPL1ParserNUMBER = 21 - SPL1ParserSTRING = 22 - SPL1ParserIDENT = 23 - SPL1ParserEQ2 = 24 - SPL1ParserNE = 25 - SPL1ParserLE = 26 - SPL1ParserGE = 27 - SPL1ParserEQ = 28 - SPL1ParserLT = 29 - SPL1ParserGT = 30 - SPL1ParserBANG = 31 - SPL1ParserPIPE = 32 - SPL1ParserCOMMA = 33 - SPL1ParserLPAREN = 34 - SPL1ParserRPAREN = 35 - SPL1ParserLBRACKET = 36 - SPL1ParserRBRACKET = 37 - SPL1ParserPLUS = 38 - SPL1ParserMINUS = 39 - SPL1ParserSTAR = 40 - SPL1ParserSLASH = 41 - SPL1ParserPERCENT = 42 - SPL1ParserWS = 43 - SPL1ParserUNKNOWN = 44 - SPL1ParserNUMBER_TIGHT = 45 - SPL1ParserSTAR_TIGHT = 46 - SPL1ParserMINUS_TIGHT = 47 - SPL1ParserSTAR_TERM = 48 - SPL1ParserSTAR_OP = 49 - SPL1ParserNOT_WORD = 50 + SPL1ParserRENAME = 12 + SPL1ParserBY = 13 + SPL1ParserAS = 14 + SPL1ParserSPAN = 15 + SPL1ParserLIMIT = 16 + SPL1ParserFIELD = 17 + SPL1ParserAND = 18 + SPL1ParserOR = 19 + SPL1ParserNOT = 20 + SPL1ParserDURATION = 21 + SPL1ParserNUMBER = 22 + SPL1ParserSTRING = 23 + SPL1ParserIDENT = 24 + SPL1ParserEQ2 = 25 + SPL1ParserNE = 26 + SPL1ParserLE = 27 + SPL1ParserGE = 28 + SPL1ParserEQ = 29 + SPL1ParserLT = 30 + SPL1ParserGT = 31 + SPL1ParserBANG = 32 + SPL1ParserPIPE = 33 + SPL1ParserCOMMA = 34 + SPL1ParserLPAREN = 35 + SPL1ParserRPAREN = 36 + SPL1ParserLBRACKET = 37 + SPL1ParserRBRACKET = 38 + SPL1ParserPLUS = 39 + SPL1ParserMINUS = 40 + SPL1ParserSTAR = 41 + SPL1ParserSLASH = 42 + SPL1ParserPERCENT = 43 + SPL1ParserWS = 44 + SPL1ParserUNKNOWN = 45 + SPL1ParserNUMBER_TIGHT = 46 + SPL1ParserSTAR_TIGHT = 47 + SPL1ParserMINUS_TIGHT = 48 + SPL1ParserSTAR_TERM = 49 + SPL1ParserSTAR_OP = 50 + SPL1ParserNOT_WORD = 51 ) // SPL1Parser rules. @@ -796,9 +816,11 @@ const ( SPL1ParserRULE_limitArg = 71 SPL1ParserRULE_limitTail = 72 SPL1ParserRULE_binItem = 73 - SPL1ParserRULE_binField = 74 - SPL1ParserRULE_identLikeNotSpan = 75 - SPL1ParserRULE_identLikeNotLimit = 76 + SPL1ParserRULE_renamePair = 74 + SPL1ParserRULE_renameField = 75 + SPL1ParserRULE_binField = 76 + SPL1ParserRULE_identLikeNotSpan = 77 + SPL1ParserRULE_identLikeNotLimit = 78 ) // IStageCommandContext is an interface to support dynamic dispatch. @@ -903,11 +925,11 @@ func (p *SPL1Parser) StageCommand() (localctx IStageCommandContext) { p.EnterRule(localctx, 0, SPL1ParserRULE_stageCommand) p.EnterOuterAlt(localctx, 1) { - p.SetState(154) + p.SetState(158) p.Command() } { - p.SetState(155) + p.SetState(159) p.StageEnd() } @@ -1026,11 +1048,11 @@ func (p *SPL1Parser) StageSearch() (localctx IStageSearchContext) { p.EnterRule(localctx, 2, SPL1ParserRULE_stageSearch) p.EnterOuterAlt(localctx, 1) { - p.SetState(157) + p.SetState(161) p.SearchExpr() } { - p.SetState(158) + p.SetState(162) p.StageEnd() } @@ -1127,7 +1149,7 @@ func (p *SPL1Parser) StageEnd() (localctx IStageEndContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(160) + p.SetState(164) _la = p.GetTokenStream().LA(1) if !(_la == SPL1ParserEOF || _la == SPL1ParserPIPE) { @@ -1205,6 +1227,87 @@ func (s *CommandContext) ToStringTree(ruleNames []string, recog antlr.Recognizer return antlr.TreesStringTree(s, ruleNames, recog) } +type CmdRenameContext struct { + CommandContext +} + +func NewCmdRenameContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *CmdRenameContext { + var p = new(CmdRenameContext) + + InitEmptyCommandContext(&p.CommandContext) + p.parser = parser + p.CopyAll(ctx.(*CommandContext)) + + return p +} + +func (s *CmdRenameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CmdRenameContext) RENAME() antlr.TerminalNode { + return s.GetToken(SPL1ParserRENAME, 0) +} + +func (s *CmdRenameContext) AllRenamePair() []IRenamePairContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRenamePairContext); ok { + len++ + } + } + + tst := make([]IRenamePairContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRenamePairContext); ok { + tst[i] = t.(IRenamePairContext) + i++ + } + } + + return tst +} + +func (s *CmdRenameContext) RenamePair(i int) IRenamePairContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRenamePairContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRenamePairContext) +} + +func (s *CmdRenameContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(SPL1ParserCOMMA) +} + +func (s *CmdRenameContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(SPL1ParserCOMMA, i) +} + +func (s *CmdRenameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case SPL1Visitor: + return t.VisitCmdRename(s) + + default: + return t.VisitChildren(s) + } +} + type CmdFieldsContext struct { CommandContext } @@ -1884,7 +1987,7 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { var _alt int - p.SetState(221) + p.SetState(235) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1895,19 +1998,19 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { localctx = NewCmdSearchContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(162) + p.SetState(166) p.Match(SPL1ParserSEARCH) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(164) + p.SetState(168) p.GetErrorHandler().Sync(p) if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 0, p.GetParserRuleContext()) == 1 { { - p.SetState(163) + p.SetState(167) p.SearchExpr() } @@ -1919,19 +2022,19 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { localctx = NewCmdWhereContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(166) + p.SetState(170) p.Match(SPL1ParserWHERE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(168) + p.SetState(172) p.GetErrorHandler().Sync(p) if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1, p.GetParserRuleContext()) == 1 { { - p.SetState(167) + p.SetState(171) p.ValueExpr() } @@ -1943,7 +2046,7 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { localctx = NewCmdStatsContext(p, localctx) p.EnterOuterAlt(localctx, 3) { - p.SetState(170) + p.SetState(174) p.Match(SPL1ParserSTATS) if p.HasError() { // Recognition error - abort rule @@ -1951,10 +2054,10 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { } } { - p.SetState(171) + p.SetState(175) p.AggList() } - p.SetState(173) + p.SetState(177) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1963,7 +2066,7 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { if _la == SPL1ParserBY { { - p.SetState(172) + p.SetState(176) p.ByClause() } @@ -1973,7 +2076,7 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { localctx = NewCmdTimechartContext(p, localctx) p.EnterOuterAlt(localctx, 4) { - p.SetState(175) + p.SetState(179) p.Match(SPL1ParserTIMECHART) if p.HasError() { // Recognition error - abort rule @@ -1981,7 +2084,7 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { } } { - p.SetState(176) + p.SetState(180) p.TimechartBody() } @@ -1989,7 +2092,7 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { localctx = NewCmdEvalContext(p, localctx) p.EnterOuterAlt(localctx, 5) { - p.SetState(177) + p.SetState(181) p.Match(SPL1ParserEVAL) if p.HasError() { // Recognition error - abort rule @@ -1997,10 +2100,10 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { } } { - p.SetState(178) + p.SetState(182) p.Assignment() } - p.SetState(183) + p.SetState(187) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2009,7 +2112,7 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { for _la == SPL1ParserCOMMA { { - p.SetState(179) + p.SetState(183) p.Match(SPL1ParserCOMMA) if p.HasError() { // Recognition error - abort rule @@ -2017,11 +2120,11 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { } } { - p.SetState(180) + p.SetState(184) p.Assignment() } - p.SetState(185) + p.SetState(189) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2033,19 +2136,19 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { localctx = NewCmdRexContext(p, localctx) p.EnterOuterAlt(localctx, 6) { - p.SetState(186) + p.SetState(190) p.Match(SPL1ParserREX) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(188) + p.SetState(192) p.GetErrorHandler().Sync(p) if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 4, p.GetParserRuleContext()) == 1 { { - p.SetState(187) + p.SetState(191) p.RexField() } @@ -2053,7 +2156,7 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { goto errorExit } { - p.SetState(190) + p.SetState(194) p.Match(SPL1ParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -2065,27 +2168,27 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { localctx = NewCmdTableContext(p, localctx) p.EnterOuterAlt(localctx, 7) { - p.SetState(191) + p.SetState(195) p.Match(SPL1ParserTABLE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(195) + p.SetState(199) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2041801692151806) != 0 { + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4083603384303614) != 0 { { - p.SetState(192) + p.SetState(196) p.TableItem() } - p.SetState(197) + p.SetState(201) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2097,41 +2200,41 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { localctx = NewCmdFieldsContext(p, localctx) p.EnterOuterAlt(localctx, 8) { - p.SetState(198) + p.SetState(202) p.Match(SPL1ParserFIELDS) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(200) + p.SetState(204) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&141562122076160) != 0 { + if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&283124244152320) != 0 { { - p.SetState(199) + p.SetState(203) p.FieldsSign() } } - p.SetState(205) + p.SetState(209) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1125908506214398) != 0 { + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2251817012428798) != 0 { { - p.SetState(202) + p.SetState(206) p.FieldsItem() } - p.SetState(207) + p.SetState(211) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2143,7 +2246,7 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { localctx = NewCmdSortContext(p, localctx) p.EnterOuterAlt(localctx, 9) { - p.SetState(208) + p.SetState(212) p.Match(SPL1ParserSORT) if p.HasError() { // Recognition error - abort rule @@ -2151,7 +2254,7 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { } } { - p.SetState(209) + p.SetState(213) p.SortBody() } @@ -2159,19 +2262,19 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { localctx = NewCmdHeadContext(p, localctx) p.EnterOuterAlt(localctx, 10) { - p.SetState(210) + p.SetState(214) p.Match(SPL1ParserHEAD) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(212) + p.SetState(216) p.GetErrorHandler().Sync(p) if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 8, p.GetParserRuleContext()) == 1 { { - p.SetState(211) + p.SetState(215) p.LimitArg() } @@ -2183,14 +2286,14 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { localctx = NewCmdBinContext(p, localctx) p.EnterOuterAlt(localctx, 11) { - p.SetState(214) + p.SetState(218) p.Match(SPL1ParserBIN) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(218) + p.SetState(222) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2202,12 +2305,12 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(215) + p.SetState(219) p.BinItem() } } - p.SetState(220) + p.SetState(224) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2218,6 +2321,69 @@ func (p *SPL1Parser) Command() (localctx ICommandContext) { } } + case SPL1ParserRENAME: + localctx = NewCmdRenameContext(p, localctx) + p.EnterOuterAlt(localctx, 12) + { + p.SetState(225) + p.Match(SPL1ParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(226) + p.RenamePair() + } + p.SetState(232) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3520653439270910) != 0 { + p.SetState(230) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case SPL1ParserCOMMA: + { + p.SetState(227) + p.Match(SPL1ParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(228) + p.RenamePair() + } + + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserSTRING, SPL1ParserIDENT, SPL1ParserSTAR, SPL1ParserSTAR_TIGHT, SPL1ParserSTAR_OP, SPL1ParserNOT_WORD: + { + p.SetState(229) + p.RenamePair() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + p.SetState(234) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + default: p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) goto errorExit @@ -2366,32 +2532,32 @@ func (p *SPL1Parser) SearchExpr() (localctx ISearchExprContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(223) + p.SetState(237) p.SearchAnd() } - p.SetState(227) + p.SetState(241) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 11, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 13, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(224) + p.SetState(238) p.SearchOrTail() } } - p.SetState(229) + p.SetState(243) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 11, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 13, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -2516,36 +2682,36 @@ func (p *SPL1Parser) SearchOrTail() (localctx ISearchOrTailContext) { localctx = NewSearchOrTailContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 10, SPL1ParserRULE_searchOrTail) p.EnterOuterAlt(localctx, 1) - p.SetState(230) + p.SetState(244) if !(p.at(SPL1ParserOR)) { p.SetError(antlr.NewFailedPredicateException(p, "p.at(SPL1ParserOR)", "")) goto errorExit } { - p.SetState(231) + p.SetState(245) p.Match(SPL1ParserOR) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(234) + p.SetState(248) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 12, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 14, p.GetParserRuleContext()) { case 1: { - p.SetState(232) + p.SetState(246) p.SearchAnd() } case 2: { - p.SetState(233) + p.SetState(247) p.AbsentOperand() } @@ -2696,32 +2862,32 @@ func (p *SPL1Parser) SearchAnd() (localctx ISearchAndContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(236) + p.SetState(250) p.SearchNot() } - p.SetState(240) + p.SetState(254) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 13, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(237) + p.SetState(251) p.SearchAndPart() } } - p.SetState(242) + p.SetState(256) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 13, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -2905,46 +3071,46 @@ func (s *SAndImplicitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} func (p *SPL1Parser) SearchAndPart() (localctx ISearchAndPartContext) { localctx = NewSearchAndPartContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 14, SPL1ParserRULE_searchAndPart) - p.SetState(251) + p.SetState(265) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 17, p.GetParserRuleContext()) { case 1: localctx = NewSAndExplicitContext(p, localctx) p.EnterOuterAlt(localctx, 1) - p.SetState(243) + p.SetState(257) if !(p.at(SPL1ParserAND)) { p.SetError(antlr.NewFailedPredicateException(p, "p.at(SPL1ParserAND)", "")) goto errorExit } { - p.SetState(244) + p.SetState(258) p.Match(SPL1ParserAND) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(247) + p.SetState(261) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 14, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 16, p.GetParserRuleContext()) { case 1: { - p.SetState(245) + p.SetState(259) p.SearchNot() } case 2: { - p.SetState(246) + p.SetState(260) p.AbsentOperand() } @@ -2955,14 +3121,14 @@ func (p *SPL1Parser) SearchAndPart() (localctx ISearchAndPartContext) { case 2: localctx = NewSAndImplicitContext(p, localctx) p.EnterOuterAlt(localctx, 2) - p.SetState(249) + p.SetState(263) if !(p.startsTerm()) { p.SetError(antlr.NewFailedPredicateException(p, "p.startsTerm()", "")) goto errorExit } { - p.SetState(250) + p.SetState(264) p.SearchNot() } @@ -3154,18 +3320,18 @@ func (p *SPL1Parser) SearchNot() (localctx ISearchNotContext) { p.EnterRule(localctx, 16, SPL1ParserRULE_searchNot) var _la int - p.SetState(259) + p.SetState(273) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 17, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 19, p.GetParserRuleContext()) { case 1: localctx = NewSNotUnaryContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(253) + p.SetState(267) _la = p.GetTokenStream().LA(1) if !(_la == SPL1ParserNOT || _la == SPL1ParserBANG) { @@ -3175,22 +3341,22 @@ func (p *SPL1Parser) SearchNot() (localctx ISearchNotContext) { p.Consume() } } - p.SetState(256) + p.SetState(270) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 16, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 18, p.GetParserRuleContext()) { case 1: { - p.SetState(254) + p.SetState(268) p.SearchNot() } case 2: { - p.SetState(255) + p.SetState(269) p.AbsentOperand() } @@ -3202,7 +3368,7 @@ func (p *SPL1Parser) SearchNot() (localctx ISearchNotContext) { localctx = NewSNotPrimaryContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(258) + p.SetState(272) p.SearchComparison() } @@ -3353,32 +3519,32 @@ func (p *SPL1Parser) SearchComparison() (localctx ISearchComparisonContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(261) + p.SetState(275) p.SearchAdditive() } - p.SetState(265) + p.SetState(279) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 18, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 20, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(262) + p.SetState(276) p.SearchComparisonTail() } } - p.SetState(267) + p.SetState(281) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 18, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 20, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -3515,32 +3681,32 @@ func (p *SPL1Parser) SearchComparisonTail() (localctx ISearchComparisonTailConte localctx = NewSearchComparisonTailContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 20, SPL1ParserRULE_searchComparisonTail) p.EnterOuterAlt(localctx, 1) - p.SetState(268) + p.SetState(282) if !(p.atCompare()) { p.SetError(antlr.NewFailedPredicateException(p, "p.atCompare()", "")) goto errorExit } { - p.SetState(269) + p.SetState(283) p.ComparisonOp() } - p.SetState(272) + p.SetState(286) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } switch p.GetTokenStream().LA(1) { - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserDURATION, SPL1ParserNUMBER, SPL1ParserSTRING, SPL1ParserIDENT, SPL1ParserLPAREN, SPL1ParserLBRACKET, SPL1ParserPLUS, SPL1ParserMINUS, SPL1ParserSTAR, SPL1ParserNUMBER_TIGHT, SPL1ParserSTAR_TIGHT, SPL1ParserMINUS_TIGHT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserDURATION, SPL1ParserNUMBER, SPL1ParserSTRING, SPL1ParserIDENT, SPL1ParserLPAREN, SPL1ParserLBRACKET, SPL1ParserPLUS, SPL1ParserMINUS, SPL1ParserSTAR, SPL1ParserNUMBER_TIGHT, SPL1ParserSTAR_TIGHT, SPL1ParserMINUS_TIGHT, SPL1ParserNOT_WORD: { - p.SetState(270) + p.SetState(284) p.SearchOperand() } case SPL1ParserEOF, SPL1ParserEQ2, SPL1ParserNE, SPL1ParserLE, SPL1ParserGE, SPL1ParserEQ, SPL1ParserLT, SPL1ParserGT, SPL1ParserPIPE, SPL1ParserCOMMA, SPL1ParserRPAREN, SPL1ParserRBRACKET: { - p.SetState(271) + p.SetState(285) p.AbsentOperand() } @@ -3739,7 +3905,7 @@ func (s *SOpValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *SPL1Parser) SearchOperand() (localctx ISearchOperandContext) { localctx = NewSearchOperandContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 22, SPL1ParserRULE_searchOperand) - p.SetState(277) + p.SetState(291) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3750,7 +3916,7 @@ func (p *SPL1Parser) SearchOperand() (localctx ISearchOperandContext) { localctx = NewSOpStringContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(274) + p.SetState(288) p.Match(SPL1ParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -3758,11 +3924,11 @@ func (p *SPL1Parser) SearchOperand() (localctx ISearchOperandContext) { } } - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNUMBER_TIGHT, SPL1ParserSTAR_TIGHT, SPL1ParserMINUS_TIGHT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNUMBER_TIGHT, SPL1ParserSTAR_TIGHT, SPL1ParserMINUS_TIGHT, SPL1ParserNOT_WORD: localctx = NewSOpValueContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(275) + p.SetState(289) p.SearchOperandValue() } @@ -3770,7 +3936,7 @@ func (p *SPL1Parser) SearchOperand() (localctx ISearchOperandContext) { localctx = NewSOpExprContext(p, localctx) p.EnterOuterAlt(localctx, 3) { - p.SetState(276) + p.SetState(290) p.SearchOperandExpr() } @@ -3986,42 +4152,42 @@ func (p *SPL1Parser) SearchOperandValue() (localctx ISearchOperandValueContext) p.EnterRule(localctx, 24, SPL1ParserRULE_searchOperandValue) var _alt int - p.SetState(321) + p.SetState(335) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } switch p.GetTokenStream().LA(1) { - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: p.EnterOuterAlt(localctx, 1) { - p.SetState(279) + p.SetState(293) p.IdentLike() } - p.SetState(283) + p.SetState(297) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 21, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 23, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(280) + p.SetState(294) p.RhsTail() } } - p.SetState(285) + p.SetState(299) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 21, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 23, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -4030,36 +4196,36 @@ func (p *SPL1Parser) SearchOperandValue() (localctx ISearchOperandValueContext) case SPL1ParserNUMBER_TIGHT: p.EnterOuterAlt(localctx, 2) { - p.SetState(286) + p.SetState(300) p.Match(SPL1ParserNUMBER_TIGHT) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(290) + p.SetState(304) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 22, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 24, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(287) + p.SetState(301) p.RhsTail() } } - p.SetState(292) + p.SetState(306) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 22, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 24, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -4068,59 +4234,59 @@ func (p *SPL1Parser) SearchOperandValue() (localctx ISearchOperandValueContext) case SPL1ParserSTAR_TIGHT: p.EnterOuterAlt(localctx, 3) { - p.SetState(293) + p.SetState(307) p.Match(SPL1ParserSTAR_TIGHT) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(302) + p.SetState(316) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } switch p.GetTokenStream().LA(1) { - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: { - p.SetState(294) + p.SetState(308) p.IdentLike() } case SPL1ParserNUMBER, SPL1ParserNUMBER_TIGHT: { - p.SetState(295) + p.SetState(309) p.Number() } case SPL1ParserMINUS, SPL1ParserMINUS_TIGHT: { - p.SetState(296) + p.SetState(310) p.Minus() } - p.SetState(300) + p.SetState(314) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } switch p.GetTokenStream().LA(1) { - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: { - p.SetState(297) + p.SetState(311) p.IdentLike() } case SPL1ParserNUMBER, SPL1ParserNUMBER_TIGHT: { - p.SetState(298) + p.SetState(312) p.Number() } case SPL1ParserSTAR, SPL1ParserSTAR_TIGHT, SPL1ParserSTAR_TERM, SPL1ParserSTAR_OP: { - p.SetState(299) + p.SetState(313) p.Star() } @@ -4133,29 +4299,29 @@ func (p *SPL1Parser) SearchOperandValue() (localctx ISearchOperandValueContext) p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) goto errorExit } - p.SetState(307) + p.SetState(321) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 25, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 27, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(304) + p.SetState(318) p.RhsTail() } } - p.SetState(309) + p.SetState(323) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 25, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 27, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -4164,29 +4330,29 @@ func (p *SPL1Parser) SearchOperandValue() (localctx ISearchOperandValueContext) case SPL1ParserMINUS_TIGHT: p.EnterOuterAlt(localctx, 4) { - p.SetState(310) + p.SetState(324) p.Match(SPL1ParserMINUS_TIGHT) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(313) + p.SetState(327) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } switch p.GetTokenStream().LA(1) { - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: { - p.SetState(311) + p.SetState(325) p.IdentLike() } case SPL1ParserSTAR, SPL1ParserSTAR_TIGHT, SPL1ParserSTAR_TERM, SPL1ParserSTAR_OP: { - p.SetState(312) + p.SetState(326) p.Star() } @@ -4194,29 +4360,29 @@ func (p *SPL1Parser) SearchOperandValue() (localctx ISearchOperandValueContext) p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) goto errorExit } - p.SetState(318) + p.SetState(332) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 27, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 29, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(315) + p.SetState(329) p.RhsTail() } } - p.SetState(320) + p.SetState(334) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 27, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 29, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -4374,86 +4540,86 @@ func (s *RhsTailContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *SPL1Parser) RhsTail() (localctx IRhsTailContext) { localctx = NewRhsTailContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 26, SPL1ParserRULE_rhsTail) - p.SetState(336) + p.SetState(350) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 30, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 32, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) - p.SetState(323) + p.SetState(337) if !(p.touchingPrev()) { p.SetError(antlr.NewFailedPredicateException(p, "p.touchingPrev()", "")) goto errorExit } { - p.SetState(324) + p.SetState(338) p.Star() } case 2: p.EnterOuterAlt(localctx, 2) - p.SetState(325) + p.SetState(339) if !(p.touchingPrev()) { p.SetError(antlr.NewFailedPredicateException(p, "p.touchingPrev()", "")) goto errorExit } { - p.SetState(326) + p.SetState(340) p.IdentLike() } case 3: p.EnterOuterAlt(localctx, 3) - p.SetState(327) + p.SetState(341) if !(p.touchingPrev()) { p.SetError(antlr.NewFailedPredicateException(p, "p.touchingPrev()", "")) goto errorExit } { - p.SetState(328) + p.SetState(342) p.Number() } case 4: p.EnterOuterAlt(localctx, 4) - p.SetState(329) + p.SetState(343) if !(p.hyphenTail()) { p.SetError(antlr.NewFailedPredicateException(p, "p.hyphenTail()", "")) goto errorExit } { - p.SetState(330) + p.SetState(344) p.Minus() } - p.SetState(334) + p.SetState(348) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } switch p.GetTokenStream().LA(1) { - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: { - p.SetState(331) + p.SetState(345) p.IdentLike() } case SPL1ParserNUMBER, SPL1ParserNUMBER_TIGHT: { - p.SetState(332) + p.SetState(346) p.Number() } case SPL1ParserSTAR, SPL1ParserSTAR_TIGHT, SPL1ParserSTAR_TERM, SPL1ParserSTAR_OP: { - p.SetState(333) + p.SetState(347) p.Star() } @@ -4652,59 +4818,59 @@ func (p *SPL1Parser) SearchOperandExpr() (localctx ISearchOperandExprContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(338) + p.SetState(352) p.SearchOperandUnary() } - p.SetState(342) + p.SetState(356) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 31, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 33, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(339) + p.SetState(353) p.SearchMulTail() } } - p.SetState(344) + p.SetState(358) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 31, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 33, p.GetParserRuleContext()) if p.HasError() { goto errorExit } } - p.SetState(348) + p.SetState(362) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 32, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 34, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(345) + p.SetState(359) p.SearchAddTail() } } - p.SetState(350) + p.SetState(364) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 32, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 34, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -4852,7 +5018,7 @@ func (p *SPL1Parser) SearchOperandUnary() (localctx ISearchOperandUnaryContext) p.EnterRule(localctx, 30, SPL1ParserRULE_searchOperandUnary) var _la int - p.SetState(357) + p.SetState(371) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4862,7 +5028,7 @@ func (p *SPL1Parser) SearchOperandUnary() (localctx ISearchOperandUnaryContext) case SPL1ParserPLUS, SPL1ParserMINUS: p.EnterOuterAlt(localctx, 1) { - p.SetState(351) + p.SetState(365) _la = p.GetTokenStream().LA(1) if !(_la == SPL1ParserPLUS || _la == SPL1ParserMINUS) { @@ -4872,22 +5038,22 @@ func (p *SPL1Parser) SearchOperandUnary() (localctx ISearchOperandUnaryContext) p.Consume() } } - p.SetState(354) + p.SetState(368) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 33, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 35, p.GetParserRuleContext()) { case 1: { - p.SetState(352) + p.SetState(366) p.SearchUnary() } case 2: { - p.SetState(353) + p.SetState(367) p.AbsentOperand() } @@ -4898,7 +5064,7 @@ func (p *SPL1Parser) SearchOperandUnary() (localctx ISearchOperandUnaryContext) case SPL1ParserDURATION, SPL1ParserNUMBER, SPL1ParserLPAREN, SPL1ParserLBRACKET, SPL1ParserSTAR: p.EnterOuterAlt(localctx, 2) { - p.SetState(356) + p.SetState(370) p.SearchOperandPrimary() } @@ -5045,7 +5211,7 @@ func (s *SearchOperandPrimaryContext) Accept(visitor antlr.ParseTreeVisitor) int func (p *SPL1Parser) SearchOperandPrimary() (localctx ISearchOperandPrimaryContext) { localctx = NewSearchOperandPrimaryContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 32, SPL1ParserRULE_searchOperandPrimary) - p.SetState(367) + p.SetState(381) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -5055,7 +5221,7 @@ func (p *SPL1Parser) SearchOperandPrimary() (localctx ISearchOperandPrimaryConte case SPL1ParserLPAREN: p.EnterOuterAlt(localctx, 1) { - p.SetState(359) + p.SetState(373) p.Match(SPL1ParserLPAREN) if p.HasError() { // Recognition error - abort rule @@ -5063,11 +5229,11 @@ func (p *SPL1Parser) SearchOperandPrimary() (localctx ISearchOperandPrimaryConte } } { - p.SetState(360) + p.SetState(374) p.SearchExpr() } { - p.SetState(361) + p.SetState(375) p.Match(SPL1ParserRPAREN) if p.HasError() { // Recognition error - abort rule @@ -5078,7 +5244,7 @@ func (p *SPL1Parser) SearchOperandPrimary() (localctx ISearchOperandPrimaryConte case SPL1ParserDURATION: p.EnterOuterAlt(localctx, 2) { - p.SetState(363) + p.SetState(377) p.Match(SPL1ParserDURATION) if p.HasError() { // Recognition error - abort rule @@ -5089,7 +5255,7 @@ func (p *SPL1Parser) SearchOperandPrimary() (localctx ISearchOperandPrimaryConte case SPL1ParserNUMBER: p.EnterOuterAlt(localctx, 3) { - p.SetState(364) + p.SetState(378) p.Match(SPL1ParserNUMBER) if p.HasError() { // Recognition error - abort rule @@ -5100,7 +5266,7 @@ func (p *SPL1Parser) SearchOperandPrimary() (localctx ISearchOperandPrimaryConte case SPL1ParserSTAR: p.EnterOuterAlt(localctx, 4) { - p.SetState(365) + p.SetState(379) p.Match(SPL1ParserSTAR) if p.HasError() { // Recognition error - abort rule @@ -5111,7 +5277,7 @@ func (p *SPL1Parser) SearchOperandPrimary() (localctx ISearchOperandPrimaryConte case SPL1ParserLBRACKET: p.EnterOuterAlt(localctx, 5) { - p.SetState(366) + p.SetState(380) p.Subsearch() } @@ -5263,32 +5429,32 @@ func (p *SPL1Parser) SearchAdditive() (localctx ISearchAdditiveContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(369) + p.SetState(383) p.SearchMultiplicative() } - p.SetState(373) + p.SetState(387) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 36, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 38, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(370) + p.SetState(384) p.SearchAddTail() } } - p.SetState(375) + p.SetState(389) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 36, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 38, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -5425,32 +5591,32 @@ func (p *SPL1Parser) SearchAddTail() (localctx ISearchAddTailContext) { localctx = NewSearchAddTailContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 36, SPL1ParserRULE_searchAddTail) p.EnterOuterAlt(localctx, 1) - p.SetState(376) + p.SetState(390) if !(p.atAdd()) { p.SetError(antlr.NewFailedPredicateException(p, "p.atAdd()", "")) goto errorExit } { - p.SetState(377) + p.SetState(391) p.AddOp() } - p.SetState(380) + p.SetState(394) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 37, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 39, p.GetParserRuleContext()) { case 1: { - p.SetState(378) + p.SetState(392) p.SearchMultiplicative() } case 2: { - p.SetState(379) + p.SetState(393) p.AbsentOperand() } @@ -5601,32 +5767,32 @@ func (p *SPL1Parser) SearchMultiplicative() (localctx ISearchMultiplicativeConte p.EnterOuterAlt(localctx, 1) { - p.SetState(382) + p.SetState(396) p.SearchUnary() } - p.SetState(386) + p.SetState(400) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 38, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 40, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(383) + p.SetState(397) p.SearchMulTail() } } - p.SetState(388) + p.SetState(402) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 38, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 40, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -5763,32 +5929,32 @@ func (p *SPL1Parser) SearchMulTail() (localctx ISearchMulTailContext) { localctx = NewSearchMulTailContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 40, SPL1ParserRULE_searchMulTail) p.EnterOuterAlt(localctx, 1) - p.SetState(389) + p.SetState(403) if !(p.atSearchMul()) { p.SetError(antlr.NewFailedPredicateException(p, "p.atSearchMul()", "")) goto errorExit } { - p.SetState(390) + p.SetState(404) p.SearchMulOp() } - p.SetState(393) + p.SetState(407) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 39, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 41, p.GetParserRuleContext()) { case 1: { - p.SetState(391) + p.SetState(405) p.SearchUnary() } case 2: { - p.SetState(392) + p.SetState(406) p.AbsentOperand() } @@ -5986,36 +6152,36 @@ func (s *SUnaryPrimaryContext) Accept(visitor antlr.ParseTreeVisitor) interface{ func (p *SPL1Parser) SearchUnary() (localctx ISearchUnaryContext) { localctx = NewSearchUnaryContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 42, SPL1ParserRULE_searchUnary) - p.SetState(401) + p.SetState(415) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 41, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 43, p.GetParserRuleContext()) { case 1: localctx = NewSUnarySignContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(395) + p.SetState(409) p.Sign() } - p.SetState(398) + p.SetState(412) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 40, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 42, p.GetParserRuleContext()) { case 1: { - p.SetState(396) + p.SetState(410) p.SearchUnary() } case 2: { - p.SetState(397) + p.SetState(411) p.AbsentOperand() } @@ -6027,7 +6193,7 @@ func (p *SPL1Parser) SearchUnary() (localctx ISearchUnaryContext) { localctx = NewSUnaryPrimaryContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(400) + p.SetState(414) p.SearchPrimary() } @@ -6525,18 +6691,18 @@ func (p *SPL1Parser) SearchPrimary() (localctx ISearchPrimaryContext) { p.EnterRule(localctx, 44, SPL1ParserRULE_searchPrimary) var _alt int - p.SetState(426) + p.SetState(440) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 44, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 46, p.GetParserRuleContext()) { case 1: localctx = NewSPrimParenContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(403) + p.SetState(417) p.Match(SPL1ParserLPAREN) if p.HasError() { // Recognition error - abort rule @@ -6544,11 +6710,11 @@ func (p *SPL1Parser) SearchPrimary() (localctx ISearchPrimaryContext) { } } { - p.SetState(404) + p.SetState(418) p.SearchExpr() } { - p.SetState(405) + p.SetState(419) p.Match(SPL1ParserRPAREN) if p.HasError() { // Recognition error - abort rule @@ -6560,7 +6726,7 @@ func (p *SPL1Parser) SearchPrimary() (localctx ISearchPrimaryContext) { localctx = NewSPrimStringContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(407) + p.SetState(421) p.Match(SPL1ParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -6572,32 +6738,32 @@ func (p *SPL1Parser) SearchPrimary() (localctx ISearchPrimaryContext) { localctx = NewSPrimWordContext(p, localctx) p.EnterOuterAlt(localctx, 3) { - p.SetState(408) + p.SetState(422) p.ExprWord() } - p.SetState(412) + p.SetState(426) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 42, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 44, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(409) + p.SetState(423) p.SearchTermTail() } } - p.SetState(414) + p.SetState(428) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 42, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 44, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -6607,7 +6773,7 @@ func (p *SPL1Parser) SearchPrimary() (localctx ISearchPrimaryContext) { localctx = NewSPrimNumberContext(p, localctx) p.EnterOuterAlt(localctx, 4) { - p.SetState(415) + p.SetState(429) p.Number() } @@ -6615,7 +6781,7 @@ func (p *SPL1Parser) SearchPrimary() (localctx ISearchPrimaryContext) { localctx = NewSPrimDurationContext(p, localctx) p.EnterOuterAlt(localctx, 5) { - p.SetState(416) + p.SetState(430) p.Match(SPL1ParserDURATION) if p.HasError() { // Recognition error - abort rule @@ -6626,17 +6792,17 @@ func (p *SPL1Parser) SearchPrimary() (localctx ISearchPrimaryContext) { case 6: localctx = NewSPrimStarRunContext(p, localctx) p.EnterOuterAlt(localctx, 6) - p.SetState(417) + p.SetState(431) if !(p.termStarRun()) { p.SetError(antlr.NewFailedPredicateException(p, "p.termStarRun()", "")) goto errorExit } { - p.SetState(418) + p.SetState(432) p.Star() } - p.SetState(420) + p.SetState(434) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -6646,7 +6812,7 @@ func (p *SPL1Parser) SearchPrimary() (localctx ISearchPrimaryContext) { switch _alt { case 1: { - p.SetState(419) + p.SetState(433) p.SearchTermTail() } @@ -6655,9 +6821,9 @@ func (p *SPL1Parser) SearchPrimary() (localctx ISearchPrimaryContext) { goto errorExit } - p.SetState(422) + p.SetState(436) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 43, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 45, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -6667,7 +6833,7 @@ func (p *SPL1Parser) SearchPrimary() (localctx ISearchPrimaryContext) { localctx = NewSPrimStarContext(p, localctx) p.EnterOuterAlt(localctx, 7) { - p.SetState(424) + p.SetState(438) p.OperandStar() } @@ -6675,7 +6841,7 @@ func (p *SPL1Parser) SearchPrimary() (localctx ISearchPrimaryContext) { localctx = NewSPrimSubsearchContext(p, localctx) p.EnterOuterAlt(localctx, 8) { - p.SetState(425) + p.SetState(439) p.Subsearch() } @@ -6801,23 +6967,23 @@ func (s *SearchTermTailContext) Accept(visitor antlr.ParseTreeVisitor) interface func (p *SPL1Parser) SearchTermTail() (localctx ISearchTermTailContext) { localctx = NewSearchTermTailContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 46, SPL1ParserRULE_searchTermTail) - p.SetState(434) + p.SetState(448) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 45, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 47, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) - p.SetState(428) + p.SetState(442) if !(p.touchingPrev()) { p.SetError(antlr.NewFailedPredicateException(p, "p.touchingPrev()", "")) goto errorExit } { - p.SetState(429) + p.SetState(443) p.Match(SPL1ParserSTAR_TERM) if p.HasError() { // Recognition error - abort rule @@ -6827,27 +6993,27 @@ func (p *SPL1Parser) SearchTermTail() (localctx ISearchTermTailContext) { case 2: p.EnterOuterAlt(localctx, 2) - p.SetState(430) + p.SetState(444) if !(p.touchingPrev()) { p.SetError(antlr.NewFailedPredicateException(p, "p.touchingPrev()", "")) goto errorExit } { - p.SetState(431) + p.SetState(445) p.IdentLike() } case 3: p.EnterOuterAlt(localctx, 3) - p.SetState(432) + p.SetState(446) if !(p.touchingPrev()) { p.SetError(antlr.NewFailedPredicateException(p, "p.touchingPrev()", "")) goto errorExit } { - p.SetState(433) + p.SetState(447) p.Number() } @@ -6998,32 +7164,32 @@ func (p *SPL1Parser) ValueExpr() (localctx IValueExprContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(436) + p.SetState(450) p.ValueAnd() } - p.SetState(440) + p.SetState(454) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 46, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 48, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(437) + p.SetState(451) p.ValueOrTail() } } - p.SetState(442) + p.SetState(456) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 46, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 48, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -7148,36 +7314,36 @@ func (p *SPL1Parser) ValueOrTail() (localctx IValueOrTailContext) { localctx = NewValueOrTailContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 50, SPL1ParserRULE_valueOrTail) p.EnterOuterAlt(localctx, 1) - p.SetState(443) + p.SetState(457) if !(p.at(SPL1ParserOR)) { p.SetError(antlr.NewFailedPredicateException(p, "p.at(SPL1ParserOR)", "")) goto errorExit } { - p.SetState(444) + p.SetState(458) p.Match(SPL1ParserOR) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(447) + p.SetState(461) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 47, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 49, p.GetParserRuleContext()) { case 1: { - p.SetState(445) + p.SetState(459) p.ValueAnd() } case 2: { - p.SetState(446) + p.SetState(460) p.AbsentOperand() } @@ -7328,32 +7494,32 @@ func (p *SPL1Parser) ValueAnd() (localctx IValueAndContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(449) + p.SetState(463) p.ValueNot() } - p.SetState(453) + p.SetState(467) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 48, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 50, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(450) + p.SetState(464) p.ValueAndPart() } } - p.SetState(455) + p.SetState(469) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 48, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 50, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -7537,46 +7703,46 @@ func (s *VAndExplicitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} func (p *SPL1Parser) ValueAndPart() (localctx IValueAndPartContext) { localctx = NewValueAndPartContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 54, SPL1ParserRULE_valueAndPart) - p.SetState(464) + p.SetState(478) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 50, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 52, p.GetParserRuleContext()) { case 1: localctx = NewVAndExplicitContext(p, localctx) p.EnterOuterAlt(localctx, 1) - p.SetState(456) + p.SetState(470) if !(p.at(SPL1ParserAND)) { p.SetError(antlr.NewFailedPredicateException(p, "p.at(SPL1ParserAND)", "")) goto errorExit } { - p.SetState(457) + p.SetState(471) p.Match(SPL1ParserAND) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(460) + p.SetState(474) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 49, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 51, p.GetParserRuleContext()) { case 1: { - p.SetState(458) + p.SetState(472) p.ValueNot() } case 2: { - p.SetState(459) + p.SetState(473) p.AbsentOperand() } @@ -7587,14 +7753,14 @@ func (p *SPL1Parser) ValueAndPart() (localctx IValueAndPartContext) { case 2: localctx = NewVAndImplicitContext(p, localctx) p.EnterOuterAlt(localctx, 2) - p.SetState(462) + p.SetState(476) if !(p.startsTerm()) { p.SetError(antlr.NewFailedPredicateException(p, "p.startsTerm()", "")) goto errorExit } { - p.SetState(463) + p.SetState(477) p.ValueNot() } @@ -7786,18 +7952,18 @@ func (p *SPL1Parser) ValueNot() (localctx IValueNotContext) { p.EnterRule(localctx, 56, SPL1ParserRULE_valueNot) var _la int - p.SetState(472) + p.SetState(486) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 52, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 54, p.GetParserRuleContext()) { case 1: localctx = NewVNotUnaryContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(466) + p.SetState(480) _la = p.GetTokenStream().LA(1) if !(_la == SPL1ParserNOT || _la == SPL1ParserBANG) { @@ -7807,22 +7973,22 @@ func (p *SPL1Parser) ValueNot() (localctx IValueNotContext) { p.Consume() } } - p.SetState(469) + p.SetState(483) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 51, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 53, p.GetParserRuleContext()) { case 1: { - p.SetState(467) + p.SetState(481) p.ValueNot() } case 2: { - p.SetState(468) + p.SetState(482) p.AbsentOperand() } @@ -7834,7 +8000,7 @@ func (p *SPL1Parser) ValueNot() (localctx IValueNotContext) { localctx = NewVNotPrimaryContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(471) + p.SetState(485) p.ValueComparison() } @@ -7985,32 +8151,32 @@ func (p *SPL1Parser) ValueComparison() (localctx IValueComparisonContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(474) + p.SetState(488) p.ValueAdd() } - p.SetState(478) + p.SetState(492) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 53, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 55, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(475) + p.SetState(489) p.ValueComparisonTail() } } - p.SetState(480) + p.SetState(494) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 53, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 55, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -8147,32 +8313,32 @@ func (p *SPL1Parser) ValueComparisonTail() (localctx IValueComparisonTailContext localctx = NewValueComparisonTailContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 60, SPL1ParserRULE_valueComparisonTail) p.EnterOuterAlt(localctx, 1) - p.SetState(481) + p.SetState(495) if !(p.atCompare()) { p.SetError(antlr.NewFailedPredicateException(p, "p.atCompare()", "")) goto errorExit } { - p.SetState(482) + p.SetState(496) p.ComparisonOp() } - p.SetState(485) + p.SetState(499) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 54, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 56, p.GetParserRuleContext()) { case 1: { - p.SetState(483) + p.SetState(497) p.ValueAdd() } case 2: { - p.SetState(484) + p.SetState(498) p.AbsentOperand() } @@ -8323,32 +8489,32 @@ func (p *SPL1Parser) ValueAdd() (localctx IValueAddContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(487) + p.SetState(501) p.ValueMul() } - p.SetState(491) + p.SetState(505) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 55, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 57, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(488) + p.SetState(502) p.ValueAddTail() } } - p.SetState(493) + p.SetState(507) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 55, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 57, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -8485,32 +8651,32 @@ func (p *SPL1Parser) ValueAddTail() (localctx IValueAddTailContext) { localctx = NewValueAddTailContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 64, SPL1ParserRULE_valueAddTail) p.EnterOuterAlt(localctx, 1) - p.SetState(494) + p.SetState(508) if !(p.atAdd()) { p.SetError(antlr.NewFailedPredicateException(p, "p.atAdd()", "")) goto errorExit } { - p.SetState(495) + p.SetState(509) p.AddOp() } - p.SetState(498) + p.SetState(512) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 56, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 58, p.GetParserRuleContext()) { case 1: { - p.SetState(496) + p.SetState(510) p.ValueMul() } case 2: { - p.SetState(497) + p.SetState(511) p.AbsentOperand() } @@ -8661,32 +8827,32 @@ func (p *SPL1Parser) ValueMul() (localctx IValueMulContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(500) + p.SetState(514) p.ValueUnary() } - p.SetState(504) + p.SetState(518) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 57, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 59, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(501) + p.SetState(515) p.ValueMulTail() } } - p.SetState(506) + p.SetState(520) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 57, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 59, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -8823,32 +8989,32 @@ func (p *SPL1Parser) ValueMulTail() (localctx IValueMulTailContext) { localctx = NewValueMulTailContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 68, SPL1ParserRULE_valueMulTail) p.EnterOuterAlt(localctx, 1) - p.SetState(507) + p.SetState(521) if !(p.atMul()) { p.SetError(antlr.NewFailedPredicateException(p, "p.atMul()", "")) goto errorExit } { - p.SetState(508) + p.SetState(522) p.MulOp() } - p.SetState(511) + p.SetState(525) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 58, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 60, p.GetParserRuleContext()) { case 1: { - p.SetState(509) + p.SetState(523) p.ValueUnary() } case 2: { - p.SetState(510) + p.SetState(524) p.AbsentOperand() } @@ -9046,36 +9212,36 @@ func (s *VUnaryPrimaryContext) Accept(visitor antlr.ParseTreeVisitor) interface{ func (p *SPL1Parser) ValueUnary() (localctx IValueUnaryContext) { localctx = NewValueUnaryContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 70, SPL1ParserRULE_valueUnary) - p.SetState(519) + p.SetState(533) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 60, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 62, p.GetParserRuleContext()) { case 1: localctx = NewVUnarySignContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(513) + p.SetState(527) p.Sign() } - p.SetState(516) + p.SetState(530) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 59, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 61, p.GetParserRuleContext()) { case 1: { - p.SetState(514) + p.SetState(528) p.ValueUnary() } case 2: { - p.SetState(515) + p.SetState(529) p.AbsentOperand() } @@ -9087,7 +9253,7 @@ func (p *SPL1Parser) ValueUnary() (localctx IValueUnaryContext) { localctx = NewVUnaryPrimaryContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(518) + p.SetState(532) p.ValuePrimary() } @@ -9560,18 +9726,18 @@ func (p *SPL1Parser) ValuePrimary() (localctx IValuePrimaryContext) { p.EnterRule(localctx, 72, SPL1ParserRULE_valuePrimary) var _la int - p.SetState(546) + p.SetState(560) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 63, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 65, p.GetParserRuleContext()) { case 1: localctx = NewVPrimParenContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(521) + p.SetState(535) p.Match(SPL1ParserLPAREN) if p.HasError() { // Recognition error - abort rule @@ -9579,11 +9745,11 @@ func (p *SPL1Parser) ValuePrimary() (localctx IValuePrimaryContext) { } } { - p.SetState(522) + p.SetState(536) p.ValueExpr() } { - p.SetState(523) + p.SetState(537) p.Match(SPL1ParserRPAREN) if p.HasError() { // Recognition error - abort rule @@ -9594,33 +9760,33 @@ func (p *SPL1Parser) ValuePrimary() (localctx IValuePrimaryContext) { case 2: localctx = NewVPrimCallContext(p, localctx) p.EnterOuterAlt(localctx, 2) - p.SetState(525) + p.SetState(539) if !(p.callAhead()) { p.SetError(antlr.NewFailedPredicateException(p, "p.callAhead()", "")) goto errorExit } { - p.SetState(526) + p.SetState(540) p.ExprWord() } { - p.SetState(527) + p.SetState(541) p.Match(SPL1ParserLPAREN) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(536) + p.SetState(550) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 62, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 64, p.GetParserRuleContext()) == 1 { { - p.SetState(528) + p.SetState(542) p.ValueExpr() } - p.SetState(533) + p.SetState(547) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -9629,7 +9795,7 @@ func (p *SPL1Parser) ValuePrimary() (localctx IValuePrimaryContext) { for _la == SPL1ParserCOMMA { { - p.SetState(529) + p.SetState(543) p.Match(SPL1ParserCOMMA) if p.HasError() { // Recognition error - abort rule @@ -9637,11 +9803,11 @@ func (p *SPL1Parser) ValuePrimary() (localctx IValuePrimaryContext) { } } { - p.SetState(530) + p.SetState(544) p.ValueExpr() } - p.SetState(535) + p.SetState(549) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -9653,7 +9819,7 @@ func (p *SPL1Parser) ValuePrimary() (localctx IValuePrimaryContext) { goto errorExit } { - p.SetState(538) + p.SetState(552) p.Match(SPL1ParserRPAREN) if p.HasError() { // Recognition error - abort rule @@ -9665,7 +9831,7 @@ func (p *SPL1Parser) ValuePrimary() (localctx IValuePrimaryContext) { localctx = NewVPrimWordContext(p, localctx) p.EnterOuterAlt(localctx, 3) { - p.SetState(540) + p.SetState(554) p.ExprWord() } @@ -9673,7 +9839,7 @@ func (p *SPL1Parser) ValuePrimary() (localctx IValuePrimaryContext) { localctx = NewVPrimStringContext(p, localctx) p.EnterOuterAlt(localctx, 4) { - p.SetState(541) + p.SetState(555) p.Match(SPL1ParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -9685,7 +9851,7 @@ func (p *SPL1Parser) ValuePrimary() (localctx IValuePrimaryContext) { localctx = NewVPrimNumberContext(p, localctx) p.EnterOuterAlt(localctx, 5) { - p.SetState(542) + p.SetState(556) p.Number() } @@ -9693,7 +9859,7 @@ func (p *SPL1Parser) ValuePrimary() (localctx IValuePrimaryContext) { localctx = NewVPrimDurationContext(p, localctx) p.EnterOuterAlt(localctx, 6) { - p.SetState(543) + p.SetState(557) p.Match(SPL1ParserDURATION) if p.HasError() { // Recognition error - abort rule @@ -9705,7 +9871,7 @@ func (p *SPL1Parser) ValuePrimary() (localctx IValuePrimaryContext) { localctx = NewVPrimStarContext(p, localctx) p.EnterOuterAlt(localctx, 7) { - p.SetState(544) + p.SetState(558) p.OperandStar() } @@ -9713,7 +9879,7 @@ func (p *SPL1Parser) ValuePrimary() (localctx IValuePrimaryContext) { localctx = NewVPrimSubsearchContext(p, localctx) p.EnterOuterAlt(localctx, 8) { - p.SetState(545) + p.SetState(559) p.Subsearch() } @@ -9831,7 +9997,7 @@ func (p *SPL1Parser) Subsearch() (localctx ISubsearchContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(548) + p.SetState(562) p.Match(SPL1ParserLBRACKET) if p.HasError() { // Recognition error - abort rule @@ -9839,19 +10005,19 @@ func (p *SPL1Parser) Subsearch() (localctx ISubsearchContext) { } } p.abortSubsearch() - p.SetState(553) + p.SetState(567) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 64, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 66, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(550) + p.SetState(564) _la = p.GetTokenStream().LA(1) if _la <= 0 || _la == SPL1ParserEOF || _la == SPL1ParserPIPE { @@ -9863,12 +10029,12 @@ func (p *SPL1Parser) Subsearch() (localctx ISubsearchContext) { } } - p.SetState(555) + p.SetState(569) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 64, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 66, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -10018,10 +10184,10 @@ func (p *SPL1Parser) AbsentOperand() (localctx IAbsentOperandContext) { p.EnterOuterAlt(localctx, 1) p.abortMissingOperand() { - p.SetState(557) + p.SetState(571) _la = p.GetTokenStream().LA(1) - if !((int64((_la - -1)) & ^0x3f) == 0 && ((int64(1)<<(_la - -1))&373628600321) != 0) { + if !((int64((_la - -1)) & ^0x3f) == 0 && ((int64(1)<<(_la - -1))&747257200641) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -10147,10 +10313,10 @@ func (p *SPL1Parser) ComparisonOp() (localctx IComparisonOpContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(559) + p.SetState(573) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2130706432) != 0) { + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4261412864) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -10256,10 +10422,10 @@ func (p *SPL1Parser) OperandStar() (localctx IOperandStarContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(561) + p.SetState(575) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&352943232516096) != 0) { + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&705886465032192) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -10368,7 +10534,7 @@ func (s *StarContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *SPL1Parser) Star() (localctx IStarContext) { localctx = NewStarContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 82, SPL1ParserRULE_star) - p.SetState(565) + p.SetState(579) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -10378,14 +10544,14 @@ func (p *SPL1Parser) Star() (localctx IStarContext) { case SPL1ParserSTAR, SPL1ParserSTAR_TIGHT, SPL1ParserSTAR_TERM: p.EnterOuterAlt(localctx, 1) { - p.SetState(563) + p.SetState(577) p.OperandStar() } case SPL1ParserSTAR_OP: p.EnterOuterAlt(localctx, 2) { - p.SetState(564) + p.SetState(578) p.Match(SPL1ParserSTAR_OP) if p.HasError() { // Recognition error - abort rule @@ -10491,7 +10657,7 @@ func (p *SPL1Parser) Minus() (localctx IMinusContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(567) + p.SetState(581) _la = p.GetTokenStream().LA(1) if !(_la == SPL1ParserMINUS || _la == SPL1ParserMINUS_TIGHT) { @@ -10595,7 +10761,7 @@ func (p *SPL1Parser) Number() (localctx INumberContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(569) + p.SetState(583) _la = p.GetTokenStream().LA(1) if !(_la == SPL1ParserNUMBER || _la == SPL1ParserNUMBER_TIGHT) { @@ -10707,7 +10873,7 @@ func (s *AddOpContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *SPL1Parser) AddOp() (localctx IAddOpContext) { localctx = NewAddOpContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 88, SPL1ParserRULE_addOp) - p.SetState(573) + p.SetState(587) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -10717,7 +10883,7 @@ func (p *SPL1Parser) AddOp() (localctx IAddOpContext) { case SPL1ParserPLUS: p.EnterOuterAlt(localctx, 1) { - p.SetState(571) + p.SetState(585) p.Match(SPL1ParserPLUS) if p.HasError() { // Recognition error - abort rule @@ -10728,7 +10894,7 @@ func (p *SPL1Parser) AddOp() (localctx IAddOpContext) { case SPL1ParserMINUS, SPL1ParserMINUS_TIGHT: p.EnterOuterAlt(localctx, 2) { - p.SetState(572) + p.SetState(586) p.Minus() } @@ -10843,7 +11009,7 @@ func (s *MulOpContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *SPL1Parser) MulOp() (localctx IMulOpContext) { localctx = NewMulOpContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 90, SPL1ParserRULE_mulOp) - p.SetState(578) + p.SetState(592) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -10853,14 +11019,14 @@ func (p *SPL1Parser) MulOp() (localctx IMulOpContext) { case SPL1ParserSTAR, SPL1ParserSTAR_TIGHT, SPL1ParserSTAR_TERM, SPL1ParserSTAR_OP: p.EnterOuterAlt(localctx, 1) { - p.SetState(575) + p.SetState(589) p.Star() } case SPL1ParserSLASH: p.EnterOuterAlt(localctx, 2) { - p.SetState(576) + p.SetState(590) p.Match(SPL1ParserSLASH) if p.HasError() { // Recognition error - abort rule @@ -10871,7 +11037,7 @@ func (p *SPL1Parser) MulOp() (localctx IMulOpContext) { case SPL1ParserPERCENT: p.EnterOuterAlt(localctx, 3) { - p.SetState(577) + p.SetState(591) p.Match(SPL1ParserPERCENT) if p.HasError() { // Recognition error - abort rule @@ -10992,10 +11158,10 @@ func (p *SPL1Parser) SearchMulOp() (localctx ISearchMulOpContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(580) + p.SetState(594) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&641015278993408) != 0) { + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1282030557986816) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -11104,7 +11270,7 @@ func (s *SignContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *SPL1Parser) Sign() (localctx ISignContext) { localctx = NewSignContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 94, SPL1ParserRULE_sign) - p.SetState(584) + p.SetState(598) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -11114,14 +11280,14 @@ func (p *SPL1Parser) Sign() (localctx ISignContext) { case SPL1ParserMINUS, SPL1ParserMINUS_TIGHT: p.EnterOuterAlt(localctx, 1) { - p.SetState(582) + p.SetState(596) p.Minus() } case SPL1ParserPLUS: p.EnterOuterAlt(localctx, 2) { - p.SetState(583) + p.SetState(597) p.Match(SPL1ParserPLUS) if p.HasError() { // Recognition error - abort rule @@ -11167,6 +11333,7 @@ type IIdentLikeContext interface { SORT() antlr.TerminalNode HEAD() antlr.TerminalNode BIN() antlr.TerminalNode + RENAME() antlr.TerminalNode BY() antlr.TerminalNode AS() antlr.TerminalNode SPAN() antlr.TerminalNode @@ -11261,6 +11428,10 @@ func (s *IdentLikeContext) BIN() antlr.TerminalNode { return s.GetToken(SPL1ParserBIN, 0) } +func (s *IdentLikeContext) RENAME() antlr.TerminalNode { + return s.GetToken(SPL1ParserRENAME, 0) +} + func (s *IdentLikeContext) BY() antlr.TerminalNode { return s.GetToken(SPL1ParserBY, 0) } @@ -11322,10 +11493,10 @@ func (p *SPL1Parser) IdentLike() (localctx IIdentLikeContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(586) + p.SetState(600) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1125899916279806) != 0) { + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2251799832559614) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -11366,6 +11537,7 @@ type IExprWordContext interface { SORT() antlr.TerminalNode HEAD() antlr.TerminalNode BIN() antlr.TerminalNode + RENAME() antlr.TerminalNode BY() antlr.TerminalNode AS() antlr.TerminalNode SPAN() antlr.TerminalNode @@ -11459,6 +11631,10 @@ func (s *ExprWordContext) BIN() antlr.TerminalNode { return s.GetToken(SPL1ParserBIN, 0) } +func (s *ExprWordContext) RENAME() antlr.TerminalNode { + return s.GetToken(SPL1ParserRENAME, 0) +} + func (s *ExprWordContext) BY() antlr.TerminalNode { return s.GetToken(SPL1ParserBY, 0) } @@ -11516,10 +11692,10 @@ func (p *SPL1Parser) ExprWord() (localctx IExprWordContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(588) + p.SetState(602) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1125899915755518) != 0) { + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2251799831511038) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -11663,10 +11839,10 @@ func (p *SPL1Parser) AggList() (localctx IAggListContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(590) + p.SetState(604) p.Agg() } - p.SetState(595) + p.SetState(609) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -11675,7 +11851,7 @@ func (p *SPL1Parser) AggList() (localctx IAggListContext) { for _la == SPL1ParserCOMMA { { - p.SetState(591) + p.SetState(605) p.Match(SPL1ParserCOMMA) if p.HasError() { // Recognition error - abort rule @@ -11683,11 +11859,11 @@ func (p *SPL1Parser) AggList() (localctx IAggListContext) { } } { - p.SetState(592) + p.SetState(606) p.Agg() } - p.SetState(597) + p.SetState(611) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -11839,10 +12015,10 @@ func (p *SPL1Parser) Agg() (localctx IAggContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(598) + p.SetState(612) p.IdentLike() } - p.SetState(604) + p.SetState(618) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -11851,19 +12027,19 @@ func (p *SPL1Parser) Agg() (localctx IAggContext) { if _la == SPL1ParserLPAREN { { - p.SetState(599) + p.SetState(613) p.Match(SPL1ParserLPAREN) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(601) + p.SetState(615) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 70, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 72, p.GetParserRuleContext()) == 1 { { - p.SetState(600) + p.SetState(614) p.ValueExpr() } @@ -11871,7 +12047,7 @@ func (p *SPL1Parser) Agg() (localctx IAggContext) { goto errorExit } { - p.SetState(603) + p.SetState(617) p.Match(SPL1ParserRPAREN) if p.HasError() { // Recognition error - abort rule @@ -11880,7 +12056,7 @@ func (p *SPL1Parser) Agg() (localctx IAggContext) { } } - p.SetState(607) + p.SetState(621) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -11889,7 +12065,7 @@ func (p *SPL1Parser) Agg() (localctx IAggContext) { if _la == SPL1ParserAS { { - p.SetState(606) + p.SetState(620) p.AliasClause() } @@ -12048,10 +12224,10 @@ func (p *SPL1Parser) AggListNotSpan() (localctx IAggListNotSpanContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(609) + p.SetState(623) p.AggNotSpan() } - p.SetState(614) + p.SetState(628) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -12060,7 +12236,7 @@ func (p *SPL1Parser) AggListNotSpan() (localctx IAggListNotSpanContext) { for _la == SPL1ParserCOMMA { { - p.SetState(610) + p.SetState(624) p.Match(SPL1ParserCOMMA) if p.HasError() { // Recognition error - abort rule @@ -12068,11 +12244,11 @@ func (p *SPL1Parser) AggListNotSpan() (localctx IAggListNotSpanContext) { } } { - p.SetState(611) + p.SetState(625) p.Agg() } - p.SetState(616) + p.SetState(630) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -12224,10 +12400,10 @@ func (p *SPL1Parser) AggNotSpan() (localctx IAggNotSpanContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(617) + p.SetState(631) p.IdentLikeNotSpan() } - p.SetState(623) + p.SetState(637) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -12236,19 +12412,19 @@ func (p *SPL1Parser) AggNotSpan() (localctx IAggNotSpanContext) { if _la == SPL1ParserLPAREN { { - p.SetState(618) + p.SetState(632) p.Match(SPL1ParserLPAREN) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(620) + p.SetState(634) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 74, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 76, p.GetParserRuleContext()) == 1 { { - p.SetState(619) + p.SetState(633) p.ValueExpr() } @@ -12256,7 +12432,7 @@ func (p *SPL1Parser) AggNotSpan() (localctx IAggNotSpanContext) { goto errorExit } { - p.SetState(622) + p.SetState(636) p.Match(SPL1ParserRPAREN) if p.HasError() { // Recognition error - abort rule @@ -12265,7 +12441,7 @@ func (p *SPL1Parser) AggNotSpan() (localctx IAggNotSpanContext) { } } - p.SetState(626) + p.SetState(640) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -12274,7 +12450,7 @@ func (p *SPL1Parser) AggNotSpan() (localctx IAggNotSpanContext) { if _la == SPL1ParserAS { { - p.SetState(625) + p.SetState(639) p.AliasClause() } @@ -12383,7 +12559,7 @@ func (p *SPL1Parser) AliasClause() (localctx IAliasClauseContext) { p.EnterRule(localctx, 108, SPL1ParserRULE_aliasClause) p.EnterOuterAlt(localctx, 1) { - p.SetState(628) + p.SetState(642) p.Match(SPL1ParserAS) if p.HasError() { // Recognition error - abort rule @@ -12391,7 +12567,7 @@ func (p *SPL1Parser) AliasClause() (localctx IAliasClauseContext) { } } { - p.SetState(629) + p.SetState(643) p.IdentLike() } @@ -12498,7 +12674,7 @@ func (p *SPL1Parser) ByClause() (localctx IByClauseContext) { p.EnterRule(localctx, 110, SPL1ParserRULE_byClause) p.EnterOuterAlt(localctx, 1) { - p.SetState(631) + p.SetState(645) p.Match(SPL1ParserBY) if p.HasError() { // Recognition error - abort rule @@ -12506,7 +12682,7 @@ func (p *SPL1Parser) ByClause() (localctx IByClauseContext) { } } { - p.SetState(632) + p.SetState(646) p.FieldExprList() } @@ -12718,31 +12894,31 @@ func (p *SPL1Parser) TimechartBody() (localctx ITimechartBodyContext) { p.EnterRule(localctx, 112, SPL1ParserRULE_timechartBody) var _la int - p.SetState(644) + p.SetState(658) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 79, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 81, p.GetParserRuleContext()) { case 1: localctx = NewTcSpanFirstContext(p, localctx) p.EnterOuterAlt(localctx, 1) - p.SetState(634) + p.SetState(648) if !(p.at(SPL1ParserSPAN)) { p.SetError(antlr.NewFailedPredicateException(p, "p.at(SPL1ParserSPAN)", "")) goto errorExit } { - p.SetState(635) + p.SetState(649) p.TimechartSpan() } { - p.SetState(636) + p.SetState(650) p.AggList() } - p.SetState(638) + p.SetState(652) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -12751,7 +12927,7 @@ func (p *SPL1Parser) TimechartBody() (localctx ITimechartBodyContext) { if _la == SPL1ParserBY { { - p.SetState(637) + p.SetState(651) p.ByClause() } @@ -12761,10 +12937,10 @@ func (p *SPL1Parser) TimechartBody() (localctx ITimechartBodyContext) { localctx = NewTcAggFirstContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(640) + p.SetState(654) p.AggListNotSpan() } - p.SetState(642) + p.SetState(656) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -12773,7 +12949,7 @@ func (p *SPL1Parser) TimechartBody() (localctx ITimechartBodyContext) { if _la == SPL1ParserBY { { - p.SetState(641) + p.SetState(655) p.ByClause() } @@ -12886,7 +13062,7 @@ func (p *SPL1Parser) TimechartSpan() (localctx ITimechartSpanContext) { p.EnterRule(localctx, 114, SPL1ParserRULE_timechartSpan) p.EnterOuterAlt(localctx, 1) { - p.SetState(646) + p.SetState(660) p.Match(SPL1ParserSPAN) if p.HasError() { // Recognition error - abort rule @@ -12894,7 +13070,7 @@ func (p *SPL1Parser) TimechartSpan() (localctx ITimechartSpanContext) { } } { - p.SetState(647) + p.SetState(661) p.SpanAssign() } @@ -13001,7 +13177,7 @@ func (p *SPL1Parser) SpanAssign() (localctx ISpanAssignContext) { p.EnterRule(localctx, 116, SPL1ParserRULE_spanAssign) p.EnterOuterAlt(localctx, 1) { - p.SetState(649) + p.SetState(663) p.Match(SPL1ParserEQ) if p.HasError() { // Recognition error - abort rule @@ -13009,7 +13185,7 @@ func (p *SPL1Parser) SpanAssign() (localctx ISpanAssignContext) { } } { - p.SetState(650) + p.SetState(664) p.SpanValue() } @@ -13120,14 +13296,14 @@ func (p *SPL1Parser) RexField() (localctx IRexFieldContext) { localctx = NewRexFieldContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 118, SPL1ParserRULE_rexField) p.EnterOuterAlt(localctx, 1) - p.SetState(652) + p.SetState(666) if !(p.at(SPL1ParserFIELD)) { p.SetError(antlr.NewFailedPredicateException(p, "p.at(SPL1ParserFIELD)", "")) goto errorExit } { - p.SetState(653) + p.SetState(667) p.Match(SPL1ParserFIELD) if p.HasError() { // Recognition error - abort rule @@ -13135,7 +13311,7 @@ func (p *SPL1Parser) RexField() (localctx IRexFieldContext) { } } { - p.SetState(654) + p.SetState(668) p.Match(SPL1ParserEQ) if p.HasError() { // Recognition error - abort rule @@ -13143,7 +13319,7 @@ func (p *SPL1Parser) RexField() (localctx IRexFieldContext) { } } { - p.SetState(655) + p.SetState(669) p.IdentLike() } @@ -13283,18 +13459,18 @@ func (p *SPL1Parser) FieldExprList() (localctx IFieldExprListContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(657) + p.SetState(671) p.FieldExpr() } - p.SetState(663) + p.SetState(677) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2041801692151806) != 0 { - p.SetState(661) + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4083603384303614) != 0 { + p.SetState(675) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -13303,7 +13479,7 @@ func (p *SPL1Parser) FieldExprList() (localctx IFieldExprListContext) { switch p.GetTokenStream().LA(1) { case SPL1ParserCOMMA: { - p.SetState(658) + p.SetState(672) p.Match(SPL1ParserCOMMA) if p.HasError() { // Recognition error - abort rule @@ -13311,13 +13487,13 @@ func (p *SPL1Parser) FieldExprList() (localctx IFieldExprListContext) { } } { - p.SetState(659) + p.SetState(673) p.FieldExpr() } - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserSTAR, SPL1ParserSTAR_TIGHT, SPL1ParserSTAR_TERM, SPL1ParserSTAR_OP, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserSTAR, SPL1ParserSTAR_TIGHT, SPL1ParserSTAR_TERM, SPL1ParserSTAR_OP, SPL1ParserNOT_WORD: { - p.SetState(660) + p.SetState(674) p.FieldExpr() } @@ -13326,7 +13502,7 @@ func (p *SPL1Parser) FieldExprList() (localctx IFieldExprListContext) { goto errorExit } - p.SetState(665) + p.SetState(679) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -13447,24 +13623,24 @@ func (s *FieldExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *SPL1Parser) FieldExpr() (localctx IFieldExprContext) { localctx = NewFieldExprContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 122, SPL1ParserRULE_fieldExpr) - p.SetState(668) + p.SetState(682) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } switch p.GetTokenStream().LA(1) { - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: p.EnterOuterAlt(localctx, 1) { - p.SetState(666) + p.SetState(680) p.IdentLike() } case SPL1ParserSTAR, SPL1ParserSTAR_TIGHT, SPL1ParserSTAR_TERM, SPL1ParserSTAR_OP: p.EnterOuterAlt(localctx, 2) { - p.SetState(667) + p.SetState(681) p.Star() } @@ -13593,11 +13769,11 @@ func (p *SPL1Parser) Assignment() (localctx IAssignmentContext) { p.EnterRule(localctx, 124, SPL1ParserRULE_assignment) p.EnterOuterAlt(localctx, 1) { - p.SetState(670) + p.SetState(684) p.IdentLike() } { - p.SetState(671) + p.SetState(685) p.Match(SPL1ParserEQ) if p.HasError() { // Recognition error - abort rule @@ -13605,7 +13781,7 @@ func (p *SPL1Parser) Assignment() (localctx IAssignmentContext) { } } { - p.SetState(672) + p.SetState(686) p.ValueExpr() } @@ -13710,7 +13886,7 @@ func (s *SpanValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *SPL1Parser) SpanValue() (localctx ISpanValueContext) { localctx = NewSpanValueContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 126, SPL1ParserRULE_spanValue) - p.SetState(676) + p.SetState(690) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -13720,7 +13896,7 @@ func (p *SPL1Parser) SpanValue() (localctx ISpanValueContext) { case SPL1ParserDURATION: p.EnterOuterAlt(localctx, 1) { - p.SetState(674) + p.SetState(688) p.Match(SPL1ParserDURATION) if p.HasError() { // Recognition error - abort rule @@ -13728,10 +13904,10 @@ func (p *SPL1Parser) SpanValue() (localctx ISpanValueContext) { } } - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: p.EnterOuterAlt(localctx, 2) { - p.SetState(675) + p.SetState(689) p.IdentLike() } @@ -13858,7 +14034,7 @@ func (s *TableItemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *SPL1Parser) TableItem() (localctx ITableItemContext) { localctx = NewTableItemContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 128, SPL1ParserRULE_tableItem) - p.SetState(681) + p.SetState(695) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -13868,7 +14044,7 @@ func (p *SPL1Parser) TableItem() (localctx ITableItemContext) { case SPL1ParserCOMMA: p.EnterOuterAlt(localctx, 1) { - p.SetState(678) + p.SetState(692) p.Match(SPL1ParserCOMMA) if p.HasError() { // Recognition error - abort rule @@ -13879,14 +14055,14 @@ func (p *SPL1Parser) TableItem() (localctx ITableItemContext) { case SPL1ParserSTAR, SPL1ParserSTAR_TIGHT, SPL1ParserSTAR_TERM, SPL1ParserSTAR_OP: p.EnterOuterAlt(localctx, 2) { - p.SetState(679) + p.SetState(693) p.Star() } - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: p.EnterOuterAlt(localctx, 3) { - p.SetState(680) + p.SetState(694) p.IdentLike() } @@ -13996,7 +14172,7 @@ func (s *FieldsSignContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *SPL1Parser) FieldsSign() (localctx IFieldsSignContext) { localctx = NewFieldsSignContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 130, SPL1ParserRULE_fieldsSign) - p.SetState(685) + p.SetState(699) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -14006,14 +14182,14 @@ func (p *SPL1Parser) FieldsSign() (localctx IFieldsSignContext) { case SPL1ParserMINUS, SPL1ParserMINUS_TIGHT: p.EnterOuterAlt(localctx, 1) { - p.SetState(683) + p.SetState(697) p.Minus() } case SPL1ParserPLUS: p.EnterOuterAlt(localctx, 2) { - p.SetState(684) + p.SetState(698) p.Match(SPL1ParserPLUS) if p.HasError() { // Recognition error - abort rule @@ -14127,7 +14303,7 @@ func (s *FieldsItemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *SPL1Parser) FieldsItem() (localctx IFieldsItemContext) { localctx = NewFieldsItemContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 132, SPL1ParserRULE_fieldsItem) - p.SetState(689) + p.SetState(703) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -14137,7 +14313,7 @@ func (p *SPL1Parser) FieldsItem() (localctx IFieldsItemContext) { case SPL1ParserCOMMA: p.EnterOuterAlt(localctx, 1) { - p.SetState(687) + p.SetState(701) p.Match(SPL1ParserCOMMA) if p.HasError() { // Recognition error - abort rule @@ -14145,10 +14321,10 @@ func (p *SPL1Parser) FieldsItem() (localctx IFieldsItemContext) { } } - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: p.EnterOuterAlt(localctx, 2) { - p.SetState(688) + p.SetState(702) p.IdentLike() } @@ -14427,34 +14603,34 @@ func (p *SPL1Parser) SortBody() (localctx ISortBodyContext) { p.EnterRule(localctx, 134, SPL1ParserRULE_sortBody) var _la int - p.SetState(706) + p.SetState(720) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 89, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 91, p.GetParserRuleContext()) { case 1: localctx = NewSortLimitContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(691) + p.SetState(705) p.LimitArg() } - p.SetState(695) + p.SetState(709) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1267470628290558) != 0 { + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2534941256581118) != 0 { { - p.SetState(692) + p.SetState(706) p.SortItem() } - p.SetState(697) + p.SetState(711) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -14466,23 +14642,23 @@ func (p *SPL1Parser) SortBody() (localctx ISortBodyContext) { localctx = NewSortFirstFieldContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(698) + p.SetState(712) p.SortFirstItem() } - p.SetState(702) + p.SetState(716) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1267470628290558) != 0 { + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2534941256581118) != 0 { { - p.SetState(699) + p.SetState(713) p.SortItem() } - p.SetState(704) + p.SetState(718) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -14618,7 +14794,7 @@ func (p *SPL1Parser) SortItem() (localctx ISortItemContext) { p.EnterRule(localctx, 136, SPL1ParserRULE_sortItem) var _la int - p.SetState(713) + p.SetState(727) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -14628,7 +14804,7 @@ func (p *SPL1Parser) SortItem() (localctx ISortItemContext) { case SPL1ParserCOMMA: p.EnterOuterAlt(localctx, 1) { - p.SetState(708) + p.SetState(722) p.Match(SPL1ParserCOMMA) if p.HasError() { // Recognition error - abort rule @@ -14636,24 +14812,24 @@ func (p *SPL1Parser) SortItem() (localctx ISortItemContext) { } } - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserPLUS, SPL1ParserMINUS, SPL1ParserMINUS_TIGHT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserPLUS, SPL1ParserMINUS, SPL1ParserMINUS_TIGHT, SPL1ParserNOT_WORD: p.EnterOuterAlt(localctx, 2) - p.SetState(710) + p.SetState(724) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&141562122076160) != 0 { + if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&283124244152320) != 0 { { - p.SetState(709) + p.SetState(723) p.Sign() } } { - p.SetState(712) + p.SetState(726) p.IdentLike() } @@ -14797,7 +14973,7 @@ func (s *SortFirstItemContext) Accept(visitor antlr.ParseTreeVisitor) interface{ func (p *SPL1Parser) SortFirstItem() (localctx ISortFirstItemContext) { localctx = NewSortFirstItemContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 138, SPL1ParserRULE_sortFirstItem) - p.SetState(720) + p.SetState(734) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -14807,7 +14983,7 @@ func (p *SPL1Parser) SortFirstItem() (localctx ISortFirstItemContext) { case SPL1ParserCOMMA: p.EnterOuterAlt(localctx, 1) { - p.SetState(715) + p.SetState(729) p.Match(SPL1ParserCOMMA) if p.HasError() { // Recognition error - abort rule @@ -14818,18 +14994,18 @@ func (p *SPL1Parser) SortFirstItem() (localctx ISortFirstItemContext) { case SPL1ParserPLUS, SPL1ParserMINUS, SPL1ParserMINUS_TIGHT: p.EnterOuterAlt(localctx, 2) { - p.SetState(716) + p.SetState(730) p.Sign() } { - p.SetState(717) + p.SetState(731) p.IdentLike() } - case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: p.EnterOuterAlt(localctx, 3) { - p.SetState(719) + p.SetState(733) p.SortField() } @@ -14936,7 +15112,7 @@ func (p *SPL1Parser) SortField() (localctx ISortFieldContext) { p.EnterRule(localctx, 140, SPL1ParserRULE_sortField) p.EnterOuterAlt(localctx, 1) { - p.SetState(722) + p.SetState(736) p.IdentLikeNotLimit() } @@ -15102,24 +15278,24 @@ func (s *LimitKeywordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} func (p *SPL1Parser) LimitArg() (localctx ILimitArgContext) { localctx = NewLimitArgContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 142, SPL1ParserRULE_limitArg) - p.SetState(728) + p.SetState(742) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 93, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 95, p.GetParserRuleContext()) { case 1: localctx = NewLimitKeywordContext(p, localctx) p.EnterOuterAlt(localctx, 1) - p.SetState(724) + p.SetState(738) if !(p.at(SPL1ParserLIMIT)) { p.SetError(antlr.NewFailedPredicateException(p, "p.at(SPL1ParserLIMIT)", "")) goto errorExit } { - p.SetState(725) + p.SetState(739) p.Match(SPL1ParserLIMIT) if p.HasError() { // Recognition error - abort rule @@ -15127,7 +15303,7 @@ func (p *SPL1Parser) LimitArg() (localctx ILimitArgContext) { } } { - p.SetState(726) + p.SetState(740) p.LimitTail() } @@ -15135,7 +15311,7 @@ func (p *SPL1Parser) LimitArg() (localctx ILimitArgContext) { localctx = NewLimitNumberContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(727) + p.SetState(741) p.Number() } @@ -15246,7 +15422,7 @@ func (p *SPL1Parser) LimitTail() (localctx ILimitTailContext) { p.EnterRule(localctx, 144, SPL1ParserRULE_limitTail) p.EnterOuterAlt(localctx, 1) { - p.SetState(730) + p.SetState(744) p.Match(SPL1ParserEQ) if p.HasError() { // Recognition error - abort rule @@ -15254,7 +15430,7 @@ func (p *SPL1Parser) LimitTail() (localctx ILimitTailContext) { } } { - p.SetState(731) + p.SetState(745) p.Number() } @@ -15420,24 +15596,24 @@ func (s *BinSpanItemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} func (p *SPL1Parser) BinItem() (localctx IBinItemContext) { localctx = NewBinItemContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 146, SPL1ParserRULE_binItem) - p.SetState(739) + p.SetState(753) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 94, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 96, p.GetParserRuleContext()) { case 1: localctx = NewBinSpanItemContext(p, localctx) p.EnterOuterAlt(localctx, 1) - p.SetState(733) + p.SetState(747) if !(p.at(SPL1ParserSPAN)) { p.SetError(antlr.NewFailedPredicateException(p, "p.at(SPL1ParserSPAN)", "")) goto errorExit } { - p.SetState(734) + p.SetState(748) p.Match(SPL1ParserSPAN) if p.HasError() { // Recognition error - abort rule @@ -15445,7 +15621,7 @@ func (p *SPL1Parser) BinItem() (localctx IBinItemContext) { } } { - p.SetState(735) + p.SetState(749) p.SpanAssign() } @@ -15453,7 +15629,7 @@ func (p *SPL1Parser) BinItem() (localctx IBinItemContext) { localctx = NewBinFieldItemContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(736) + p.SetState(750) p.BinField() } p.binFieldSeen() @@ -15475,6 +15651,423 @@ errorExit: goto errorExit // Trick to prevent compiler error if the label is not used } +// IRenamePairContext is an interface to support dynamic dispatch. +type IRenamePairContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllRenameField() []IRenameFieldContext + RenameField(i int) IRenameFieldContext + AS() antlr.TerminalNode + + // IsRenamePairContext differentiates from other interfaces. + IsRenamePairContext() +} + +type RenamePairContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRenamePairContext() *RenamePairContext { + var p = new(RenamePairContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SPL1ParserRULE_renamePair + return p +} + +func InitEmptyRenamePairContext(p *RenamePairContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SPL1ParserRULE_renamePair +} + +func (*RenamePairContext) IsRenamePairContext() {} + +func NewRenamePairContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RenamePairContext { + var p = new(RenamePairContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = SPL1ParserRULE_renamePair + + return p +} + +func (s *RenamePairContext) GetParser() antlr.Parser { return s.parser } + +func (s *RenamePairContext) AllRenameField() []IRenameFieldContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRenameFieldContext); ok { + len++ + } + } + + tst := make([]IRenameFieldContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRenameFieldContext); ok { + tst[i] = t.(IRenameFieldContext) + i++ + } + } + + return tst +} + +func (s *RenamePairContext) RenameField(i int) IRenameFieldContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRenameFieldContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRenameFieldContext) +} + +func (s *RenamePairContext) AS() antlr.TerminalNode { + return s.GetToken(SPL1ParserAS, 0) +} + +func (s *RenamePairContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RenamePairContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RenamePairContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case SPL1Visitor: + return t.VisitRenamePair(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *SPL1Parser) RenamePair() (localctx IRenamePairContext) { + localctx = NewRenamePairContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 148, SPL1ParserRULE_renamePair) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(755) + p.RenameField() + } + { + p.SetState(756) + p.Match(SPL1ParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(757) + p.RenameField() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRenameFieldContext is an interface to support dynamic dispatch. +type IRenameFieldContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IdentLike() IIdentLikeContext + Star() IStarContext + STAR_TIGHT() antlr.TerminalNode + Number() INumberContext + STAR() antlr.TerminalNode + STAR_OP() antlr.TerminalNode + STRING() antlr.TerminalNode + + // IsRenameFieldContext differentiates from other interfaces. + IsRenameFieldContext() +} + +type RenameFieldContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRenameFieldContext() *RenameFieldContext { + var p = new(RenameFieldContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SPL1ParserRULE_renameField + return p +} + +func InitEmptyRenameFieldContext(p *RenameFieldContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SPL1ParserRULE_renameField +} + +func (*RenameFieldContext) IsRenameFieldContext() {} + +func NewRenameFieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RenameFieldContext { + var p = new(RenameFieldContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = SPL1ParserRULE_renameField + + return p +} + +func (s *RenameFieldContext) GetParser() antlr.Parser { return s.parser } + +func (s *RenameFieldContext) IdentLike() IIdentLikeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentLikeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentLikeContext) +} + +func (s *RenameFieldContext) Star() IStarContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStarContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStarContext) +} + +func (s *RenameFieldContext) STAR_TIGHT() antlr.TerminalNode { + return s.GetToken(SPL1ParserSTAR_TIGHT, 0) +} + +func (s *RenameFieldContext) Number() INumberContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumberContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumberContext) +} + +func (s *RenameFieldContext) STAR() antlr.TerminalNode { + return s.GetToken(SPL1ParserSTAR, 0) +} + +func (s *RenameFieldContext) STAR_OP() antlr.TerminalNode { + return s.GetToken(SPL1ParserSTAR_OP, 0) +} + +func (s *RenameFieldContext) STRING() antlr.TerminalNode { + return s.GetToken(SPL1ParserSTRING, 0) +} + +func (s *RenameFieldContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RenameFieldContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RenameFieldContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case SPL1Visitor: + return t.VisitRenameField(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *SPL1Parser) RenameField() (localctx IRenameFieldContext) { + localctx = NewRenameFieldContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 150, SPL1ParserRULE_renameField) + p.SetState(776) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(759) + p.IdentLike() + } + p.SetState(762) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 97, p.GetParserRuleContext()) == 1 { + p.SetState(760) + + if !(p.touchingPrev()) { + p.SetError(antlr.NewFailedPredicateException(p, "p.touchingPrev()", "")) + goto errorExit + } + { + p.SetState(761) + p.Star() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case SPL1ParserSTAR_TIGHT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(764) + p.Match(SPL1ParserSTAR_TIGHT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(767) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, SPL1ParserIDENT, SPL1ParserNOT_WORD: + { + p.SetState(765) + p.IdentLike() + } + + case SPL1ParserNUMBER, SPL1ParserNUMBER_TIGHT: + { + p.SetState(766) + p.Number() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + p.SetState(771) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 99, p.GetParserRuleContext()) == 1 { + p.SetState(769) + + if !(p.touchingPrev()) { + p.SetError(antlr.NewFailedPredicateException(p, "p.touchingPrev()", "")) + goto errorExit + } + { + p.SetState(770) + p.Star() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case SPL1ParserSTAR: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(773) + p.Match(SPL1ParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case SPL1ParserSTAR_OP: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(774) + p.Match(SPL1ParserSTAR_OP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case SPL1ParserSTRING: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(775) + p.Match(SPL1ParserSTRING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + // IBinFieldContext is an interface to support dynamic dispatch. type IBinFieldContext interface { antlr.ParserRuleContext @@ -15557,10 +16150,10 @@ func (s *BinFieldContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *SPL1Parser) BinField() (localctx IBinFieldContext) { localctx = NewBinFieldContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 148, SPL1ParserRULE_binField) + p.EnterRule(localctx, 152, SPL1ParserRULE_binField) p.EnterOuterAlt(localctx, 1) { - p.SetState(741) + p.SetState(778) p.IdentLikeNotSpan() } @@ -15597,6 +16190,7 @@ type IIdentLikeNotSpanContext interface { SORT() antlr.TerminalNode HEAD() antlr.TerminalNode BIN() antlr.TerminalNode + RENAME() antlr.TerminalNode BY() antlr.TerminalNode AS() antlr.TerminalNode LIMIT() antlr.TerminalNode @@ -15689,6 +16283,10 @@ func (s *IdentLikeNotSpanContext) BIN() antlr.TerminalNode { return s.GetToken(SPL1ParserBIN, 0) } +func (s *IdentLikeNotSpanContext) RENAME() antlr.TerminalNode { + return s.GetToken(SPL1ParserRENAME, 0) +} + func (s *IdentLikeNotSpanContext) BY() antlr.TerminalNode { return s.GetToken(SPL1ParserBY, 0) } @@ -15737,15 +16335,15 @@ func (s *IdentLikeNotSpanContext) Accept(visitor antlr.ParseTreeVisitor) interfa func (p *SPL1Parser) IdentLikeNotSpan() (localctx IIdentLikeNotSpanContext) { localctx = NewIdentLikeNotSpanContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 150, SPL1ParserRULE_identLikeNotSpan) + p.EnterRule(localctx, 154, SPL1ParserRULE_identLikeNotSpan) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(743) + p.SetState(780) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&9420798) != 0) { + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&18841598) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -15786,6 +16384,7 @@ type IIdentLikeNotLimitContext interface { SORT() antlr.TerminalNode HEAD() antlr.TerminalNode BIN() antlr.TerminalNode + RENAME() antlr.TerminalNode BY() antlr.TerminalNode AS() antlr.TerminalNode SPAN() antlr.TerminalNode @@ -15879,6 +16478,10 @@ func (s *IdentLikeNotLimitContext) BIN() antlr.TerminalNode { return s.GetToken(SPL1ParserBIN, 0) } +func (s *IdentLikeNotLimitContext) RENAME() antlr.TerminalNode { + return s.GetToken(SPL1ParserRENAME, 0) +} + func (s *IdentLikeNotLimitContext) BY() antlr.TerminalNode { return s.GetToken(SPL1ParserBY, 0) } @@ -15931,15 +16534,15 @@ func (s *IdentLikeNotLimitContext) Accept(visitor antlr.ParseTreeVisitor) interf func (p *SPL1Parser) IdentLikeNotLimit() (localctx IIdentLikeNotLimitContext) { localctx = NewIdentLikeNotLimitContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 152, SPL1ParserRULE_identLikeNotLimit) + p.EnterRule(localctx, 156, SPL1ParserRULE_identLikeNotLimit) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(745) + p.SetState(782) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1125899916247038) != 0) { + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2251799832494078) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -16088,6 +16691,13 @@ func (p *SPL1Parser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex in } return p.BinItem_Sempred(t, predIndex) + case 75: + var t *RenameFieldContext = nil + if localctx != nil { + t = localctx.(*RenameFieldContext) + } + return p.RenameField_Sempred(t, predIndex) + default: panic("No predicate with index: " + fmt.Sprint(ruleIndex)) } @@ -16293,3 +16903,16 @@ func (p *SPL1Parser) BinItem_Sempred(localctx antlr.RuleContext, predIndex int) panic("No predicate with index: " + fmt.Sprint(predIndex)) } } + +func (p *SPL1Parser) RenameField_Sempred(localctx antlr.RuleContext, predIndex int) bool { + switch predIndex { + case 25: + return p.touchingPrev() + + case 26: + return p.touchingPrev() + + default: + panic("No predicate with index: " + fmt.Sprint(predIndex)) + } +} diff --git a/pkg/parser/spl1/gen/spl1_visitor.go b/pkg/parser/spl1/gen/spl1_visitor.go index e448f61..baa5ff5 100644 --- a/pkg/parser/spl1/gen/spl1_visitor.go +++ b/pkg/parser/spl1/gen/spl1_visitor.go @@ -49,6 +49,9 @@ type SPL1Visitor interface { // Visit a parse tree produced by SPL1Parser#CmdBin. VisitCmdBin(ctx *CmdBinContext) interface{} + // Visit a parse tree produced by SPL1Parser#CmdRename. + VisitCmdRename(ctx *CmdRenameContext) interface{} + // Visit a parse tree produced by SPL1Parser#searchExpr. VisitSearchExpr(ctx *SearchExprContext) interface{} @@ -340,6 +343,12 @@ type SPL1Visitor interface { // Visit a parse tree produced by SPL1Parser#BinFieldItem. VisitBinFieldItem(ctx *BinFieldItemContext) interface{} + // Visit a parse tree produced by SPL1Parser#renamePair. + VisitRenamePair(ctx *RenamePairContext) interface{} + + // Visit a parse tree produced by SPL1Parser#renameField. + VisitRenameField(ctx *RenameFieldContext) interface{} + // Visit a parse tree produced by SPL1Parser#binField. VisitBinField(ctx *BinFieldContext) interface{} diff --git a/pkg/parser/spl1/grammar/SPL1.g4 b/pkg/parser/spl1/grammar/SPL1.g4 index b085eff..3087948 100644 --- a/pkg/parser/spl1/grammar/SPL1.g4 +++ b/pkg/parser/spl1/grammar/SPL1.g4 @@ -55,9 +55,9 @@ func (p *SPL1Parser) isIdentLike(t int) bool { case SPL1ParserIDENT, SPL1ParserSEARCH, SPL1ParserWHERE, SPL1ParserSTATS, SPL1ParserTIMECHART, SPL1ParserEVAL, SPL1ParserREX, SPL1ParserTABLE, SPL1ParserFIELDS, SPL1ParserSORT, SPL1ParserHEAD, SPL1ParserBIN, - SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, SPL1ParserLIMIT, - SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, SPL1ParserNOT, - SPL1ParserNOT_WORD: + SPL1ParserRENAME, SPL1ParserBY, SPL1ParserAS, SPL1ParserSPAN, + SPL1ParserLIMIT, SPL1ParserFIELD, SPL1ParserAND, SPL1ParserOR, + SPL1ParserNOT, SPL1ParserNOT_WORD: return true } return false @@ -282,6 +282,7 @@ command | SORT sortBody #CmdSort | HEAD limitArg? #CmdHead | BIN binItem* #CmdBin + | RENAME renamePair (COMMA renamePair | renamePair)* #CmdRename ; // Every operator rule below is gated on its own token type. Without the gate, @@ -526,8 +527,8 @@ sign : minus | PLUS ; identLike : IDENT | SEARCH | WHERE | STATS | TIMECHART | EVAL | REX | TABLE | FIELDS - | SORT | HEAD | BIN | BY | AS | SPAN | LIMIT | FIELD | AND | OR | NOT - | NOT_WORD + | SORT | HEAD | BIN | RENAME | BY | AS | SPAN | LIMIT | FIELD | AND | OR + | NOT | NOT_WORD ; // exprWord is identLike where a bare `not` cannot start an expression: there @@ -535,7 +536,8 @@ identLike // follows an operator as NOT_WORD so it stays available as a field name. exprWord : IDENT | SEARCH | WHERE | STATS | TIMECHART | EVAL | REX | TABLE | FIELDS - | SORT | HEAD | BIN | BY | AS | SPAN | LIMIT | FIELD | AND | OR | NOT_WORD + | SORT | HEAD | BIN | RENAME | BY | AS | SPAN | LIMIT | FIELD | AND | OR + | NOT_WORD ; aggList @@ -654,6 +656,29 @@ binItem | binField {p.binFieldSeen()} #BinFieldItem ; +renamePair + : renameField AS renameField + ; + +// A field name, optionally ending in one tight wildcard (`EU*`). A leading +// wildcard (`*foo`, `*`) is also a field pattern in Splunk, so it is accepted +// here and refused by the emitter, which keeps every wildcard refusal on one +// code. A quoted name may contain spaces; the builder decodes it. A wildcard +// is only recognised when it touches the name, so `rename a * as b` stays a +// syntax error. +// +// The leading-wildcard alternative starts on STAR_TIGHT because the driver +// retypes a star that touches a following word, so it has a first token of its +// own; a bare star is the plain or operator spelling. SLL prediction therefore +// never has to choose between alternatives that share a first token. +renameField + : identLike ({p.touchingPrev()}? star)? + | STAR_TIGHT (identLike | number) ({p.touchingPrev()}? star)? + | STAR + | STAR_OP + | STRING + ; + // `span` is always the keyword inside `bin`, so it is not a field name here. binField : identLikeNotSpan @@ -662,13 +687,14 @@ binField // `span` excluded: `bin span` starts a span assignment, never a field. identLikeNotSpan : IDENT | SEARCH | WHERE | STATS | TIMECHART | EVAL | REX | TABLE | FIELDS - | SORT | HEAD | BIN | BY | AS | LIMIT | FIELD | AND | OR | NOT + | SORT | HEAD | BIN | RENAME | BY | AS | LIMIT | FIELD | AND | OR | NOT ; // `limit` excluded: `sort limit` starts the limit argument, never a field. identLikeNotLimit : IDENT | SEARCH | WHERE | STATS | TIMECHART | EVAL | REX | TABLE | FIELDS - | SORT | HEAD | BIN | BY | AS | SPAN | FIELD | AND | OR | NOT | NOT_WORD + | SORT | HEAD | BIN | RENAME | BY | AS | SPAN | FIELD | AND | OR | NOT + | NOT_WORD ; // --- lexer --------------------------------------------------------------- @@ -686,6 +712,7 @@ FIELDS : [fF][iI][eE][lL][dD][sS] ; SORT : [sS][oO][rR][tT] ; HEAD : [hH][eE][aA][dD] ; BIN : [bB][iI][nN] ; +RENAME : [rR][eE][nN][aA][mM][eE] ; BY : [bB][yY] ; AS : [aA][sS] ; SPAN : [sS][pP][aA][nN] ; diff --git a/pkg/parser/spl1/lexer.go b/pkg/parser/spl1/lexer.go index 3fb524e..d4026cc 100644 --- a/pkg/parser/spl1/lexer.go +++ b/pkg/parser/spl1/lexer.go @@ -231,8 +231,9 @@ func convertToken(m *antlrpos.SourceMap, t antlr.Token) (Token, error) { spl1gen.SPL1ParserSEARCH, spl1gen.SPL1ParserWHERE, spl1gen.SPL1ParserSTATS, spl1gen.SPL1ParserTIMECHART, spl1gen.SPL1ParserEVAL, spl1gen.SPL1ParserREX, spl1gen.SPL1ParserTABLE, spl1gen.SPL1ParserFIELDS, spl1gen.SPL1ParserSORT, - spl1gen.SPL1ParserHEAD, spl1gen.SPL1ParserBIN, spl1gen.SPL1ParserBY, - spl1gen.SPL1ParserAS, spl1gen.SPL1ParserSPAN, spl1gen.SPL1ParserLIMIT, + spl1gen.SPL1ParserHEAD, spl1gen.SPL1ParserBIN, spl1gen.SPL1ParserRENAME, + spl1gen.SPL1ParserBY, spl1gen.SPL1ParserAS, spl1gen.SPL1ParserSPAN, + spl1gen.SPL1ParserLIMIT, spl1gen.SPL1ParserFIELD, spl1gen.SPL1ParserAND, spl1gen.SPL1ParserOR, spl1gen.SPL1ParserNOT: return Token{Kind: Ident, Text: t.GetText(), Pos: pos}, nil diff --git a/pkg/parser/spl1/parse.go b/pkg/parser/spl1/parse.go index afa7b4b..bd5320b 100644 --- a/pkg/parser/spl1/parse.go +++ b/pkg/parser/spl1/parse.go @@ -122,9 +122,10 @@ func isIdentLikeToken(t int) bool { spl1gen.SPL1ParserSTATS, spl1gen.SPL1ParserTIMECHART, spl1gen.SPL1ParserEVAL, spl1gen.SPL1ParserREX, spl1gen.SPL1ParserTABLE, spl1gen.SPL1ParserFIELDS, spl1gen.SPL1ParserSORT, spl1gen.SPL1ParserHEAD, spl1gen.SPL1ParserBIN, - spl1gen.SPL1ParserBY, spl1gen.SPL1ParserAS, spl1gen.SPL1ParserSPAN, - spl1gen.SPL1ParserLIMIT, spl1gen.SPL1ParserFIELD, spl1gen.SPL1ParserAND, - spl1gen.SPL1ParserOR, spl1gen.SPL1ParserNOT, spl1gen.SPL1ParserNOT_WORD: + spl1gen.SPL1ParserRENAME, spl1gen.SPL1ParserBY, spl1gen.SPL1ParserAS, + spl1gen.SPL1ParserSPAN, spl1gen.SPL1ParserLIMIT, spl1gen.SPL1ParserFIELD, + spl1gen.SPL1ParserAND, spl1gen.SPL1ParserOR, spl1gen.SPL1ParserNOT, + spl1gen.SPL1ParserNOT_WORD: return true } return false diff --git a/pkg/parser/spl1/parser_test.go b/pkg/parser/spl1/parser_test.go index d06d43c..ca08e24 100644 --- a/pkg/parser/spl1/parser_test.go +++ b/pkg/parser/spl1/parser_test.go @@ -33,6 +33,7 @@ func TestParseStageKinds(t *testing.T) { {"fields exclude", `index=web | fields - _raw`, []string{"search", "fields"}}, {"sort and head", `index=web | sort limit=10 -bytes | head 5`, []string{"search", "sort", "head"}}, {"bin", `index=web | bin span=1h _time`, []string{"search", "bin"}}, + {"rename", `index=web | rename host as dest`, []string{"search", "rename"}}, {"leading pipe", `| stats count`, []string{"stats"}}, } @@ -842,6 +843,136 @@ func TestSortSignOnAKeywordField(t *testing.T) { } } +// TestRename pins the lowered rename stage: every pair keeps both field +// spellings and both token positions, quoted names are decoded, and a tight +// wildcard stays part of the name for the emitter to refuse. +func TestRename(t *testing.T) { + tests := []struct { + name string + src string + want []ast.Rename + }{ + { + name: "one pair", + src: `index=web | rename host as dest`, + want: []ast.Rename{{ + From: "host", FromPos: ast.Pos{Line: 1, Col: 20, Offset: 19}, + To: "dest", ToPos: ast.Pos{Line: 1, Col: 28, Offset: 27}, + }}, + }, + { + name: "two pairs", + src: `index=web | rename a as b, c as d`, + want: []ast.Rename{ + {From: "a", FromPos: ast.Pos{Line: 1, Col: 20, Offset: 19}, To: "b", ToPos: ast.Pos{Line: 1, Col: 25, Offset: 24}}, + {From: "c", FromPos: ast.Pos{Line: 1, Col: 28, Offset: 27}, To: "d", ToPos: ast.Pos{Line: 1, Col: 33, Offset: 32}}, + }, + }, + { + name: "quoted name with a space", + src: `index=web | rename "user agent" as ua`, + want: []ast.Rename{{ + From: "user agent", FromPos: ast.Pos{Line: 1, Col: 20, Offset: 19}, + To: "ua", ToPos: ast.Pos{Line: 1, Col: 36, Offset: 35}, + }}, + }, + { + name: "tight wildcards stay in the name", + src: `index=web | rename EU* as EMEA*`, + want: []ast.Rename{{ + From: "EU*", FromPos: ast.Pos{Line: 1, Col: 20, Offset: 19}, + To: "EMEA*", ToPos: ast.Pos{Line: 1, Col: 27, Offset: 26}, + }}, + }, + { + name: "leading wildcard", + src: `index=web | rename *foo as bar`, + want: []ast.Rename{{ + From: "*foo", FromPos: ast.Pos{Line: 1, Col: 20, Offset: 19}, + To: "bar", ToPos: ast.Pos{Line: 1, Col: 28, Offset: 27}, + }}, + }, + { + name: "wildcard target", + src: `index=web | rename properties.* as *`, + want: []ast.Rename{{ + From: "properties.*", FromPos: ast.Pos{Line: 1, Col: 20, Offset: 19}, + To: "*", ToPos: ast.Pos{Line: 1, Col: 36, Offset: 35}, + }}, + }, + { + name: "same name on both sides", + src: `index=web | rename a as a`, + want: []ast.Rename{{ + From: "a", FromPos: ast.Pos{Line: 1, Col: 20, Offset: 19}, + To: "a", ToPos: ast.Pos{Line: 1, Col: 25, Offset: 24}, + }}, + }, + { + name: "keywords as field names", + src: `index=web | rename where as search`, + want: []ast.Rename{{ + From: "where", FromPos: ast.Pos{Line: 1, Col: 20, Offset: 19}, + To: "search", ToPos: ast.Pos{Line: 1, Col: 29, Offset: 28}, + }}, + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + p := mustParse(t, tc.src) + s, ok := p.Stages[len(p.Stages)-1].(*ast.RenameStage) + if !ok { + t.Fatalf("last stage = %#v, want *ast.RenameStage", p.Stages[len(p.Stages)-1]) + } + if len(s.Renames) != len(tc.want) { + t.Fatalf("got %d pairs, want %d", len(s.Renames), len(tc.want)) + } + for i, want := range tc.want { + if got := s.Renames[i]; got != want { + t.Errorf("pair %d = %#v, want %#v", i, got, want) + } + } + }) + } +} + +// TestRenameErrors pins the grammar's argument errors: every malformed pair is +// refused at parse time rather than reaching the emitter, and a wildcard must +// touch its name so `a *` is not silently read as `a*`. +func TestRenameErrors(t *testing.T) { + tests := []struct { + src string + col int + }{ + {`index=web | rename`, 19}, + {`index=web | rename a`, 21}, + {`index=web | rename a as`, 24}, + {`index=web | rename a as b,`, 27}, + {`index=web | rename a as b c`, 28}, + {`index=web | rename a as b as c`, 30}, + {`index=web | rename a * as b`, 22}, + } + for _, tc := range tests { + t.Run(tc.src, func(t *testing.T) { + _, err := Parse(tc.src) + if err == nil { + t.Fatal("expected an error") + } + ds, ok := diag.FromError(err) + if !ok || len(ds) != 1 { + t.Fatalf("err = %v, want one diagnostic", err) + } + if ds[0].Code != "syntax" { + t.Fatalf("code = %q, want syntax (%v)", ds[0].Code, err) + } + if ds[0].Pos.Line != 1 || ds[0].Pos.Col != tc.col { + t.Fatalf("diagnostic at %d:%d, want 1:%d (%v)", + ds[0].Pos.Line, ds[0].Pos.Col, tc.col, ds[0].Message) + } + }) + } +} + // TestBinRejectsSecondField covers the single-field rule: the second field is // refused at its own token, before any later argument error can be reported. func TestBinRejectsSecondField(t *testing.T) { diff --git a/pkg/parser/spl1/tight.go b/pkg/parser/spl1/tight.go index 2dd44a4..17c51a0 100644 --- a/pkg/parser/spl1/tight.go +++ b/pkg/parser/spl1/tight.go @@ -308,7 +308,7 @@ func isCommandKeyword(t int) bool { spl1gen.SPL1ParserEVAL, spl1gen.SPL1ParserREX, spl1gen.SPL1ParserTABLE, spl1gen.SPL1ParserFIELDS, spl1gen.SPL1ParserSORT, spl1gen.SPL1ParserHEAD, - spl1gen.SPL1ParserBIN: + spl1gen.SPL1ParserBIN, spl1gen.SPL1ParserRENAME: return true } return false