<commit_before>function IsPortListening
{
  param($portNumber, $protocol)
  $netstatOutput = netstat -an | Out-String
  $networkIPs = (Get-WmiObject Win32_NetworkAdapterConfiguration | ? {$_.IPEnabled}) | %{ $_.IPAddress[0] }
  [array] $networkIPs += "0.0.0.0"
  [array] $networkIPs += "127.0.0.1"
  [array] $networkIPs += "[::1]"
  foreach ($ipaddress in $networkIPs)
  {
    $matchExpression = ("$ipaddress" + ":" + $portNumber + ".*LISTENING")
    if ($protocol) { $matchExpression = ($protocol.toUpper() + "\s+$matchExpression") }
    if ($netstatOutput -match $matchExpression) { return $true }
  }
  $false
}<commit_msg>add ipv6 equivalent of 0.0.0.0 ([::]) to network addressess checked don't require "LISTENING" in the matched string if "*:*" exists (UDP listening ports to not have a "State" (i.e. LISTENING) in netstat output like TCP ports do, but instead show the Foreign Addres as "*:*")<commit_after>function IsPortListening
{
  param($portNumber, $protocol)
  $netstatOutput = netstat -an | Out-String
  $networkIPs = (Get-WmiObject Win32_NetworkAdapterConfiguration | ? {$_.IPEnabled}) | %{ $_.IPAddress[0] }
  [array] $networkIPs += "0.0.0.0"
  [array] $networkIPs += "127.0.0.1"
  [array] $networkIPs += "[::1]"
  [array] $networkIPs += "[::]"
  foreach ($ipaddress in $networkIPs)
  {
    $matchExpression = ("$ipaddress" + ":" + $portNumber + ".*(LISTENING|\*:\*)")
    if ($protocol) { $matchExpression = ($protocol.toUpper() + "\s+$matchExpression") }
    if ($netstatOutput -match $matchExpression) { return $true }
  }
  $false
}
{'fraction_non_alphanumeric': 0.1828718609143593, 'fraction_numerical': 0.021249195106245976, 'mean_word_length': 4.433566433566433, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 5, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4739307', 'n_tokens_mistral': 554, 'n_tokens_neox': 537, 'n_words': 128}