mirror of
https://github.com/Jerryplusy/AI-powered-switches.git
synced 2025-07-04 21:29:18 +00:00
基础api服务可进行,可扫描网络交换机(已修改相关问题,注意下载Nmap才可扫描交换机网址:https://nmap.org/download.html)需用实际设备进一步调试
This commit is contained in:
parent
8d1b1379e9
commit
265307b24e
@ -3,11 +3,12 @@ import json
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Dict
|
from typing import List, Dict
|
||||||
from ..utils.logger import logger
|
from ..utils.logger import logger
|
||||||
|
import os
|
||||||
|
|
||||||
class NetworkScanner:
|
class NetworkScanner:
|
||||||
def __init__(self, cache_path: str = "switch_devices.json"):
|
def __init__(self, cache_path: str = "switch_devices.json"):
|
||||||
self.cache_path = Path(cache_path)
|
self.cache_path = Path(cache_path)
|
||||||
|
os.environ["PATH"] += r";D:\Program Files\Nmap"
|
||||||
self.nm = nmap.PortScanner()
|
self.nm = nmap.PortScanner()
|
||||||
|
|
||||||
def scan_subnet(self, subnet: str = "192.168.1.0/24") -> List[Dict]:
|
def scan_subnet(self, subnet: str = "192.168.1.0/24") -> List[Dict]:
|
||||||
|
@ -5,7 +5,7 @@ app = create_app()
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
app,
|
"src.backend.app:app",
|
||||||
host="0.0.0.0",
|
host="0.0.0.0",
|
||||||
port=8000,
|
port=8000,
|
||||||
log_level="info",
|
log_level="info",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user