Skip to content

Commit 9f2b0a8

Browse files
BornToBeRootclaude
andauthored
Feature: IP scanner host info (#3691)
* Refactor: Remote Desktop: Shared control for the credentials of profiles and groups (W1) The credentials (use credentials, username, domain, password, warning if the profile file is not encrypted) were written out in the profile and the group dialog, and their validation was repeated in three MultiDataTriggers each for the Save button and the error icon of the tab (ElementName bindings to the text boxes). WindowsCredentialsControl / WindowsCredentialsViewModel (like the SNMP credentials control) hold them, with HasError (same rules as the validators) and the values to save (empty if not used). Preparation for the Windows credentials of the IP Scanner. No behaviour change, no change of the profile file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Feature: IP Scanner: Windows credentials in profiles and groups (W2) New profile / group values IPScanner_UseWindowsCredentials, IPScanner_WindowsUsername, IPScanner_WindowsDomain and IPScanner_WindowsPassword (saved in the profile file like the Remote Desktop password, encrypted with profile file encryption), edited with the shared WindowsCredentialsControl in the IP Scanner tab of the profile and group dialog (section "Windows" after SNMP). GetWindowsCredentials returns the ones of the profile, otherwise of its group, otherwise null: the user running the application (no Windows credentials in the settings). WindowsCredentials keeps the password as SecureString (copy), ToString without the password. Preparation for the Windows host information of the scan. Unit tests like the SNMP override (order, saved / loaded, copy constructors, old profile file). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Feature: IP Scanner: Read the SMB / NTLM information of a host without credentials (W3a) SMBInfoResolver connects to TCP 445 and sends an SMB2 NEGOTIATE (dialects 2.0.2 - 3.1.1, preauth integrity context) and a SESSION_SETUP with an NTLM NEGOTIATE message in an SPNEGO token. The NTLM CHALLENGE of the answer contains the version of the operating system (major.minor.build), the NetBIOS / DNS computer and domain names, the forest and the time of the host; the negotiate response the dialect, signing required, the server GUID and the system time (time offset corrected by half the round trip time). The connection is closed after the challenge: no credentials are sent, no logon is attempted. Exception-free (null), cancellation is passed on. WindowsVersionHelper names the version by its build (10.0.26200 = Windows 11 25H2, 26100 = Windows 11 24H2 / Server 2025 unless the role is known, ...), no name for Samba (build 0). Not used by the scan yet. Unit tests for the requests, the parsing (MS-NLMP example, SPNEGO answer, invalid / truncated answers) and the version names. Checked against Samba 4.23 (SMB 3.1.1, challenge parsed, version 6.1.0 without a name). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Feature: IP Scanner: Read the Windows host information with the NetApi (W3b) WindowsNetApiResolver reads with the credentials of the calling thread: NetServerGetInfo 101 (role: workstation / server / domain controller, domain member, description), NetWkstaGetInfo 100 (workgroup), NetWkstaUserEnum 1 (logged-on users without computer / DWM / UMFD accounts, needs admin rights) and, only if the users could be read, the remote registry (build with patch level, display version e.g. 25H2, edition, installation type). Buffers are freed with NetApiBufferFree, IPv6 hosts use the ipv6-literal.net name. The calls are blocking (run by the scan on limited threads with a timeout). WindowsLogon: LogonUser with LOGON32_LOGON_NEW_CREDENTIALS (like runas /netonly) - the credentials are only used for outgoing SMB / RPC, no privileges needed, no SMB session of the user is changed (no conflict with mapped drives like WNetAddConnection2). The password goes from the SecureString to unmanaged memory (zeroed after the call), never to a managed string. "DOMAIN\user" and UPNs without a domain are supported. WindowsHostInfo combines the SMB / NTLM values (no credentials) and the NetApi values: OS name (registry version, otherwise NTLM build; the role decides shared builds), edition, domain / workgroup, computer name, time offset, users, errors (logon failure detection). Not used by the scan yet. Unit tests for the username split, UNC names, roles, user filter, editions and the combined values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Feature: IP Scanner: Read Windows host information in the scan (W3c) New settings IPScanner_WindowsEnabled ("Read Windows host information", default off, section "Windows" after SNMP with a help icon, also in the options menu) and IPScanner_WindowsTimeout (5000 ms). For reachable hosts - with the port scan and 445 in its ports only if 445 is open, otherwise every found host (D-P5) - after the port scan: the SMB / NTLM request (no credentials), then, if the host answered on 445, the NetApi requests. These are blocking: each runs on its own thread (max. 16 at the same time, a call that exceeds the timeout keeps its slot until Windows returns, its result is ignored) with the network logon of the scan. Credentials: the Windows credentials of the profile / group the tab was opened with (WindowsLogon, created once per scan; if it fails every host gets the error instead of using another user), otherwise the user running the application. The options menu shows 'Windows credentials of "X" (DOMAIN\user)' like the SNMP credentials. Target of the NetApi requests (D-P8): the DNS hostname if its first label is the computer name of the NTLM challenge (Kerberos; a stale PTR record can't point to another computer), otherwise the IP address; a name that can't be found falls back to the IP address. The result is IPScannerHostInfo.Windows with IsWindowsPending ("...", ended on cancel, CopyFrom). Not shown yet (next commit). Docs: setting, timeout, options menu; changelog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Feature: IP Scanner: Show the Windows host information in the result (W4) New columns (only for a scan with Read Windows host information): Windows (version name, version number in the tooltip), Domain, Time offset (+1.2 s, -3 min 5 s, ...; highlighted above 5 minutes, the Kerberos limit) and Logged-on users (one per line in the tooltip, or why they could not be read). The row details get a fifth column "Windows" (1*, D-P7): operating system, edition, version, role, computer name, domain, description, time offset, users, SMB version / signing and the error of the NetApi requests; a note if the setting was disabled. WindowsHostInfoToStringConverter (one converter, the value as parameter) for the columns and the row details. Copy > Windows > Operating system / Domain / Logged-on users, search (version, edition, computer name, domain, description, users) and export (WindowsOS ... SMBServerGuid at the end; time offset in seconds, NetApi error as Win32 code; empty values if disabled). A status message if the logon with the Windows credentials of the profile / group failed (D-P11, once per scan with the number of hosts). DateTimeHelper.TimeSpanToOffsetString + unit tests, export tests for the new columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: NetApi requests could connect to another computer with the same name (review #1) GetWindowsTarget used the DNS hostname (PTR) if its first label was the computer name of the NTLM challenge. A stale PTR record of a computer with the same name in another domain (e.g. srv01.lab.example.com for SRV01 in corp.example.com) resolved to another host: it got the credentials and the row showed its role, users and patch level. The hostname is only used if it is the full DNS name the host sends in the NTLM challenge, otherwise the IP address (also for a computer in a workgroup, which has no DNS domain). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Limit of the blocked NetApi calls per scan instead of for the application (review #2) The 16 slots for the blocking NetApi calls were per IPScanner instance, but a call that exceeds the timeout keeps its thread after the scan is completed. Every repeated scan (Automatically scan every), rescan or other tab got 16 new slots, so hosts that don't answer RPC could pile up blocked threads. The semaphore is shared by all scans now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Logon failure message of a rescan counted all rows (review #3) After a rescan of selected hosts, the message "The logon with the Windows credentials ... failed on n host(s)" counted every row of the result, also the ones that were not rescanned (they keep the result of the last scan). A rescan of one host showed e.g. "failed on 19 host(s)". Only the rescanned rows are counted now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Any error of the Windows logon was shown as wrong password (review #4) If WindowsLogon.Create failed with an exception other than a Win32Exception (e.g. a disposed password), every host got ERROR_LOGON_FAILURE (1326): the rows and the status message said the username or password is wrong. These errors get ERROR_GEN_FAILURE (31) now, no logon failure message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Unknown server build shown as a client release (review #5) For a build that is not in the list, "(build N)" was replaced by the display version of the registry. A newer server ("Windows (build 28000)") became "Windows 25H2": it looked like a client and the build was gone. Only an unknown Windows 11 build gets the display version ("Windows 11 26H1"), other unknown builds keep the build number. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Search didn't find the Windows version number (review #7) The docs say the search matches the Windows version, but only the name (e.g. "Windows 11 25H2") was searched - "26200" or "10.0.26200.6584" (e.g. to find hosts without an update) found nothing. The version number is searched as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Time offset of the NTLM timestamp used the round trip of the negotiate request (review #8) If the negotiate response has no system time, the time of the NTLM challenge is used - but it was compared with the local time of the negotiate request (one round trip earlier), so the offset grew by the session setup delay on a slow connection. Each time is compared with the middle of its own round trip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: IP Scanner: Check once per scan if the port scan checks SMB (review #9) IsSMBPortOpenOrNotScanned searched the ports of the port scan for 445 up to twice per found host (up to 65535 ports), the answer doesn't change during a scan - computed once per scan now. The SMB port is one public constant (SMBInfoResolver.SMBPort) instead of a copy in the scanner. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: A wrong password of the Windows credentials could lock the account (B1) The NetApi requests ran on up to 16 hosts at the same time with the credentials of the profile / group. With a wrong password every host in a domain made the domain controller count a failed logon - a /24 with many Windows hosts reached the lockout threshold in seconds, and Automatically scan every repeated it every interval. WindowsLogonGate checks the credentials on one host first, the other hosts wait (at most twice the timeout): - Accepted (success, or access denied = logged on without rights): all hosts run in parallel. - Logon failure on a host in the domain of the credentials (NetBIOS / DNS domain of the NTLM challenge, domain or UPN suffix of the credentials), or the third logon failure on hosts of other domains: rejected. The other hosts are not tried ("Not tried: ..." in the row details, WindowsError -1). - Timeout / other errors: the next host checks. Computers in a workgroup (no domain controller) and local accounts are not gated, a logon failure there only affects the host itself. Rejected credentials are not used again in the tab (next scans, repeat, rescan, also after a canceled scan); one message instead of the count of failed hosts. Unit tests for the gate (order, domain matching, failure cap, workgroup / local accounts, timeout, rejected in an earlier scan). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Windows host information after the ports (O1) The Windows host information needs the port scan (TCP 445) like the web page: it follows the port scan in the settings (section after Port scanner), the options menu, the result columns (after Port status), the row details (Ping / hostnames | Ports | Windows | Web | NetBIOS / SNMP), the Copy menu and the docs. The export columns stay at the end (fixed order). The docs anchor of the SNMP timeout is updated (timeout-ms-6). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: User of the Windows credentials appended outside the translation (L1) The options line 'Windows credentials of "Site A" (CORP\admin)' appended the user in the code, so a translation couldn't change its position. The user is a placeholder of the string now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Feature: IP Scanner: Windows credentials of a tab and Scan as... (S2) Options > Windows credentials... sets the Windows credentials of the tab (WindowsCredentialsChildWindow with the shared credentials control, not saved, discarded with the tab): they replace the ones of the profile / group, "Use credentials" off uses the user running the application. Works also for a tab without a profile (no Windows credentials in the settings). They are used for the following scans, Automatically scan every and Rescan (a rescan uses the current credentials of the tab, not the ones of the last scan); credentials that were rejected are used again after they were set. The options show 'Windows credentials of this tab (CORP\admin)'. Scan as... in the context menu of a profile asks for the credentials (the ones of the profile / group as default) and scans the profile with them in a new tab, like Connect as... of the Remote Desktop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Docs: IP Scanner: Warning that every host with SMB receives a logon (S1) Every host that answers on port 445 receives a logon with the credentials of the scan (also the user running NETworkManager) - with NTLM (asked by IP address) a malicious host could relay it or crack the password offline. Warning in the docs of Read Windows host information and in its help tooltip: only scan trusted networks with privileged accounts, least privilege, SMB signing on servers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Windows values exported as text instead of number / boolean (C1) WindowsTimeOffset, WindowsError and SMBSigningRequired were exported as strings ("-185.500", "5", "True" in JSON), unlike WebStatusCode / WebCertificateSelfSigned. They are numbers / booleans now (null without a value). The CSV file formats values with the invariant culture, so the time offset keeps its decimal point (a decimal comma would split the column). No change for the other columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: SMB request threw an exception for every host without SMB (P1) The connection of SMBInfoResolver used Socket.ConnectAsync with a token: a refused or unanswered port 445 threw a SocketException / an OperationCanceledException for every found host (with the port scan disabled) - slow with a debugger attached, which PortProbe and NetBIOSResolver avoid. The connect uses SocketOperation now (SocketError instead of an exception). Checked against Samba (answer in 35 ms, refused port: null at once, no answer: null after the timeout). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: SMB signing in its own row of the row details (U1) "3.1.1 (signing required)" looked like a problem, also on hosts where the logon worked. The row details show SMB (the version) and SMB signing (Required / Not required, a setting of the SMB server of the host) in two rows; the docs explain that it is not an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Windows credentials / Scan as dialog cut off on the right (S2b) The grid of the dialog had a fixed width of 500 plus a margin of 10, the child window is 500 wide (ChildWindowWidth of DefaultChildWindow): the text and the Cancel button were cut off. The grid uses the width of the dialog like the other child windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Ping status and NetBIOS reachable only in the row details (K1) Both columns mostly repeated the status icon of the host: the probes that answered are in its tooltip, the status icons of ping and NetBIOS in the headers of the row details, the values (time, TTL, NetBIOS name and workgroup) in the row details and the NetBIOS name is used for Hostname. The result is two columns narrower. Sorting by ping status / NetBIOS reachable is gone (Time sorts the hosts that answered the ping). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Labels of the Windows credentials in the profile / group dialog not styled (W2b) The labels of WindowsCredentialsControl relied on the implicit TextBlock style the dialogs set in the resources of their grids. In the IP Scanner tab of the profile and group dialog the control is not in such a grid: the labels were black and smaller than the other rows. The control sets the style itself (CenterTextBlock, like the dialogs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Windows version and OS guess in one OS column (K2) The OS (guess) column and the Windows column showed the same kind of value side by side. One OS column now: the Windows version if it was read (Windows logo, edition and version number in the tooltip), otherwise the guess from the TTL as before (icon, hops in the tooltip); "..." while the ping or the Windows host information is still running. Shown if the guess or Read Windows host information is enabled for the scan (IsOSShown), sorted by OSName (Windows version, otherwise the guess). Copy > OS (guess), search and export are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Credentials section in the options menu (S2c) "Windows credentials..." was in the middle of the scan options (after Read Windows host information) and looked like another option. The options menu has a credentials section after the options: the SNMP version and credentials of the profile / group (moved from below the SNMP option), the Windows credentials of the tab and "Set Windows credentials...". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Open ports as text instead of the port status icon (K3) The Port status column only showed whether any port is open (icon), the ports were in the tooltip. The column shows the open ports (e.g. "22, 80, 443"; "..." while the port scan is running, "-/-" without open port), the tooltip the services as before; sorted by the number of open ports (OpenPortCount). Search, Copy and export (PortStatus, Ports) are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: IP Scanner: Remove the unused ping / NetBIOS tooltips (K1b) IPScannerStatusToolTipConverter formatted the tooltips of the Ping status and NetBIOS reachable columns, which are removed (K1). The ports (Open ports column) and the answered / no answer tooltips of the row details stay. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Domain column also with the NetBIOS workgroup (K4) The Domain column was only shown with Read Windows host information. It shows the domain / workgroup of the Windows host information, otherwise the workgroup / domain of the NetBIOS answer (shown if one of them is enabled for the scan, IsDomainShown; "..." while a source is still running). Search matches this value (also the NetBIOS workgroup now). Copy > Windows > Domain and the export are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Docs: IP Scanner: Export columns of the Windows host information (D1) The docs of the web page and SNMP list their export columns, the Windows host information didn't: WindowsOS ... SMBServerGuid, with the unit of the time offset and the meaning of WindowsError (-1: not tried). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: One helper to remove control characters of network values (R1) Five resolvers had their own copy to remove (or replace) the control characters of a value received from the network: MDNSResolver, SMBInfoResolver, SNMPSystemInfoResolver, WebPageResolver and WindowsNetApiResolver. They use StringHelper.RemoveControlCharacters / ReplaceControlCharactersWithSpace now. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: A host with guest access could accept a wrong Windows password (G1) The lockout protection accepted the credentials on the first host that answered with success / access denied. A host that maps a failed logon to guest (e.g. a NAS with "map to guest = bad user") also answers a wrong password: the credentials were accepted and every host of the domain got the wrong password in parallel. Only a host in the domain of the credentials accepts them now; hosts of other domains (also a UPN suffix that is not the domain of the hosts) after three of them (MinAcceptsOutsideDomain), until then the next host checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Hosts not tried while the Windows credentials were checked showed a timeout (G2) A host that waited longer than twice the timeout for its turn to check the credentials (other hosts checked them without a result, e.g. timeout or RPC error) got ERROR_TIMEOUT - shown as "This operation returned because the timeout period expired.", although it was never contacted. It gets its own error now (ErrorLogonNotChecked, -2 in the export): "Not tried: the Windows credentials were still being checked on another host". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Copy menu with the OS, Open ports and Domain columns (G4) The Copy menu was not updated when the columns changed (K2 - K4): it still copied the port status (Yes / No) and the OS guess (only with ping), and Copy > Windows > Domain only the Windows domain. - OS: the text of the OS column (Windows version, otherwise the guess), shown if the column is (IsOSShown), disabled while it is still read (IsOSPending). - Open ports: the port numbers like the column, instead of Port status. - Domain: the Domain column (also the NetBIOS workgroup), top level, shown with IsDomainShown - replaces Copy > Windows > Domain. - Windows > Time offset (new). The unused PortOpenToStringConverter is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Docs: IP Scanner: Changelog with the five columns of the row details (G5) The row details have a Windows section since #149: five columns instead of four. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: Profiles: Invalid username / domain of the credentials could be saved (H1) WPF doesn't pass invalid input of a text box with validation rules to the view model, it keeps the last valid value: clearing the username left its first character, "john doe" left "john". HasError of the view model didn't see it, Save / OK stayed enabled and the truncated value was saved. Before the shared WindowsCredentialsControl (W1), the Remote Desktop dialogs checked the validation of the text boxes. The controls count the validation errors of their text boxes (NotifyOnValidationError) and set HasInputError of the view model, which is part of HasError. Also for the SNMP username (SNMPCredentialsControl). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Next host checked the Windows credentials while a timed-out logon was still running (H2) The host that checked the credentials reported its result to the lockout protection when its NetApi requests exceeded the timeout (ERROR_TIMEOUT, not decided). The next host checked them while the blocked call - with the same credentials - was still running, and the late result (e.g. a logon failure in the domain that rejects them) was ignored: with slow RPC every host could send a wrong password one after the other. The result is reported when the call returns (onCallCompleted), also after the timeout of the host; the row still shows the timeout. Until then the other hosts wait (and show "Not tried" after their timeout). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Windows credentials without domain were rejected only after three logon failures (H3) Credentials without a domain (e.g. "admin") are never "in the domain" of a host, so the lockout protection rejected them only after the third logon failure - each one may be counted by the domain controller of the host. Without a domain, the first logon failure on a gated host rejects them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Windows logon always failed with "DOMAIN\user" and a domain (H5) With a domain set, the username was passed to LogonUser as it is: "CORP\admin" with the domain "CORP" logged on as user "CORP\admin" in CORP and always failed (counted as wrong password by the lockout protection), and was shown as "CORP\CORP\admin". A UPN with a domain had the same problem (LogonUser needs a null domain for a UPN). "DOMAIN\user" uses the domain of the username, a UPN never a domain - also if the domain is set. DisplayName shows the user as it logs on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: A slow remote registry discarded the Windows values already read (H4) All NetApi requests of a host share one timeout, the remote registry (patch level) is read last and can be slow (Remote Registry service started on demand). If it exceeded the timeout, the role, workgroup, description and logged-on users already read were discarded and only the timeout error was shown. WindowsNetApiResolver.Resolve reports the NetApi values before it reads the registry (onNetApiRead): after the timeout they are shown without the patch level. The lockout protection gets the result at the same time (the registry doesn't change the logon), so the other hosts don't wait for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: OS column sorted by the TTL guess also if it was disabled (H6) OSName (sorting of the OS column) and IsOSPending (Copy > OS) used the guess from the TTL also if Guess the operating system from the TTL was disabled: rows that show "-/-" were sorted by the hidden guess, and Copy > OS was disabled while the ping was running although it can't give a value. The host knows if the guess is enabled in its scan (IsOSGuessEnabled, set by the scan, copied by CopyFrom). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Windows host information starts after the port scan instead of all probes (H7) The Windows host information of a found host was started after all probes were finished (ping, NetBIOS, SNMP and the port scan), although it only needs the result of TCP 445: every Windows host waited for the slowest probe (e.g. the SNMPv3 timeouts). It starts when the host is found, or - if the port scan checks 445 - when the port scan is finished. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: IP Scanner: Helpers for the Win32 error and the logon errors (H8) - GetWin32Error: the mapping of an exception to its Win32 error (ERROR_GEN_FAILURE otherwise) was written twice in IPScanner. - WindowsHostInfo.IsLogonError: WindowsLogonGate created a WindowsHostInfo only to read IsLogonFailure. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Unchanged Windows credentials keep their profile / group as source (G6) Scan as... and Set Windows credentials... are prefilled with the current credentials. OK without a change showed 'Windows credentials of this tab' in the options, although they are the ones of the profile / group. The dialog returns the credentials it was opened with if nothing was changed (same username / domain, no new password): Scan as... shows the profile / group as source, Set Windows credentials... keeps the source (and still uses rejected credentials again). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Windows credentials in the options only with Read Windows host information (G7) Set Windows credentials... and the line with the Windows credentials of the tab were shown also if Read Windows host information is disabled (they are not used then). Both are shown with the setting (it can be turned on in the same menu); the separator of the credentials section is hidden if none of its lines is shown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: IP Scanner: Dispose the copies of the Windows password of a tab (G8) The tab keeps a copy of the Windows password (SecureString) of the profile / group, Scan as... or Set Windows credentials.... It is disposed when it is replaced, when the tab is closed and when Scan as... doesn't use the copy of the profile / group (canceled or other credentials). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Lockout protection of the Windows credentials started again in every scan (I1, I3, I6) Every scan created its own WindowsLogonGate, only the rejected state was passed to the next scan of the tab: - I1: the logon failures were not counted over the scans. Wrong password and two hosts of another (trusted) domain: below the limit of three per scan, never rejected - with Automatically scan every the domain controller counted two failed logons per scan and locked the account. - I3: a check that exceeded the timeout and returned after the scan was completed (H2) reported to the gate of that scan only, the next scan checked the credentials again. - I6: rejected credentials added the "logon failed" message again in every following scan, although no logon was tried. The tab keeps one gate for its credentials (IPScannerOptions.WindowsLogonGate, new with Set Windows credentials...) and shows the message once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Rejected Windows credentials were still used for workgroup computers (I2) WaitAsync returned Proceed for hosts that are not gated (computers in a workgroup, the host of a local account) before it checked if the credentials were rejected: they got the wrong password in every scan (with Automatically scan every, the local account of a workgroup computer could be locked). Rejected credentials are skipped for every host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Line breaks of the Windows computer description were removed (I4) The control characters of the description (NetServerGetInfo) were removed, a description with several lines ran together ("File server\r\nBuilding 2" -> "File serverBuilding 2"). They are replaced with spaces like the SNMP description (StringHelper.ReplaceControlCharactersWithSpace). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Sort key of the OS column not updated after the ping (I10) OSName depends on IsPingPending (via OSGuess), but its setter didn't notify it: the ping result sets PingInfo while the ping is still pending (empty guess), then IsPingPending = false without a notification - the sort key of the OS column could stay empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Unknown Windows build without role not named Windows 11 (I7) An unknown build from 22000 was named "Windows 11 (build n)" also if the role of the host is unknown - the usual case without credentials (no NetApi / registry): a newer Windows Server would have been shown as Windows 11. Only a workstation gets "Windows 11 (build n)", an unknown role "Windows (build n)" like a server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: Profiles: One helper to track the invalid input of the credentials controls (I8) The counting of the validation errors (H1) was copied in WindowsCredentialsControl and SNMPCredentialsControl. InputErrorTracker does it once for a control whose view model implements IHasInputError. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Accepted Windows credentials were not checked again in the next scans (J1) Since the tab keeps one lockout protection for all its scans (I1), the accepted state was kept too: a password changed or expired in the domain later was sent to every host in every repeated scan without a check (and could lock the account). Every scan checks accepted credentials again (WindowsLogonGate.StartScan), the logon failures and a rejection are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Workgroup computers skipped after a rejection by the domain hosts (J2) Since I2, rejected credentials were skipped for every host, also for the hosts that are not gated: "admin" (no domain) meant for the local admin of workgroup computers was rejected by the first domain host, then every workgroup computer showed "Not tried" although the password is correct there ("PC01\admin" rejected by domain hosts also skipped PC01). A host that is not gated is independent of the rejection again, but is skipped in the next scans after its own logon failure (ReportUngated, by IP address): one failed logon per host and tab instead of one per scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Repeated scan could start while the Windows credentials were edited (J3) Set Windows credentials... is only disabled while a scan runs when the dialog opens. Automatically scan every could start a scan while the dialog was open; OK then replaced the credentials and their lockout protection under the running scan (its rejection was checked on the new one and lost). The repeat waits while the dialog is open, like for the confirmation of a large scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Copy > OS / Time offset copied "-/-" without a value (J4) Copy > OS and Copy > Windows > Time offset used the converters of the column, which show "-/-" without a value: the placeholder was copied. The other Copy entries copy an empty value. IPScannerOSToStringConverter returns an empty text with the parameter "Copy", WindowsHostInfoToStringConverter has a NoValue property (empty for the Copy instance). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: Profiles: Passwords of the credentials decrypted to check if they are empty (J5) WindowsCredentialsViewModel.IsPasswordEmpty and SNMPCredentialsViewModel decrypted the SecureString to a managed string every time a password was set (every key stroke, and the password of the tab / profile when the dialog opens) only to check if it is empty. They use its Length. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: IP Scanner: Remove WindowsHostInfo.IsLogonFailure (J6) Only used by tests since the lockout protection uses WindowsHostInfo.IsLogonError (H8). The tests use IsLogonError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: IP Scanner: Compute the open ports and the Windows version once per host (J7) OpenPorts / OpenPortCount (Open ports column) and WindowsOS (OS column, WindowsVersionHelper.GetName) were computed on every read - sorting and the search read them for every row again. They are computed when Ports / Windows are set. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: IP Scanner: Report the NetApi result to the lockout protection on one path (J8) ResolveNetApiWithLogonAsync reported to the lockout protection on three paths (canceled / no slot directly, the call through Complete). All of them use Complete now, which reports exactly once. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Docs: IP Scanner: PR number in the changelog of the Windows host information (I9) The entry linked a placeholder ([#PR]): #3691. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Hosts without NTLM names bypassed the lockout protection (K1) A challenge without (or with a truncated) target info has empty computer and domain names: IsDomainMember was false, so the host was treated as a workgroup computer, and for credentials without domain the empty computer name also matched the local account check. Such hosts (e.g. domain-joined NAS devices) got the unchecked credentials in parallel. Only a host with both names is known as workgroup computer / computer of a local account, every other host is gated (like a host without challenge). Reported by Copilot on #3691. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Successes outside the domain accepted unchecked Windows credentials (K2) Three successes on hosts outside the domain of the credentials accepted them for all hosts. Such a success doesn't prove the password: a host that maps a failed logon to guest (NAS, Samba "map to guest") or, for credentials without domain, a local account with the same name also answer a wrong password. The counter was also kept over the scans, so one guest host could supply all three successes. The remaining domain hosts then got a possibly wrong password in parallel. Only a host in the domain of the credentials accepts them, a success elsewhere is used by this host only and the next host checks them. A host in the forest whose root domain is the domain of the credentials (e.g. the UPN suffix "example.com" for "corp.example.com") counts as in the domain (its domain controller checks the logon). Reported by Copilot on #3691. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Unknown NetApi errors let every host try the Windows credentials (K3) The lockout protection only counted the errors of a known list as logon failures, every other error let the next host check the credentials - with no limit. A wrong password reported with an error that is not in the list (e.g. a Kerberos / SSPI error with a hostname as target, ERROR_ACCOUNT_EXPIRED or ERROR_INVALID_PASSWORD) was tried on every host one after the other. Inverted: only the errors that show that no domain controller checked the password (timeout, host / network / RPC / domain controller of the host not reachable, NTLM blocked) let the next host check them, every other error counts as a logon failure (also for the hosts that are not gated). WindowsHostInfo.IsLogonError is replaced by IsLogonNotDecided. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Max. logon failures of the Windows credentials as setting, counted per account (K4) The lockout protection rejected the credentials after the third logon failure on hosts of other domains (e.g. a trusted domain, whose domain controller passes the logon to the one of the credentials). A domain controller may count one failed logon twice (Kerberos, then NTLM): 3 failures could be 6 counts, above a lockout threshold of 5. The failures were also counted per tab: every tab with the same account (Scan as..., the same profile) and the credentials entered again started from zero. New setting Max. logon failures (Windows section, 1 - 5, default 2, help icon: keep it below half of the lockout threshold), passed to the gate per scan. The failures are counted per account for all gates until the application is closed, like the domain controller counts them; a new gate still checks the credentials once (e.g. a corrected password). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Logon restrictions rejected correct Windows credentials (K5) The lockout protection counted every logon error as a failed logon, also the ones that don't fail the password: a logon type that is not granted (e.g. "Deny access to this computer from the network" for tiered admin accounts on a domain controller - checked by the host after the domain controller accepted the password), logon hours, workstation and account restrictions (e.g. Protected Users with NTLM). One such host rejected the credentials for the whole tab. - Logon type not granted on a host in the domain accepts the credentials (like access denied). - Logon hours / workstation / account restriction are not counted and not accepted (the restriction may be checked before the password): the next host checks them; a host that is not gated is not skipped. - An accept in the domain resets the counted logon failures of the account, like a successful logon resets badPwdCount. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: No message if the Windows credentials were rejected after the scan (K6) The message that the credentials were rejected was only checked when a scan was completed. A check that exceeded the timeout reports its result when Windows returns - after the scan, so without Automatically scan every no scan showed the message and the rows only had their timeout. The gate raises Rejected once when it rejects the credentials; the tab shows the message right away if no scan is running (otherwise when the scan is completed, after its other messages), once per credentials. Reported by Copilot on #3691. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Local account "." logged on unchecked without the computer name (K7) Local accounts (".\admin") were not gated and logged on with "." as domain for all hosts in parallel. Whether a domain member checks "." with its own accounts or passes it to its domain controller depends on what the client sends for "." in the NTLM / Kerberos logon - if it is passed on, a domain account with the same name gets one failed logon per host. A local account is logged on for each host with its own computer name of the NTLM challenge ("PC01\admin", WindowsCredentials.ForHost): only the host checks it, independent of how "." is handled. A host without its computer name (no challenge, or without its names) is gated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Rescan read the Windows host information after it was turned off (K8) A rescan of selected hosts uses the options of the last scan, also Read Windows host information: after turning it off (e.g. as kill switch while it is tested), a rescan still sent the SMB request and logged on to the hosts with the Windows credentials. The rescan reads it only if it is still enabled; otherwise the rescanned hosts have no Windows values (the other options stay those of the scan). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Scan as... only with Read Windows host information (K9) Scan as... in the context menu of a profile asked for Windows credentials also with Read Windows host information turned off - they were not used by the scan. Shown and enabled only with the setting, like Set Windows credentials... in the options of the tab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Beta label for Read Windows host information (K10) Read Windows host information is released for public testing: a Beta label (accent badge, tooltip "tested publicly and may change") next to the setting on the settings page and in the Options menu of the tab, a note in the documentation (turning it off stops all SMB requests and logons, also of Rescan) and "beta" in the changelog. Still off by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: IP Scanner: Wrap the summary of the lockout protection (K5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * IP Scanner: Log of the lockout protection of the Windows credentials (K11) The checks of the Windows credentials were not logged: a failed logon or a rejection was only visible in the rows of the tab. Logged by the gate (account as used for the logon, never the password; host as IP address with computer name and domain / workgroup of the NTLM challenge, Win32 error with its message): - INFO: start of a scan (max. logon failures, failures counted for the account; or rejected in an earlier scan), accepted on a host of the domain, logged on outside the domain (not proven), logon not allowed (not counted), a failure below the limit, the number of hosts of the scan that didn't use the credentials (rejected / waited longer than the timeout) - once per scan instead of per host. - WARN: each logon failure (with the failures of the account), the rejection (reason: failure in the domain, without domain, max. failures), the logon failure of a host that is not gated (skipped in the next scans). - DEBUG: the host that checks them, errors without a decision, a host skipped after its own failure. Report / ReportUngated get the host (and its challenge) for the log. Tests check the messages and that the password is never logged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Host skipped after its own logon failure showed "rejected on another host" (K12) A host that is not gated (workgroup computer, local account) is skipped in the next scans after its own logon failure (J2). Its row showed the same text as a host skipped by the rejection on the domain hosts: "rejected on another host" - wrong for this host. The text (and the documented WindowsError -1) now names both cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Docs: IP Scanner: Windows host information after the review of the lockout protection (K13) - Changelog: the entry names what the lockout protection does now (only a host in the domain accepts, failures counted per account for all tabs, Max. logon failures, local accounts with the computer name, log file). - Options menu: Read Windows host information (beta); credentials set again are checked again, the failures of the account stay counted. - NetApi step: also the credentials of the tab. - Workgroup computers / local accounts: the sentence about hosts without NTLM names no longer splits it (K1 put it between the statement and its explanation). - Comments of the gate in the tab / options: failures per account. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Docs: FAQ: Windows account lockout protection of the IP Scanner (K14) The lockout protection grew too detailed for a note in Read Windows host information. New FAQ page that explains it: why it is needed, how one host checks the credentials, which result accepts / rejects them (table per host in / outside the domain / without domain), when a host is in the domain of the credentials, why successes elsewhere and unknown errors don't accept them, how the failed logons are counted (per account, Max. logon failures, reset, checked once when set again), what happens after a rejection, which hosts are not gated, what is logged, what is not covered and recommendations. The IP Scanner page keeps a short summary and links to it (also from the Options menu and Max. logon failures). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Hosts that are not gated could send the Windows credentials to the domain controller (K15) Workgroup computers and local accounts are not gated: they use the credentials in parallel, a failure only counts on the host. But a host whose DNS name matched the full name it sends in the NTLM challenge (e.g. a NAS "nas.home.lan") was asked by its hostname: Windows can then use Kerberos and first asks the KDC of the credentials (e.g. CORP\admin) for a ticket - a wrong password counted at the domain controller for every such host, in parallel and without limit. A host that is not gated is always asked by its IP address (NTLM only), the hostname (Kerberos) only for gated hosts and without credentials. Found by the independent review of the lockout protection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Lockout protection of the Windows credentials only per tab (K16) The turn (one host checks the credentials at a time) and the rejection were per gate, i.e. per tab; only the logon failures were shared (K4). Several tabs with a wrong password (e.g. Scan profile for 5 profiles of a group) checked it at the same time - 5 tabs, 5 failed logons at once - and every new tab tried a rejected password again. "CORP.example.com\admin" and "admin@corp.example.com" were also counted as two accounts. The state is kept per account (domain\user, the UPN suffix as domain) for all gates until the application is closed: - One turn per account: one host of all tabs checks them at a time. - A rejected password stays rejected: a gate with it starts rejected (also takes a rejection by another tab while it waited). A gate with another password (e.g. corrected in the profile) or with credentials the user entered (Set Windows credentials..., Scan as..., also unchanged) checks them again. - To recognize a password without keeping it: a keyed hash (HMAC-SHA256, random key per start of the application) in memory only; the password is copied to a pinned buffer that is zeroed right away. Found by the independent review of the lockout protection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Samba / NAS members of the domain accepted unchecked Windows credentials (K17) A success on a host in the domain of the credentials accepted them for all hosts. A Samba server or NAS that is a member of the domain and maps a wrong password to guest ("map to guest = bad password") answers a wrong password with a success: all domain hosts then got it in parallel. Only a Windows host (build in its NTLM challenge; Samba / NAS devices send none or 0) accepts them; a success on another host is used by this host only, the next host checks them. A logon failure on such a host still rejects them. Found by the independent review of the lockout protection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: ERROR_GEN_FAILURE of a host let the next host try the Windows credentials (K18) Every exception of the NetApi call became ERROR_GEN_FAILURE (31), which was in the list of errors without a logon decision - also a 31 that a host returned after the logon (e.g. NT_STATUS_UNSUCCESSFUL of Samba): the next host checked them, a failed logon would not be counted. The call reports to the lockout protection only if the requests were sent with the logon; a call that didn't send them (e.g. the logon was disposed, the local logon of a host failed) reports nothing (not decided, the next host checks them; the row still shows the error). 31 is no longer in the list, so a 31 of a host counts as a logon failure. Found by the independent review of the lockout protection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: No stop after the Windows credentials were accepted (K19) After a host accepted the credentials, the other hosts used them in parallel without reporting their result: a failed logon in the domain later in the scan (the password was changed or expired, the account was locked, or the accept was wrong) didn't stop the hosts that didn't start yet - all of them tried a wrong password. Gated hosts that use the accepted credentials report their result (ReportAccepted): a logon failure on a host in the domain of the credentials rejects them (counted, shared with the other gates of the account, Rejected event, logged); the hosts that didn't start yet skip them (at most 16 run at the same time). Failures on hosts of other domains don't (expected also with a correct password, e.g. a domain that is not trusted). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Docs: FAQ: A spoofed accept of the Windows credentials is stopped by the next failure (K20) With K17 / K19 a host that pretends to be in the domain must also look like a Windows host, and the next failed logon in the domain stops the credentials again - only the hosts that already started (max. 16) still try them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: Reusable TagTextBlock style for the Beta label and the ICMP label of the Ping Monitor (K21) The Beta label (K10) was an accent badge of its own, the Ping Monitor shows the protocol of a host (ICMP) as accent text on a gray background - two looks for the same kind of label. New style TagTextBlock (based on AccentTextBlock: Gray8 background, padding 5, centered) for both; the label in the Options menu of the IP Scanner with less padding (height of a menu item). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Beta label not centered next to Read Windows host information (K22) On the settings page, the Beta label was aligned to the top of the whole toggle switch (header and switch) and is higher than the header text, so it was not centered on the header line. It is in the header of the toggle switch now, centered next to its text (padding of the menu label). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Settings: Remove the Experimental features setting (K23) Settings > Update had an Experimental features switch that no feature reads any more. Features in testing are marked per setting with a Beta label now (e.g. Read Windows host information of the IP Scanner, see K10). Removed the setting (SettingsInfo / GlobalStaticConfiguration), its view model property, the Experimental section of the settings page, its English strings (translations come from Transifex) and the docs section. An existing value in the settings file is ignored when it is loaded and dropped when the settings are saved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: An exception of the NetApi call rejected correct Windows credentials (K24) Since K18, every exception after the requests were sent was reported to the lockout protection as ERROR_GEN_FAILURE (31), which counts as a failed logon. An exception after NetServerGetInfo succeeded (e.g. while reading the workgroup or the users) rejected correct credentials on a host in the domain - for all hosts, the next scans and new tabs of the profile. A host reports a failed logon as an error code, never as an exception: a call that ended with an exception reports nothing to the lockout protection (not decided, the next host checks them; the row shows the error). A 31 returned by a host still counts. Found by the final code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: "Logon failed" message after a scan without Windows credentials (K25) The message that the Windows credentials were rejected was shown when any scan of the tab completed, also a scan that didn't use them: e.g. a new tab of a profile whose password was rejected before (its gate starts rejected, K16) showed "The logon ... failed" after a scan with Read Windows host information turned off - no logon at all. Only the completion of a scan that used the credentials (Read Windows host information enabled) shows it; a rejection reported after the scan still shows it (K6). Found by the final code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: OS column sorted by the untranslated name of the guess (K26) The OS column is sorted by OSName: the Windows version, otherwise the name of the guess value ("LinuxUnix", "NetworkDevice", "Windows"), while the cell shows the translated name (e.g. "Netzwerkgerät") - in another language the order didn't match the shown text. OSName uses IPScannerHostInfo.OSGuessToString (the Models project has no translations), set by the IP Scanner to the same translation as the cell. Found by the final code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: IP Scanner: Logged-on users computed once per host (K27) WindowsUsers joined the users on every read; the Logged-on users column is sorted by it and the search reads it for every row (also again with live filtering). Computed once when the Windows host information is set, like WindowsOS. Found by the final code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Password entered in the Windows credentials dialog not disposed (K28) Set Windows credentials... and Scan as... copy an entered password into the credentials of the tab, but the SecureString of the password box stayed in memory until it was finalized - every other copy of the password is disposed (G8). The dialog disposes the entered password after OK (the credentials have a copy) and on Cancel, not the password of the credentials it was opened with (owned by the caller). Found by the final code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: IP Scanner: Remove the Windows XP / Server 2003 names that can't be read (K29) The Windows host information only sends an SMB2 negotiate (2.0.2 - 3.1.1) and reads the NetApi / registry after an SMB2 answer. Windows XP and Server 2003 only know SMB1: no version is ever read for them, the names for 5.1 / 5.2 were dead code that suggested support the feature doesn't have. Vista / Server 2008 (SMB 2.0.2) and later stay. Found by the final code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor: IP Scanner: One method to open a tab for a profile, also for Scan as... (K30) Scan as... repeated the code of AddTab(ProfileInfo): the SNMP version and credentials of the profile / group and the names of the SNMP / Windows credentials sources. Both use AddProfileTab now, with the Windows credentials, whether they are the ones of the profile / group (shown as the source) and whether the user entered them. Found by the final code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Docs: Changelog 2023.11.28.0 linked to the removed Experimental features setting (K31) The changelog of 2023.11.28.0 linked to /docs/settings/update#experimental-features, removed with the setting (K23) - the website build fails on broken anchors (onBrokenAnchors: throw). Links to the page, with a note that the setting was replaced by the Beta label. Found by the final code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Windows credentials set after the tab was closed (K32) Set Windows credentials... didn't check if the tab was closed while the dialog was open (OnClose disposed the password of the tab): OK with unchanged credentials created a new lockout protection whose password fingerprint read the disposed password (ObjectDisposedException in the fire-and-forget task); changed credentials stayed on the closed tab with their password copy never disposed. After the dialog, a closed tab ignores the credentials and disposes the password of new ones (like the confirmation of a scan). Found by the final code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Hosts of other domains could reject correct Windows credentials first (K33) Whichever gated host got the turn first checked the credentials. If the first hosts of a scan were in a domain that is not trusted (a logon failure also with a correct password), Max. logon failures (default 2) rejected correct credentials before a host of their domain checked them - for all hosts, the next scans and (K16) every tab with this password. A host of another domain (or without NTLM values) first waits up to half of its time for the decision of a host in the domain of the credentials, then checks them itself (e.g. no such host in the scan). Not for credentials without domain (no host is in their domain). Found by the final code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: Windows credentials with another UPN suffix were never accepted (K34) Credentials were only accepted on a host whose NetBIOS / DNS domain or forest matched the domain of the credentials. With a UPN suffix that is not a domain name (e.g. admin@company.com for corp.local - common), no host was ever "in the domain": the gated hosts stayed one at a time for the whole scan and most of them were not tried (waited longer than twice the timeout); with K33 every host also waited first. For a UPN, a Windows member of a domain accepts them too (it passes the UPN to its domain controller; a Windows member doesn't log a wrong password of a domain account on as guest - Samba / NAS still don't accept, K17), it doesn't wait for the domain (K33), and a logon failure on it after the accept stops them (K19). Credentials without domain stay one host at a time (local accounts of the same name, documented). Found by the final code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix: IP Scanner: NetApi errors shown as "Unknown error" (K35) WindowsHostInfo.GetErrorMessage used Win32Exception, which only knows the messages of the system. The NetApi errors (NERR_*, 2100 - 2999, e.g. 2114 NERR_ServerNotStarted, 2102 NERR_WkstaNotStarted - both in the list of the lockout protection) are in netmsg.dll: the row details and the log showed "Unknown error (0x842)". NERR errors are read from netmsg.dll (loaded once as data file, FormatMessage), otherwise (or if not found / not on Windows) the message of the system as before. Found by the final code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Feature: IP Scanner: Max. concurrent Windows host information threads configurable The max. number of hosts whose NetApi requests run at the same time (was a constant 16) is a setting now (default 16, 1-64). The slots stay shared by all scans; the limit is passed with every request, so a changed value applies to the next requests while blocked calls of earlier scans still count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Feature: IP Scanner: Windows 11 26H2 (build 26300) and 26H1 (build 28000) 26H2 was shown as "Windows (build 26300)". 26H1 only ships on new devices with new chips (e.g. Snapdragon X2). The host info tests used 28000 as an unknown newer build, now 29000. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c7b3bc2 commit 9f2b0a8

79 files changed

Lines changed: 7528 additions & 934 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows.Data;
4+
using NETworkManager.Localization.Resources;
5+
using NETworkManager.Models.Network;
6+
7+
namespace NETworkManager.Converters;
8+
9+
/// <summary>
10+
/// Text and tooltip of the OS column of the IP Scanner: the Windows version if it was read (more precise), otherwise
11+
/// the guess from the TTL of the ping reply (see <see cref="IPScannerOSGuessToStringConverter" />).
12+
/// </summary>
13+
public sealed class IPScannerOSToStringConverter : IMultiValueConverter
14+
{
15+
/// <summary>
16+
/// Gets the text or tooltip of the OS column.
17+
/// </summary>
18+
/// <param name="values">
19+
/// [0] <see cref="IPScannerOSGuess" />, [1] hops (<see cref="int" />), [2] the ping is running, [3] the guess was
20+
/// enabled for the scan, [4] <see cref="WindowsHostInfo" /> (null if not read), [5] the Windows host information
21+
/// is still read.
22+
/// </param>
23+
/// <param name="targetType"></param>
24+
/// <param name="parameter">
25+
/// "ToolTip" to get the tooltip (version of Windows, or the hops of the guess), "Copy" for the clipboard (empty
26+
/// without value).
27+
/// </param>
28+
/// <param name="culture"></param>
29+
/// <returns>Text ("..." while running, "-/-" without value) or tooltip (null without value).</returns>
30+
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
31+
{
32+
if (values is not { Length: 6 })
33+
return null;
34+
35+
var osGuess = values[3] is true && values[0] is IPScannerOSGuess value ? value : IPScannerOSGuess.None;
36+
var hops = values[1] is int hopsValue ? hopsValue : 0;
37+
var isPingPending = values[3] is true && values[2] is true;
38+
var windows = values[4] as WindowsHostInfo;
39+
var isWindowsPending = values[5] is true;
40+
41+
var isToolTip = parameter as string == "ToolTip";
42+
43+
if (!string.IsNullOrEmpty(windows?.OS))
44+
{
45+
if (!isToolTip)
46+
return windows.OS;
47+
48+
// E.g. "Pro, 10.0.26200.6584"
49+
return string.IsNullOrEmpty(windows.Edition)
50+
? windows.Version?.ToString()
51+
: $"{windows.Edition}, {windows.Version}";
52+
}
53+
54+
if (osGuess != IPScannerOSGuess.None)
55+
return isToolTip
56+
? string.Format(Strings.OSGuessBasedOnTheTTLXHops, hops)
57+
: IPScannerOSGuessToStringConverter.ToLocalizedString(osGuess);
58+
59+
if (isToolTip)
60+
return null;
61+
62+
if (parameter as string == "Copy")
63+
return string.Empty;
64+
65+
return isPingPending || isWindowsPending ? "..." : "-/-";
66+
}
67+
68+
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
69+
{
70+
throw new NotImplementedException();
71+
}
72+
}

‎Source/NETworkManager.Converters/IPScannerStatusToolTipConverter.cs‎

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Globalization;
44
using System.Linq;
5-
using System.Net.NetworkInformation;
65
using System.Windows.Data;
76
using NETworkManager.Localization;
87
using NETworkManager.Localization.Resources;
@@ -11,8 +10,8 @@
1110
namespace NETworkManager.Converters;
1211

1312
/// <summary>
14-
/// Convert a result of the IP Scanner to the tooltip of its status icon: ping status with time and TTL, open ports,
15-
/// NetBIOS name and workgroup / domain - or whether the host answered a probe.
13+
/// Convert a result of the IP Scanner to a tooltip: the open ports (Open ports column), or whether the host answered
14+
/// a probe (status icons in the headers of the row details).
1615
/// </summary>
1716
public sealed class IPScannerStatusToolTipConverter : IValueConverter
1817
{
@@ -25,8 +24,8 @@ public sealed class IPScannerStatusToolTipConverter : IValueConverter
2524
/// Convert a result of the IP Scanner to the tooltip of its status icon.
2625
/// </summary>
2726
/// <param name="value">
28-
/// <see cref="PingInfo" />, ports (<see cref="List{PortInfo}" />), <see cref="NetBIOSInfo" />, or the
29-
/// <see cref="IPScannerDetectionMethod" /> of a host with the probe as <paramref name="parameter" />.
27+
/// Ports (<see cref="List{PortInfo}" />), or the <see cref="IPScannerDetectionMethod" /> of a host with the probe
28+
/// as <paramref name="parameter" />.
3029
/// </param>
3130
/// <param name="targetType"></param>
3231
/// <param name="parameter">Probe as name of <see cref="IPScannerDetectionMethod" /> (e.g. "ICMP").</param>
@@ -36,18 +35,6 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
3635
{
3736
switch (value)
3837
{
39-
// Success (2 ms, TTL 64) / Timed out
40-
case PingInfo pingInfo:
41-
var status = ResourceTranslator.Translate(ResourceIdentifier.IPStatus, pingInfo.Status);
42-
43-
if (pingInfo.Status != IPStatus.Success)
44-
return status;
45-
46-
var time = Models.Network.Ping.TimeToString(pingInfo.Status, pingInfo.Time);
47-
48-
// No TTL for IPv6
49-
return pingInfo.TTL > 0 ? $"{status} ({time}, {Strings.TTL} {pingInfo.TTL})" : $"{status} ({time})";
50-
5138
// Open: 22 (ssh), 80 (http) / No open ports found! (closed or timed out - the ports that are not open may
5239
// be hidden, see IPScanner.GetShownPorts)
5340
case List<PortInfo> ports:
@@ -64,16 +51,6 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
6451

6552
return $"{ResourceTranslator.Translate(ResourceIdentifier.PortState, PortState.Open)}: {list}";
6653

67-
// Yes (PC01, WORKGROUP) / No
68-
case NetBIOSInfo netBIOSInfo:
69-
if (!netBIOSInfo.IsReachable)
70-
return Strings.No;
71-
72-
var names = new[] { netBIOSInfo.ComputerName, netBIOSInfo.GroupName }
73-
.Where(x => !string.IsNullOrEmpty(x)).ToList();
74-
75-
return names.Count == 0 ? Strings.Yes : $"{Strings.Yes} ({string.Join(", ", names)})";
76-
7754
// Answered / No answer
7855
case IPScannerDetectionMethod detectedBy:
7956
return Enum.TryParse<IPScannerDetectionMethod>(parameter as string, out var method) &&

‎Source/NETworkManager.Converters/PortOpenToStringConverter.cs‎

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows.Data;
4+
using NETworkManager.Localization.Resources;
5+
using NETworkManager.Models.Network;
6+
using NETworkManager.Utilities;
7+
8+
namespace NETworkManager.Converters;
9+
10+
/// <summary>
11+
/// Converts a value of the <see cref="WindowsHostInfo" /> of an IP Scanner host to a <see cref="string" /> for the
12+
/// result and the row details, "-/-" if there is none. The value is selected with the converter parameter:
13+
/// <c>OS</c>, <c>Edition</c>, <c>Version</c>, <c>Role</c>, <c>ComputerName</c>, <c>Domain</c>,
14+
/// <c>Description</c>, <c>TimeOffset</c>, <c>Users</c> (one per line, the error if they could not be read),
15+
/// <c>SMB</c> (dialect), <c>SMBSigning</c> (required / not required), <c>Error</c> (message of the NetApi error).
16+
/// </summary>
17+
public sealed class WindowsHostInfoToStringConverter : IValueConverter
18+
{
19+
/// <summary>
20+
/// Text without a value: "-/-" (default), empty for Copy.
21+
/// </summary>
22+
public string NoValue { get; set; } = "-/-";
23+
24+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
25+
{
26+
var text = value is WindowsHostInfo info ? GetValue(info, parameter as string) : null;
27+
28+
return string.IsNullOrEmpty(text) ? NoValue : text;
29+
}
30+
31+
/// <summary>
32+
/// Gets a value of the Windows host information as text.
33+
/// </summary>
34+
/// <param name="info">Windows host information.</param>
35+
/// <param name="name">Name of the value, see <see cref="WindowsHostInfoToStringConverter" />.</param>
36+
/// <returns>Value, empty if there is none.</returns>
37+
public static string GetValue(WindowsHostInfo info, string name)
38+
{
39+
return name switch
40+
{
41+
"OS" => info.OS,
42+
"Edition" => info.Edition,
43+
"Version" => info.Version?.ToString(),
44+
"Role" => RoleToLocalizedString(info.Role),
45+
"ComputerName" => info.ComputerName,
46+
"Domain" => info.Domain,
47+
"Description" => info.Description,
48+
"TimeOffset" => info.TimeOffset is { } offset ? DateTimeHelper.TimeSpanToOffsetString(offset) : null,
49+
"Users" => info.Users != null
50+
? string.Join(Environment.NewLine, info.Users)
51+
: GetErrorMessage(info.UsersError),
52+
"SMB" => info.SMB?.Dialect,
53+
"SMBSigning" => info.SMB == null
54+
? null
55+
: info.SMB.SigningRequired
56+
? Strings.Required
57+
: Strings.NotRequired,
58+
"Error" => GetErrorMessage(info.Error),
59+
_ => null
60+
};
61+
}
62+
63+
/// <summary>
64+
/// Gets the message of an error of the NetApi requests (of Windows, or the credentials were not tried).
65+
/// </summary>
66+
private static string GetErrorMessage(int error)
67+
{
68+
return error switch
69+
{
70+
WindowsHostInfo.ErrorLogonSkipped => Strings.WindowsLogonSkippedMessage,
71+
WindowsHostInfo.ErrorLogonNotChecked => Strings.WindowsLogonNotCheckedMessage,
72+
_ => WindowsHostInfo.GetErrorMessage(error)
73+
};
74+
}
75+
76+
/// <summary>
77+
/// Gets the translated role of a Windows host, empty if unknown.
78+
/// </summary>
79+
/// <param name="role">Role.</param>
80+
/// <returns>Translated role.</returns>
81+
public static string RoleToLocalizedString(WindowsHostRole role)
82+
{
83+
return role switch
84+
{
85+
WindowsHostRole.Workstation => Strings.Workstation,
86+
WindowsHostRole.Server => Strings.Server,
87+
WindowsHostRole.DomainController => Strings.DomainController,
88+
_ => string.Empty
89+
};
90+
}
91+
92+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
93+
{
94+
throw new NotImplementedException();
95+
}
96+
}

0 commit comments

Comments
 (0)