首页 > 其他分享 >手机号段抓取脚本

手机号段抓取脚本

时间:2022-11-20 14:46:47浏览次数:42  
标签:脚本 手机号 headers list 抓取 ret phone print

手机号段抓取脚本

#! -*- coding:utf-8 -*-
import requests
from multiprocessing.pool import ThreadPool
from lxml import etree

# 取消验证警告
from requests.packages.urllib3.exceptions import InsecureRequestWarning 
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)


headers_str = """Host: www.sdfl.net
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: https://cn.bing.com/
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: cross-site
Sec-Fetch-User: ?1
Pragma: no-cache
Cache-Control: no-cache"""


headers = dict([line.split(": ",1) for line in headers_str.split("\n")])

proxies = {
        "http": "socks5://127.0.0.1:8080",
        }

url = "https://www.sdfl.net/s/hubei/wuhan/"
ret = requests.get(url=url, headers=headers, verify=False)  #proxies=proxies


# print(ret.text)
print("[*] 获取html成功")

html_data = etree.HTML(ret.text)

seach_list = html_data.xpath(r'//div[@class="wrap h_list"]/dl[@class="list"]')

print("[*] 获取手机号段数量:", len(seach_list))

phone_list = []

for x in seach_list:                    # 获取搜素结果
    ret = x.xpath(r'./dd/a/text()')
    for id in ret:
        # print(id)
        for y in range(0, 10000):
            # print(y)
            phone_list.append("{}{:0>4d}\n".format(id, y))

print("[*] 获取手机号总数量:", len(phone_list))
with open(r'phone.txt', "a") as f:
    for phone in phone_list:
        f.writelines(phone)

标签:脚本,手机号,headers,list,抓取,ret,phone,print
From: https://www.cnblogs.com/startstart/p/16908443.html

相关文章

  • vue项目:系统禁用脚本
    创建vue项目时,提示禁用的脚本需要操作:管理员身份打开PowerShell 运行命令“set-ExecutionPolicyRemoteSigned”(set-ExecutionPolicyRemoteSigned(签名或运行这些脚本......
  • 网络工程师脚本生成工具V1.6.2(交换机脚本批量生成 SecureCRT vbs脚本)
    由于从事弱电行业,平时网络工程师不在,偶尔需要自己调试交换机。在调试中往往前端几十上百台设备的配置基本一样(除开地址,VLAN,名称不一样外),作为编程业余爱好者,最见不得简单有......
  • springboot 启动脚本
    springboot项目打包有是一个jar包,需要启动,如下命令启动命令:nohupjava-jarapp.jar>./log.out2>&1&但使用脚本会更加方便,脚本如下:#!/bin/bash#这里可替换为你自己......
  • 集群分发xsync xcall 脚本命令
     建立hosts白名单127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4::1localhostlocalhost.localdomainlocalhost6loca......
  • [YURIS引擎] 寻找脚本密钥
    [YURIS引擎]寻找脚本密钥0x00背景在寻找密钥之前来了解一下yuris的脚本yuris的脚本一般放在一个叫bn.ypforysbin.ypf的封包里。有兴趣了解结构的可以看看这个链接......
  • ECMAScript客户端脚本语言的标准 注释 数据类型
    1基本语法:1,与html结合方式  1,内部js  定义<script>,标签内容就算js代码2,外部JS定义<script>,通过src属性引入外部的js......
  • Bash 脚本 命令使用详解
    什么是Bash简介Bash(GNUBourne-AgainShell)是一个为GNU计划编写的Unixshell,它是许多Linux平台默认使用的shell。shell是一个命令解释器,是介于操作系统内核与用户......
  • 如何设置把vscode 左下角的 NPM脚本(NPM SCRIPT)显示出来
    一、如图按照步骤1,2进入设置二、如图设置,选择用户——>扩展——>Npm,4处默认的on,5处要勾选上  三、重启VScode,点开项目中的package.json,然后点击资源管理器旁边......
  • 跨站脚本攻击(XSS)
    跨站脚本攻击(XSS)漏洞描述  web程序代码中对用户提交的参数未做过滤或者过滤不严格,导致参数中的特殊字符破坏了HTML页面的原有逻辑,攻击者可以利用改漏洞执行恶意的htm......
  • 针对zabbix二次开发的监控脚本执行timeout时,zabbix-server性能消耗增大问题,开发处理ti
    脚本内容:#!/bin/sh####################################################Scripttohandleexecutiontimeoutstates#scriptbyshell#writedbyDeliver#huchangx......