Skip to content

About

PacketHound turns Windows Firewall into an "ask me first" firewall for outgoing connections, without drowning you in questions about Windows itself.

Topics

Resources

Stars

67 stars

Watchers

1 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

PacketHound

An outbound application firewall for Windows, in the spirit of Little Snitch. When a third-party app tries to make an outgoing connection for the first time, PacketHound asks whether to Allow or Block it. Your answer is saved as a normal Windows Firewall rule. Windows itself is never prompted for.

Download: https://packethound.app (Windows 10 1809+ / Windows 11, x64 or ARM64)

Buy Me a Coffee

How it works

PacketHound doesn't use a kernel driver. It builds on Windows Firewall:

  1. Default outbound = Block. On all three firewall profiles (Domain, Private, Public), every program without an allow rule is blocked.

  2. Auditing. Failure auditing for Filtering Platform Connection is switched on, so each blocked attempt is written to the Security log as event 5157.

  3. Monitoring. PacketHound watches for outbound 5157 events. For each program without a rule:

    • Windows component → an Allow rule is added silently (group PacketHound (Windows components)).

    • Third-party app → a prompt shows the app, publisher, destination hostname/IP, port and protocol. Allow or Block creates an outbound rule (group PacketHound). The rule can cover:

      • Any connection (the default): the whole app.
      • Only this IP address.
      • Only this host (e.g. api.example.com), or only this domain and its subdomains (*.example.com). Windows Firewall only matches IP addresses, so PacketHound keeps the rule's address list up to date: when the app connects to a new address for that name, the address is added (the app may need to retry once).

      Separately, Port can limit the rule to one TCP or UDP port the app tried (e.g. Only TCP port 443 (HTTPS)), on its own or together with an IP, host or domain. Windows Firewall matches the port itself.

      If the app tries several destinations or ports before you answer (a browser such as Tor does), each one is listed, and the one you picked stays selected as more arrive.

      Warnings. Above the options, the prompt points out what's worth a closer look before allowing a program: a signature that isn't valid (the file was changed after it was signed, or the certificate isn't trusted), a Windows program's name (svchost.exe, lsass.exe, …) outside the Windows folder, running from a Downloads folder, Desktop, the Public folder, the Recycle Bin, a removable drive or a network location, and a file created or changed within the last hour. None of these means the program is harmful.

      The rule lasts Forever, Until the app quits, For 1 hour or For the rest of today. A temporary rule is removed once no process of that program is running, and also when PacketHound exits. A timed rule is removed when its time is up, or at PacketHound's next start if it was closed by then.

      Copy (or right-click the details) copies the IP address, host name, program path or command line. For PowerShell, cmd, script interpreters (Python, Node, Java, …) and download tools, the prompt also shows the command line, so you can see which script or download is behind the connection. Connections a destination or port rule doesn't cover are asked about again. Decide later keeps it blocked and lists it under Waiting for your decision on the Rules tab, where you can decide any time. After 10 minutes PacketHound asks again if the app is still running, or otherwise the next time it connects.

      Updates that move to a new folder. Some apps install each version into a new folder (app-1.2.3\ → app-1.2.4\). When a program's path matches one with rules except for a version-numbered folder, the prompt says "This looks like an update" and offers Same as before, which copies the old version's rules to the new path (and removes the old ones if that version is gone). If the new version is signed by someone other than the old one, the button isn't offered and you decide again.

      Installers and updaters in temporary folders. Many unpack themselves into a new random folder under %TEMP% on every run, so a rule for one copy's path never matches the next. For a program running from a temp folder the prompt says "This looks like an installer or updater", and its rule lasts until it quits, so dead rules don't pile up. If it's validly signed and you allow it, that's remembered: future copies in a temp folder with the same file name and a valid signature from the same signer are allowed without a prompt (listed on the Rules tab as Installer / updater). Block isn't remembered, so a blocked installer asks again next time instead of failing silently. Windows Firewall can only match paths, so PacketHound watches the temp folders: when a remembered program is unpacked there, its signature is checked and its rule is made before it runs. From the signature check until the program quits, PacketHound keeps the file open so it can't be replaced, deleted or renamed; otherwise other software could swap a different program in at the allowed path. (Because of that, an installer may occasionally leave its temp folder behind.) If PacketHound is too late (or it's the very first run, before you've answered), the first connection is blocked and many installers give up, so a notification offers to pause protection for 5 minutes in one click.

      Allowed programs that change. A rule made from the prompt records who signed the program. Windows Firewall matches rules by path alone, so a different program put at an allowed path would be allowed too, and since its connections aren't blocked, PacketHound would never hear of it. So PacketHound checks the allowed programs 30 seconds after it starts and every 10 minutes after that (and when you click Refresh on the Rules tab). If one is now signed by someone else, isn't signed, or has a signature that isn't valid, its rules are marked Signature changed, No longer signed or Signature not valid, it's noted in Activity, and a notification says so. It stays allowed until you decide: block it, or select it and click Accept new signature if it's an update you trust. A file is checked again only when its size or times change (and at every start), so this catches programs that were updated or replaced, not software that also sets the file's times back. A change is reported once a second check, two minutes later, finds it too, so a check that fails for a moment (during Windows Update, say) doesn't raise a false alarm. A signing certificate that has simply expired since (the file itself unchanged) isn't counted as a change.

  4. Quiet mode. For 30 minutes, 1 hour, 3 hours or until you turn it off (main window, or tray icon › Quiet mode), new apps are blocked without a prompt and listed under Waiting for your decision. When it ends, PacketHound asks about the ones that are still running. Quiet mode doesn't survive a restart.

  5. Pausing. Protection can be paused for 5 minutes, 15 minutes, 1 hour, or until you turn it back on (tray icon › Pause protection, or the button in the main window). A timed pause turns protection back on by itself, also if the PC restarts in the meantime. While paused, apps without a rule can connect; your Block rules still apply.

The rules are ordinary firewall rules (wf.msc › Outbound Rules). They keep working when PacketHound isn't running, or after it's uninstalled.

Rules for programs that are no longer on the PC (uninstalled, or replaced by an update that installs into a new versioned folder) show Program not found on the Rules tab. Remove missing deletes them after you confirm. Programs on a drive that isn't connected, or on a network share, are never counted as missing.

What counts as "Windows"

A program is treated as Windows only if all of these hold:

  • It lives in a Windows location: %SystemRoot%, Program Files\Windows *, or the Defender platform folder. The third-party driver store (System32\DriverStore) and Windows temp folders don't count.
  • Its file is owned by TrustedInstaller or SYSTEM.
  • It has a valid Microsoft Windows Authenticode signature, embedded or via a security catalog. WHQL-signed vendor tools, such as the NVIDIA utilities Windows copies into System32, are signed "Microsoft Windows Hardware Compatibility Publisher". They are not treated as Windows.

The Windows kernel (System) and Microsoft-published Store packages count as Windows too. You can turn off the Store-package rule in Settings.

By default you're still asked about Windows tools that malware often uses to download payloads: PowerShell, cmd, curl, certutil, bitsadmin, mshta, rundll32, regsvr32, wscript, msiexec, ssh and similar. You can turn this off in Settings.

On this PC, 625 of 659 programs in System32 count as Windows. The rest are those tools, plus vendor software (NVIDIA, Vulkan, Apple Bonjour) and unsigned files.

Build

You need the .NET 10 SDK.

.\build.ps1                  # publish\PacketHound.exe (~750 KB); needs the .NET 10 Desktop Runtime
.\build.ps1 -SelfContained   # larger exe that needs no .NET install
.\build.ps1 -Arch arm64      # the same for Windows on ARM, in publish\arm64
.\build.ps1 -Installer       # publish\PacketHound-Setup-<version>.exe and ...-<version>-arm64.exe; needs Inno Setup 7 (or 6)

The installer (installer/PacketHound.iss) is self-contained (~65 MB), so the PC doesn't need .NET. It installs to C:\Program Files\PacketHound, which only admins can change. That matters because the sign-in task runs PacketHound elevated: an exe in a user-writable folder such as Downloads could be swapped by other software to gain admin rights. The version number comes from <Version> in the project file.

Code signing isn't set up yet. The script has commented-out SignTool lines to enable once there's a certificate.

Use

  1. Run the installer (or PacketHound.exe) and accept the UAC prompt. It needs admin to change firewall and audit policy.

  2. On first run a welcome window explains what it will change, with Turn protection on now and Start PacketHound when I sign in both ticked; untick either before clicking Continue. Starting at sign-in uses an elevated Task Scheduler task, so there's no UAC prompt each time. Closing the window without Continue changes nothing, and it's shown again next time.

  3. PacketHound lives in the notification area:

    • Left-click opens the waiting prompt if there is one, otherwise the window (on the Rules tab if apps are waiting for your decision).
    • Right-click has Pause protection (5 minutes, 15 minutes, 1 hour, or until you turn it back on), Quiet mode, Turn protection on, a link to apps waiting for your decision, and Exit.
    • The tooltip shows whether protection is on, until when it's paused, and how many apps are waiting.
  4. The main window has four tabs:

    • Rules: search, flip a rule between Allow and Block with its switch (green = Allow, red = Block) or the Allow/Block buttons, and delete rules. Edit… (or double-click a rule) changes its action, what it applies to (any connection, one IP address, one host or a whole domain) and its port (any, or one TCP or UDP port), and can make a temporary or timed rule permanent. Apps you chose to decide later about are listed above the rules under Waiting for your decision, each with a Decide… button. The Status column shows temporary and disabled rules, rules whose program is gone (Program not found, tinted red; Remove missing deletes them), and allowed programs whose signature changed (tinted red; see Allowed programs that change above). Remembered installers and updaters are listed with the type Installer / updater.
    • Activity: blocked attempts and what happened to each, with the date and time. Search by app, host, IP address, protocol or result (:80 finds port 80; several words narrow it down). Double-click a row to copy its IP address; right-click to copy it or the host name, or to decide about an app that's still waiting. The list is kept across restarts for 1 day by default (Settings › Activity: this session only, 1, 7 or 30 days), in C:\ProgramData\PacketHound\activity.jsonl; Clear empties it.
    • Hosts: the entries in the Windows hosts file, which decides where host names lead for every program on the PC, before any DNS server is asked. Add…, Edit… (or double-click) and Delete entries; an entry either blocks its names (sends them to 0.0.0.0) or sends them to an IP address you give. The On switch turns an entry off without deleting it (it's kept, commented out with #). The Status column flags names that an earlier line already covers (Windows uses the first entry for a name), and the Add/Edit dialog warns about the same before you save. Each name is matched exactly: example.com doesn't cover www.example.com. Right-click a row on the Activity tab and pick Block this host in the hosts file… to start an entry from it. Changes are saved straight away, the DNS cache is cleared so they take effect, and lines PacketHound doesn't change (comments included) are kept exactly as they were. The version before each change is kept in C:\ProgramData\PacketHound\hosts.backup, and Undo puts it back. Back up… saves a copy of the hosts file (the file itself, so Notepad opens it too) wherever you choose; Restore… shows how many entries a backup has and replaces the whole hosts file with it (any file in the hosts file's format works, such as one from another PC; Undo puts back the one it replaced). If another program changed the file since PacketHound read it, nothing is saved; it's read again and you're asked to make the change once more. Microsoft Defender may report a hosts file that redirects Microsoft's own servers (HostsFileHijack) and offer to undo it; the dialog mentions this when it applies.
    • Settings, including Appearance (Light, Dark, or Same as Windows, which follows the Windows app mode), Prompts (what the prompt's Duration starts on: Forever, until the app quits, for 1 hour, for the rest of today, or Remember last selection) and Updates: once a week PacketHound asks https://packethound.app/version.php for the latest version number (on by default; untick to stop, or use Check now). If there's a newer version, the main window, the tray menu and a notification link to the download page. It never downloads or installs anything itself. Its own outbound access is a rule allowing HTTPS (TCP 443) only, listed on the Rules tab; switching that to Block stops update checks. The address is set in Core/UpdateService.cs.

    Click a column header to sort (click again to reverse). The arrow shows the sorted column, and the choice is remembered. Rules start sorted newest first. Text too long for its column is cut off with "…"; select the row to see all of it.

The window remembers its size, position and whether it was maximized.

Prompts appear on top without taking keyboard focus, so typing never answers one by accident.

Pause, exit and uninstall

  • Pause protection sets the outbound default back to Allow. Your Block rules still apply. Pick 5 minutes, 15 minutes or 1 hour and protection turns itself back on (also after a restart), or pause until you turn it back on.
  • Exit asks whether to keep blocking apps without a rule while PacketHound is closed. Answering No pauses protection. Either way your rules stay active: blocked apps stay blocked.
  • Uninstall from Windows Settings › Apps. The uninstaller asks whether to delete PacketHound's rules, then restores the original outbound default and audit setting, removes the startup task and deletes C:\ProgramData\PacketHound. It does this by running PacketHound.exe --uninstall (add --keep-rules to keep the rules). Without the installer, click Restore Windows defaults in Settings, then delete the exe.

Limitations

  • The first connection fails. PacketHound learns about an app because its connection was blocked, so after you click Allow the app has to retry. Most apps retry automatically, and a browser just needs a refresh. Truly holding a connection until you answer, as Little Snitch does, needs a signed kernel-mode WFP callout driver. Some installers give up after that first failure; pause protection for 5 minutes and run them again (PacketHound offers this after you allow one).
  • Destination rules match IP addresses. Host and domain rules learn a name's addresses as the app connects, so a new address may need one retry, and sites sharing an address (CDNs) share the rule. A rule can be limited to one port; port ranges or lists can be set in wf.msc, but PacketHound can't edit those rules.
  • Group Policy wins. On managed PCs, firewall or audit policy pushed by a domain overrides local changes.
  • Security log volume. Auditing also logs blocked inbound connections, so the Security log fills a little faster. It rotates automatically.
  • Path-based rules. A new app version installed into a new folder (some updaters do this) is treated as a new program and prompts again; the old rule then shows Program not found. If only a version-numbered folder changed, Same as before in the prompt copies the rules over (see above); other renamed folders aren't recognised. Signed installers and updaters in temp folders are the exception (see above). Unsigned ones, or ones that use a random file name, are asked about every run.

Project layout

src/PacketHound/
  App.xaml(.cs)               startup, single instance, first run, tray lifetime
  Core/Controller.cs          event → decision pipeline, prompt queue, decide-later list, pause timer,
                              installer/updater (signed-copy) rules
  Core/FirewallManager.cs     Windows Firewall COM API (HNetCfg.FwPolicy2), rule snapshot
  Core/ConnectionMonitor.cs   Security log event 5157 subscription
  Core/AuditPolicy.cs         Filtering Platform Connection audit setting
  Core/WindowsAppClassifier.cs  "is this Windows?" rules
  Core/Signature.cs           WinVerifyTrust embedded + catalog signature verification (valid, unsigned or invalid)
  Core/SignatureMonitor.cs    "is this allowed program still signed by the same signer?" check
  Core/ProgramWarnings.cs     the prompt's warnings (invalid signature, Windows lookalike name, unusual folder, new file)
  Core/RulePort.cs            rules limited to one TCP or UDP port
  Core/HostsFile.cs           reads and changes the hosts file, keeping everything it doesn't change
  Core/TempFolders.cs         temp-folder detection, and the watcher that prepares installer rules
  Core/ProgramPresence.cs     "is this rule's program still installed?" check
  Core/ProgramVersions.cs     "is this an update of a program in another versioned folder?"
  Core/ActivityLog.cs         keeps the Activity list across restarts
  Core/DevicePaths.cs         \device\harddiskvolumeN\… → C:\…
  Core/HostNames.cs           IP → hostname via the DNS client cache, then reverse DNS
  Core/AutoStart.cs           Task Scheduler logon task
  UI/PromptWindow.xaml        the Allow / Block prompt
  UI/MainWindow.xaml          rules, activity, hosts, settings
  UI/RuleEditWindow.xaml      the Edit rule dialog
  UI/HostsView.xaml           the Hosts tab
  UI/HostsEntryWindow.xaml    the Add / Edit hosts entry dialog
  UI/WelcomeWindow.xaml       the first-run welcome
  UI/TrayIcon.cs              notification-area icon
  UI/GridSorting.cs           remembered column sorting
  Assets/logo.png             the logo (main window header); source for every icon
  Assets/*.ico                app/tray icons, generated by tools/make-icons.py
installer/PacketHound.iss     Inno Setup script (.\build.ps1 -Installer)
tools/make-icons.py           rebuilds the icons, installer and website images from the logo (needs Pillow)

Settings and the log are kept in C:\ProgramData\PacketHound\.

License

PacketHound is free software, licensed under the GNU General Public License v3.0.

About

PacketHound turns Windows Firewall into an "ask me first" firewall for outgoing connections, without drowning you in questions about Windows itself.

Topics

Resources

Stars

67 stars

Watchers

1 watching

Forks

Contributors

Languages