Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 10b7786

Browse files
committed
自动道歉。。
1 parent a1eca0b commit 10b7786

File tree

4 files changed

+344
-12
lines changed

4 files changed

+344
-12
lines changed

adb微信加好友/fuck.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# @Time : 2019/12/20 14:49
2+
# @Author : Libuda
3+
# @FileName: fuck.py
4+
# @Software: PyCharm
5+
from adb微信加好友.main import Adb
6+
7+
adb = Adb()
8+
res = []
9+
10+
bounds = adb.find_node_by_text("发送")
11+
i = 1
12+
while 1:
13+
for i in range(1, 9):
14+
for j in range(1, i):
15+
tem = str(i) + "*" + str(j) + "=" + str(i * j)
16+
print(tem)
17+
adb.adb_input(tem)
18+
adb.click_use_bounds(bounds)
19+
# bounds = adb.find_node_by_text("发送")
20+
# while 1:
21+
# adb.adb_input("dudu i am sorry ")
22+
# adb.click_use_bounds(bounds)

adb微信加好友/main.py

Lines changed: 87 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# -*- coding:utf-8 -*-
33

44
"""
5-
@author: valor
5+
@author: libuda
66
@file: main.py
7-
@time: 2018/11/5 15:59
7+
@time: 2019/12/5 15:59
88
"""
99

1010
import traceback
@@ -106,6 +106,52 @@ def __init__(self, port=None, device=None):
106106
self._x = None
107107
self._y = None
108108

109+
def get_phone_resolution(self):
110+
"""
111+
获取设备分辨率
112+
:return:
113+
"""
114+
displayPowerState = os.popen(
115+
"adb shell wm size").read().strip() # Physical size: 1080x2244
116+
state = str(displayPowerState).split(" ")[-1]
117+
width, heidht = state.strip().split("x")
118+
return int(width), int(heidht)
119+
120+
def get_center(self):
121+
"""
122+
获取设备中心点
123+
:return:
124+
"""
125+
width, height = self.get_phone_resolution()
126+
return width / 2, height / 2
127+
128+
def swipe(self, start=None, end=None):
129+
"""
130+
滑动屏幕 默认从屏幕底部往上滑
131+
:param start:
132+
:param end:
133+
:return:
134+
"""
135+
if start is None:
136+
start = self.get_center()
137+
x1, y1 = start
138+
if end is None:
139+
end = x1, y1 - int(y1 / 2)
140+
x2, y2 = end
141+
cmd = self._baseShell + "shell input swipe " + str(x1) + " " + str(y1) + " " + str(x2) + " " + str(y2)
142+
print(cmd)
143+
os.system(cmd)
144+
145+
def show_current_pk(self):
146+
"""
147+
展示当前所在app的包名
148+
:return:
149+
"""
150+
displayPowerState = os.popen(
151+
"adb shell dumpsys window windows |findstr -i current").read().strip() # 读出来这种 mAwake=truemScreenOnEarly=true mScreenOnFully=true 字节类型
152+
state = str(displayPowerState).split(" ")[-1]
153+
return state
154+
109155
def adb_keyboard(self, event):
110156
"""
111157
不同event对应不同指令
@@ -555,6 +601,7 @@ def clean_phone(self):
555601

556602
def add_friends(self, phone):
557603
# 输入号码
604+
phone = str(int(phone))
558605
self._adb.adb_input(phone)
559606
# 点击搜索
560607

@@ -607,6 +654,33 @@ def add_friends(self, phone):
607654
# 清空已输入的字符
608655
self.clean_phone()
609656

657+
def fuck(self):
658+
"""
659+
发99乘法表 点进输入框 随便输入一个字符 出现“发送”两个字就可以用此函数了
660+
:return:
661+
"""
662+
bounds = self._adb.find_node_by_text("发送")
663+
while 1:
664+
for i in range(1, 9):
665+
for j in range(1, i):
666+
tem = str(i) + "*" + str(j) + "=" + str(i * j)
667+
print(tem)
668+
self._adb.adb_input(tem)
669+
self._adb.click_use_bounds(bounds)
670+
671+
def Imsorry(self):
672+
"""
673+
道歉 使用同上
674+
:return:
675+
"""
676+
bounds = self._adb.find_node_by_text("发送")
677+
i = 1
678+
tem = "Im.Sorry.DuDu"
679+
while 1:
680+
self._adb.adb_input(tem)
681+
self._adb.click_use_bounds(bounds)
682+
i +=1
683+
610684

611685
def main(self):
612686
#读取手机号数据
@@ -616,15 +690,15 @@ def main(self):
616690
self.add_friends(phone)
617691

618692
def test(self):
619-
620-
# 唤醒屏幕
621-
self._adb.wake_up_the_screen()
622-
# 解锁 此处只能滑动解锁
623-
self._adb.unlock()
624-
# 启动微信
625-
self._adb.start_wechat()
626-
# 判断微信是否启动
627-
self._adb.check_wechat_is_start()
693+
global phone_can_write_index
694+
# # 唤醒屏幕
695+
# self._adb.wake_up_the_screen()
696+
# # 解锁 此处只能滑动解锁
697+
# self._adb.unlock()
698+
# # 启动微信
699+
# self._adb.start_wechat()
700+
# # 判断微信是否启动
701+
# self._adb.check_wechat_is_start()
628702
# 添加好友
629703
self._adb.click_add_friend()
630704
# 点击那两个 微信号/手机号
@@ -633,10 +707,11 @@ def test(self):
633707
phone_datas = [get_keywords_data(phoe_tables, i, phone_get_col) for i in
634708
range(1, phoe_tables.nrows)]
635709
for phone in phone_datas:
710+
636711
self.add_friends(phone)
712+
phone_can_write_index +=1
637713

638714

639715
if __name__ == '__main__':
640716
fun = Main()
641-
# fun.main()
642717
fun.test()

adb微信加好友/playgame.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# @Time : 2019/12/20 12:25
2+
# @Author : Libuda
3+
# @FileName: playgame.py
4+
# @Software: PyCharm
5+
from pynput.keyboard import Listener
6+
7+
keys = ""
8+
9+
10+
def press(key):
11+
global keys
12+
keys += str(key.char)
13+
if len(keys) > 10:
14+
print(keys)
15+
16+
17+
with Listener(on_press=press) as listener:
18+
listener.join()

0 commit comments

Comments
 (0)