代码拉取完成,页面将自动刷新
同步操作将从 刘骢/ufi-message 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!python3
import os
import sys
import smtp
unknow = []
sent = []
recv = []
def get_msg_num(line):
return int(line.rstrip(' (sent)\n').rstrip(' (received)\n').rstrip(' (unknown)\n')[::-1].split('/',1)[0])
def send_msg(num):
os.system("sudo mmcli -s "+str(num)+" --send")
def del_msg(num):
os.system("sudo mmcli -m 0 --messaging-delete-sms="+str(num))
def scan_local_msg():
p=os.popen('mmcli -m 0 --messaging-list-sms')
for line in p.readlines():
if line.endswith(' (unknown)\n'):
num = get_msg_num(line)
unknow.append(num)
if line.endswith(' (sent)\n'):
num = get_msg_num(line)
sent.append(num)
if line.endswith(' (received)\n'):
num = get_msg_num(line)
recv.append(num)
print('未发送:',unknow,'已发送:',sent,'接收:',recv)
def add_msg(number,text):
os.system("sudo mmcli -m 0 --messaging-create-sms=\"text=\'"+text+"\',number=\'+"+number+"\'\"")
def clean_sent():
for i in sent:
del_msg(i)
def clean_unknow():
for i in unknow:
del_msg(i)
def clean_recv():
for i in recv:
del_msg(i)
def send_all():
for i in unknow:
send_msg(i)
def forward_msg():
for i in recv:
p=os.popen('mmcli -m 0 -s '+str(i))
res = smtp.mail(p.read())
if res:
print('Send ok:',i)
else:
print('Send error:',i)
cmd = sys.argv
cmd_len = len(cmd)
if cmd[1] == 'help':
print('随身wifi短信转发')
print('Command: help add send clean forward')
elif cmd[1] == 'add':
add_msg(cmd[2],cmd[3])
elif cmd[1] == 'send':
scan_local_msg()
send_all()
elif cmd[1] == 'clean':
scan_local_msg()
clean_sent()
clean_unknow()
clean_recv()
elif cmd[1] == 'forward':
scan_local_msg()
forward_msg()
else:
print('Command error.')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。