python 自动获取手机短信验证码

本文介绍了如何使用Android APK在手机上实时存储短信,并通过Python脚本来读取和解析短信验证码。通过Android脚本创建smslog.txt文件,然后Python脚本截取其中的验证码,从而实现自动化处理。
摘要由CSDN通过智能技术生成

需要一个有权限的 APK 在手机实时存储短信到手机内存 /sdcard/smslog.txt 里(外部SD卡也可以知道能通过adb命令访问到):

 

 

/*****  

 

......

try {
long timestamp = System.currentTimeMillis();
String time = formatter.format(new Date());
String fileName = "smsLog.txt";
if (Environment.getExternalStorageState().equals(Environment.MOUNTED)) {
String path = Environment.getExternalStorageDirectory()+"/";
***
if (!dir.exists()) {
dir.mkdirs();
}

*

fos.write((time + " " + s).getBytes());
fos.close();
}
return fileName;
} catch (Exception e) {
Log.e("sms", "an error occured while writing file...", e);
}
return null;
}

*******/

 

  android脚本好了,签名+打包,装入手机就好了,安装实验一下: 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值