debian系统带sim卡设备实现短信转发

设备:

高通410随身wifi

Linux openstick 5.18.0-msm8916mainline+ #4 SMP PREEMPT Sun Jul 17 12:39:00 CST 2022 aarch64 GNU/Linux

项目地址:

Angels-Ray/ufi_sms (github.com)

依赖:

1、python3.7+

2、cron

3、Python的第三方库requests

基于以下项目魔改而来:

1、SMS_Forward https://github.com/n0raml/SMS-Forward

2、ufi-message https://gitee.com/jiu-xiao/ufi-message

教程:

1、下载ufi_sms

wget https://raw.githubusercontent.com/Angels-Ray/ufi_sms/main/msg.py
wget https://raw.githubusercontent.com/Angels-Ray/ufi_sms/main/corp_init.py

#无法访问用下面链接
wget https://raw.githubusercontents.com/Angels-Ray/ufi_sms/main/msg.py
wget https://raw.githubusercontents.com/Angels-Ray/ufi_sms/main/corp_init.py

2、配置corp_init.py

Corpid企业ID
Agentid企业应用的ID
Corpsecret企业应用的凭证密钥
Touser成员(默认@all就行,注:多个成员ID使用|隔开)
Media_id媒体文件id,需上传到企业微信的素材库,选填, 不填则发送文本信息

企业微信开发者文档: https://developer.work.weixin.qq.com/document/path/90236

3、测试

python3 msg.py forward

注:

发送成功短信都会写入日志文件sms_log,如不需日志,就注释掉msg.py第38行的“save_log(title,content)”。

发送成功短信都会自动删除。若不想删除就注释掉msg.py第161行“del_msg(i)”

配置定时任务:

随身wifi默认的debian并没有配置cron,先安装cron

apt install cron

配置cron

vi /var/spool/cron/crontabs/root

填入以下内容(每分钟执行一次发送短信)

*/1 * * * *  python3 /root/app/sms/msg.py forward

记录LOG

在当前目录下 ‘sms_log’ 文件

评论

  1. HELLO
    3月前
    2023-6-13 19:09:21

    能否增加一个发送到钉钉的

    • 博主
      HELLO
      3月前
      2023-6-14 12:53:40

      一直没有钉钉的需求,所以也就没弄了,等过段时间可能会弄

      • verper
        ATRAY
        2月前
        2023-7-17 20:04:03

        更需要邮箱的版本,博主能不能加一下转发邮箱呢

      • 大力
        ATRAY
        1月前
        2023-8-15 10:52:30

        可以分享5.18.0的内核包吗?

  2. jinitaimei
    2月前
    2023-7-14 10:31:23

    企业微信不是人人有,发送到邮箱的需求更普遍化吧,期待博主··~

  3. verper
    已编辑
    2月前
    2023-7-17 20:02:49

    去看一下博主的源代码,mmcli -m 0 –messaging-list-sms,为啥一直是No sms messages were found ???

    • 博主
      verper
      2月前
      2023-8-07 23:10:22

      这是没有收到短信,不用理会

  4. verper
    2月前
    2023-7-17 22:37:10

    Messaging options:
    –messaging-status Show status of messaging support.
    –messaging-list-sms List SMS messages available in a given modem
    –messaging-create-sms=[“key=value,…”] Create a new SMS in a given modem
    –messaging-create-sms-with-data=[File path] Pass the given file as data contents when creating a new SMS
    –messaging-delete-sms=[PATH|INDEX] Delete a SMS from a given modem

  5. verper
    2月前
    2023-7-17 22:48:01

    user@openstick:~ $ mmcli -m 0 –messaging-status

    Messaging | supported storages: sm, me
    | default storages: me
    这什么意思,这帮助文件里没找到具体解释。。。

发送评论 编辑评论


				
上一篇
下一篇