-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1042 from Ana06/obfuscator-io-deobfuscator
Introduce `VM-Install-Node-Tool` and add `obfuscator-io-deobfuscator.vm`
- Loading branch information
Showing
5 changed files
with
50 additions
and
10 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 |
---|---|---|
|
@@ -454,6 +454,26 @@ function VM-Install-From-Zip { | |
} | ||
} | ||
|
||
function VM-Install-Node-Tool { | ||
[CmdletBinding()] | ||
[OutputType([System.Object[]])] | ||
Param | ||
( | ||
[Parameter(Mandatory=$true, Position=0)] | ||
[string] $toolName, | ||
[Parameter(Mandatory=$true, Position=1)] | ||
[string] $category, | ||
[Parameter(Mandatory=$false)] | ||
[string] $arguments | ||
) | ||
try { | ||
npm install -g $toolName --no-update-notifier | ||
VM-Install-Shortcut -toolName $toolName -category $category -arguments "$toolName $arguments" -powershell | ||
} catch { | ||
VM-Write-Log-Exception $_ | ||
} | ||
} | ||
|
||
function VM-Install-Node-Tool-From-Zip { | ||
[CmdletBinding()] | ||
[OutputType([System.Object[]])] | ||
|
@@ -473,17 +493,10 @@ function VM-Install-Node-Tool-From-Zip { | |
[Parameter(Mandatory=$false)] | ||
[bool] $innerFolder=$true # Default to true as most node apps are GH repos (ZIP with inner folder) | ||
) | ||
# Install dependencies with npm when running shortcut as we ignore errors below | ||
$powershellCommand = "npm install; node $command" | ||
|
||
$toolDir = (VM-Install-From-Zip $toolName $category $zipUrl $zipSha256 -innerFolder $innerFolder -powershellCommand $powershellCommand)[0] | ||
$toolDir = (VM-Install-From-Zip $toolName $category $zipUrl $zipSha256 -innerFolder $innerFolder -powershellCommand "node $command")[0] | ||
|
||
# Prevent the following warning from failing the package: "npm WARN deprecated [email protected]" | ||
$ErrorActionPreference = 'Continue' | ||
# Get absolute path as npm may not be in PATH until Powershell is restarted | ||
$npmPath = Join-Path ${Env:ProgramFiles} "\nodejs\npm.cmd" -Resolve | ||
# Install tool dependencies with npm | ||
Set-Location $toolDir; & "$npmPath" install | Out-Null | ||
Set-Location $toolDir; npm install --no-update-notifier | ||
} | ||
|
||
# This functions returns $executablePath | ||
|
13 changes: 13 additions & 0 deletions
13
packages/obfuscator-io-deobfuscator.vm/obfuscator-io-deobfuscator.vm.nuspec
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,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> | ||
<metadata> | ||
<id>obfuscator-io-deobfuscator.vm</id> | ||
<version>0.0.0.20240514</version> | ||
<authors>ben-sb</authors> | ||
<description>A deobfuscator for scripts obfuscated by Obfuscator.io</description> | ||
<dependencies> | ||
<dependency id="common.vm" version="0.0.0.20240514"/> | ||
<dependency id="nodejs.vm" /> | ||
</dependencies> | ||
</metadata> | ||
</package> |
7 changes: 7 additions & 0 deletions
7
packages/obfuscator-io-deobfuscator.vm/tools/chocolateyinstall.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,7 @@ | ||
$ErrorActionPreference = 'Stop' | ||
Import-Module vm.common -Force -DisableNameChecking | ||
|
||
$toolName = 'obfuscator-io-deobfuscator' | ||
$category = 'Javascript' | ||
|
||
VM-Install-Node-Tool -toolName $toolName -category $category -arguments "--help" |
7 changes: 7 additions & 0 deletions
7
packages/obfuscator-io-deobfuscator.vm/tools/chocolateyuninstall.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,7 @@ | ||
$ErrorActionPreference = 'Continue' | ||
Import-Module vm.common -Force -DisableNameChecking | ||
|
||
$toolName = 'obfuscator-io-deobfuscator' | ||
$category = 'Javascript' | ||
|
||
VM-Remove-Tool-Shortcut $toolName $category |