手機羣發短信腳本python

首先電腦上安裝好adb工具包,然後手機usb接上電腦,需要打開調試模式
然後準備好一個表格,表格裏準備好需要羣發的手機號碼

import os 
import pandas as pd 
import numpy as np 
import time
#羣發短信,50個號碼一發,讀取表格中手機號,列名寫“手機號”

content="短信內容"
mobiles=""
df = pd.read_excel('mobiles.xlsx')
#遍歷表格,讀取手機號
for index,row in df.iterrows():
    if index==len(df)-1:
        mobiles=mobiles+str(row['手機號'])
        os.popen("adb shell am start -a android.intent.action.SENDTO -d sms:{} --es sms_body {}".format(mobiles,content))
        time.sleep(2)
        #模擬發送
        os.popen("adb shell input keyevent 22")
        time.sleep(1)
        os.popen("adb shell input keyevent 66")
        time.sleep(120)
        os.popen("adb shell input keyevent 3")
    elif index % 50==0 and index!=0:

        mobiles=mobiles+str(row['手機號'])
        #打開短信,編輯短信
        os.popen("adb shell am start -a android.intent.action.SENDTO -d sms:{} --es sms_body {}".format(mobiles,content))
        time.sleep(2)
        #模擬發送
        os.popen("adb shell input keyevent 22")
        time.sleep(1)
        os.popen("adb shell input keyevent 66")
        time.sleep(120)
        os.popen("adb shell input keyevent 3")
        mobiles=""
    else:
        mobiles=mobiles+str(row['手機號'])+','
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章