Coder Social home page Coder Social logo

psreflect-functions's People

Contributors

andrewchiles avatar brianreitz avatar cobbr avatar harmj0y avatar jaredcatkinson avatar leechristensen avatar xorrior avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

psreflect-functions's Issues

Is this the de facto place to maintain PSReflect? Or should PSReflect be added as a submodule of PSReflect-Functions

I've been reading through the PSReflect code, and I want to take a shot at creating my own interpretation of it. It may or may not have any value to others.

But I'm wondering if I should work in parallel in forks of both PSReflect and PSReflect-Functions, just to keep things in sync. (In case my project bears any fruit)

Actually, I just noticed that in @mattifestation's copy, it has the update that I found necessary to get it to run under PowerShell 7. (Because they moved the .DefineDynamicAssembly() method)
https://github.com/mattifestation/PSReflect/blob/e8a4e831d1c58b2dd38662153909f9a8b135badc/PSReflect.psm1#L51

And I think that .DefineDynamicModule( [string], [bool] ) is going away in .NET 5. .DefineDynamicModule( [string] ) will be it; there will be no other overloads as far as I can tell.

My use case is to do P/Invoke stuff involving user32.dll , which is outside the scope of what is going on here. Of course, what I'm doing could just as easily be done with C# code in a string, passed to Add-Type. But that's not as much fun.

One last question: How important is PowerShell version 2 compatibility for code like this, moving forward?

Crowdstrike identifying this module as malicious

See title - I'm working with our AV folks, but these sorts of things tend to have a cascading effect on AV groupthink (e.g. rep heuristics, partner ID of PUPs), might want to start a convo w CS

Failed to install: Windows Defender flags package

I get the following when trying to install:

Install-Package: C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:9711
Line |
9711 |  … talledPackages = PackageManagement\Install-Package @PSBoundParameters
     |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Package 'PSReflect-Functions' failed to be installed because: Operation did not complete successfully
     | because the file contains a virus or potentially unwanted software. :
     | 'C:\Users\Scott\AppData\Local\Temp\e5unvpcv\PSReflect.ps1'

Windows Defender also flags "HackTool:PowerShell/PowerView" on the same file.

Potential memory leak in WinVerifyTrust call

Missing call to FreeHGlobal to free memory

    $Data.cbStruct = $WINTRUST_DATA::GetSize()
!    $Data.pData = [System.Runtime.InteropServices.Marshal]::AllocHGlobal($Size)
    $Data.dwUIChoice = $WTD_UI::None
    [System.Runtime.InteropServices.Marshal]::StructureToPtr($Info, $Data.pData, $false)

    $SUCCESS = $wintrust::WinVerifyTrust($WindowHandle, [ref]$ActionID, [ref]$Data)

    if($SUCCESS -eq 0)
    {
        Write-Output $true
    }
    else
    {
        if(($SUCCESS -eq 0x80096010) -or ($SUCCESS -eq 0x800b0100))
        {
            Write-Output $false
        }
        else
        {
! no call to FreeHGlobal in exception path
            throw ([ComponentModel.Win32Exception]$SUCCESS).Message
        }
    }
! no call to FreeHGlobal    

$Data.pData = [System.Runtime.InteropServices.Marshal]::AllocHGlobal($Size)

Similar issue here with missing FreeHGlobal for AllocHGlobal call:

$lpLuid = [System.Runtime.InteropServices.Marshal]::AllocHGlobal($LUID::GetSize())

Ditto:

$AtomName = [System.Runtime.InteropServices.Marshal]::AllocHGlobal(1024)

Similar issue in the paths that throw exceptions in GetIpNetTable.ps1:

        elseif($SUCCESS -eq $ERROR_NO_DATA)
        {
            Write-Output $null
        }
        else
        {
            throw "[GetIpNetTable] Error: $($SUCCESS)"
! leak due to failure to call FreeHGlobal($pIpNetTable)
        }
    }
    else
    {
        throw "[GetIpNetTable] Error: $($SUCCESS)"
! leak due to failure to call FreeHGlobal($pIpNetTable)
    }

    [System.Runtime.InteropServices.Marshal]::FreeHGlobal($pIpNetTable)
}

[System.Runtime.InteropServices.Marshal]::FreeHGlobal($pIpNetTable)

Might want to do a pass through the repo for these.

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.