Struct malwaredb_server::State
source · pub struct State {
pub port: u16,
pub directory: Option<PathBuf>,
pub max_upload: usize,
pub ip: IpAddr,
pub db_type: DatabaseType,
pub started: SystemTime,
pub db_config: MDBConfig,
/* private fields */
}
Expand description
State & configuration of the running server instance
Fields§
§port: u16
The port which will be used to listen for connections.
directory: Option<PathBuf>
The directory to store malware samples, if we’re keeping them.
max_upload: usize
Maximum upload size
ip: IpAddr
The IP to use for listening for connections
db_type: DatabaseType
Handle to the database connection
started: SystemTime
Start time of the server
db_config: MDBConfig
Configuration which is stored in the database
Implementations§
source§impl State
impl State
sourcepub async fn new(
port: u16,
directory: Option<PathBuf>,
max_upload: usize,
ip: IpAddr,
db_string: &str,
vt_api_key: Option<Zeroizing<String>>,
) -> Result<Self>
pub async fn new( port: u16, directory: Option<PathBuf>, max_upload: usize, ip: IpAddr, db_string: &str, vt_api_key: Option<Zeroizing<String>>, ) -> Result<Self>
New server state object given a few configuration parameters
sourcepub async fn store_bytes(&self, data: &[u8]) -> Result<bool>
pub async fn store_bytes(&self, data: &[u8]) -> Result<bool>
Store the sample with a depth of three based on the sample’s SHA-256 hash, even if compressed
sourcepub async fn retrieve_bytes(&self, sha256: &String) -> Result<Vec<u8>>
pub async fn retrieve_bytes(&self, sha256: &String) -> Result<Vec<u8>>
Retrieve a sample given the SHA-256 hash Assumes that MalwareDB permissions have already been checked to ensure this is permitted.
sourcepub async fn get_info(&self) -> Result<ServerInfo>
pub async fn get_info(&self) -> Result<ServerInfo>
Get server information
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for State
impl !RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl !UnwindSafe for State
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more