pub struct ScriptResult { /* private fields */ }Expand description
Contains the complete result of parsing and evaluating a PowerShell script.
This structure holds the final result value, any output generated, parsing errors encountered, and the tokenized representation of the script. It’s particularly useful for debugging and deobfuscation purposes.
§Examples
use ps_parser::PowerShellSession;
let mut session = PowerShellSession::new();
let script_result = session.parse_input("$a = 42; $a").unwrap();
// Access different parts of the result
println!("Final value: {:?}", script_result.result());
println!("Output: {:?}", script_result.output());
println!("Errors: {:?}", script_result.errors());Implementations§
Source§impl ScriptResult
impl ScriptResult
pub fn result(&self) -> PsValue
pub fn deobfuscated_lines(&self) -> Vec<String>
pub fn deobfuscated(&self) -> String
pub fn tokens(&self) -> Tokens
pub fn errors(&self) -> Vec<ParserError>
pub fn output(&self) -> String
pub fn output_lines(&self) -> Vec<String>
pub fn script_variables(&self) -> HashMap<String, PsValue>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ScriptResult
impl RefUnwindSafe for ScriptResult
impl Send for ScriptResult
impl Sync for ScriptResult
impl Unpin for ScriptResult
impl UnwindSafe for ScriptResult
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> 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>
Converts
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>
Converts
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