mongo用的比较多,mysql现在不常用,留作备份。
# mysql基本语法
- 查询某个字段
select * from vuln.new_vulns_all WHERE ID= 'xxVULN_2019xxxx_0xxx';
- 更新某个字段的数据
UPDATE vuln.new_vulns_all SET Status='未xx' WHERE ID= 'xxVULN_2019xxxx_0xxx';
- 删除数据库的某个表的所有数据
delete from vvv.xxx_xxxx_all;
- 统计某个数据表的数量
SELECT count(*) FROM vvv.xxx_xxxx_all where xxx <> '未知' ;
- 去重后的数量
select count(distinct SIG_hhh) FROM vvv.xxx_xxxx_all;
# elastcisearch 查询语句
es_query = {
"query": {
"bool": {
"must": [
{"match": {"deviceCustomString1":"FE_Exploit_RTF_"}},#精确匹配
{"match": {"threat_type": "wildfire"}},
{"match": {"application": "smtp"}}
]
}
},
"aggs": {
"fileHash": {
"terms": {
"field": "fileHash",
"size": ES_AGGREATE_NUM
}
}
}
}
- 模糊查询
{ "wildcard": {
"deviceCustomString1": {
"value": "*RTF_Generic*"
}
}
}