手机号生成工具
import numpy
import re
import requests
import time
import os
current_path = os.path.dirname(os.path.abspath(__file__))
seed1 = input('手机号前三位:')
seed2 = input('城市(拼音):')
seed3 = input('手机号后二位:')
S = time.perf_counter()
modify = seed1 + '/' + seed2 + '.htm'
url = 'https://m.jihaoba.com/haoduan/' + modify
headers = {
'User-Agent': 'Mozilla/5.0 (Linux; U; Android 10; zh-Hans-CN; HLK-AL00 Build/HONORHLK-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 Quark/5.6.6.211 Mobile Safari/537.36'
}
seedling = requests.get(url=url, headers=headers).text
ex = '(\d{7})号段'
Mature = re.findall(ex, seedling, re.S)
matrix0 = numpy.array(Mature)
matrix = matrix0.astype(int)
print('唐醋俞')
matrix2 = matrix * 100
list0 = matrix2.tolist()
listK = []
for i in list0:
segment = numpy.arange(i, i + 100, dtype=numpy.int64)
fruit = segment * 100 + int(seed3)
listK.append(fruit.tolist())
generate_format = input('请选择生成的文件格式 (txt/vcf): ')
for x in range(len(listK)):
for n in listK[x]:
if generate_format == 'txt':
s = str(n) + '\n'
with open(os.path.join(current_path, '手机号.txt'), 'a') as f:
f.write(s)
elif generate_format == 'vcf':
s = 'BEGIN:VCARD\n' + 'N;CHARSET=UTF-8:' + str(n) + '\n' + 'FN;CHARSET=UTF-8:' + str(n) + '\n' + 'TEL;TYPE=CELL:' + str(n) + '\n' + 'END:VCARD' + '\n'
with open(os.path.join(current_path, '手机号.vcf'), 'a') as f:
f.write(s)
E = time.perf_counter()
dur = E - S
print('共生成号码:' + str(len(listK) * 100))
print('耗时:' + str(dur))
print('操作完成')
评论已关闭