pub struct MdbClient {
pub url: String,
/* private fields */
}
Expand description
MalwareDB Client Configuration and connection
Fields§
§url: String
URL of MalwareDB, including http and port number, ending without a slash
Implementations§
Source§impl MdbClient
impl MdbClient
Sourcepub fn new(
url: String,
api_key: String,
cert_path: Option<PathBuf>,
) -> Result<Self>
pub fn new( url: String, api_key: String, cert_path: Option<PathBuf>, ) -> Result<Self>
MDB Client from components, doesn’t test connectivity
Sourcepub async fn login(
url: String,
username: String,
password: String,
save: bool,
cert_path: Option<PathBuf>,
) -> Result<Self>
pub async fn login( url: String, username: String, password: String, save: bool, cert_path: Option<PathBuf>, ) -> Result<Self>
Login to a server, optionally save the config file, and return a client object
Sourcepub async fn reset_key(&self) -> Result<()>
pub async fn reset_key(&self) -> Result<()>
Reset one’s own API key to effectively logout & disable all clients who are using the key
Sourcepub async fn server_info(&self) -> Result<ServerInfo>
pub async fn server_info(&self) -> Result<ServerInfo>
Get information about the server, unauthenticated
Sourcepub async fn supported_types(&self) -> Result<SupportedFileTypes>
pub async fn supported_types(&self) -> Result<SupportedFileTypes>
Get file types supported by the server, unauthenticated
Sourcepub async fn whoami(&self) -> Result<GetUserInfoResponse>
pub async fn whoami(&self) -> Result<GetUserInfoResponse>
Get information about the user
Sourcepub async fn submit(
&self,
contents: impl AsRef<[u8]>,
file_name: &str,
source_id: u32,
) -> Result<bool>
pub async fn submit( &self, contents: impl AsRef<[u8]>, file_name: &str, source_id: u32, ) -> Result<bool>
Submit one file to MalwareDB: provide the contents, file name, and source ID
Sourcepub async fn retrieve(&self, hash: &str, cart: bool) -> Result<Vec<u8>>
pub async fn retrieve(&self, hash: &str, cart: bool) -> Result<Vec<u8>>
Retrieve sample by hash, optionally in the CaRT format
Sourcepub async fn similar(&self, contents: &[u8]) -> Result<SimilarSamplesResponse>
pub async fn similar(&self, contents: &[u8]) -> Result<SimilarSamplesResponse>
Find similar samples in MalwareDB based on the contents of a given file. This does not submit the sample to MalwareDB.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MdbClient
impl<'de> Deserialize<'de> for MdbClient
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MdbClient
impl RefUnwindSafe for MdbClient
impl Send for MdbClient
impl Sync for MdbClient
impl Unpin for MdbClient
impl UnwindSafe for MdbClient
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