Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
eae4695
PowerUp update:
HarmJ0y Dec 12, 2016
7c32bf6
-Complete ground-up rewrite of PowerView
HarmJ0y Dec 12, 2016
32bd21e
bug fix in Get-DomainSearcher
HarmJ0y Dec 13, 2016
6aca12a
Typo correction and Recon README.md update
HarmJ0y Dec 13, 2016
7f10db7
Added spacing to prep for platyPS doc generation.
HarmJ0y Dec 13, 2016
0aaa23c
first take at platyPS doc generation
HarmJ0y Dec 13, 2016
e956bf4
First commit of mkdocs.yml for readthedocs.io
HarmJ0y Dec 13, 2016
fb90773
file extensions are important :)
HarmJ0y Dec 13, 2016
9033f2f
Another try at getting readthedocs.io working
HarmJ0y Dec 13, 2016
b78f164
someday I'll get this right...
HarmJ0y Dec 13, 2016
813eab4
maybe now?
HarmJ0y Dec 13, 2016
f4f5fb1
Added Set-DomainUserPassword to reset a particular user's password.
HarmJ0y Dec 13, 2016
f00e3fc
Added Set-DomainObjectOwner to modify an object's owner
HarmJ0y Dec 13, 2016
5da1774
updated mkdocs.yml
HarmJ0y Dec 13, 2016
7964823
Added documentation for PowerUp
HarmJ0y Dec 14, 2016
07ccc07
mods to Get-System for it to pass PSScriptAnalyzer
HarmJ0y Dec 14, 2016
85b374c
-Fixes for PSScriptAnalyzer compatibility
HarmJ0y Dec 14, 2016
7cdaa3c
For ./Antivirus/ :
HarmJ0y Dec 14, 2016
1980f40
For ./CodeExecution/ :
HarmJ0y Dec 14, 2016
a81faf3
For ./Mayhem/ :
HarmJ0y Dec 14, 2016
cf44439
For ./Persistence/ :
HarmJ0y Dec 14, 2016
9ed26d6
removed whitespace
HarmJ0y Dec 14, 2016
59e6f94
For ./ScriptModification/ :
HarmJ0y Dec 14, 2016
ad32d6c
For ./Recon/ :
HarmJ0y Dec 15, 2016
601ad0c
Logic bug fix in Get-DomainFileServer
HarmJ0y Dec 15, 2016
831dde1
Bug fix for the Find-DomainUserLocation bug fix :)
HarmJ0y Dec 15, 2016
9853900
Type fix.
HarmJ0y Dec 16, 2016
1916464
bug fix in Get-TokenInformation
HarmJ0y Dec 21, 2016
96ae5e3
type correction
HarmJ0y Dec 21, 2016
1118f53
Added "-InformationClass Type" to Get-TokenInformation to enumerate t…
HarmJ0y Dec 21, 2016
94438ed
Replaced Invoke-WScriptUACBypass with @enigma0x3's Invoke-EventVwrByp…
HarmJ0y Dec 21, 2016
d106093
Fix errors gathering the forest SID
mbrancato Jan 5, 2017
5500a7e
Fix for issue #170
HarmJ0y Jan 8, 2017
8552033
Merge pull request #205 from mbrancato/dev
HarmJ0y Jan 8, 2017
3f7a32d
Get-DomainSPNTicket/Invoke-Kerberoast now include 'real' user data in…
HarmJ0y Jan 9, 2017
215ec25
Bug fixes in Get-GPPPassword
HarmJ0y Jan 9, 2017
aecb0b5
Words :P
leechristensen Jan 10, 2017
e4b1930
Merge pull request #207 from leechristensen/patch-3
HarmJ0y Jan 10, 2017
9ea5c5b
Couple of fixes for Get-DomainSPNTicket
HarmJ0y Jan 10, 2017
ce19ebd
Merge branch 'dev' of github.com:PowerShellMafia/PowerSploit into dev
HarmJ0y Jan 10, 2017
e084329
Fixed KerberosPreauthNotRequired
leechristensen Jan 11, 2017
6c113b7
Fixed bug in Convert-ADName that output an array including null value…
HarmJ0y Jan 11, 2017
d4166f8
bug fix for Get-DomainObject/Get-DomainObjectACL
HarmJ0y Jan 11, 2017
fa1baa6
Parenthesis escaping for Get-DomainObject DN searches
HarmJ0y Jan 11, 2017
8a2e1da
Parenthesis for additional LDAP functions
HarmJ0y Jan 12, 2017
1dd560b
Merge pull request #210 from leechristensen/patch-3
HarmJ0y Jan 12, 2017
510cba8
Added displayname to the default filter set for Get-DomainObject[ACL]
HarmJ0y Jan 12, 2017
ea60b0e
Merge branch 'dev' of github.com:PowerShellMafia/PowerSploit into dev
HarmJ0y Jan 12, 2017
454e040
Standardized output from Find-InterestingDomainAcl
HarmJ0y Jan 12, 2017
bda533d
Merge pull request #1 from PowerShellMafia/dev
mbrancato Jan 16, 2017
6927a26
Fix for impersonation in Get-NetLocalGroup*
mbrancato Jan 16, 2017
445f7b2
Changed -KerberosPreauthNotRequired to -PreauthNotRequired
HarmJ0y Jan 17, 2017
c8cee64
Added Invoke-CompareAttributesForClass.ps1
Jan 23, 2017
bd6fe64
Cast DllCharacteristics to [Int]
FuzzySecurity Feb 13, 2017
f2a9cb2
The DFS subfunctions only accept a single $Domain
Apr 5, 2017
08b3062
Support for DNs containing commas
Apr 5, 2017
834a80f
Set explicit LDAP SecurityMask settings
leechristensen Apr 17, 2017
cb14cf1
Merge pull request #231 from leechristensen/patch-4
HarmJ0y Apr 26, 2017
0bbc9db
Merge pull request #227 from joncave/dfs_domain
HarmJ0y Apr 26, 2017
97382c2
Merge pull request #226 from joncave/dn_commas
HarmJ0y Apr 26, 2017
cfc0b64
Merge pull request #215 from api0cradle/master
HarmJ0y Apr 26, 2017
92e17e5
Merge pull request #214 from mbrancato/dev
HarmJ0y Apr 26, 2017
9f4e32e
Renamed Get-DomainPolicy to Get-DomainPolicyData and generalized the
HarmJ0y Apr 26, 2017
fc04f97
Generalized ACE creation and added LDAP logonhours conversion
leechristensen Apr 27, 2017
27747f9
Merge pull request #233 from leechristensen/patch-5
HarmJ0y Apr 28, 2017
0959882
Get-DomainGPO - fixed enumerations of 'enforced' GPOs, and
HarmJ0y Apr 28, 2017
2501e8e
Get-GPODelegation
MrAnde7son May 4, 2017
226c1c1
Host parsing extension for IP ranges
cfalta May 4, 2017
6a71a6e
Update PowerView.ps1
MrAnde7son May 7, 2017
f9b95c5
Fix build for import and run of Invoke-PrivescAudit
May 7, 2017
f8d2a34
fixed quotes
HarmJ0y May 9, 2017
5228976
Default Invoke-PrivEscAudit to return objects for parsing
hackjammer May 9, 2017
a78474a
Add Name alias to PowerUp object properties for easier parsing
hackjammer May 9, 2017
d12e151
increased PowerUp error checking
HarmJ0y May 20, 2017
6789187
Get-DomainPolicyData now returns proper object output instead of hash…
HarmJ0y May 20, 2017
0e2daae
Merge pull request #236 from MrAnde7son/patch-3
HarmJ0y May 24, 2017
786793c
Merge branch 'dev' of github.com:PowerShellMafia/PowerSploit into dev
HarmJ0y May 24, 2017
30c5177
-added parsing of the 'useraccountcontrol' property into human readab…
HarmJ0y May 24, 2017
783bff3
-Added "-GroupScope [DomainLocal/Global/Universal]" to Get-DomainGroup
HarmJ0y May 25, 2017
d9e9231
-Added negations to some -GroupScope and -GroupProperty values
HarmJ0y May 25, 2017
6889a8e
Fixed alias typo for Find-GPOComputerAdmin
byt3bl33d3r May 31, 2017
1bfe3a2
Updated Find-DomainObjectPropertyOutlier approach.
HarmJ0y Jun 13, 2017
0351663
-Added Get-DomainObjectAttributeHistory to retrieve attribute replica…
HarmJ0y Jun 13, 2017
d0e4e27
Convert-LDAPProperty now properly parses sidHistory with multiple values
HarmJ0y Jun 16, 2017
7e4d7ee
Added Sacl enumeration to Get-DomainObjectACL
HarmJ0y Jun 17, 2017
7dc41b6
For any "-Identity" values formatted as distinguishednames passed to …
HarmJ0y Jun 18, 2017
872f711
-Added the dynamic -UACFilter parameter that completes based on the $…
HarmJ0y Jun 19, 2017
b895866
+ Invalid Cast Fix
FuzzySecurity Jul 17, 2017
e47c52a
+ PSv2 Compatibility
FuzzySecurity Jul 17, 2017
fc43eb8
Typo fix
FuzzySecurity Jul 17, 2017
0bbf86e
Merge pull request #241 from byt3bl33d3r/dev
FuzzySecurity Jul 17, 2017
41cad0e
Fix for edge case where System.Core is not loaded
FuzzySecurity Jul 18, 2017
7a3e16a
+Region check on Find-DomainLocalGroupMember
FuzzySecurity Jul 22, 2017
d5c0abc
Fix for profile cleanup
FuzzySecurity Jul 22, 2017
b038f09
Typo fix
FuzzySecurity Jul 22, 2017
1950a16
+Version check fix
FuzzySecurity Aug 9, 2017
3d0d32d
Path array fix for Get-ModifiablePath
FuzzySecurity Aug 10, 2017
bf652bc
Adds dlls from knowndll paths to knowndlls
Sep 8, 2017
6eb3c6f
Merge branch 'dev' of github.com:PowerShellMafia/PowerSploit into dev
Sep 8, 2017
0a89499
Adds tolower() as it was dropping .DLL files in my local
Sep 8, 2017
fcc35ac
Add Remove-DomainGroupMember function
andyrobbins Sep 17, 2017
1864095
Merge pull request #254 from andyrobbins/patch-1
HarmJ0y Sep 17, 2017
41cef58
Merge pull request #253 from davehull/dev
HarmJ0y Sep 17, 2017
e24d642
Merge pull request #243 from cfalta/master
HarmJ0y Sep 17, 2017
428d906
Merge pull request #238 from hackjammer/dev
HarmJ0y Sep 17, 2017
a4a3ae5
Fixed New-ADObjectAccessControlEntry so -PrincipalIdentity now accept…
HarmJ0y Sep 17, 2017
35452ce
Fixed Kerberoasting output so it at least cracks now for john's new f…
HarmJ0y Sep 17, 2017
fe7746f
Added Remove-DomainObjectAcl
HarmJ0y Sep 17, 2017
c5eb994
corrected verbose output for some PowerView functions
HarmJ0y Sep 17, 2017
f6e6c09
Added mod to Get-DomainSPNTicket from @leechristensen to better parse…
HarmJ0y Oct 16, 2017
50e18ef
-changed default enumeration method for Get-DomainTrust to LDAP
HarmJ0y Oct 16, 2017
398b0f2
-Redid the default DC bindserver logic for Get-DomainSearcher
HarmJ0y Oct 30, 2017
be932ce
re-added -Domain to Get-DomainForeignUser/GroupMember
HarmJ0y Nov 12, 2017
f94a5d2
swapped default kerberoasting output formats
HarmJ0y Jul 2, 2018
d943001
Updated README.md
HarmJ0y Aug 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 86 additions & 86 deletions AntivirusBypass/Find-AVSignature.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ function Find-AVSignature

