平时开 ss 都是用 pac 模式, 有些网站打不开时就开 全局 模式 , 然后用抓包工具看该网站都请求了哪些url, 然后把这些url填入到 ss 的 pac.txt 列表中
这个姿势用的比较多, 所以就弄个python脚本工具方便点.
姿势

- 抓取url. 打开 fiddler, 清空记录, 然后开始 capturing, 在这个网站上多点击个连接, 这样会url全面一点.
- 复制url. 全选url, 右键 -> copy -> just url, 粘贴到一个文本 aaa222.lua 中
- 跑脚本 ( 动图中的 右键 -> run code 是自己写的 vscode 插件工具 ). 输出的内容在 aaa333.lua 中, 叫输出内容复制粘贴到 ss 的 pac.txt 中
后面浏览这个网站是就不用开全局了.
python脚本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| def testRegForFiddlerToShadowsocks(): filePath = "c:/Users/wolegequ/Desktop/aaa222.lua" lines = util.readFileLines(filePath)
resArr = [] for url in lines: if len(url) > 0: res = re.findall(r"\.([0-9a-zA-Z]+)", url) resLen = len(res) if resLen > 1: domain = res[resLen-2] + "." + res[resLen-1] resArr.append(domain)
resMap = {} content = "" for domain in resArr: if (domain not in resMap.keys()): resMap[domain] = True content += ('"%s": 1,\n') % domain
outPath = "c:/Users/wolegequ/Desktop/aaa333.lua" util.writeFile(outPath, content)
|