Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mandiant/VM-Packages
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d84a5a2098f933b6b1aa725054c9122f1d8edb1f
Choose a base ref
..
head repository: mandiant/VM-Packages
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 69ed6d9122cae2b70eeae7a87d6b477e9a991aa8
Choose a head ref
Showing with 10 additions and 5 deletions.
  1. +1 −1 packages/fakenet-ng.vm/tools/chocolateyinstall.ps1
  2. +9 −4 packages/internet_detector.vm/tools/internet_detector.pyw
2 changes: 1 addition & 1 deletion packages/fakenet-ng.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ try {

# Replace `default.ini` with our modified one that includes change for 'internet_detector'.
# IMPORTANT: Keep our modified `default.ini` in-sync on updates to package.
Copy-Item "$packageToolDir\default.ini" -Destination "C:\Tools\fakenet\fakenet3.3\configs"
Copy-Item "$packageToolDir\default.ini" -Destination "{$Env:RAW_TOOLS_DIR}\fakenet\fakenet3.3\configs"

# Create shortcut in Desktop to FakeNet tool directory
$desktopShortcut = Join-Path ${Env:UserProfile} "Desktop\fakenet_logs.lnk"
13 changes: 9 additions & 4 deletions packages/internet_detector.vm/tools/internet_detector.pyw
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This tool checks if internet connectivity exists by reaching out to specific websites and checking if they return expected values and
# This tool checks if internet connectivity exists by pinging some of the well-known public DNS servers
# display the current state via changes to the background, theme, and icon in the taskbar.
# * It works even with a tool like FakeNet running (provided it uses the default configuration)
# If internet is detected, the tool:
@@ -29,8 +29,13 @@ import re

# Define constants
CHECK_INTERVAL = 2 # Seconds
# Testing the internet connection by pinging some of
# the largest public DNS servers (minimal downtime)

# - ICMP is a faster and a more-efficient way for checking the connection
# as it has a minimal fingerprint of 2 packets (echo/reply) per request.
# - IP addresses are used instead of well-known websites or domains so
# no DNS resolution is needed.
# - The used IP addresses are some of the largest public DNS servers to
# ensure zero or minimal downtime.
TEST_IPS = [
"8.8.8.8", # Google
"8.8.4.4", # Google
@@ -310,7 +315,7 @@ def check_internet():
for ip_address in TEST_IPS:
try:
# Perform internet connectivity tests
ip_host = icmplib.ping(ip_address, count=1, timeout=CHECK_INTERVAL)
ip_host = icmplib.ping(ip_address, 1)
if ip_host.is_alive:
print(f"Internet connectivity detected via IP: {ip_address}")
return True