Files
PEASS-ng/.gitignore
Giveen c9055a7688 winPEAS: Fix network scanning (arg parsing, race condition, port scanner, auto-mode crash) (#612)
* Fix thread count override and add -z flag to set thread count

* Enforce THREADS >= 1 after detection; validate -z range; clarify help text

* Strip colours from -z warning; add regression tests for -z getopts/help

* Tighten getopts regression test: match 'while getopts' line with regex

* Fix WinPEAS network host discovery and port scanner bugs

- Fix auto-mode NullReferenceException: change plain 'if' to 'else if'
  for IPAddressNetmask/IPAddressList branches in NetworkScanner.Scan(),
  so the auto path no longer falls through and calls AddRange(null)
- Fix HostsAlive race condition in NetPinger: replace List<string> with
  ConcurrentBag<string> so concurrent async ping callbacks don't corrupt
  the collection
- Fix unbound parallelism: cap outer host loop at MaxDegreeOfParallelism=5
  and inner port loop at 50; create a PortScanner per host to remove
  shared-state concerns
- Fix port scan output bypassing Beaprint: replace raw Console.WriteLine
  with Beaprint.GoodPrint so open-port results are colour-highlighted and
  respect -nocolor
- Move network scan into NetworkInfo.PrintInfo(): add PrintNetworkScan()
  method, wire it into the check list when IsNetworkScan is true, remove
  the detached scan block from RunChecks(), expose NetworkScanOptions and
  PortScannerPorts as public, and remove the now-unused using directive

* Add compiled binaries (x86/x64/Release), Directory.Build.targets Linux shim, fix Vault enum/struct casing

* Fix -network/-ports arg parsing to accept space-separated values

* Remove Directory.Build.targets from tracking; add to .gitignore

* Dispose Ping per-attempt in NetPinger to prevent handle leaks on large sweeps

* Fix TcpClient/WaitHandle leaks in PortScanner: use using block, close wait handle, remove stale AsyncCallback+TcpPortState

* Force-select networkinfo check when -network is set with a subset of checks

* Remove unused System.Threading.Tasks import from PortScanner

* Add tests for space-separated -network/-ports arg normalisation

* Remove Thread.Sleep(1) and unused System.Threading import from PortScanner

* Replace BeginConnect/WaitOne APM with ConnectAsync+Wait(timeout) in PortScanner

* Cap concurrent pings at 50 with SemaphoreSlim in NetPinger to prevent resource exhaustion on large ranges

* Isolate per-IP ping exceptions so a single bad target can't abort the sweep; surface errors in debug mode

* Observe timed-out ConnectAsync task via ContinueWith to prevent UnobservedTaskException

* Broaden ParseOnly reset to cover all arg-parsing-mutable Checks fields to prevent test cross-talk

* Add MainPrint/LinkPrint header to PrintNetworkScan; remove misplaced GreatPrint from NetworkScanner.Scan()

* Add dedicated 'networkscan' system check to avoid running all NetworkInfo sub-checks when -network is passed with a subset

* Delete linpeas_test.sh

* Delete winPEAS/winPEASexe/binaries/Release/winPEAS.exe

* Delete winPEAS/winPEASexe/binaries/x64/Release/winPEAS.exe

* Delete winPEAS/winPEASexe/binaries/x86/Release/winPEAS.exe

---------

Co-authored-by: SirBroccoli <carlospolop@gmail.com>
2026-03-07 14:12:16 +01:00

36 lines
589 B
Plaintext
Executable File

.vs/*
.vscode/*
winPEAS/winPEASexe/.vs/*
v16/*
winPEAS/winPEASexe/.vs/winPEAS/v16/*
winPEAS/winPEASexe/binaries/**/*.exe
Debug/*
winPEAS/winPEASexe/winPEAS/bin/Debug/*
.DS_Store
./.DS_Store
./*/.DS_Store
./*/.tmp1
.tmp1
obj
bin
packages
*cpython*
*/*cpython*
launch.json
*.pyc
**/*.pyc
__pycache__
*/__pycache__
**/__pycache__
linPEAS/builder/__pycache__/*
linPEAS/builder/src/__pycache__/*
linPEAS/linpeas.sh
linPEAS/builder/linpeas_base_tmp.sh
build_lists/regexes.yaml
sh2bin
sh2bin/*
winPEAS/winPEASexe/Directory.Build.targets
.dccache
./*/.dccache
regexes.yaml
build_lists/regexes.yaml