This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| ## | |
| ## dump object to string | |
| ## | |
| # XXX - ''.join([(len(`chr(x)`)==3) and chr(x) or '.' for x in range(256)]) | |
| __vis_filter = """................................ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[.]^_`abcdefghijklmnopqrstuvwxyz{|}~.................................................................................................................................""" | |
| def hexdump(buf, length=16): | |
| """form dpkt: Return a hexdump output string of the given buffer.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| IMOUTO_HOST="https://www.dropbox.com/sh/lw0ljk3sllmimpz/AAC-n6LmtWbdlKQRbdEa0QUoa/imouto.host.7z?dl=1" | |
| # download hosts file | |
| curl -L -o imouto.host.7z ${IMOUTO_HOST} | |
| # unzip | |
| ./7za x imouto.host.7z imouto.host.txt | |
| awk '{ if (NR==1) sub(/^\xef\xbb\xbf/,""); print }' imouto.host.txt > imouto.host.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| HOSTS = """ | |
| # 将gfw hosts内容粘贴到这里 | |
| """ | |
| BLACK_LIST = """com.co.jp | |
| akamaihd.net | |
| angrybirds.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pexpect # download from https://github.com/pexpect/pexpect | |
| def remote_ssh_cmd(ip, cmd, user="root", passwd=""): | |
| ssh = pexpect.spawn('ssh %s@%s "%s"' % (user, ip, cmd)) | |
| r = '' | |
| try: | |
| i = ssh.expect(['password: ', 'continue connecting (yes/no)?']) | |
| if i == 0 : | |
| ssh.sendline(passwd) | |
| elif i == 1: |
NewerOlder