pub struct TraceContext<PB: ProtocolBehavior> {
pub knowledge_store: KnowledgeStore<PB::ProtocolTypes>,
agents: Vec<Agent<PB>>,
claims: GlobalClaimList<PB::Claim>,
pub config_trace: ConfigTrace,
spawner: Spawner<PB>,
phantom: PhantomData<PB>,
pub executed_until: usize,
}Expand description
The TraceContext represents the state of an execution.
The TraceContext contains a list of EvaluatedTerm, which is known as the knowledge
of the attacker. EvaluatedTerm can contain data of various types like for example
client and server extensions, cipher suits or session ID It also holds the concrete
references to the Agents and the underlying streams, which contain the messages
which have need exchanged and are not yet processed by an output step.
Fields§
§knowledge_store: KnowledgeStore<PB::ProtocolTypes>The knowledge of the attacker
agents: Vec<Agent<PB>>§claims: GlobalClaimList<PB::Claim>§config_trace: ConfigTrace§spawner: Spawner<PB>§phantom: PhantomData<PB>§executed_until: usizeThe number of steps that have been successfully executed
Implementations§
Source§impl<PB: ProtocolBehavior> TraceContext<PB>
impl<PB: ProtocolBehavior> TraceContext<PB>
pub fn new(spawner: Spawner<PB>) -> Self
pub fn new_config(spawner: Spawner<PB>, config_trace: ConfigTrace) -> Self
pub fn verify_security_violations(&self) -> Result<(), Error>
Sourcepub fn number_matching_message_with_source(
&self,
source: Source,
type_id: TypeId,
tls_message_type: &Option<<PB::ProtocolTypes as ProtocolTypes>::Matcher>,
) -> usize
pub fn number_matching_message_with_source( &self, source: Source, type_id: TypeId, tls_message_type: &Option<<PB::ProtocolTypes as ProtocolTypes>::Matcher>, ) -> usize
Count the number of sub-messages of type type_id with the correct source
Sourcepub fn number_matching_message(
&self,
type_id: TypeId,
tls_message_type: &Option<<PB::ProtocolTypes as ProtocolTypes>::Matcher>,
) -> usize
pub fn number_matching_message( &self, type_id: TypeId, tls_message_type: &Option<<PB::ProtocolTypes as ProtocolTypes>::Matcher>, ) -> usize
Count the number of sub-messages of type type_id in the output message.
pub fn find_claim( &self, agent_name: AgentName, query_type_shape: TypeShape<PB::ProtocolTypes>, ) -> Option<Box<dyn EvaluatedTerm<PB::ProtocolTypes>>>
Sourcepub fn find_variable(
&self,
query_type_shape: TypeShape<PB::ProtocolTypes>,
query: &Query<<PB::ProtocolTypes as ProtocolTypes>::Matcher>,
) -> Option<&dyn EvaluatedTerm<PB::ProtocolTypes>>
pub fn find_variable( &self, query_type_shape: TypeShape<PB::ProtocolTypes>, query: &Query<<PB::ProtocolTypes as ProtocolTypes>::Matcher>, ) -> Option<&dyn EvaluatedTerm<PB::ProtocolTypes>>
Returns the variable which matches best -> highest specificity If we want a variable with lower specificity, then we can just query less specific
pub fn spawn( &mut self, descriptor: &AgentDescriptor<<PB::ProtocolTypes as ProtocolTypes>::PUTConfig>, ) -> Result<(), Error>
pub fn find_agent_mut( &mut self, name: AgentName, ) -> Result<&mut Agent<PB>, Error>
pub fn find_agent(&self, name: AgentName) -> Result<&Agent<PB>, Error>
pub fn agents_successful(&self) -> bool
Sourcepub fn compare(
&self,
other: &Self,
descriptors: &Vec<AgentDescriptor<<PB::ProtocolTypes as ProtocolTypes>::PUTConfig>>,
) -> Vec<TraceDifference>
pub fn compare( &self, other: &Self, descriptors: &Vec<AgentDescriptor<<PB::ProtocolTypes as ProtocolTypes>::PUTConfig>>, ) -> Vec<TraceDifference>
Compare with another TraceContext and return a Vec of differences
Trait Implementations§
Source§impl<PB: Debug + ProtocolBehavior> Debug for TraceContext<PB>
impl<PB: Debug + ProtocolBehavior> Debug for TraceContext<PB>
Source§impl<PB: ProtocolBehavior> Display for TraceContext<PB>
impl<PB: ProtocolBehavior> Display for TraceContext<PB>
Source§impl<PB: ProtocolBehavior + PartialEq> PartialEq for TraceContext<PB>
impl<PB: ProtocolBehavior + PartialEq> PartialEq for TraceContext<PB>
Auto Trait Implementations§
impl<PB> Freeze for TraceContext<PB>
impl<PB> !RefUnwindSafe for TraceContext<PB>
impl<PB> !Send for TraceContext<PB>
impl<PB> !Sync for TraceContext<PB>
impl<PB> Unpin for TraceContext<PB>where
PB: Unpin,
<<PB as ProtocolBehavior>::ProtocolTypes as ProtocolTypes>::PUTConfig: Unpin,
<<PB as ProtocolBehavior>::ProtocolTypes as ProtocolTypes>::Matcher: Unpin,
<PB as ProtocolBehavior>::ProtocolTypes: Unpin,
impl<PB> !UnwindSafe for TraceContext<PB>
Blanket Implementations§
§impl<Head, T> Append<T> for Head
impl<Head, T> Append<T> for Head
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
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<Tail, T> Prepend<T> for Tail
impl<Tail, T> Prepend<T> for Tail
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString]. Read more