Locate tiny AV signatures.

PowerSploit Function: Find-AVSignature
Authors: Chris Campbell (@obscuresec) & Matt Graeber (@mattifestation)
License: BSD 3-Clause
Required Dependencies: None
Optional Dependencies: None
PowerSploit Function: Find-AVSignature
Authors: Chris Campbell (@obscuresec) & Matt Graeber (@mattifestation)
License: BSD 3-Clause
Required Dependencies: None
Optional Dependencies: None

.DESCRIPTION

Expand Down Expand Up @@ -37,19 +37,19 @@ Optionally specifies the directory to write the binaries to.

.PARAMETER BufferLen

Specifies the length of the file read buffer . Defaults to 64KB.
Specifies the length of the file read buffer . Defaults to 64KB.

.PARAMETER Force

Forces the script to continue without confirmation.
Forces the script to continue without confirmation.

.EXAMPLE

PS C:\> Find-AVSignature -Startbyte 0 -Endbyte max -Interval 10000 -Path c:\test\exempt\nc.exe
PS C:\> Find-AVSignature -StartByte 10000 -EndByte 20000 -Interval 1000 -Path C:\test\exempt\nc.exe -OutPath c:\test\output\run2 -Verbose
PS C:\> Find-AVSignature -StartByte 16000 -EndByte 17000 -Interval 100 -Path C:\test\exempt\nc.exe -OutPath c:\test\output\run3 -Verbose
PS C:\> Find-AVSignature -StartByte 16800 -EndByte 16900 -Interval 10 -Path C:\test\exempt\nc.exe -OutPath c:\test\output\run4 -Verbose
PS C:\> Find-AVSignature -StartByte 16890 -EndByte 16900 -Interval 1 -Path C:\test\exempt\nc.exe -OutPath c:\test\output\run5 -Verbose
Find-AVSignature -Startbyte 0 -Endbyte max -Interval 10000 -Path c:\test\exempt\nc.exe
Find-AVSignature -StartByte 10000 -EndByte 20000 -Interval 1000 -Path C:\test\exempt\nc.exe -OutPath c:\test\output\run2 -Verbose
Find-AVSignature -StartByte 16000 -EndByte 17000 -Interval 100 -Path C:\test\exempt\nc.exe -OutPath c:\test\output\run3 -Verbose
Find-AVSignature -StartByte 16800 -EndByte 16900 -Interval 10 -Path C:\test\exempt\nc.exe -OutPath c:\test\output\run4 -Verbose
Find-AVSignature -StartByte 16890 -EndByte 16900 -Interval 1 -Path C:\test\exempt\nc.exe -OutPath c:\test\output\run5 -Verbose

