一、实现iMessage数据检测的两种方式:
1.人工筛选,将要验证的号码输出到文件中,以逗号分隔。再将文件中的号码粘贴到iMessage客户端的地址栏,iMessage客户端会自动逐个检验该号码是否为iMessage账号,检验速度视网速而定。红色表示不是iMessage账号,蓝色表示iMessage账号。
2.编写程序控制Mac os/iphone上自带的iMessage应用进行验证(自动无痕迹检测,无需人工干预),将数据自动填充到号码框之后,如果捕获到失败则不是iMessage账号,捕获到成功则把数据保存下来。
二、iMessage蓝号检测协议分析
/* 注意:检测不同国家手机号需要在手机号的前缀 +国家代码即可,自动检测导入的txt数据,蓝号数据自动保存,最新升级版参考文章: https://www.cnblogs.com */
无痕检测是否imessge蓝号协议代码如下:
'''
协议通道版iMessage蓝号检测
'''
import time
import os
import urllib.request
import common
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
# 初始化参数设置
def init():
options = Options()
options.binary_location = "./chrome.exe"
options.add_argument('--ignore-certificate-errors')
options.add_argument('--ignore-ssl-errors')
options.add_argument("--log-level=3")
options.add_experimental_option("excludeSwitches", ["enable-logging"])
options.add_argument(f"user-agent=common.get_rand_ua()")
options.add_argument('--headless')
# 创建服务
service = Service(executable_path="./chromedriver.exe")
driver = webdriver.Chrome(service=service, options=options)
driver.set_window_position(0,0)
driver.set_window_size(560,820)
driver.get(check_URL)
driver.implicitly_wait(5)
return driver
# 任务处理
def Check(file_txt, ini_file, result_path, result_file_name):
if os.path.exists(file_txt) == True:
#启动浏览器
browser = init()
with open(file_txt, 'r') as f:
lines = f.readlines()
line_count = len(lines)
common.log(f"待检测数据文件 {file_txt} 总数量: {line_count} 条")
index = int(common.read_ini(ini_file))
tag = True
while tag:
#根据索引取出数据
Email_data = lines[index].strip()
common.log(Email_data + " 检测中...")
email_locator = (By.CLASS_NAME, 'generic-input-field.form-textbox-input.iforgot-apple-id.force-ltr')
email_element = common.is_element_present(browser, email_locator)
image_data_locator = (By.XPATH, '//idms-captcha//div//div//img')
image_data_element = common.is_element_present(browser, image_data_locator)
capth_locator = (By.CLASS_NAME, 'generic-input-field.form-textbox-input.captcha-input')
capth_element = common.is_element_present(browser, capth_locator)
submit_locator = (By.XPATH, '//idms-toolbar//div//div//div//button')
submit_element = common.is_element_present(browser, submit_locator)
if email_element == True and image_data_element == True and capth_element == True and submit_element == True :
time.sleep(0.5)
browser.find_element(By.CLASS_NAME, 'generic-input-field.form-textbox-input.iforgot-apple-id.force-ltr').send_keys(Email_data)
# 获取验证码数据并识别
image_element = browser.find_element(By.CSS_SELECTOR, '.img-wrapper > img:nth-child(1)')
Verification_code = common.get_verify_code(image_element.screenshot_as_png)
time.sleep(0.5)
browser.find_element(By.CLASS_NAME, 'generic-input-field.form-textbox-input.captcha-input').send_keys(Verification_code)
time.sleep(0.5)
browser.find_element(By.XPATH, '//idms-toolbar//div//div//div//button').click()
time.sleep(1)
button_locator = (By.CSS_SELECTOR, 'button.button:nth-child(2) > div:nth-child(1)')
button_element = common.is_element_present(browser, button_locator)
if button_element == True :
# 记录当前检测的数据的索引
index += 1
common.write_ini(ini_file, index)
# 记录检测成功的数据
common.wirte_append_txt(result_path, result_file_name, Email_data + "---" + "OK\n")
common.log(Email_data + ' 已开通')
else:
err_mess_locator = (By.CLASS_NAME, 'form-message-wrapper.std-error span.form-message')
err_mess_lement= common.is_element_present(browser, err_mess_locator)
if err_mess_lement == True :
common.log('验证码识别错误,重新检测中...')
else:
index += 1
common.write_ini(ini_file, index)
# 记录检测成功的数据
common.wirte_append_txt(result_path, result_file_name, Email_data + "---" + "Fail\n")
common.log(Email_data + ' 未开通')
if index >= line_count:
common.write_ini(ini_file, 0)
common.log(f'{file_txt}, 文件的{line_count}条数据已全部检测完毕!')
tag = False
break
else:
common.log('API接口加载失败,重新请求中...')
browser.quit()
time.sleep(0.5)
browser = init()
else:
common.log(f"待检测的 {file_txt} 文件不存在!")
if __name__ == '__main__':
common.banner()
Check('data.txt', 'Config.ini', '检测结果', '检测结果.txt')
源码编译后运行效果图(程序可以在WindowsMac/Linux等系统下多开同时运行,全自动检测无需人工看守,检测结果自动保存.)