Git Product home page Git Product logo

Comments (4)

mattifestation avatar mattifestation commented on June 12, 2024

Considering 'EnvironmentVariables' is made available to you via Get-Process, would you have a problem with me just calling that and assigning my EnvironmentVariables accordingly? Or would you rather I follow the pointer to the environment variables and walk the list?

Example:

$EnvironmentVariables = (Get-Process -Id $ProcessId -ErrorAction SilentlyContinue).StartInfo.EnvironmentVariables

from powersploit.

zippy1981 avatar zippy1981 commented on June 12, 2024

Matt, Its good to know that's an option. I didn't think to check the startup options. I think it'd be better to only include the functionality in Get-PEB, if it was reading from the environment block. People are going to assume that's the case, so it would do more harm than good including it.

I took a quick look at the ProcessHacker 1.0 source code which is C# and discovered that ProcessHandle.GetEnvironmentVariables(). I'll see what it takes to extract that into PowerShell code. It looks like that's a better source to model Get-PEB after since its pure C#.

My desire for this stems from trying to figure out how to get SQL Server stacktraces to use the symbol server. In that case, the problem is solved. However, if I was debugging powershell.exe or cmd.exe as well as child processes launched from a command line, I'd probably want the PEB to be read.

from powersploit.

zippy1981 avatar zippy1981 commented on June 12, 2024

If I were to do a Raw memory copy would you prefer I did an Import-DllImports on NtReadVirtualMemory or is there another method you prefer for calling unmanaged APIs?

from powersploit.

mattifestation avatar mattifestation commented on June 12, 2024

Check out Get-StructFromMemory (https://github.com/mattifestation/PowerSploit/blob/master/ReverseEngineering/Get-StructFromMemory.ps1). I use kernel32!VirtualQueryEx to ensure that I can read a particular address in a remote process and kernel32!ReadProcessMemory to read memory in the remote process.

from powersploit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.