Giter VIP home page Giter VIP logo

powerob's Introduction

fenrir-desktop-bg

Powerob

An on-the-fly Powershell script obfuscator meant for red team engagements. Built out of necessity.

This only obfuscates functions and removes found in PowerShell scripts. Roadmap includes bfuscating variables. Pull requests and collaborative welcomed.

About

This was built out of the need to bypass endpoint security on a recent engagement. During priv esc attempts I could not download PowerUp.ps1 until it was obfuscated.

This is technically v2 and has been updated to remove comments.

Installation

git clone https://github.com/cwolff411/powerob

Usage

python3 powerob.py obfuscate originalfile.ps1 obfuscatedfile.ps1

Takes an INPUTFILE obfuscates it and dumps the obfuscated version into OUTPUTFILE.

PowerOb


python3 powerob.py list

Lists all of the currently obfuscated files along with their commands and associated obfuscated commands.

PowerOb


python3 powerob.py getcommand COMMAND_NAME

For reference on the fly for when you forget. Takes the original command name and displays the obfuscated command name to be used in Powershell.

PowerOb


python3 powerob.py cleardb

Maintenance function to clear the db of past obfuscated files and functions.

License

MIT License

powerob's People

Contributors

cwolff411 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

powerob's Issues

TypeError

Any ideas? :)

root@kali:/opt/tools/powerob# python3 powerob.py obfuscate revnew.ps1 revx.ps1 

       ___                        ___ _     
      / _ \_____      _____ _ __ /___| |__  
     / /_)/ _ \ \ /\ / / _ | '__//  /| '_ \ 
    / ___| (_) \ V  V |  __| | / \_//| |_) |
    \/    \___/ \_/\_/ \___|_| \___/ |_.__/ 

            author: Cory Wolff <visnet>
            company: Layer 8 <layer8security.com>
    
---------------------------------------------------------------------------

[+] Loading the Powershell script
[+] Locating functions
[-] No Functions Found. Exiting...
Traceback (most recent call last):
  File "powerob.py", line 120, in find_functions
    exit()
  File "/usr/lib/python3.8/_sitebuiltins.py", line 26, in __call__
    raise SystemExit(code)
SystemExit: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "powerob.py", line 316, in <module>
    PowerOb()
  File "powerob.py", line 192, in __init__
    getattr(self, args.command)()
  File "powerob.py", line 205, in obfuscate
    functions = find_functions(args.inputfile)
  File "powerob.py", line 126, in find_functions
    print(color("[-] Unexpected error:" + sys.exc_info()[0]))
TypeError: can only concatenate str (not "type") to str

No Functions Found. Exiting...

Getting this error:

[+] Loading the Powershell script
[+] Locating functions
[-] No Functions Found. Exiting...

But script contains this:


function func_get_proc_address {
	Param ($var_module, $var_procedure)		
	$var_unsafe_native_methods = ([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split('\\')[-1].Equals('System.dll') }).GetType('Microsoft.Win32.UnsafeNativeMethods')
	$var_gpa = $var_unsafe_native_methods.GetMethod('GetProcAddress', [Type[]] @('System.Runtime.InteropServices.HandleRef', 'string'))
	return $var_gpa.Invoke($null, @([System.Runtime.InteropServices.HandleRef](New-Object System.Runtime.InteropServices.HandleRef((New-Object IntPtr), ($var_unsafe_native_methods.GetMethod('GetModuleHandle')).Invoke($null, @($var_module)))), $var_procedure))
}

function func_get_delegate_type {
	Param (
		[Parameter(Position = 0, Mandatory = $True)] [Type[]] $var_parameters,
		[Parameter(Position = 1)] [Type] $var_return_type = [Void]`

```

Not working for a handful of scripts

This worked for PowerUp.ps1 but would not work on Invoke-Mimikatz or Out-Minidump. I tried on a handful other scripts, some worked, some didnt, but the two above were the most notable.
Errors out while looking for functions -

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.