简介
在做溯源反制的时候有时,获取到攻击者的脱敏手机号和地区,但因为手机号并不全无法进行下一步的利用,于是就有了下面的这个脚本来复原脱敏手机号
当发现存在账号时就会有高亮显示了
脚本代码
# -*- coding: utf-8 -*-
# @Author : CatalyzeSec
import time
from phone import Phone
import requests
pre_num = input("[*]请输入手机号前三位:")
suf_num = input("[*]请输入手机号后四位:")
city = input("[*]请输入省份/地区:")
#手机号获取csdn注册状态
def get_csdn(mn):
mobile_num = mn
url = 'https://passport.csdn.net/v1/service/mobiles/'
response = requests.get(url + mobile_num)
if "success" in response.text:
return 'CSDN账号存在'
else:
return '不存在CSDN账号'
#通过脱敏手机号如131****1234和地区批量获取csdn注册状态
def realphone(pre_num, suf_num, city):
p = Phone()
flag = 0
lis = []
for i in range(10000):
mobile_num = pre_num + '{:04d}'.format(i) + suf_num
out = p.find(mobile_num)
if out:
if out['province'] == city:
if flag <= 50:
flag += 1
if get_csdn(out['phone']) == "CSDN账号存在":
print("\033[91m" + out['phone'], out['province'], out['city'], out['phone_type'], get_csdn(out['phone']) + "\033[0m")
lis.append(out)
else:
print(out['phone'], out['province'], out['city'], out['phone_type'], get_csdn(out['phone']))
else:
print("发送数据过多,请稍等......")
time.sleep(30)
flag = 0
continue
elif out['city'] == city:
if flag <= 50:
flag += 1
if get_csdn(out['phone']) == "CSDN账号存在":
print("\033[91m" + out['phone'], out['province'], out['city'], out['phone_type'], get_csdn(out['phone']) + "\033[0m")
lis.append(out)
else:
print(out['phone'], out['province'], out['city'], out['phone_type'], get_csdn(out['phone']))
else:
print("发送数据过多,请稍等......")
time.sleep(20)
flag = 0
continue
print("=============================================================")
print("\033[91m" + "[*]存在CSDN账号的手机号:" + "\033[0m")
for item in lis:
print("\033[91m" + item['phone'], item['province'], item['city'], item['phone_type'], get_csdn(item['phone']) + "\033[0m")
if __name__ == "__main__":
realphone(pre_num, suf_num, city)
微信公众号二维码
扫一扫关注CatalyzeSec公众号
我们一起来学习网络安全