Skip to content

Instantly share code, notes, and snippets.

Avatar

Tian Xie shinvdu

View GitHub Profile
@shinvdu
shinvdu / tun-ping-linux.py
Created Aug 18, 2016 — forked from glacjay/tun-ping-linux.py
Reading/writing Linux's TUN/TAP device using Python.
View tun-ping-linux.py
import fcntl
import os
import struct
import subprocess
# Some constants used to ioctl the device file. I got them by a simple C
# program.
TUNSETIFF = 0x400454ca
TUNSETOWNER = TUNSETIFF + 2
@shinvdu
shinvdu / send_file.py
Created Aug 2, 2016 — forked from dengshilong/send_file.py
使用smtplib的例子
View send_file.py
#--*-- encoding:utf-8 --*--
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders
from datetime import date
def sendMail(user,pwd,to,subject,filename):
outer = MIMEMultipart()
outer['From'] = user
outer['To'] = to
@shinvdu
shinvdu / build_mysql.sh
Created Mar 2, 2016 — forked from shichao-an/build_mysql.sh
Build and install MySQL 5.1 from source on Ubuntu 14.04
View build_mysql.sh
#!/bin/bash
# Run as root
set -e
apt-get update
apt-get install -y build-essential
apt-get install -y libncurses5-dev
useradd mysql
@shinvdu
shinvdu / gist:d0054671bad636310320
Last active Aug 29, 2015 — forked from saga/gist:1381374
Python实现QQ机器人
View gist:d0054671bad636310320
目前网上有不少的实现QQ机器人的方法,都不太稳定甚至都已经失效了,而且我们还要冒着QQ号被盗用的风险。其实我们可以自己实现一个QQ自动应答的机器人,思路非常简单:通过模拟登录3G版QQ,来实现相关的操作:
一、首先我们得看看3GQQ的相关协议
为此,我们需要一个支持WAP的浏览器,可以使用Firefox的wmlbrowser插件,打开FF后,访问地址:https://addons.mozilla.org/zh-CN/firefox/search/?q=wmlbrowser&cat=all&x=17&y=11
二、进入3GQQ的进行协议分析
3GQQ的地址是:http://pt.3g.qq.com/s?aid=nLogin3gqq 用安装了wmlbrowser插件的FF打开页面后,启用firebug,即可监视提交的数据。
三、源代码
View decode_session_cookie.rb