This file contains 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 os | |
import re | |
import socket | |
import struct | |
def dns_resolve(host, dnsserver): | |
assert isinstance(host, basestring) and isinstance(dnsserver, basestring) | |
index = os.urandom(2) | |
hoststr = ''.join(chr(len(x))+x for x in host.split('.')) | |
data = '%s\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00%s\x00\x00\x01\x00\x01' % (index, hoststr) |
This file contains 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
from pcapy import open_offline | |
def filter_HTTPGET(packet): | |
if packet[0x33] == '\x06' and packet[0x52:0x56] == "GET ":#tcp and tcp[20:4] = 0x47455420 | |
return True | |
return False | |
def get_source_IP(packet): | |
#return '.'.join(str(ord(i)) for i in packet[0x36:0x3A]) | |
return tuple(ord(i) for i in packet[0x36:0x3A]) |
This file contains 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 -*- | |
""" | |
legit.scm | |
~~~~~~~~~ | |
This module provides the main interface to Git. | |
""" | |
import os |
This file contains 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
from socket import * | |
import os | |
import struct | |
ADDR = ('59.78.41.61',5006)#你的IP,端口随意 | |
BUFSIZE = 1024 | |
filename = 'sort-collection.py'#文件名,把这个文件跟要传的文件放一个目录里 | |
FILEINFO_SIZE=struct.calcsize('128s32sI8s') | |
sendSock = socket(AF_INET,SOCK_STREAM) |
This file contains 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
_ = ( | |
255, | |
lambda | |
V ,B,c | |
:c and Y(V*V+B,B, c | |
-1)if(abs(V)<6)else | |
( 2+c-4*abs(V)**-0.4)/i | |
) ;v, x=1500,1000;C=range(v*x | |
);import struct;P=struct.pack;M,\ | |
j ='<QIIHHHH',open('M.bmp','wb').write |
This file contains 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 dpkt, socket | |
f = open('t.cap', 'rb') | |
pcap = dpkt.pcap.Reader(f) | |
c = 0 | |
for ts, buf in pcap: | |
# make sure we are dealing with IP traffic | |
# ref: http://www.iana.org/assignments/ethernet-numbers |
This file contains 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
#!/usr/bin/env python | |
import dpkt, socket | |
f = open('t.cap', 'rb') | |
pcap = dpkt.pcap.Reader(f) | |
c = 0 | |
ptr_c = 0 | |
log = open('4-seg-ip-dns-filter','w') |
This file contains 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
from PyQt4 import QtCore, QtGui | |
class TextEdit(QtGui.QTextEdit): | |
""" | |
A TextEdit editor that sends editingFinished events | |
when the text was changed and focus is lost. | |
""" | |
editingFinished = QtCore.pyqtSignal() | |
receivedFocus = QtCore.pyqtSignal() |
This file contains 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
from PyQt4 import QtCore | |
import glob | |
import os | |
import time | |
def all_files(pattern, search_path, pathsep=os.pathsep): | |
for path in search_path.split(pathsep): | |
for match in glob.glob(os.path.join(path, pattern)): | |
yield match |
This file contains 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 | |
from random import choice | |
paper = [{'E': "天才", 'S': "笨蛋", 'W': "猪八戒", 'N': "大师兄"}, {'E': "Hentai", 'S': "绅士", 'W': "高富帅", 'N': "矮穷挫"}] | |
command = raw_input("Please input Direction and count, like: W25\n>>> ") | |
direction = command[0] | |
count = choice([0, 1]) + int(command[1:]) | |
print paper[count % 2][direction] |
OlderNewer