-
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.
Co-authored-by: Ana Martinez Gomez <[email protected]>
- Loading branch information
Showing
8 changed files
with
833 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> | ||
<metadata> | ||
<id>internet_detector.vm</id> | ||
<version>1.0.0</version> | ||
<authors>Elliot Chernofsky and Ana Martinez Gomez</authors> | ||
<description>Tool that changes the background and a taskbar icon if it detects internet connectivity</description> | ||
<dependencies> | ||
<dependency id="common.vm" version="0.0.0.20240821" /> | ||
<dependency id="libraries.python3.vm" version="0.0.0.20240726" /> | ||
<dependency id="fakenet-ng.vm" version="3.2.0.20240425" /> | ||
</dependencies> | ||
</metadata> | ||
</package> |
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,37 @@ | ||
$ErrorActionPreference = 'Stop' | ||
Import-Module vm.common -Force -DisableNameChecking | ||
|
||
$toolName = 'internet_detector' | ||
$category = 'Utilities' | ||
$packageToolDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" | ||
|
||
# Create tool directory | ||
$toolDir = Join-Path ${Env:RAW_TOOLS_DIR} $toolName | ||
New-Item -Path $toolDir -ItemType Directory -Force -ea 0 | ||
VM-Assert-Path $toolDir | ||
|
||
# Install dependency for windows api | ||
VM-Pip-Install "pywin32" | ||
# Install dependency for creating python executable | ||
VM-Pip-Install "pyinstaller" | ||
|
||
Start-Process -FilePath 'cmd.exe' -ArgumentList "/c pyinstaller --onefile -w --distpath $toolDir --workpath $packageToolDir --specpath $packageToolDir $packageToolDir\internet_detector.pyw" -Wait | ||
|
||
# Move images to %VM_COMMON_DIR% directory | ||
$imagesPath = Join-Path $packageToolDir "images" | ||
Copy-Item "$imagesPath\*" ${Env:VM_COMMON_DIR} -Force | ||
|
||
VM-Install-Shortcut -toolName $toolName -category $category -executablePath "$toolDir/$toolName.exe" | ||
|
||
# TODO - Uncomment when FakeNet BlackList for DNS is fixed/addressed. https://github.com/mandiant/flare-fakenet-ng/issues/190 | ||
# # Create scheduled task for tool to run every 2 minutes. | ||
# $action = New-ScheduledTaskAction -Execute $rawToolPath | ||
# $trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 2) | ||
# Register-ScheduledTask -Action $action -Trigger $trigger -TaskName 'Internet Detector' -Force | ||
|
||
# Copy updated `default.ini` with tool added to ProcessBlackList to FakeNet Config Directory | ||
$fakenetConfigDir = Join-Path ${Env:UserProfile} "Desktop\fakenet_logs.lnk" | ||
if (Test-Path $fakenetConfigDir) { # Check if the shortcut exists | ||
$targetPath = (New-Object -ComObject WScript.Shell).CreateShortcut($fakenetConfigDir).TargetPath | ||
Copy-Item "$packageToolDir\default.ini" -Destination $targetPath | ||
} |
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,8 @@ | ||
$ErrorActionPreference = 'Continue' | ||
Import-Module vm.common -Force -DisableNameChecking | ||
|
||
$toolName = 'internet_detector' | ||
$category = 'Utilities' | ||
|
||
VM-Uninstall $toolName $category | ||
Unregister-ScheduledTask -TaskName 'Internet Detector' -Confirm:$false |
Oops, something went wrong.