xmppcコマンドを使用してテキストファイルの内容を送信するには?

xmppcコマンドを使用してテキストファイルの内容を送信するには?

内部にテモックス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.',
  }
]

おすすめ記事