code thay gmail va tu tai app

 avatar
user_8607526207
python
2 years ago
2.5 kB
0
Indexable
Never
import uiautomator2 as u2
import time
d = u2.connect()
pack = "pack.txt"
def getPass(pswd):
	f = open(pswd,'r')
	pswds = f.readline()
	return pswds
def getPacket(packet):
	f = open(packet,'r')
	packs = f.readline()
	return packs
app = "link.txt"
pswd = "pass.txt"
passwd = getPass(pswd)
packet = getPacket(pack)
print(packet)
def getMail(app):
	f = open(app,'r')
	links = f.readlines()
	return links

def changeMail(mail,passwd):
	d.app_start("com.android.vending", use_monkey=True)
	time.sleep(5)
	d.xpath('//androidx.compose.ui.platform.ComposeView/android.view.View[1]/android.view.View[1]/android.view.View[1]/android.view.ViewGroup[1]').click()
	time.sleep(5)
	d.xpath('//android.widget.ScrollView/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.view.ViewGroup[1]/android.widget.FrameLayout[2]').click()
	time.sleep(5)
	d(resourceId="com.android.vending:id/0_resource_name_obfuscated", text="Quản lý Tài khoản Google của bạn").click()
	time.sleep(5)
	d.xpath('//*[@resource-id="com.google.android.gms:id/account_spinner"]/android.widget.ImageView[1]').click()
	time.sleep(5)
	d.xpath('//*[@resource-id="com.google.android.gms:id/list"]/android.widget.LinearLayout[1]').click()
	time.sleep(5)
	d.xpath('//*[@resource-id="view_container"]/android.view.View[2]/android.view.View[1]/android.view.View[1]/android.widget.TextView[2]').click()
	time.sleep(5)
	d(resourceId="identifierId").click()
	time.sleep(5)
	d.set_fastinput_ime(True)
	time.sleep(5)
	d.send_keys(mail, clear=True)
	d(text="Tiếp theo").click()
	time.sleep(5)
	d.set_fastinput_ime(True)
	d.send_keys(passwd, clear=True)
	d(text="Tiếp theo").click()
	time.sleep(5)
	d(text="Tôi đồng ý").click()
	time.sleep(5)
def closeAll():
	d = u2.connect()
	d(resourceId="com.android.systemui:id/recent_apps").click()
	d(resourceId="com.sec.android.app.launcher:id/clear_all_button").click()
def openApp(packet):
	d=u2.connect()
	d.open_url(packet)

for curlink in getMail(app):
	changeMail(curlink,passwd)
	closeAll()
	#openApp(p)
	d.open_url(packet)
	d.xpath('//androidx.compose.ui.platform.ComposeView/android.view.View[1]/android.view.View[2]/android.view.View[2]/android.view.View[2]').click()
	d.xpath('//androidx.compose.ui.platform.ComposeView/android.view.View[1]/android.view.View[2]/android.view.View[2]/android.view.View[2]').click()
	time.sleep(10)
	closeAll()