-
Notifications
You must be signed in to change notification settings - Fork 100
mysql: add tests #2067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
QianKaiLin
wants to merge
4
commits into
OISF:master
Choose a base branch
from
QianKaiLin:tests-3346-mysql-v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
mysql: add tests #2067
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Description | ||
Test sql query statement like `select * from xxx where xxx = yyy` args contents. |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
outputs: | ||
- eve-log: | ||
enabled: yes | ||
filetype: regular | ||
filename: eve.json | ||
types: | ||
- alert | ||
|
||
app-layer: | ||
protocols: | ||
mysql: | ||
enabled: yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alert mysql any any -> any any (msg:"test mysql";mysql.command; content:"33030219971120201X"; metadata: mysql command; sid:1;) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
requires: | ||
min-version: 8 | ||
|
||
args: | ||
- -k none | ||
|
||
checks: | ||
- filter: | ||
count: 1 | ||
match: | ||
pcap_cnt: 40 | ||
src_ip: 172.18.0.1 | ||
src_port: 35316 | ||
dest_ip: 172.18.0.3 | ||
dest_port: 3306 | ||
proto: "TCP" | ||
direction: "to_server" | ||
event_type: alert | ||
alert.signature: "test mysql" | ||
alert.signature_id: 1 | ||
alert.severity: 3 | ||
alert.metadata.mysql[0]: "command" | ||
mysql.command: "select * from test.identify where identify = 33030219971120201X" | ||
mysql.rows[0]: "1,33030219971120201X" | ||
|
||
QianKaiLin marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Test Description | ||
|
||
TODO: Simple description of what this test is for. | ||
|
||
## PCAP | ||
|
||
TODO: What is the source of this PCAP. | ||
|
||
## Related issues | ||
|
||
TODO: Issue numbers or links to related issues. |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
outputs: | ||
- eve-log: | ||
enabled: yes | ||
filetype: regular | ||
filename: eve.json | ||
types: | ||
- mysql | ||
|
||
app-layer: | ||
protocols: | ||
mysql: | ||
enabled: yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
requires: | ||
min-version: 8 | ||
|
||
args: | ||
- -k none | ||
|
||
checks: | ||
- filter: | ||
count: 1 | ||
match: | ||
dest_ip: 172.16.10.104 | ||
dest_port: 3306 | ||
pcap_cnt: 14 | ||
event_type: mysql | ||
mysql.affected_rows: 0 | ||
mysql.command: SET NAMES utf8mb4 | ||
mysql.tls: false | ||
mysql.version: 8.0.32 | ||
proto: TCP | ||
src_ip: 172.16.10.222 | ||
src_port: 42074 | ||
- filter: | ||
count: 1 | ||
match: | ||
dest_ip: 172.16.10.104 | ||
dest_port: 3306 | ||
event_type: mysql | ||
mysql.command: SELECT VERSION() | ||
mysql.rows[0]: 8.0.32 | ||
mysql.tls: false | ||
mysql.version: 8.0.32 | ||
proto: TCP | ||
src_ip: 172.16.10.222 | ||
src_port: 42074 | ||
- filter: | ||
count: 1 | ||
match: | ||
dest_ip: 172.16.10.104 | ||
dest_port: 3306 | ||
pcap_cnt: 20 | ||
event_type: mysql | ||
mysql.affected_rows: 0 | ||
mysql.command: ping | ||
mysql.tls: false | ||
mysql.version: 8.0.32 | ||
proto: TCP | ||
src_ip: 172.16.10.222 | ||
src_port: 42074 | ||
- filter: | ||
count: 1 | ||
match: | ||
dest_ip: 172.16.10.104 | ||
dest_port: 3306 | ||
event_type: mysql | ||
mysql.command: SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='sentinel_flow_admin' | ||
mysql.rows[0]: sentinel_flow_admin | ||
mysql.tls: false | ||
mysql.version: 8.0.32 | ||
proto: TCP | ||
src_ip: 172.16.10.222 | ||
src_port: 42074 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Test Description | ||
|
||
Test mysql prepare statement like `select * from xxx where id = ?`. | ||
|
||
## PCAP | ||
This PCAP was generated from flow in my workspace. |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
outputs: | ||
- eve-log: | ||
enabled: yes | ||
filetype: regular | ||
filename: eve.json | ||
types: | ||
- mysql | ||
|
||
app-layer: | ||
protocols: | ||
mysql: | ||
enabled: yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
requires: | ||
min-version: 8 | ||
|
||
args: | ||
- -k none | ||
|
||
checks: | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: mysql | ||
mysql.command: select * from requests WHERE id =1 limit 1 | ||
mysql.tls: false | ||
QianKaiLin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mysql.version: 8.4.0 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: mysql | ||
mysql.command: select * from requests WHERE id =2 limit 1 | ||
mysql.tls: false | ||
mysql.version: 8.4.0 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: mysql | ||
mysql.command: select * from requests WHERE id=3 and client_code=client2 limit | ||
1 | ||
mysql.tls: false | ||
mysql.version: 8.4.0 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: mysql | ||
mysql.command: select * from requests WHERE id =4 limit 1 | ||
mysql.tls: false | ||
mysql.version: 8.4.0 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: mysql | ||
mysql.command: select * from requests WHERE id =5 limit 1 | ||
mysql.tls: false | ||
mysql.version: 8.4.0 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: mysql | ||
mysql.command: select * from requests WHERE id =6 limit 1 | ||
mysql.tls: false | ||
mysql.version: 8.4.0 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: mysql | ||
mysql.command: select * from requests WHERE id =7 limit 1 | ||
mysql.tls: false | ||
mysql.version: 8.4.0 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: mysql | ||
mysql.command: select * from requests WHERE id=8 and client_code=client2 limit | ||
1 | ||
mysql.tls: false | ||
mysql.version: 8.4.0 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: mysql | ||
mysql.command: select * from requests WHERE id=9 and client_code=client2 limit | ||
1 | ||
mysql.tls: false | ||
mysql.version: 8.4.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Test Description | ||
|
||
Test mysql normal sql statement. | ||
|
||
## PCAP | ||
This PCAP was generated from flow in my workspace. |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
outputs: | ||
- eve-log: | ||
enabled: yes | ||
filetype: regular | ||
filename: eve.json | ||
types: | ||
- mysql | ||
|
||
app-layer: | ||
protocols: | ||
mysql: | ||
enabled: yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
requires: | ||
min-version: 8 | ||
|
||
args: | ||
- -k none | ||
|
||
checks: | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: mysql | ||
mysql.version: 8.0.32 | ||
mysql.tls: false | ||
mysql.command: "SELECT VERSION()" | ||
mysql.rows[0]: "8.0.32" | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: mysql | ||
mysql.version: 8.0.32 | ||
mysql.tls: false | ||
mysql.command: "ping" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Description | ||
Test sql query 's result like `id,1,2,3,4,5` content |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
outputs: | ||
- eve-log: | ||
enabled: yes | ||
filetype: regular | ||
filename: eve.json | ||
types: | ||
- alert | ||
|
||
app-layer: | ||
protocols: | ||
mysql: | ||
enabled: yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alert mysql any any -> any any (msg:"test mysql";mysql.rows; content:"33030219971120201X"; metadata: mysql rows; sid:1;) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
requires: | ||
min-version: 8 | ||
|
||
args: | ||
- -k none | ||
|
||
checks: | ||
- filter: | ||
count: 1 | ||
match: | ||
tx_id: 1 | ||
pcap_cnt: 41 | ||
src_ip: 172.18.0.3 | ||
src_port: 3306 | ||
dest_port: 35318 | ||
dest_ip: 172.18.0.1 | ||
proto: "TCP" | ||
event_type: alert | ||
alert.action: "allowed" | ||
alert.signature: "test mysql" | ||
alert.signature_id: 1 | ||
alert.severity: 3 | ||
direction: "to_client" | ||
alert.metadata.mysql[0]: "rows" | ||
mysql.version: "9.0.1" | ||
mysql.tls: false | ||
mysql.command: "select * from test.identify where id = 1" | ||
mysql.rows[0]: "1,33030219971120201X" | ||
- filter: | ||
count: 1 | ||
match: | ||
tx_id: 3 | ||
pcap_cnt: 43 | ||
src_ip: 172.18.0.3 | ||
src_port: 3306 | ||
dest_port: 35316 | ||
dest_ip: 172.18.0.1 | ||
proto: "TCP" | ||
direction: "to_client" | ||
event_type: alert | ||
alert.action: "allowed" | ||
alert.signature: "test mysql" | ||
alert.signature_id: 1 | ||
alert.severity: 3 | ||
alert.metadata.mysql[0]: "rows" | ||
mysql.version: "9.0.1" | ||
mysql.tls: false | ||
mysql.command: "select * from test.identify where identify = 33030219971120201X" | ||
mysql.rows[0]: "1,33030219971120201X" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Test Description | ||
|
||
Check MySQL protocol upgrade to TLS protocol. | ||
|
||
## PCAP | ||
From my desktop's docker. |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
outputs: | ||
- eve-log: | ||
enabled: yes | ||
filetype: regular | ||
filename: eve.json | ||
types: | ||
- mysql | ||
- tls | ||
|
||
app-layer: | ||
protocols: | ||
mysql: | ||
enabled: yes | ||
tls: | ||
enabled: yes |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.