Skip to content

Instantly share code, notes, and snippets.

View coconut49's full-sized avatar
🐰
Focusing

49 coconut49

🐰
Focusing
View GitHub Profile
@coconut49
coconut49 / updateTorIP.py
Last active December 15, 2017 15:22
a python function, ask Tor change to a new IP. Usually use for small spider.
import requests
import socket
def updateTorIP(host="127.0.0.1", port=9051, passwd="mypassword", torProxy="socks5://127.0.0.1:9050"):
if torProxy:
proxies = {
"http": torProxy,
"https": torProxy,
}
else:
@coconut49
coconut49 / 0_reuse_code.js
Created November 3, 2016 05:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@coconut49
coconut49 / unicode_escape.py
Created September 9, 2016 07:39 — forked from omsobliga/unicode_escape.py
Python 在什么情况下会输出 Unicode 字符串
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" 测试 Python 在什么情况下会输出 Unicode 字符串
需要首先理解在 Python 中 Unicode 类型和 Unicode 字符串指的不是同一个东西。
Unicode 字符串是 str 类型,但它的值的表现形式是 Unicode 编码形式。
"""
def printt(str):
import iptools
with open("chn.txt") as f,open("chnroute-ipip.txt",mode="w") as o:
line = f.readline()
while line:
ip,netmask = line.split(" ")
print("Now Processing IP: "+str(ip)+" Netmask: "+str(netmask))
cidr = iptools.ipv4.netmask2prefix(str(netmask))
o.writelines("prefixcmd "+str(ip)+"/"+str(cidr)+" suffixcmd\n")
line = f.readline()
import iptools
with open("chn.txt") as f,open("proxifier.txt",mode="w") as o:
line = f.readline()
while line:
ip,netmask = line.split(" ")
print("Now Processing IP: "+str(ip)+" Netmask: "+str(netmask))
ipstart,ipend=iptools.ipv4.subnet2block(str(ip)+"/"+str(netmask))
o.writelines(ipstart+"-"+ipend+"\n")
line = f.readline()
@coconut49
coconut49 / hosts
Created July 24, 2016 11:04
OneNote Hosts For China With Microsoft HongKong CDN
204.79.197.212 onedrive.live.com
204.79.197.212 skyapi.onedrive.live.com
204.79.197.212 d.docs.live.net
204.79.197.212 dm2304files.storage.live.com
204.79.197.212 ocws.officeapps.live.com
40.74.129.10 www.onenote.com
104.210.40.87 nexus.officeapps.live.com
204.79.197.212 ocos-office365-s2s.msedge.net
204.79.197.212 directory.services.live.com
204.79.197.212 docs.live.net

Keybase proof

I hereby claim:

  • I am zfox49 on github.
  • I am zfox49 (https://keybase.io/zfox49) on keybase.
  • I have a public key whose fingerprint is 3216 55FD F882 A8C1 E294 09F3 9285 232B 68DC 5B97

To claim this, I am signing this object:

# -*- coding: utf-8 -*-
import requests
import re
import time
def get_xml():
try:
global l
doc = requests.get("http://bbsrss.mirrors.cqupt.edu.cn/bbs/forum.php?mod=rss&fid=68&auth=0").text
l = [[x, y] for x, y in zip(re.findall(re.compile(r'<title>(.*?)</title>'), doc)[2:],

如何在路由器中实现透明代理?

0 互联网现状

目前整个互联网环境,被破坏最严重地部分,是 Web 服务体验。当直接破坏难以实现时,就会从流程链的上下游着手,如:DNS 污染。

其它地互联网服务类型,例如:邮件,可能小部分会受到 Web 服务上下游破坏地余震,但整体上基本不受影响。

[Proxy]
WIFI = direct, interface=en2
VPN = direct, interface=utun0
[Rule]
DOMAIN-SUFFIX,yach.me,WIFI
FINAL,VPN