2026/11/23

這二天在測試 agent0 
連接 litellm-proxy 一直有問題
看log是 token認証一直有問題
明明就沒打錯
而且在hermes agent 也沒問題
找了很久才發現是 , 的問題
因為在litellm-proxy設定的 master key 含有 ,
拿掉就正常了

2026/11/20

查看litellm-proxy各節點的健康狀態


curl -X GET 'http://10.0.0.1:4000/health' -H 'Authorization: Bearer 12345678'

2026/11/15

librenms 使用 Custom OID 時

Data Type 分為二種

說明一下要怎麼選

如果OID撈到的是當下的值而且不會持續累積

選擇 GAUGE

如果OID的值會持續累積

如果要等到當下的值 就要選擇  COUNTER

這樣才會用現在的值減到上一次的值

得到的才會是目前的值

另外如果建好後要改不同的data type

在web介面刪除後 要再進librenms os 手動刪除 對應的rrd檔 讓librenms 重建

如果不刪除 改type後 圖形不會重畫 所以會是錯的




2026/11/12

最近真的問題很多
早上又碰到 webatm不能登入




















查了半天 竟是 rsshub radar 這個plugin的問題 XD 關掉就正常了




2026/11/08

M$出的好用工具
可以完整記錄在win上執行的東西

下載後開dos視窗以系統管理員安裝


sysmon64.exe -accepteula -i sysmonconfig-export.xml


如何查看 Sysmon 事件紀錄

安裝並運作後,事件會被記錄在 Windows 事件日誌中:
1. 按下 Win + R 鍵,輸入 eventvwr.msc 開啟事件檢視器。
2. 依序展開:應用程式及服務記錄檔 -> Microsoft -> Windows -> Sysmon -> Operational。
3. 尋找常見的 Event ID 來分析行為:
• Event ID 1:處理序建立(Process Creation,包含完整的 Command Line 與雜湊值)。
• Event ID 3:網路連線(Network Connection)。
• Event ID 11:檔案建立(File Create)。
• Event ID 22:DNS 查詢(DNS Event)


所有ID

ID 標籤 事件
1 ProcessCreate 進程創建
2 檔案建立時間 檔案建立時間
3 NetworkConnect 偵測到的網路連線
4 n/a Sysmon 服務狀態變更 (無法篩選)
5 ProcessTerminate 處理程序已終止
6 DriverLoad 驅動程式已載入
7 ImageLoad 映像已載入
8 CreateRemoteThread 偵測到 CreateRemoteThread
9 RawAccessRead 偵測到 RawAccessRead
10 ProcessAccess 程序已被存取
11 FileCreate 檔案已建立
12 註冊事件 登錄物件已新增或刪除
13 註冊事件 登錄值已設定
14 註冊事件 登錄物件已重新命名
15 FileCreateStreamHash 檔案資料流已建立
16 n/a Sysmon 設定變更 (無法篩選)
17 PipeEvent 具名管道已建立
18 PipeEvent 具名管道已連線
19 WmiEvent WMI 篩選
20 WmiEvent WMI 使用者
21 WmiEvent WMI 使用者篩選器
22 DnsQuery DNS 查詢
23 檔案刪除 已封存檔案刪除
24 剪貼簿變更 剪貼簿中的新內容
25 處理程序操控 處理進程圖像變更
26 檔案刪除已偵測 檔案刪除動作已被記錄
27 FileBlockExecutable 阻擋可執行檔案
28 FileBlockShredding 檔案區塊銷毀
29 偵測到可執行檔案 偵測到可執行檔



2026/11/04

弱掃軟体

docker run --rm -v $(pwd):/output projectdiscovery/nuclei:latest \
  -u https://10.1.1.1  \
  -pdf-export /output/report.pdf


直接用python起http server

python3 -m http.server 3333


2026/10/28

cloudflare 提供免費靜態網頁的使用

講一下流程

先註冊或直使用google或其他帳號 (無需信用卡)

https://dash.cloudflare.com/login

登入後依照以下擷圖操作

使用上傳放式如果網頁內容有修改

不能只上傳修改部分

要砍掉重傳









snmp從windows server 2012 開始就被棄用

最近剛好看到 ncpa 

nagios 出的工具

記錄一下安裝使用流程 被監控端以windows 為例

下載 windows agent 安裝 

安裝過程中 token 記得要修改

監控端下載 check_ncpa.py

撈取被控端資料語法如下


# 1. 檢查 CPU 使用率 (5分鐘平均)

python3 check_ncpa.py -H 192.168.1.100 -t 'mytoken' -M 'cpu/percent' -q "aggregate=avg" -w 80 -c 90


# 2. 檢查記憶體使用率 (%)

python3 check_ncpa.py -H 192.168.1.100 -t 'mytoken' -M 'memory/virtual/percent' -w 80 -c 90


# 3. 檢查根目錄 / (Linux) 或 C: 磁碟空間 (Windows)

