pub struct PayloadConfig {
pub max_per_category: usize,
pub deduplicate: bool,
pub marker_prefix: String,
pub exclude_categories: Vec<String>,
pub include_categories: Vec<String>,
pub target_runtime: Option<Vec<String>>,
pub marker_position: MarkerPosition,
pub max_payload_length: usize,
}Expand description
Fields§
§max_per_category: usizeMaximum payloads per category before truncation (0 = unlimited).
deduplicate: boolWhether to deduplicate identical payloads within a category.
marker_prefix: StringDefault marker prefix for taint tracking (e.g. “SLN”).
exclude_categories: Vec<String>Categories to exclude from generation (e.g. for compliance).
include_categories: Vec<String>Categories to include exclusively (empty = all).
target_runtime: Option<Vec<String>>Restrict loaded grammars to one or more runtimes (empty = all).
marker_position: MarkerPositionWhere to place the taint marker in generated marker payloads.
max_payload_length: usizeMaximum length of a single payload in bytes (0 = unlimited).
Implementations§
Source§impl PayloadConfig
impl PayloadConfig
Sourcepub fn builder() -> PayloadConfigBuilder
pub fn builder() -> PayloadConfigBuilder
Create a builder for PayloadConfig.
Example:
use attackstr::PayloadConfig;
let config = PayloadConfig::builder().marker_prefix("TRACE").build();
assert_eq!(config.marker_prefix, "TRACE");Sourcepub fn load<P: AsRef<Path>>(path: P) -> Result<Self, PayloadError>
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self, PayloadError>
Load a PayloadConfig from a TOML file.
Example:
use attackstr::PayloadConfig;
let dir = tempfile::tempdir().unwrap();
let path = dir.path().join("payloads.toml");
std::fs::write(&path, "marker_prefix = \"TRACE\"\n").unwrap();
let config = PayloadConfig::load(&path).unwrap();
assert_eq!(config.marker_prefix, "TRACE");§Errors
Returns a PayloadError if reading or parsing the file fails.
Sourcepub fn from_toml(
toml_str: &str,
source: impl Into<String>,
) -> Result<Self, PayloadError>
pub fn from_toml( toml_str: &str, source: impl Into<String>, ) -> Result<Self, PayloadError>
Parse a PayloadConfig directly from TOML text.
Example:
use attackstr::{MarkerPosition, PayloadConfig};
let config = PayloadConfig::from_toml("marker_position = \"suffix\"", "<inline>").unwrap();
assert_eq!(config.marker_position, MarkerPosition::Suffix);§Errors
Returns a PayloadError if parsing the TOML fails.
Trait Implementations§
Source§impl Clone for PayloadConfig
impl Clone for PayloadConfig
Source§fn clone(&self) -> PayloadConfig
fn clone(&self) -> PayloadConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PayloadConfig
impl Debug for PayloadConfig
Source§impl Default for PayloadConfig
impl Default for PayloadConfig
Source§impl<'de> Deserialize<'de> for PayloadConfig
impl<'de> Deserialize<'de> for PayloadConfig
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
Source§impl Display for PayloadConfig
impl Display for PayloadConfig
impl Eq for PayloadConfig
Source§impl Hash for PayloadConfig
impl Hash for PayloadConfig
Source§impl PartialEq for PayloadConfig
impl PartialEq for PayloadConfig
Source§impl Serialize for PayloadConfig
impl Serialize for PayloadConfig
impl StructuralPartialEq for PayloadConfig
Auto Trait Implementations§
impl Freeze for PayloadConfig
impl RefUnwindSafe for PayloadConfig
impl Send for PayloadConfig
impl Sync for PayloadConfig
impl Unpin for PayloadConfig
impl UnsafeUnpin for PayloadConfig
impl UnwindSafe for PayloadConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.