Skip to content

Commit 6126bcb

Browse files
authored
Merge pull request clong#890 from xx4h/fix-current-problems
Fix current problems
2 parents 70fb1ec + d68447b commit 6126bcb

File tree

9 files changed

+146
-11
lines changed

9 files changed

+146
-11
lines changed

Vagrant/Vagrantfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Vagrant.configure("2") do |config|
6565
cfg.vm.provision "shell", path: "scripts/download_palantir_wef.ps1", privileged: false
6666
cfg.vm.provision "shell", path: "scripts/install-utilities.ps1", privileged: false
6767
cfg.vm.provision "shell", path: "scripts/install-redteam.ps1", privileged: false
68+
cfg.vm.provision "file", source: "files/choco-winpcap", destination: "choco-winpcap"
6869
cfg.vm.provision "shell", path: "scripts/install-choco-extras.ps1", privileged: false
6970
cfg.vm.provision "shell", path: "scripts/install-osquery.ps1", privileged: false
7071
cfg.vm.provision "shell", path: "scripts/install-sysinternals.ps1", privileged: false
@@ -137,6 +138,7 @@ Vagrant.configure("2") do |config|
137138
cfg.vm.provision "shell", path: "scripts/install-utilities.ps1", privileged: false
138139
cfg.vm.provision "shell", path: "scripts/install-redteam.ps1", privileged: false
139140
cfg.vm.provision "shell", path: "scripts/install-evtx-attack-samples.ps1", privileged: false
141+
cfg.vm.provision "file", source: "files/choco-winpcap", destination: "choco-winpcap"
140142
cfg.vm.provision "shell", path: "scripts/install-choco-extras.ps1", privileged: false
141143
cfg.vm.provision "shell", path: "scripts/install-osquery.ps1", privileged: false
142144
cfg.vm.provision "shell", path: "scripts/install-sysinternals.ps1", privileged: false
@@ -196,6 +198,7 @@ Vagrant.configure("2") do |config|
196198
cfg.vm.provision "shell", inline: 'wevtutil el | Select-String -notmatch "Microsoft-Windows-LiveId" | Foreach-Object {wevtutil cl "$_"}', privileged: false
197199
cfg.vm.provision "shell", path: "scripts/install-utilities.ps1", privileged: false
198200
cfg.vm.provision "shell", path: "scripts/install-redteam.ps1", privileged: false
201+
cfg.vm.provision "file", source: "files/choco-winpcap", destination: "choco-winpcap"
199202
cfg.vm.provision "shell", path: "scripts/install-choco-extras.ps1", privileged: false
200203
cfg.vm.provision "shell", path: "scripts/install-osquery.ps1", privileged: false
201204
cfg.vm.provision "shell", path: "scripts/install-sysinternals.ps1", privileged: false
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
3+
<metadata>
4+
<id>WinPcap</id>
5+
<version>4.1.3.20161116</version>
6+
<title>WinPcap</title>
7+
<authors>NetGroup, CACE Technologies</authors>
8+
<owners>chocolatey</owners>
9+
<licenseUrl>http://www.winpcap.org/misc/copyright.htm</licenseUrl>
10+
<projectUrl>http://www.winpcap.org/</projectUrl>
11+
<iconUrl>https://cdn.rawgit.com/chocolatey/chocolatey-coreteampackages/b689d60fd7922e46e600536569805cc1785b6bf1/icons/winpcap.png</iconUrl>
12+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
13+
<description>WinPcap is the industry-standard tool for link-layer network access in Windows environments: it allows applications to capture and transmit network packets bypassing the protocol stack, and has additional useful features, including kernel-level packet filtering, a network statistics engine and support for remote packet capture.
14+
15+
## Notes
16+
17+
- This package uses an Autohotkey script for unattended as vendor removed silent installation options.</description>
18+
<releaseNotes>https://www.winpcap.org/misc/changelog.htm</releaseNotes>
19+
<copyright>NetGroup, Politecnico di Torino (Italy). CACE Technologies, Davis (California).</copyright>
20+
<tags>driver foss packet capture network admin</tags>
21+
<packageSourceUrl>https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/automatic/winpcap</packageSourceUrl>
22+
<docsUrl>https://www.winpcap.org/docs/default.htm</docsUrl>
23+
<dependencies>
24+
<dependency id="autohotkey.portable" version="[1.1.36.02,2.0)" />
25+
<dependency id="chocolatey-core.extension" version="1.0" />
26+
</dependencies>
27+
</metadata>
28+
</package>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /><Default Extension="nuspec" ContentType="application/octet" /><Default Extension="ps1" ContentType="application/octet" /><Default Extension="ahk" ContentType="application/octet" /><Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" /></Types>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?><coreProperties xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"><dc:creator>NetGroup, CACE Technologies</dc:creator><dc:description>WinPcap is the industry-standard tool for link-layer network access in Windows environments: it allows applications to capture and transmit network packets bypassing the protocol stack, and has additional useful features, including kernel-level packet filtering, a network statistics engine and support for remote packet capture.
2+
3+
## Notes
4+
5+
- This package uses an Autohotkey script for unattended as vendor removed silent installation options.</dc:description><dc:identifier>WinPcap</dc:identifier><version>4.1.3.20161116</version><keywords>driver foss packet capture network admin</keywords><dc:title>WinPcap</dc:title><lastModifiedBy>choco, Version=0.9.10.3, Culture=neutral, PublicKeyToken=79d02ea9cad655eb;Microsoft Windows NT 6.3.9600.0;.NET Framework 4</lastModifiedBy></coreProperties>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$packageArgs = @{
4+
packageName = 'WinPcap'
5+
fileFullPath = "$(Get-PackageCacheLocation)\WinPcapInstall.exe"
6+
url = 'https://www.winpcap.org/install/bin/WinPcap_4_1_3.exe'
7+
checksum = 'fc4623b113a1f603c0d9ad5f83130bd6de1c62b973be9892305132389c8588de'
8+
checksumType = 'sha256'
9+
}
10+
Get-ChocolateyWebFile @packageArgs
11+
12+
Write-Output "Running Autohotkey installer"
13+
$toolsPath = Split-Path $MyInvocation.MyCommand.Definition
14+
$ahkScript = "$toolsPath\winpcapInstall.ahk"
15+
AutoHotkey $ahkScript $packageArgs.fileFullPath
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Write-Output "Running Autohotkey uninstaller"
2+
$toolsPath = Split-Path $MyInvocation.MyCommand.Definition
3+
$ahkScript = "$toolsPath\winpcapInstall.ahk"
4+
AutoHotkey $ahkScript $packageArgs.fileFullPath
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
2+
; #Warn ; Enable warnings to assist with detecting common errors.
3+
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
4+
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
5+
SetTitleMatchMode, RegEx
6+
7+
; uninstalling part
8+
9+
ProgramFilesX86 := A_ProgramFiles . (A_PtrSize=8 ? " (x86)" : "")
10+
11+
winpcapUninstaller = %A_ProgramFiles%\WinPcap\Uninstall.exe
12+
winpcapUninstallerx86 = %ProgramFilesX86%\WinPcap\Uninstall.exe
13+
14+
IfExist, %winpcapUninstaller%
15+
{
16+
Run, %winpcapUninstaller%
17+
installed = 1
18+
}
19+
IfExist, %winpcapUninstallerx86%
20+
{
21+
Run, %winpcapUninstallerx86%
22+
installed = 1
23+
}
24+
if (installed = 1)
25+
{
26+
WinWait, WinPcap [\d\.]+ Uninstall,, 30
27+
IfWinExist
28+
{
29+
BlockInput, On
30+
Sleep, 250
31+
WinActivate
32+
Send, {Enter}
33+
BlockInput, Off
34+
}
35+
36+
WinWait, WinPcap [\d\.]+ Uninstall, has been uninstalled, 30
37+
IfWinExist
38+
{
39+
BlockInput, On
40+
Sleep, 250
41+
WinActivate
42+
Send, {Enter}
43+
BlockInput, Off
44+
}
45+
exit
46+
}
47+
48+
; installing part
49+
winpcapInstaller = %1%
50+
Run, %winpcapInstaller%
51+
52+
WinWait, WinPcap [\d\.]+ Setup,, 30
53+
54+
Loop, 3
55+
{
56+
gosub, setupForward
57+
}
58+
59+
WinWait, WinPcap [\d\.]+ Setup, has been installed, 30
60+
IfWinExist
61+
{
62+
BlockInput, On
63+
Sleep, 250
64+
WinActivate
65+
Send, {Enter}
66+
BlockInput, Off
67+
}
68+
69+
ExitApp
70+
71+
setupForward:
72+
IfWinExist
73+
{
74+
BlockInput, On
75+
Sleep, 250
76+
WinActivate
77+
Send, {Enter}
78+
BlockInput, Off
79+
}
80+
return