# Linux:

python3 check_ncpa.py -H 192.168.1.100 -t 'mytoken' -M 'disk/logical/|/percent' -w 80 -c 90

# Windows:

python3 check_ncpa.py -H 192.168.1.100 -t mytoken -M disk/logical/C:\|/used_percent -w 80 -c 90


查看所有可撈的指標

python3 check_ncpa.py -H 192.168.1.100 -t 'mytoken' -M 'disk/logical/C:|'


https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/hh831568(v=ws.11)

https://www.nagios.org/projects/ncpa/

https://assets.nagios.com/downloads/ncpa3/

https://github.com/NagiosEnterprises/ncpa/tree/master

https://github.com/NagiosEnterprises/ncpa/tree/master/client

2026/10/19

這几天在測試把免費的ai提供者整合起來
像 ollama nvidia google ai studio 等
找到了 litellm
記一下安裝流程

先建個目錄 並在目錄下產生 config.yaml
內容如下

model_list:
  - model_name: auto
    litellm_params:
      model: ollama/gemma4:31b
      api_base: "https://ollama.com"
      api_key: "fcfc69438036414CJtv9L-1EI1i2"

  - model_name: auto
    litellm_params:
      model: openai/nvidia/nemotron-3.5-super-vl-120b-a12b
      api_base: "https://integrate.api.nvidia.com/v1"
      #model: nvidia/nemotron-3.5-super-vl-120b-a12b
      #api_base: "https://integrate.api.nvidia.com"
      api_key: "nvapi-h6TxXTV08YRypl96bQ5VhXAaPWs"

#此區設定若有提供者有問題時會詢問其他  
router_settings:
  num_retries: 3
  allowed_fails: 1
  ##cooldown_time: 300
  timeout: 90

#設定要連到 litellm的密碼
general_settings:
  master_key: "password"

之後啟動docker

docker run -d   --name litellm-proxy   --restart unless-stopped   -p 4000:4000   -v /home/config.yaml:/app/config.yaml   ghcr.io/berriai/litellm:main-latest   --config /app/config.yaml --port 4000 --num_workers 8

跑起來後測試一下

curl http://10.0.0.1:4000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer password" \
  -d '{
    "model": "auto",
    "messages": [{"role": "user", "content": "Hello ai!"}]
  }'


如果要除錯可以先設定不同提供者不同的model_name
curl的 model 指定上述不同的 model_name


設定agent 時使用的 base url 

http://10.0.0.1:4000/v1



2026/10/15

昨天外稽
提到sbom
軟体盤點的東東

安裝 syft

curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /tmp

產生 sbom

/tmp/syft dir:/ -o spdx-json=/tmp/linux_sbom.json --exclude "/home"


安裝 grype 後解析sbom並查看有無漏洞

grype db update

grype linux_sbom.json



2026/10/14

今天graylog 升到 7.2 後

發現資料都沒有出現

查了一下發現以下的問題









