Crate ps_parser

Crate ps_parser 

Source
Expand description

§ps-parser

A fast and flexible PowerShell parser written in Rust.

§Overview

ps-parser provides parsing, evaluation, and manipulation of PowerShell scripts. It supports variables, arrays, hash tables, script blocks, arithmetic, logical operations, and more.

§Features

  • Parse PowerShell scripts using pest grammar
  • Evaluate expressions, variables, arrays, hash tables, and script blocks
  • Environment and INI variable loading
  • Deobfuscation and error reporting
  • Extensible for custom PowerShell types

§Usage

use ps_parser::PowerShellSession;

let mut session = PowerShellSession::new();
let output = session.safe_eval(r#"$a = 42; Write-Output $a"#).unwrap();
println!("{}", output); // prints: 42

Structs§

PowerShellSession
Represents a PowerShell parsing and evaluation session.
ScriptResult
Contains the complete result of parsing and evaluating a PowerShell script.
Variables
Manages PowerShell variables across different scopes.

Enums§

PsValue
Represents a PowerShell value that can be stored and manipulated.
Token
Represents a parsed token from a PowerShell script.