2021年7月24日 星期六

2021年7月20日 星期二

Windows command 計算行數

Reference:

C:\>find /?
搜尋一或多個檔案中的文字字串。

FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]

  /V         顯示所有不包含指定字串的行。
  /C         只顯示包含字串的行數。
  /N         顯示每一行及它的行號。
  /I         當搜尋字串時,忽略字元的大小寫。
  /OFF[LINE] 不要略過有離線屬性集的檔案。
  "string"   指定要尋找的文字字串。
  [drive:][path]filename
             指定要搜尋的一或多個檔案。

如果沒有指定路徑,FIND 會搜尋在提示時所輸入的文字
或者在其他的命令中搜尋。

  • 計算所有行數
    • Ex: netstat -ano | find /v /c ""
  • 計算符合的行數,不分大小寫
    • Ex: netstat -ano | find /c "listen"


2021年7月14日 星期三

Windows server 修改 time_wait

Reference:

執行 regedit
進入 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
新增 REG_DWORD: TcpTimedWaitDelay
Range: Windows Server 2012R2 和更新版本: 2-300 (decimal)


2021年7月7日 星期三

Windows 10 安裝 PADS 9.x 問題

狀況:
安裝 PADS 時出現錯誤為 The following ePD applications are rinning - please shut them down and click OK to continue. Dashboard

Windows 10 執行 PDAS 卡住

Reference:

狀況:
Windows 10 更新,造成 PADS 開啟後過幾分鐘就無法操作。

解法:
設定輸入法使用以前的版本。

2021年6月30日 星期三

Fortigate SSL VPN 使用 LDAP 認證

Reference:

新增 LDAP server
Common Name Identifier: sAMAccountName
Distinguished Name: DC=mydomain,DC=com,DC=tw
Bind Type: Regular
Username: user1@mydomain.com.tw

弱點修複 Web Server HTTP Header Internal IP Disclosure

Reference:

Nessus 弱點報告
Web Server HTTP Header Internal IP Disclosure
Description
This may expose internal IP addresses that are usually hidden or masked behind a Network Address Translation (NAT) Firewall or proxy server.

There is a known issue with Microsoft IIS 4.0 doing this in its default configuration. This may also affect other web servers, web applications, web proxies, load balancers and through a variety of misconfigurations related to redirection.
Solution
Apply configuration suggested by vendor.
See Also
http://www.nessus.org/u?fe24f941
https://support.microsoft.com/en-us/help/218180
http://www.nessus.org/u?4eedfe2d

狀況:
這一台是Nginx reverse proxy,後面是 IIS web service。
本來以為是 IIS 的問題,但是直接對 IIS 掃描沒找到這個弱點,所以判斷是 Nginx 的問題。

解法:
在 Nginx config 設定
server_name  mydomain.com
server_name_in_redirect on

restart nginx service再掃描確認已修復。