2024年12月10日 星期二

jq筆記

解析帶 - 名稱

echo { \"host\": \"host\", \"host-name\": \"host-name\" } |jq  '.["host-name"]'

jsan.txt
{
  "result": {
  "host": "host", "host-name": "host-name0"
  },
  "host": "host", "host-name": "host-name1"
}

cat jsan.txt | jq '.["host-name"]'
cat jsan.txt | jq '.result["host-name"]'





Windows 10 的遠端伺服器管理工具(RSAT)

下載
https://www.microsoft.com/zh-tw/download/details.aspx?id=45520&msockid=1cc89087a3bc684704e9853ea2f06919

安裝
應用程式->選用功能->檢視功能

Powershell 相關指令
Get-WindowsCapability -Online -Name RSAT*
Add-WindowsCapability –Online –Name "Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0"
Remove-WindowsCapability -Online -Name "Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0"

執行
以管理者身分執行終端機

runas /netonly /user:tpha\administrator "mmc /server=dc-ip"

額外說明
不用加入網域

PHP $_SERVER['HTTP_REFERER'] 摘要

說明:
$_SERVER[‘HTTP_REFERER’] 來源於瀏覽器,不是所有都會設置且部份支援手動修改。

以下狀況會無效:
直接輸入網址訪問該網頁。
Javascript 打開的網址、重定向(window.location)網址及 FLASH 中的鏈接。
PHP header 或 meta refresh重定向的網址。
瀏覽器未加設置或修改

一般生效狀況:
<a></a>超鏈結
POST
GET

Debian12 Samba-Tool 移除 domain controller

登入移除要移除的 samba dc
samba-tool domain demote -Uadministrator

登入主要 samba dc
samba-tool domain demote --remove-other-dead-server=<上述移除 dc 主機名 windows-ad>

2024年12月9日 星期一

Debian 12 安裝 RustDesk Server

apt update;apt upgrade -y
apt install -y sudo wget

設定執行帳號及群組
export RUSTDESK=rustdesk

groupadd ${RUSTDESK}
useradd ${RUSTDESK} -g ${RUSTDESK} -m -r
usermod -aG sudo ${RUSTDESK}
passwd ${RUSTDESK}

安裝 rustdesk server
su - ${RUSTDESK}
cd
wget https://raw.githubusercontent.com/techahold/rustdeskinstall/master/install.sh
chmod a+x install.sh
./install.sh 

相關檔案、服務
/opt/rustdesk
rustdeskrelay.service   
rustdesksignal.service
/etc/systemd/system/rustdeskrelay.service
/etc/systemd/system/rustdesksignal.service 

/opt/gohttp
gohttpserver.service       
/etc/systemd/system/gohttpserver.service

/var/log/rustdesk

防火牆設定
21115-21119/tcp
8000/tcp
21116/udp