-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a99bac
commit 1f79b5a
Showing
22 changed files
with
341 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: runner CI build | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'runner/**' | ||
pull_request: | ||
branches: [ "master" ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Run a one-line script | ||
shell : pwsh | ||
run: | | ||
./runner/build.ps1 -OutputFile esh.exe | ||
./runner/build.ps1 -OutputFile esh-SigThief.exe -SigThief | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: | | ||
esh.exe | ||
esh-SigThief.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
@pwsh -nologo -File "%~dp0\install.ps1" -FromScript %* | ||
@pwsh -nologo -File "%~dp0\install.ps1" %* | ||
@exit /b %ERRORLEVEL% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,99 @@ | ||
[CmdletBinding()]param ($OutputFile = "$PSScriptRoot/esh.exe") | ||
[CmdletBinding()] | ||
param ( | ||
$OutputFile = "$PWD/esh.exe", | ||
[Parameter(ParameterSetName = 'SigThief')][switch]$SigThief = $false, | ||
[switch]$DetailedLog = $false | ||
) | ||
DynamicParam { | ||
if ($SigThief) { | ||
$SigThiefParam = New-Object System.Management.Automation.RuntimeDefinedParameter('SigThiefFile', [string], ([System.Management.Automation.ParameterAttribute]@{HelpMessage = 'The file to steal signature from.' })) | ||
$RuntimeParamDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary | ||
$RuntimeParamDictionary.Add('SigThiefFile', $SigThiefParam) | ||
return $RuntimeParamDictionary | ||
} | ||
} | ||
|
||
process { | ||
function GetToolFromGit($ToolName, $ToolAuthor="steve02081504"){ | ||
Write-Host "Downloading $ToolAuthor/$ToolName..." | ||
try{ | ||
if (Get-Command git -ErrorAction Ignore) { | ||
git clone https://github.com/$ToolAuthor/$ToolName "$PSScriptRoot/tools/$ToolName" | ||
} | ||
else{ | ||
Invoke-WebRequest -Uri https://github.com/$ToolAuthor/$ToolName/archive/refs/heads/master.zip -OutFile "$PSScriptRoot/tools/$ToolName.zip" | ||
Expand-Archive -Path "$PSScriptRoot/tools/$ToolName.zip" -DestinationPath "$PSScriptRoot/tools" | ||
Move-Item "$PSScriptRoot/tools/$ToolName-master" "$PSScriptRoot/tools/$ToolName" | ||
Remove-Item "$PSScriptRoot/tools/$ToolName.zip" | ||
} | ||
} catch { | ||
Write-Warning "Download failed." | ||
Exit | ||
} | ||
Write-Host "Download complete." | ||
} | ||
if (-not (Test-Path "$PSScriptRoot/tools/ps2exe/ps2exe.ps1")) { | ||
if(Get-Command ps2exe -ErrorAction Ignore){ | ||
Write-Host "Existing ps2exe doesn't meet the functionality requirements needed for a build, downloading target fork..." | ||
} | ||
GetToolFromGit ps2exe | ||
} | ||
if (-not (Test-Path "$PSScriptRoot/tools/psminnifyer/psminnifyer.ps1")) { | ||
GetToolFromGit psminnifyer | ||
} | ||
& $PSScriptRoot/tools/ps2exe/ps2exe.ps1 $PSScriptRoot/main.ps1 "$PSScriptRoot/build/esh.exe" -NoConsole ` | ||
-Minifyer { $_ | &$PSScriptRoot/tools/psminnifyer/psminnifyer.ps1 } ` | ||
-TempDir "$PSScriptRoot/build" -iconFile $PSScriptRoot/../img/esh.ico ` | ||
-title 'E-Shell' -description 'E-Shell' -version '1960.7.17.13' ` | ||
-company 'E-tek' -product 'E-Sh' -copyright '(c) E-tek Corporation. All rights reserved.' | Out-Default | ||
|
||
$ConfuserFile = if (Test-Path "$PSScriptRoot/tools/ConfuserEx/Confuser.CLI.exe") { "$PSScriptRoot/tools/ConfuserEx/Confuser.CLI.exe" } | ||
else { (Get-Command Confuser.CLI -ErrorAction Ignore).Source } | ||
if(-not $ConfuserFile){ | ||
Write-Host "Confuser.CLI not found. Downloading..." | ||
try{ | ||
Invoke-WebRequest https://github.com/mkaring/ConfuserEx/releases/latest/download/ConfuserEx-CLI.zip -OutFile $PSScriptRoot/tools/ConfuserEx.zip | ||
New-Item -ItemType Directory -Force -Path $PSScriptRoot/tools/ConfuserEx | Out-Null | ||
Expand-Archive -Path $PSScriptRoot/tools/ConfuserEx.zip -DestinationPath $PSScriptRoot/tools/ConfuserEx | ||
} catch { | ||
Write-Warning "Download failed.. Skipping obfuscation. | ||
Download it from https://github.com/mkaring/ConfuserEx | ||
and put it in the environment path or in $PSScriptRoot/tools/ConfuserEx" | ||
} | ||
if (Test-Path "$PSScriptRoot/tools/ConfuserEx/Confuser.CLI.exe") { | ||
$ConfuserFile = "$PSScriptRoot/tools/ConfuserEx/Confuser.CLI.exe" | ||
Write-Host "Download complete." | ||
} | ||
} | ||
if($ConfuserFile){ | ||
$OutputLength = (Get-Item "$PSScriptRoot/build/esh.exe").Length | ||
& $ConfuserFile -n -o="$PSScriptRoot/build" "$PSScriptRoot/build/esh.exe" | Out-Null #太长了 | ||
$ObfusLength = (Get-Item "$PSScriptRoot/build/esh.exe").Length | ||
if($ObfusLength -ne $OutputLength){ | ||
Write-Host "Obfuscation complete -> $ObfusLength bytes" | ||
} | ||
elseif($LASTEXITCODE -eq 1){ | ||
Write-Warning "Obfuscation failed." | ||
} | ||
} | ||
|
||
if (-not (Get-Module -ListAvailable ps2exe)) { | ||
Install-Module ps2exe | ||
if ($SigThief) { | ||
if (-not (Test-Path "$PSScriptRoot/tools/SigThief/sigthief.py")) { | ||
GetToolFromGit SigThief | ||
} | ||
if (-not $SigThiefFile) { | ||
$SigThiefFile = "$env:windir\explorer.exe" | ||
} | ||
if (Get-Command python -ErrorAction Ignore) { | ||
python "$PSScriptRoot/tools/SigThief/sigthief.py" -i $SigThiefFile -t "$PSScriptRoot/build/esh.exe" -o $OutputFile | ||
} | ||
else { | ||
Write-Warning "Python not found. Skipping sigthief." | ||
Copy-Item "$PSScriptRoot/build/esh.exe" $OutputFile | ||
} | ||
} | ||
else{ | ||
Copy-Item "$PSScriptRoot/build/esh.exe" $OutputFile | ||
Write-Host "Skipping sigature theft." | ||
} | ||
} | ||
Invoke-ps2exe $PSScriptRoot/main.ps1 $OutputFile -NoConsole -iconFile $PSScriptRoot/../img/esh.ico -title 'E-Shell' -description 'E-Shell' -version '1960.7.17.13' -company 'E-tek' -product 'E-Sh' -copyright '(c) E-tek Corporation. All rights reserved.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/esh.exe | ||
/esh.pdb | ||
/main.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[.ShellClassInfo] | ||
IconResource=C:\WINDOWS\System32\SHELL32.dll,261 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/PS2EXE | ||
/psminnifyer | ||
/SigThief | ||
/ConfuserEx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[.ShellClassInfo] | ||
IconResource=C:\WINDOWS\System32\SHELL32.dll,71 |
Oops, something went wrong.