diff options
| author | handingkang <[email protected]> | 2024-01-19 17:50:57 +0800 |
|---|---|---|
| committer | handingkang <[email protected]> | 2024-01-19 17:50:57 +0800 |
| commit | c423b3072b19c34a7f777cfa7e019baac6c3d7f1 (patch) | |
| tree | 60fb4edd5df29a4cb835211ce6c2d0b0ac8b5250 | |
| parent | 54a5df53fb0c69c3a812234702335451c356c369 (diff) | |
| -rw-r--r-- | apps/apiv1.py | 2 | ||||
| -rw-r--r-- | apps/fx.py | 19 | ||||
| -rw-r--r-- | apps/map.py | 8 | ||||
| -rw-r--r-- | script/neo4jcommand.py | 15 | ||||
| -rw-r--r-- | script/sched.py | 3 |
5 files changed, 28 insertions, 19 deletions
diff --git a/apps/apiv1.py b/apps/apiv1.py index 05d3435..f0fd426 100644 --- a/apps/apiv1.py +++ b/apps/apiv1.py @@ -2,6 +2,7 @@ from apiflask import APIBlueprint, Schema from apiflask.fields import Integer, String, Field from .data import bp as databp +from .fx import bp as fxbp from .stats import bp as statsbp from .sysinfo import bp as sysbp @@ -9,6 +10,7 @@ bp = APIBlueprint('apiv1', __name__, url_prefix="/api") bp.register_blueprint(statsbp) bp.register_blueprint(databp) bp.register_blueprint(sysbp) +bp.register_blueprint(fxbp) class Response(Schema): @@ -1,23 +1,24 @@ # 风险评估接口 +from apiflask import APIBlueprint - -# 高风险节点信息 - +bp = APIBlueprint('fx', __name__, url_prefix='/fx') - -# 高风险节点邻居(输入高风险节点ID) +# 高风险节点信息 [email protected]("/fxnode") +def get_fxnodes(): + pass +# 高风险节点邻居(输入高风险节点地址) [email protected]("/fxnode/<string:id>") +def get_fxnode_nei(): + pass # IP关联信息 - # AS关联 - - # ISP关联 - diff --git a/apps/map.py b/apps/map.py deleted file mode 100644 index 78bb8a2..0000000 --- a/apps/map.py +++ /dev/null @@ -1,8 +0,0 @@ -from apiflask import APIFlask,APIBlueprint -from flask import render_template - -bp=APIBlueprint("map",__name__,url_prefix="/map") - [email protected]("/") -def showmap(): - return render_template("/index.html")
\ No newline at end of file diff --git a/script/neo4jcommand.py b/script/neo4jcommand.py index b12d509..64cf051 100644 --- a/script/neo4jcommand.py +++ b/script/neo4jcommand.py @@ -33,8 +33,19 @@ CALL gds.pageRank.stream('myGraph') YIELD nodeId, score with gds.util.asNode(nodeId) as n WHERE n.IPType contains "6" -RETURN n.IP as ip, n.ISP as isp,n.CCODE as ccode,n.COU as cou,n.PROV as prov, score -ORDER BY score DESC, ip ASC,isp ASC,ccode ASC,cou ASC,prov ASC limit 30''' +RETURN n.IP as ip, n.ISP as isp,n.CCODE as ccode,n.COU as cou,n.PROV as prov, n.LAT as lat,n.LNG as lng ,score +ORDER BY score DESC limit %s''' + +# 高危节点邻居 +dnode_neighbor = ''' +CALL gds.pageRank.stream('myGraph') +YIELD nodeId, score +WHERE gds.util.asNode(nodeId).IPType contains "6" +with gds.util.asNode(nodeId) AS no, score ORDER BY score DESC limit %s +with collect(no) as nlist +MATCH (m:NodeResolver53)-[r:IP_LINK]->(n:NodeResolver53) +WHERE n in nlist and m.IPType contains "4" +RETURN n.IP,r.W,m''' # 节点邻居 node_neighbors = '''MATCH(n:NodeResolver53{IP:'%s'})-[]->(m:NodeResolver53) RETURN m''' diff --git a/script/sched.py b/script/sched.py index 44b3622..60eaf5b 100644 --- a/script/sched.py +++ b/script/sched.py @@ -174,6 +174,9 @@ def refresh_neo4j(): except Exception as e: log.error(e) + # 获取高危节点及其邻居节点信息 + DANGER_noderesult = to_dataframe(db.cypher_query(dangerous_nodes, retry_on_session_expire=True)) + log.info("完成数据一轮刷新,下一次刷新开始于: " + str(int(idle_seconds())) + "秒后") |