.NOTES

Expand All @@ -63,10 +63,12 @@ http://www.exploit-monday.com/
http://heapoverflow.com/f0rums/project.php?issueid=34&filter=changes&page=2
#>

[CmdletBinding()] Param(
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')]
[CmdletBinding()]
Param(
[Parameter(Mandatory = $True)]
[ValidateRange(0,4294967295)]
[UInt32]
[UInt32]
$StartByte,

[Parameter(Mandatory = $True)]
Expand All @@ -75,112 +77,110 @@ http://heapoverflow.com/f0rums/project.php?issueid=34&filter=changes&page=2

[Parameter(Mandatory = $True)]
[ValidateRange(0,4294967295)]
[UInt32]
[UInt32]
$Interval,

[String]
[ValidateScript({Test-Path $_ })]
[ValidateScript({Test-Path $_ })]
$Path = ($pwd.path),

[String]
$OutPath = ($pwd),


[ValidateRange(1,2097152)]
[UInt32]
$BufferLen = 65536,


[ValidateRange(1,2097152)]
[UInt32]
$BufferLen = 65536,

[Switch] $Force

)

#test variables
if (!(Test-Path $Path)) {Throw "File path not found"}
$Response = $True
if (!(Test-Path $OutPath)) {
if ($Force -or ($Response = $psCmdlet.ShouldContinue("The `"$OutPath`" does not exist! Do you want to create the directory?",""))){new-item ($OutPath)-type directory}
}
}
if (!$Response) {Throw "Output path not found"}
if (!(Get-ChildItem $Path).Exists) {Throw "File not found"}
[Int32] $FileSize = (Get-ChildItem $Path).Length
if ($StartByte -gt ($FileSize - 1) -or $StartByte -lt 0) {Throw "StartByte range must be between 0 and $Filesize"}
[Int32] $MaximumByte = (($FileSize) - 1)
if ($EndByte -ceq "max") {$EndByte = $MaximumByte}
#Recast $Endbyte into an Integer so that it can be compared properly.
[Int32]$EndByte = $EndByte
#If $Endbyte is greater than the file Length, use $MaximumByte.

#Recast $Endbyte into an Integer so that it can be compared properly.
[Int32]$EndByte = $EndByte

#If $Endbyte is greater than the file Length, use $MaximumByte.
if ($EndByte -gt $FileSize) {$EndByte = $MaximumByte}

#If $Endbyte is less than the $StartByte, use 1 Interval past $StartByte.
if ($EndByte -lt $StartByte) {$EndByte = $StartByte + $Interval}

Write-Verbose "StartByte: $StartByte"
Write-Verbose "EndByte: $EndByte"

#If $Endbyte is less than the $StartByte, use 1 Interval past $StartByte.
if ($EndByte -lt $StartByte) {$EndByte = $StartByte + $Interval}

Write-Verbose "StartByte: $StartByte"
Write-Verbose "EndByte: $EndByte"

#find the filename for the output name
[String] $FileName = (Split-Path $Path -leaf).Split('.')[0]

#Calculate the number of binaries
[Int32] $ResultNumber = [Math]::Floor(($EndByte - $StartByte) / $Interval)
if (((($EndByte - $StartByte) % $Interval)) -gt 0) {$ResultNumber = ($ResultNumber + 1)}

#Prompt user to verify parameters to avoid writing binaries to the wrong directory
$Response = $True
if ( $Force -or ( $Response = $psCmdlet.ShouldContinue("This script will result in $ResultNumber binaries being written to `"$OutPath`"!",
"Do you want to continue?"))){}
if (!$Response) {Return}
Write-Verbose "This script will now write $ResultNumber binaries to `"$OutPath`"."

Write-Verbose "This script will now write $ResultNumber binaries to `"$OutPath`"."
[Int32] $Number = [Math]::Floor($Endbyte/$Interval)

#Create a Read Buffer and Stream.
#Note: The Filestream class takes advantage of internal .NET Buffering. We set the default internal buffer to 64KB per http://research.microsoft.com/pubs/64538/tr-2004-136.doc.
[Byte[]] $ReadBuffer=New-Object byte[] $BufferLen
[System.IO.FileStream] $ReadStream = New-Object System.IO.FileStream($Path, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::Read, $BufferLen)

#write out the calculated number of binaries
[Int32] $i = 0
for ($i -eq 0; $i -lt $ResultNumber + 1 ; $i++)
{
# If this is the Final Binary, use $EndBytes, Otherwise calculate based on the Interval
if ($i -eq $ResultNumber) {[Int32]$SplitByte = $EndByte}
else {[Int32] $SplitByte = (($StartByte) + (($Interval) * ($i)))}

Write-Verbose "Byte 0 -> $($SplitByte)"

#Reset ReadStream to beginning of file
$ReadStream.Seek(0, [System.IO.SeekOrigin]::Begin) | Out-Null

#Build a new FileStream for Writing
[String] $outfile = Join-Path $OutPath "$($FileName)_$($SplitByte).bin"
[System.IO.FileStream] $WriteStream = New-Object System.IO.FileStream($outfile, [System.IO.FileMode]::Create, [System.IO.FileAccess]::Write, [System.IO.FileShare]::None, $BufferLen)

[Int32] $BytesLeft = $SplitByte
Write-Verbose "$($WriteStream.name)"

#Write Buffer Length to the Writing Stream until the bytes left is smaller than the buffer
while ($BytesLeft -gt $BufferLen){
[Int32]$count = $ReadStream.Read($ReadBuffer, 0, $BufferLen)
$WriteStream.Write($ReadBuffer, 0, $count)
$BytesLeft = $BytesLeft - $count
}

#Write the remaining bytes to the file
do {
[Int32]$count = $ReadStream.Read($ReadBuffer, 0, $BytesLeft)
$WriteStream.Write($ReadBuffer, 0, $count)
$BytesLeft = $BytesLeft - $count
}
until ($BytesLeft -eq 0)
$WriteStream.Close()
$WriteStream.Dispose()

#Create a Read Buffer and Stream.
#Note: The Filestream class takes advantage of internal .NET Buffering. We set the default internal buffer to 64KB per http://research.microsoft.com/pubs/64538/tr-2004-136.doc.
[Byte[]] $ReadBuffer=New-Object byte[] $BufferLen
[System.IO.FileStream] $ReadStream = New-Object System.IO.FileStream($Path, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::Read, $BufferLen)

#write out the calculated number of binaries
[Int32] $i = 0
for ($i -eq 0; $i -lt $ResultNumber + 1 ; $i++)
{
# If this is the Final Binary, use $EndBytes, Otherwise calculate based on the Interval
if ($i -eq $ResultNumber) {[Int32]$SplitByte = $EndByte}
else {[Int32] $SplitByte = (($StartByte) + (($Interval) * ($i)))}

Write-Verbose "Byte 0 -> $($SplitByte)"

#Reset ReadStream to beginning of file
$ReadStream.Seek(0, [System.IO.SeekOrigin]::Begin) | Out-Null

#Build a new FileStream for Writing
[String] $outfile = Join-Path $OutPath "$($FileName)_$($SplitByte).bin"
[System.IO.FileStream] $WriteStream = New-Object System.IO.FileStream($outfile, [System.IO.FileMode]::Create, [System.IO.FileAccess]::Write, [System.IO.FileShare]::None, $BufferLen)

[Int32] $BytesLeft = $SplitByte
Write-Verbose "$($WriteStream.name)"

#Write Buffer Length to the Writing Stream until the bytes left is smaller than the buffer
while ($BytesLeft -gt $BufferLen){
[Int32]$count = $ReadStream.Read($ReadBuffer, 0, $BufferLen)
$WriteStream.Write($ReadBuffer, 0, $count)
$BytesLeft = $BytesLeft - $count
}

#Write the remaining bytes to the file
do {
[Int32]$count = $ReadStream.Read($ReadBuffer, 0, $BytesLeft)
$WriteStream.Write($ReadBuffer, 0, $count)
$BytesLeft = $BytesLeft - $count
}
Write-Verbose "Files written to disk. Flushing memory."
$ReadStream.Dispose()

#During testing using large binaries, memory usage was excessive so lets fix that
[System.GC]::Collect()
Write-Verbose "Completed!"
until ($BytesLeft -eq 0)
$WriteStream.Close()
$WriteStream.Dispose()
}
Write-Verbose "Files written to disk. Flushing memory."
$ReadStream.Dispose()

#During testing using large binaries, memory usage was excessive so lets fix that
[System.GC]::Collect()
Write-Verbose "Completed!"
}
Loading