Enum malwaredb_server::db::DatabaseType
source · pub enum DatabaseType {
Postgres(Postgres),
}
Variants§
Postgres(Postgres)
Implementations§
source§impl DatabaseType
impl DatabaseType
pub async fn from_string(arg: &str) -> Result<Self>
sourcepub async fn authenticate(&self, uname: &str, password: &str) -> Result<String>
pub async fn authenticate(&self, uname: &str, password: &str) -> Result<String>
Check user credentials, return API key. Generate if it doesn’t exist.
sourcepub async fn db_info(&self) -> Result<DatabaseInformation>
pub async fn db_info(&self) -> Result<DatabaseInformation>
Retrieve information about the database
sourcepub async fn get_user_info(&self, uid: i32) -> Result<GetUserInfoResponse>
pub async fn get_user_info(&self, uid: i32) -> Result<GetUserInfoResponse>
Retrieve the names of the groups and sources the user is part of and has access to
sourcepub async fn reset_own_api_key(&self, uid: i32) -> Result<()>
pub async fn reset_own_api_key(&self, uid: i32) -> Result<()>
Let the user clear their own API key to log out from all systems
sourcepub async fn get_known_data_types(&self) -> Result<Vec<FileType>>
pub async fn get_known_data_types(&self) -> Result<Vec<FileType>>
Retrieve the supported data type information
sourcepub async fn get_labels(&self) -> Result<Labels>
pub async fn get_labels(&self) -> Result<Labels>
Get all labels from MalwareDB
sourcepub async fn get_type_id_for_bytes(&self, data: &[u8]) -> Result<i32>
pub async fn get_type_id_for_bytes(&self, data: &[u8]) -> Result<i32>
Get the corresponding type ID for a buffer representing a file
sourcepub async fn allowed_user_source(&self, uid: i32, sid: i32) -> Result<bool>
pub async fn allowed_user_source(&self, uid: i32, sid: i32) -> Result<bool>
Check that a user has been granted access data for the specific source
sourcepub async fn user_is_admin(&self, uid: i32) -> Result<bool>
pub async fn user_is_admin(&self, uid: i32) -> Result<bool>
Check to see if the user is an administrator. The user must be a member of the the admin group (group ID 0), or a one group below (a group with the parent group id of 0).
sourcepub async fn add_file(
&self,
meta: &FileMetadata,
known_type: KnownType<'_>,
uid: i32,
sid: i32,
ftype: i32,
parent: Option<i64>
) -> Result<bool>
pub async fn add_file( &self, meta: &FileMetadata, known_type: KnownType<'_>, uid: i32, sid: i32, ftype: i32, parent: Option<i64> ) -> Result<bool>
Add a file’s metadata to the database, returning true if this is a new entry
sourcepub async fn retrieve_sample(&self, uid: i32, hash: HashType) -> Result<String>
pub async fn retrieve_sample(&self, uid: i32, hash: HashType) -> Result<String>
Retrieve the SHA-256 hash of the sample while checking that the user is permitted to access to it
sourcepub async fn get_sample_report(
&self,
uid: i32,
hash: HashType
) -> Result<Report>
pub async fn get_sample_report( &self, uid: i32, hash: HashType ) -> Result<Report>
Retrieve a report for a given sample, if allowed.
sourcepub async fn find_similar_samples(
&self,
uid: i32,
sim: &[(SimilarityHashType, String)]
) -> Result<Vec<SimilarSample>>
pub async fn find_similar_samples( &self, uid: i32, sim: &[(SimilarityHashType, String)] ) -> Result<Vec<SimilarSample>>
Given a collection of similarity hashes, find samples which are similar.