Vagrant/logger_bootstrap.sh

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,9 @@ fix_eth1_static_ip() {
9494
return 0
9595
fi
9696
fi
97-
# There's a fun issue where dhclient keeps messing with eth1 despite the fact
98-
# that eth1 has a static IP set. We workaround this by setting a static DHCP lease.
99-
if ! grep 'interface "eth1"' /etc/dhcp/dhclient.conf; then
100-
echo -e 'interface "eth1" {
101-
send host-name = gethostname();
102-
send dhcp-requested-address 192.168.56.105;
103-
}' >>/etc/dhcp/dhclient.conf
104-
netplan apply
105-
fi
97+
# TODO: try to set correctly directly through vagrant net config
98+
netplan set ethernets.eth1.dhcp4=false
99+
netplan apply
106100

107101
# Fix eth1 if the IP isn't set correctly
108102
ETH1_IP=$(ip -4 addr show eth1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -1)
@@ -381,7 +375,7 @@ install_zeek() {
381375
# Update APT repositories
382376
apt-get -qq -ym update
383377
# Install tools to build and configure Zeek
384-
apt-get -qq -ym install zeek crudini
378+
apt-get -qq -ym install zeek-lts crudini
385379
export PATH=$PATH:/opt/zeek/bin
386380
pip3 install zkg==2.1.1
387381
zkg refresh

Vagrant/scripts/install-choco-extras.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ If (-not (Test-Path "C:\ProgramData\chocolatey")) {
1010
}
1111

1212
Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Installing Chocolatey extras..."
13-
choco install -y --limit-output --no-progress wireshark winpcap
13+
choco install -y --limit-output --no-progress wireshark
14+
choco install -y --limit-output --no-progress --version "1.1.36.02" autohotkey.portable
15+
16+
cd choco-winpcap
17+
choco pack WinPcap.nuspec
18+
choco install -y --limit-output --no-progress winpcap --source .
1419

1520
Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Choco addons complete!"

0 commit comments

Comments
 (0)