mirror of
https://github.com/Astatin3/rust-scan-mc.git
synced 2026-06-09 00:18:02 -06:00
28 lines
605 B
Rust
28 lines
605 B
Rust
use std::net::IpAddr;
|
|
|
|
use crate::database::DatabaseResult;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct PortScanResult {
|
|
pub ip: IpAddr,
|
|
pub open_ports: Vec<i32>,
|
|
}
|
|
|
|
impl PortScanResult {
|
|
pub fn new(ip: IpAddr) -> Self {
|
|
PortScanResult {
|
|
ip,
|
|
open_ports: Vec::new(),
|
|
// data: HashMap::new(),
|
|
}
|
|
}
|
|
pub fn to_database(&self) -> DatabaseResult {
|
|
DatabaseResult {
|
|
id: self.ip.to_string(),
|
|
ports: (*self.open_ports).to_vec(),
|
|
services: Vec::new(),
|
|
responses: String::new(),
|
|
}
|
|
}
|
|
}
|