首页 > 其他分享 >成功实现脚本检测手机号是否注册imessage的原理

成功实现脚本检测手机号是否注册imessage的原理

时间:2023-06-24 14:22:28浏览次数:50  
标签:set end 注册 -- imessage file target tell 手机号

一、imessages数据检测的两种方式:
1.人工筛选,将要验证的号码输出到文件中,以逗号分隔。再将文件中的号码粘贴到iMessage客户端的地址栏,iMessage客户端会自动逐个检验该号码是否为iMessage账号,检验速度视网速而定。红色表示不是iMessage账号,蓝色表示iMessage账号。
2.编写苹果操作系统下的脚本程序进行过滤(全自动检测,无需人工干预),类似于群发iMessage;发送一条iMessage之后,如果捕获到发送失败的异常则不是iMessage账号,捕获到发送成功则把数据保存下来。

 

 

二、实现全自动检测数据是否启用或开通imessages
1.电脑版脚本全自动检测手机号是否注册imessages,注意:检测不同国家手机号需要在手机号的前缀 +国家代码即可(自动检测导入的txt数据,蓝色的手机号数据自动保存,有偿提供源码或脚本程序联系飞机: @fz66168 )
电脑版检测脚本代码示例:

  1 startApp()
  2 
  3 on clickOk()
  4     tell application "Messages" to activate
  5     tell application "System Events"
  6         tell process "Messages"
  7             tell window 1
  8                 entire contents
  9             end tell
 10         end tell
 11     end tell
 12 end clickOk
 13 
 14 
 15 on startApp()
 16     tell application "Finder" to activate
 17     
 18     tell application "Finder"
 19         set chosenfile to (choose file) --选择制定需要检测的数据例如: phone.txt
 20     end tell
 21     
 22     tell application "Messages"
 23         tell application "Messages" to activate
 24         
 25         set phoneData to read chosenfile
 26         set cards to paragraphs of phoneData
 27         
 28         repeat with phone in cards
 29             --set msgText to (my AppendFace(" "))
 30             
 31             -- 假如字符串不是11位,则草率判定不是手机号
 32             set num to the length of phone
 33             if (num > 0) then
 34                 --执行发送
 35                 my sendMsg(phone, ".")
 36                 delay 1
 37                 
 38                 # 及时删除多余的消息
 39                 set chatNum to (get count of chat)
 40                 if chatNum is greater than 1 then
 41                     my deleteMsg(chatNum, phone)
 42                 end if
 43                 
 44             end if
 45         end repeat
 46         
 47     end tell
 48 end startApp
 49 
 50 
 51 # 发送信息
 52 on sendMsg(phone, msg)
 53     tell application "System Events"
 54         tell process "Messages"
 55             tell window 1
 56                 delay 0.2
 57                 key code 55 & 45
 58                 --核心代码,省略.........
 59             end tell
 60         end tell
 61     end tell
 62 end sendMsg
 63 
 64 
 65 # 删除信息
 66 on deleteMsg(maxNum, thisphone)
 67     tell application "Messages" to activate
 68     
 69     tell application "System Events"
 70         tell process "Messages"
 71             tell window 1
 72                 repeat maxNum times 
 73                     
 74                     delay 0.2 -- 延时0.5秒
 75                     click row 1 of table 1 of scroll area 1 of splitter group 1 --选中第一个会话
 76                     delay 0.2 -- 延时0.5秒
 77                     click menu item "删除对话…" of menu "文件" of menu bar item "文件" of menu bar 1 of application process "Messages" of application "System Events"
 78                     --激活右键菜单中的删除对话                    
 79                     delay 0.2 -- 延时0.5秒
 80                     
 81                     try
 82                         click button "删除" of sheet 1
 83                         --对启用了imessage功能的手机号码进行记录
 84                         my WritePhone(thisphone)
 85                         
 86                     end try
 87                 end repeat
 88             end tell
 89         end tell
 90     end tell
 91 end deleteMsg
 92 
 93 
 94 
 95 -- 记录有效手机号
 96 on WritePhone(the_phone)
 97     set num to the length of the_phone
 98     if (num > 0) then
 99         set fileName to date string of (current date)
100         set logFilePath to my current_folder_path() & "send/检测成功的数据.txt"
101         set this_file to (POSIX file logFilePath as string)
102         set this_story to the_phone & "
103 "
104         try
105             set fp to open for access this_file
106             set myText to read fp
107             
108             if (myText does not contain the_phone) then
109                 my write_to_file(this_story, this_file, true, true)
110             end if
111         on error
112             my write_to_file(this_story, this_file, true, true)
113         end try
114     end if
115 end WritePhone
116 
117 
118 
119 -- 写入文件
120 --    this_data(文本内容,string)
121 --    target_file(文件路径,string)
122 --    append_data(是否拼接,boolean)
123 --    append_end(是否从后面拼接,boolean)
124 on write_to_file(this_data, target_file, append_data, append_end)
125     try
126         set the target_file to the target_file as text
127         set the open_target_file to ¬
128             open for access file target_file with write permission
129         
130         if append_data is false then
131             set eof of the open_target_file to 0
132             write this_data to the open_target_file starting at eof
133         else if append_end is false then
134             -- 1、读取原来内容;
135             -- 2、清空文件,写入新内容;
136             -- 3、在新内容后面拼接原始内容
137             try
138                 set fp to open for access target_file
139                 set myText to read fp
140                 set eof of the open_target_file to 0
141                 write this_data to the open_target_file starting at eof
142                 write myText to the open_target_file starting at eof
143             on error
144                 write this_data to the open_target_file starting at eof
145             end try
146         else
147             write this_data to the open_target_file starting at eof
148         end if
149         
150         close access the open_target_file
151         return target_file
152     on error
153         try
154             close access file target_file
155         end try
156         return false
157     end try
158 end write_to_file
159 
160 
161 -- 获取当前文件的父文件夹路径
162 on current_folder_path()
163     set UnixPath to POSIX path of ((path to me as text) & "::")
164     return UnixPath
165 end current_folder_path

 全自动检测脚本运行如下图:

 

