Skip to main content

StatisticalAnalyzer

Struct StatisticalAnalyzer 

Source
pub struct StatisticalAnalyzer {
    pub significance_level: f64,
}
Expand description

Comprehensive traffic statistical analyzer.

Fields§

§significance_level: f64

P-value threshold for significance.

Implementations§

Source§

impl StatisticalAnalyzer

Source

pub fn new() -> Self

Source

pub fn with_significance(self, level: f64) -> Self

Source

pub fn byte_entropy(&self, data: &[u8]) -> f64

Shannon entropy of a byte distribution (0.0–8.0).

Source

pub fn entropy_analysis(&self, data: &[u8]) -> AnalysisResult

Analyze byte entropy: encrypted/random data should be close to 8.0.

Source

pub fn chi_squared_uniformity(&self, data: &[u8]) -> AnalysisResult

Chi-squared test for uniformity of byte distribution.

Source

pub fn pattern_detection(&self, packet_sizes: &[usize]) -> AnalysisResult

Test for repeated patterns in packet sizes.

Source

pub fn timing_regularity( &self, inter_packet_delays_us: &[u64], ) -> AnalysisResult

Timing regularity analysis: detect constant-rate traffic.

Source

pub fn full_analysis( &self, payload: &[u8], packet_sizes: &[usize], delays_us: &[u64], ) -> Vec<AnalysisResult>

Run all analysis tests on a traffic sample.

Source

pub fn suspicion_score( &self, payload: &[u8], packet_sizes: &[usize], delays_us: &[u64], ) -> f64

Overall suspicion score (0.0–1.0) from all analyses.

Trait Implementations§

Source§

impl Default for StatisticalAnalyzer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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, 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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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