@@ -5,6 +5,15 @@ $toolName = 'internet_detector'
5
5
$category = ' Networking'
6
6
$packageToolDir = " $ ( Split-Path - parent $MyInvocation.MyCommand.Definition ) "
7
7
8
+ # Modify fakenet's configuration to ignore the internet detector traffic
9
+ $fakenetConfig = " $Env: RAW_TOOLS_DIR \fakenet\fakenet3.3\configs\config.ini"
10
+ VM- Assert-Path $fakenetConfig
11
+
12
+ $IcmpID = Get-Random - Maximum 0x10000
13
+ $config = Get-Content - Path $fakenetConfig
14
+ $config = $config -replace ' ^.*BlackListIDsICMP.*$' , " BlackListIDsICMP: $IcmpID "
15
+ Set-Content - Path $fakenetConfig - Value $config - Encoding UTF8 - Force
16
+
8
17
# Create tool directory
9
18
$toolDir = Join-Path ${Env: RAW_TOOLS_DIR} $toolName
10
19
New-Item - Path $toolDir - ItemType Directory - Force - ea 0
@@ -14,8 +23,15 @@ VM-Assert-Path $toolDir
14
23
$dependencies = " pyinstaller==6.11.1,pywin32==308,icmplib==3.0.4"
15
24
VM- Pip- Install $dependencies
16
25
26
+ # Set the ICMP ID at the tool script
27
+ $scriptPath = " $packageToolDir \internet_detector.pyw"
28
+ $tempScript = Join-Path ${Env: TEMP} " temp_$ ( [guid ]::NewGuid()) "
29
+ $script = Get-Content - Path $scriptPath
30
+ $script = $script -replace ' ^ICMP_ID.*$' , " ICMP_ID = $IcmpID "
31
+ Set-Content - Path $tempScript - Value $script - Encoding UTF8 - Force
32
+
17
33
# This wrapper is needed because PyInstaller emits an error when running as admin and this mitigates the issue.
18
- Start-Process - FilePath ' cmd.exe' - WorkingDirectory $toolDir - ArgumentList " /c pyinstaller --onefile -w --log-level FATAL --distpath $toolDir --workpath $packageToolDir --specpath $packageToolDir $packageToolDir \internet_detector.pyw " - Wait
34
+ Start-Process - FilePath ' cmd.exe' - WorkingDirectory " $toolDir " - ArgumentList " /c pyinstaller --onefile -w --log-level FATAL --distpath `" $toolDir `" --workpath `" $packageToolDir `" --specpath `" $packageToolDir `" `" $tempScript `" " - Wait
19
35
20
36
# Move images to %VM_COMMON_DIR% directory
21
37
$imagesPath = Join-Path $packageToolDir " images"
0 commit comments