Struct malwaredb_server::db::sqlite::Sqlite

source ·
pub struct Sqlite { /* private fields */ }
Expand description

Handle to an SQLite file

Implementations§

source§

impl Sqlite

source

pub fn new(file_name: &str) -> Result<Self>

source

pub fn enable_compression(&self) -> Result<()>

source

pub fn disable_compression(&self) -> Result<()>

source

pub fn enable_vt_upload(&self) -> Result<()>

source

pub fn disable_vt_upload(&self) -> Result<()>

source

pub fn files_without_vt_records(&self, limit: i32) -> Result<Vec<String>>

source

pub fn store_vt_record(&self, results: &ScanResultAttributes) -> Result<()>

source

pub fn get_vt_stats(&self) -> Result<VtStats>

source

pub fn get_config(&self) -> Result<MDBConfig>

source

pub fn authenticate(&self, uname: &str, password: &str) -> Result<String>

source

pub fn get_uid(&self, apikey: &str) -> Result<i32>

source

pub fn db_info(&self) -> Result<DatabaseInformation>

source

pub fn get_user_info(&self, uid: i32) -> Result<GetUserInfoResponse>

source

pub fn get_user_sources(&self, uid: i32) -> Result<Sources>

source

pub fn reset_own_api_key(&self, uid: i32) -> Result<()>

source

pub fn get_known_data_types(&self) -> Result<Vec<FileType>>

source

pub fn get_labels(&self) -> Result<Labels>

source

pub fn get_type_id_for_bytes(&self, data: &[u8]) -> Result<i32>

source

pub fn allowed_user_source(&self, uid: i32, sid: i32) -> Result<bool>

source

pub fn user_is_admin(&self, uid: i32) -> Result<bool>

source

pub fn add_file( &self, meta: &FileMetadata, known_type: KnownType<'_>, uid: i32, sid: i32, ftype: i32, parent: Option<i64>, ) -> Result<bool>

source

pub fn retrieve_sample(&self, uid: i32, hash: &HashType) -> Result<String>

source

pub fn get_sample_report(&self, uid: i32, hash: &HashType) -> Result<Report>

source

pub fn find_similar_samples( &self, uid: i32, sim: &[(SimilarityHashType, String)], ) -> Result<Vec<SimilarSample>>

source

pub fn add_file_encryption_key(&self, key: &FileEncryption) -> Result<u32>

source

pub fn get_encryption_key_names_ids( &self, ) -> Result<Vec<(u32, EncryptionOption)>>

source

pub fn create_user( &self, uname: &str, fname: &str, lname: &str, email: &str, password: Option<String>, organisation: Option<String>, ) -> Result<u64>

source

pub fn reset_api_keys(&self) -> Result<u64>

source

pub fn set_password(&self, uname: &str, password: &str) -> Result<()>

source

pub fn list_users(&self) -> Result<Vec<User>>

source

pub fn group_id_from_name(&self, name: &str) -> Result<i32>

source

pub fn edit_group( &self, gid: i32, name: &str, desc: &str, parent: Option<i32>, ) -> Result<()>

source

pub fn list_groups(&self) -> Result<Vec<Group>>

source

pub fn add_user_to_group(&self, uid: i32, gid: i32) -> Result<()>

source

pub fn add_group_to_source(&self, gid: i32, sid: i32) -> Result<()>

source

pub fn create_group( &self, name: &str, description: &str, parent: Option<i32>, ) -> Result<i32>

source

pub fn list_sources(&self) -> Result<Vec<Source>>

source

pub fn create_source( &self, name: &str, description: Option<&str>, url: Option<&str>, date: DateTime<Local>, releasable: bool, malicious: Option<bool>, ) -> Result<i32>

source

pub fn edit_user( &self, uid: i32, uname: &str, fname: &str, lname: &str, email: &str, ) -> Result<()>

source

pub fn deactivate_user(&self, uid: i32) -> Result<()>

source

pub fn file_types_counts(&self) -> Result<HashMap<String, u32>>

source

pub fn create_label(&self, name: &str, parent: Option<i64>) -> Result<u64>

source

pub fn edit_label(&self, id: u64, name: &str, parent: Option<u64>) -> Result<()>

source

pub fn label_id_from_name(&self, name: &str) -> Result<u64>

Trait Implementations§

source§

impl Debug for Sqlite

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Sqlite

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Send for Sqlite

source§

impl Sync for Sqlite

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more