|
1 | 1 | # Install Npcap on the machine.
|
2 | 2 |
|
3 | 3 | # Config:
|
4 |
| -$npcap_oem_file = "npcap-0.99-r9-oem.exe" |
| 4 | +$npcap_oem_file = "npcap-0.9997-oem.exe" |
5 | 5 |
|
6 | 6 | # Note: because we need the /S option (silent), this script has two cases:
|
7 | 7 | # - The script is runned from a master build, then use the secure variable 'npcap_oem_key' which will be available
|
8 | 8 | # to decode the very recent npcap install oem file and use it
|
9 | 9 | # - The script is runned from a PR, then use the provided archived 0.96 version, which is the last public one to
|
10 | 10 | # provide support for the /S option
|
11 | 11 |
|
12 |
| -Try |
13 |
| -{ |
14 |
| - # Check that the key is defined (build mode) |
| 12 | +if (Test-Path Env:npcap_oem_key){ # Key is here: on master |
| 13 | + echo "Using Npcap OEM version" |
| 14 | + # Unpack the key |
15 | 15 | $user, $pass = (Get-ChildItem Env:npcap_oem_key).Value.replace("`"", "").split(",")
|
16 | 16 | if(!$user -Or !$pass){
|
17 | 17 | Throw (New-Object System.Exception)
|
|
25 | 25 | $secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
|
26 | 26 | $credential = New-Object System.Management.Automation.PSCredential($user, $secpasswd)
|
27 | 27 | Invoke-WebRequest -uri (-join("https://nmap.org/npcap/oem/dist/",$npcap_oem_file)) -OutFile $file -Headers $headers -Credential $credential
|
28 |
| -} |
29 |
| -Catch |
30 |
| -{ |
| 28 | +} else { # No key: PRs |
| 29 | + echo "Using backup 0.96" |
31 | 30 | $file = $PSScriptRoot+"\npcap-0.96.exe"
|
32 | 31 | # Download the 0.96 file from nmap servers
|
33 | 32 | wget "https://nmap.org/npcap/dist/npcap-0.96.exe" -UseBasicParsing -OutFile $file
|
|
40 | 39 | echo "Checksums matches !"
|
41 | 40 | }
|
42 | 41 | }
|
43 |
| -echo "Installing:" |
44 |
| -echo $file |
| 42 | +echo ('Installing: ' + $file) |
45 | 43 |
|
46 | 44 | # Run installer
|
47 | 45 | Start-Process $file -ArgumentList "/loopback_support=yes /S" -wait
|
48 |
| -echo "Npcap installation completed" |
| 46 | +if($?) { |
| 47 | + echo "Npcap installation completed" |
| 48 | +} |
0 commit comments