This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.
JavaScript algorithmsartificial-intelligencebugbountycryptographycyber-threat-intelligencecybersecurity-projectsethical-hackinghacking-toolsmalwarenessusnetwork-monitoringnetwork-securitynmapportscannerpythonpythonprojectsthreat-intelligencevirus-scanning
use super::Service;
use crate::{
entities::{self, Agent},
Error,
};
use chrono::Utc;
use common::api::AgentRegistered;
use uuid::Uuid;
impl Service {
pub async fn list_agents(&self) -> Result<Vec<entities::Agent>, Error> {
self.repo.find_all_agents(&self.db).await
}
pub async fn register_agent(&self) -> Result<AgentRegistered, Error> {
let id = Uuid::new_v4();
let created_at = Utc::now();
let agent = Agent {
id,
created_at,
last_seen_at: created_at,
};
self.repo.create_agent(&self.db, &agent).await?;
Ok(AgentRegistered { id })
}
}