2.手机版脚本全自动检测数据是否imessages(全自动检测用户导入的手机号数据,蓝色的数据自动保存。)

 

 

 

 

标签:set,end,注册,--,imessage,file,target,tell,手机号
From: https://www.cnblogs.com/bf66168/p/17501074.html

相关文章

  • 用applescript脚本实现检测手机号码是否注册imessage的原理
    一、检测数据的两种方式:1.人工筛选,将要验证的号码输出到文件中,以逗号分隔。再将文件中的号码粘贴到iMessage客户端的地址栏,iMessage客户端会自动逐个检验该号码是否为iMessage账号,检验速度视网速而定。红色表示不是iMessage账号,蓝色表示iMessage账号。2.编写脚本控制Macos/iphon......
  • 在system32文件夹中,config子文件夹存储了Windows注册表的备份文件。注册表是Windows操
    system32是Windows操作系统中的一个文件夹,它位于C:\Windows\system32路径下。这个文件夹包含了许多重要的系统文件和设置,它们对于操作系统的正常运行非常关键。在system32文件夹中,config子文件夹存储了Windows注册表的备份文件。注册表是Windows操作系统中的一个重要组成部分,它保......
  • MapBox账号注册教程
    MapBox是一个强大的、完整的3D地图框架,而且对于大多数使用者是免费的。但mapbox禁止中国地区的新用户注册,为源地理为您分享如何注册MapBox账号,主要使用魔法和信用卡两个工具。注册成功后,账号在国内环境下可以正常使用。一、基本信息注册前,用户需要提供的必要信息包括:姓名(Ful......
  • 申请免费SSL证书(不用注册)
    HTML5网页版ACME客户端https://xiangyuecn.gitee.io/acme-html-web-browser-client/ACME-HTML-Web-Browser-Client.html开源地址https://gitee.com/xiangyuecn/ACME-HTML-Web-Browser-Client......
  • 【nacos】nacos 注册ip
    nacos注册ip变成了127.0.0.1,服务调用失败背景:在一台Ip为10.1.22.11的机器,docker启动一个服务,然后-envspring.cloud.inetutils.preferred-networks=$ip这个参数的ip写错了,导致注册到Nacos上的服务ip变成了127.0.0.1,服务间调用乱了。。。一开始真不知道问题是啥......
  • Java学习之注册中心Zookeeper
    Zookeeper是什么ZooKeeper是一个用于维护配置信息、命名、提供分布式同步和提供组服务的集中式服务,它常作为一个注册中心服务用于分布式项目。Zookeeper拥有以下几个重要特性顺序一致性:来自客户端的相关指令会按照顺序执行,不会出现乱序的情况,客户端发送到服务的指令1->2->3->4,......
  • 驱动开发:内核注册表增删改查
    注册表是Windows中的一个重要的数据库,用于存储系统和应用程序的设置信息,注册表是一个巨大的树形结构,无论在应用层还是内核层操作注册表都有独立的API函数可以使用,而在内核中读写注册表则需要使用内核装用API函数,如下将依次介绍并封装一些案例,实现对注册表的创建,删除,更新,查询等操作......
  • 读者账号的连接数据库操作,登录验证,注册,修改账号,修改密码
    packagecom.rain.dao;importjava.sql.Connection;importjava.sql.PreparedStatement;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.util.ArrayList;importcom.rain.bean.AdminBean;importcom.rain.bean.BookBean;importcom.rain.util.DBUtil;/*......
  • 微服务 - Spring Cloud - Eureka Server单机和集群搭建、单机服务注册和集群服务注册
    Eureka服务管理Eureka是Netflix开发的服务发现框架,本身是一个基于REST的服务,主要用于定位运行在AWS域中的中间层服务,以达到负载均衡和中间层服务故障转移的目的。SpringCloud将它集成在其子项目spring-cloud-netflix中,以实现SpringCloud的服务发现功能Eureka服务注册与发现Eur......
  • Nacos注册中心原理以及Eureka和Nacos的区别与联系
    nacos注册中心:服务提供者在注册中心注册服务信息服务消费者从注册中心定时拉取服务。【服务列表缓存,每隔30拉取更新列表】消费者远程调用服务提供者。服务注册到Nacos时,可以选择注册为临时或非临时实例,默认是临时实例采用心跳检测,每隔30s向注册中心发送心跳检测,当......