Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.3 kB
4
Indexable
Never
import os
import subprocess
import sys
import time
import re
import uiautomator2 as u2
def click_mesage_901():
	d = u2.connect()
	time.sleep(10)
	d.xpath('//*[@resource-id="com.samsung.android.messaging:id/conversationRecycleListView"]/android.widget.LinearLayout[1]').click()
def delete_sms():
	d = u2.connect()
	print("Start xoa tin nhan buoc 1")
	d.xpath('//android.support.v7.widget.LinearLayoutCompat/android.widget.FrameLayout[1]').click()
	time.sleep(10)
	print("Finish xoa tin nhan buoc 1")
	print("Start xoa tin nhan buoc 2")
	d.xpath('//android.widget.ListView/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]').click()
	print("Finish xoa tin nhan buoc 2")
	time.sleep(10)
	print("Start xoa tin nhan buoc 3")
	d(resourceId="com.samsung.android.messaging:id/delete").click()
	print("Finish xoa tin nhan buoc 3")
	time.sleep(10)
	print("Start xoa tin nhan buoc 4")
	d(resourceId="android:id/button1").click()
	print("Finish xoa tin nhan buoc 4")
#click_mesage_901()
#delete_sms()
def send_sms(mes):
	number = "191"
	mesformated=formatSMS(mes)
	a = cmd_res('adb shell service call isms 7 i32 0 s16 "com.android.mms.service" s16 '+number+' s16 "null" s16 '+mesformated+' s16 "null" s16 0')
#send_sms()
def click_mesage_901():
	d = u2.connect()
	time.sleep(10)
	d.xpath('//*[@resource-id="com.samsung.android.messaging:id/conversationRecycleListView"]/android.widget.LinearLayout[1]').click()
#click_mesage_901()
def read_sms():
	d = u2.connect()
	print("In ra ma hinh tin nhan tra loi tu dong dai")
	print(d(resourceId="com.samsung.android.messaging:id/contents_container",index = 0).child_selector(className ="android.widget.TextView",resourceId= "com.samsung.android.messaging:id/content_text_view").get_text())
#read_sms()
def cmd_res(cmd):
    a = os.popen(cmd).read()
    return a
def formatSMS(SMS):
    newSMS = re.escape(SMS.replace("\n", " "))
    return newSMS
def read_txt():
	f=open("data.txt")
	return f.readlines()
for x in read_txt():
    number = "191";
    mesformated = formatSMS(x)
    #mesformated = x
    mesformated.rstrip('\t')
    print(mesformated)
    time.sleep(10)
    a = cmd_res('adb shell service call isms 7 i32 0 s16 "com.android.mms.service" s16 '+number+' s16 "null" s16 '+mesformated+' s16 "null" s16 0')