在里面特穆克斯Android 上的应用程序我得到一个包含所有短信的文本文件,如下所示:
termux-sms-list >sms.txt
我需要通过脚本自动通过 xmpp 发送其内容。可用的命令是xmppc,但它似乎不支持文件上传。我尝试了这些方法,但没有成功:
xmppc -j [email protected] -p "UserPassword" -m message chat [email protected] $(cat sms.txt)
cat sms.txt | xmppc -j [email protected] -p "UserPassword" -m message chat [email protected] -
任何想法?
答案1
我自己最终找到了一个神奇的解决方案!
显然您必须更改 JID 和密码。
while true ; do
# Get SMS's with a little treatment
termux-sms-list | sed -u "/\"_id\":/d;/\"threadid\":/d;/\"read\":/d;/\"type\":/d;s/\"/'/g" >messages.txt
# Automatically creates a second script to send the messages embedded in the xmppc command
echo '#!/bin/bash' >txt2xmpp.sh
echo 'xmppc -j [email protected] -p "UserPassword" -m message chat [email protected] \' >>txt2xmpp.sh
# xmppc requires the message to be enclosed in double quotes
echo "aaaaa$(cat messages.txt)aaaaa" | sed -u 's/aaaaa/\"/g' >>txt2xmpp.sh
# Run the second script
bash txt2xmpp.sh
# Will repeat after 5 minutes
sleep 5m
done
在接收者的 xmpp 客户端中,消息将以以下格式显示:
[
{
'number': '+77777',
'received': '2022-07-28 07:55:27',
'body': 'SERVICE: check if you have an offer and get your accounts in order. Enjoy installments of 14x or more. trade: http://domain.tld/e',
},
{
'number': '+88888',
'received': '2022-07-28 07:55:28',
'body': 'Bank: YourName, we want your opinion on your INTERNATIONAL card visit domain.tld/abcdef for a quick search. Cancel SMS:Send STOP',
},
{
'number': '+99999',
'received': '2022-07-28 07:55:29',
'body': 'Your verification code is: 999-999. Enter it in the text field.',
}
]