[c0047f66-c774-11f1-9869-bc24115e9a75]: index [graylog_345], id [c0047f66-c774-11f1-9869-bc24115e9a75], message [failed to parse field [nf_stop] of type [long] in document with id 'c0047f66-c774-11f1-9869-bc24115e9a75'. Preview of field's value: '2026-10-14T02:12:41.687Z']

[c0047f65-c774-11f1-9869-bc24115e9a75]: index [graylog_345], id [c0047f65-c774-11f1-9869-bc24115e9a75], message [failed to parse field [nf_stop] of type [long] in document with id 'c0047f65-c774-11f1-9869-bc24115e9a75'. Preview of field's value: '2026-10-14T02:11:46.808Z']

[c0047f68-c774-11f1-9869-bc24115e9a75]: index [graylog_345], id [c0047f68-c774-11f1-9869-bc24115e9a75], message [failed to parse field [nf_stop] of type [long] in document with id 'c0047f68-c774-11f1-9869-bc24115e9a75'. Preview of field's value: '2026-10-14T02:12:41.028Z']

[c0047f67-c774-11f1-9869-bc24115e9a75]: index [graylog_345], id [c0047f67-c774-11f1-9869-bc24115e9a75], message [failed to parse field [nf_stop] of type [long] in document with id 'c0047f67-c774-11f1-9869-bc24115e9a75'. Preview of field's value: '2026-10-14T02:12:41.028Z']


Rotate active index 就可以解決



2026/10/10

今天在升pve kernel時才發現很多guest都出現如下的問題
EFI disk 憑証 2026/6 就過期了
解決方法有說明
但因為做完要關几再開几
所以必須找適合的時間處理




2026/10/08

今天在升級 splunk時又出現以下問題

rpm -Uhv splunk-10.6.0.5-86587d4e3b27.x86_64.rpm
warning: splunk-10.6.0.5-86587d4e3b27.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID b3cd4420: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
verify that this sytem has all the commands we will require to perform the preflight step
This looks like an upgrade of an existing Splunk Server. Checking to see what component we are installing
extracting splunk_preinstall_base64 into splunk/bin directory
Cannot initialize: /opt/splunk/etc/system/metadata/local.meta: Permission denied
Cannot initialize: /opt/splunk/etc/apps/learned/metadata/local.meta: Permission denied
Currently configured KVStore database path="/opt/splunk/var/lib/splunk/kvstore"

-> Version file="/opt/splunk/var/run/splunk/kvstore_upgrade/versionFile70" does not exists or not accessible!
Failed to open file! Error=Permission denied

最近好几次有碰到同樣的狀況
搞了半天
最後用最簡單粗暴的方式解決
chmod -R 777 /opt/splunk/

再跑一次安裝就好了

2026/10/05

有user最近几天一直有大流量
但目前只能看到目的ip 無法知道是什麼程式造成
寫個bat 定時排程記錄
如果再發生有log可以查

@echo off
:: 取得年月日
set "yy=%date:~0,4%"
set "mm=%date:~5,2%"
set "dd=%date:~8,2%"

:: 取得時分秒
set "hh=%time:~0,2%"
set "min=%time:~3,2%"
set "ss=%time:~6,2%"

:: 如果小時小於 10(前面有空格),補 0
if "%hh:~0,1%"==" " set "hh=0%hh:~1,1%"

set "dt=%yy%%mm%%dd%_%hh%%min%%ss%"

echo 當前時間檔名:%dt%
tcpvcon.exe -a -c -n > "%dt%.csv"

2026/10/03

之前如果要打包並執行都會使用7z 再轉成執行檔
後來找了 bandizip 感覺方便許多

最近又發現 bat to exe
可以把所有需要的檔案一次打包並執行寫好的批次檔
重點是使用這個方式
就不用怕被看到原始碼了 

有個問題 很容易被M$誤判


2026/09/30

最近Novell ldap 換成AD

apache設定修改如下

舊

<Directory /var/www/test>
    AuthName ldap
    AuthType Basic
    AuthBasicProvider ldap
    AuthLDAPURL ldap://test.tw:389/o=users?cn?sub?(objectClass=*)
    AuthLDAPBindDN "cn=test01, ou=vendor, ou=people, o=users"
    AuthLDAPBindPassword passwd
    Require valid-user
</Directory>


新
<Directory /var/www/test>
    AuthName ldap
    AuthType Basic
    AuthBasicProvider ldap
    AuthLDAPURL ldap://test.tw:389/OU=user,DC=nkuht,DC=local?sAMAccountName?sub?(objectClass=*)
    AuthLDAPBindDN "test01@test.local"
    AuthLDAPBindPassword passwd
    Require valid-user
</Directory>



2026/09/26

之前討論怎麼把shell編譯成執行檔
這次來討論python
一般有二個方式 pyintaller 或 nuitka
先講 nuitka

安裝
pip install nuitka
執行需要 patchelf
sudo apt install  patchelf

再來就可以直接用了

python3 -m nuitka --standalone test.py

產生二個目錄

test.build
test.distt

執行檔在

test.distt 裡的 test.bin


2026/09/22

#!/bin/bash

刪除每次還原前系統自動建立的快照

for i in `echo "passwd"|sudo -S timeshift --list|grep Before|awk '{print $3}'`
do
        echo "passwd"|sudo -S timeshift --delete --snapshot "$i"
done

還原最後一份版本的快照

id=$(echo "passwd"|sudo -S timeshift --list|grep -v Before|tail -n 2|head -n 1|awk '{print $3}')

echo "passwd"|sudo -S timeshift --restore --snapshot "$id" --scripted


btrfs 不會自動重開几 會等到下次重開几才生效
rsync 還原後會自動馬上重開

 #!/bin/bash


/usr/bin/VBoxManage snapshot win11 restore 20260918

/usr/bin/VBoxManage startvm win11

2026/09/20

如何把寫好的shell 只給user執行 但不給user看內容


使用 shc 將腳本加密編譯為二進位檔
shc (Shell Script Compiler) 可以將 Shell 腳本轉為 C 語言原始碼並編譯成二進位檔。

# 1. 安裝 shc (以 Ubuntu/Debian 為例)
sudo apt update && sudo apt install shc

# 2. 將腳本編譯為二進位檔
shc -f myscript.sh

# 編譯後會生成兩個檔案:
# - myscript.sh.x (編譯後的二進位執行檔)
# - myscript.sh.x.c (C 語言原始碼,可刪除)

# 3. 設定權限:禁止讀取,僅留執行
chmod 701 myscript.sh.x

# 4. 移除原始的 .sh 腳本(或移至安全地方)
rm myscript.sh myscript.sh.x.c

編譯出來的 myscript.sh.x 即可實現「可執行、不可讀取」的效果。