yowsup的一些使用说明

安装python版本和库:

- python>=2.7,<=3.7
- consonance==0.1.3-1
- python-axolotl==0.2.2
- protobuf>=3.6.0
- pyopenssl==19.0.0
- pysocks==1.7.1
- six==1.10
- yowsup==3.2.3

1 注册

请求注册码

yowsup-cli registration –requestcode sms –phone 86xxx######## –cc 86 –mcc 460 –mnc 01

输出内容:

status: b'ok'
login: b'86xxxxxxxxxxx'
type: b'existing'
edge_routing_info: b'xxxxxx=='

使用注册码完成注册

yowsup-cli registration -R ****** --config-phone 86xxx######## --config-id xxxxxxxxxxxxxxxxxxxxxxx=

输出内容:

{
    "__version__": 1,
    "cc": "86",
    "client_static_keypair": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==",
    "edge_routing_info": "xxxxxx==",
    "expid": "xxxxxxxxxxxxxxxxxxxxxxxxxx==",
    "fdid": "xxxx-xxxx-xxxx-xxxx-xxxxxxx",
    "id": "xxxxxxxxxxxxxxxxxxxxxxxx",
    "login": "86xxx*******",
    "mcc": "460",
    "mnc": "005",
    "phone": "86xxx*******",
    "pushname": "Yowsup",
    "server_static_public": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=",
    "sim_mcc": "000",
    "sim_mnc": "000"
}
status: b'ok'
login: b'86xxx*******'
type: b'existing'
edge_routing_info: b'xxxxxx=='

2.配置

配置文件路径(windows)

C:\Users\用户\AppData\Local\yowsup\yowsup\86xxxxx(你的注册号码)

yowsup在哪里存储配置文件数据?

  • Win XP (not roaming): C:\Documents and Settings\Application Data\yowsup\yowsup<profile_name>\
  • Win XP (roaming): C:\Documents and Settings\Local Settings\Application Data\yowsup\yowsup<profile_name>\
  • Win 7 (not roaming): C:\Users\AppData\Local\yowsup\yowsup<profile_name>\
  • Win 7 (roaming): C:\Users\AppData\Roaming\yowsup\yowsup<profile_name>\
  • Linux: ~/.config/yowsup/<profile_name>/
  • MAC OS: ~/Library/Preferences/yowsup/<profile_name>/

里面有一个叫axolotl.db的数据库存放一些密钥对之类的东西,另外此路径下可以手动创建一个配置文件config.json用于你的号码配置,你可以使用它而不用在命令中配置一些属性。

3.发送消息

yowsup-cli demos --config-pushname yowsup --config-client_static_keypair xxxxxxxxxxxxxxxxxxx== --config-phone 86xxx****(本端号码) -s 86xxx****(对端号码) Hello,World

yowsup-cli demos --config-pushname yowsup -c C:\Users\用户\AppData\Local\yowsup\yowsup\86xxxxx(你的注册号码) -s 86xxx****(对端号码) Hello,World

输出内容:

-------------ClientConfig----------
ClientConfig(
    username=86xxx*****,
    passive=True,
    useragent=UserAgentConfig(
        platform=1,
        app_version=AppVersionConfig(
            primary=2,
            secondary=20,
            tertiary=200
        ),
        mcc=460,
        mnc=005,
        os_version=8.0.0,
        manufacturer=samsung,
        device=star2lte,
        phone_id=xxxx-xxxx-xxxx-xxxx-xxxxxxxxx,
        locale_lang=zh,
        locale_country=CN
    ),
    pushname=yowsup,
    short_connect=True
)
一堆内容
------------data----------
一堆内容
------------data2----------
一堆内容
----------server_hello1----------
一堆内容
----------server_hello2----------
一堆内容
------------data----------
一堆内容
------------data2----------
一堆内容
-----payload_buffer-------

-----ret-------
一堆内容
--------recv:ciphertext
一堆内容
--------recv:plaintext
一堆内容
=========getProtocolTreeNode=======
一堆内容
---------processPlaintextNodeAndSend----------
一堆内容
--------messageData:%s b'\n\x04baby'
--------ciphertext:%s <axolotl.protocol.prekeywhispermessage.PreKeyWhisperMessage object at 0x000002A4CFB2E5F8>
--------send:plaintext:%s 
一堆内容
--------send:ciphertext:%s 
一堆内容
------------data----------
一堆内容
--------recv:ciphertext
一堆内容
--------recv:plaintext
一堆内容
=========getProtocolTreeNode=======
一堆内容
------------data2----------
一堆内容
------------data----------
一堆内容
--------recv:ciphertext
一堆内容
--------recv:plaintext
一堆内容
=========getProtocolTreeNode=======
一堆内容
------------data2----------
一堆内容
------------data----------
一堆内容
--------recv:ciphertext
一堆内容
--------recv:plaintext
一堆内容
=========getProtocolTreeNode=======
一堆内容
------------data2----------
一堆内容
------------data----------
一堆内容
--------recv:ciphertext
一堆内容
--------recv:plaintext
一堆内容
=========getProtocolTreeNode=======
一堆内容

Yowsdown

4.发送图片

TODO

5.同步联系人

yowsup-cli demos --config-pushname yowsup -c C:\Users\用户\AppData\Local\yowsup\yowsup\86xxxxx(你的注册号码) --sync +86A(正确且存在的号码),+86B(正确且存在的号码),+86152,+123,+86111

输出内容:

前面一堆内容
=========getProtocolTreeNode=======
一堆内容
Iq:
ID: 1
Type: result
from: 86xxxxxxx@s.whatsapp.net
Wait: xxxx
Version: xxxxxx
In Numbers: +86A,+86B
Out Numbers: +86152,+86111
Invalid Numbers: +123


Yowsdown

Process finished with exit code 0

In Numbers: 为注册了whatsapp的号码
Out Numbers: 为未注册whatsapp的号码
Invalid Numbers: 无效号码

6.命令行模式

此模式下的方法最全,基本上yowsup能实现的操作都在这下面了

首先进入命令行模式:

yowsup-cli demos -c 配置文件路径 -y

进入命令模式后可以用/help查看可用的命令:

/help

命令层命令参数描述
/L  Quick login
/accountdelete Delete your account
/audiosend<number> <path>Send audio file
/contactpicturePreview<jid>Get profile picture preview for contact
/contactlastseen<jid>Get lastseen for contact
/contactpicture<jid>Get profile picture for contact
/contactssync<contacts>Sync contacts, contacts should be comma separated phone numbers, with no spaces
/disconnect  Disconnect
/groupdemote<group_jid> <jids>Remove admin of a group. Jids are a comma separated list
/groupinfo<group_jid>Get group info
/groupinvite<group_jid> <jids>Invite to group. Jids are a comma separated list
/groupkick<group_jid> <jids>Kick from group. Jids are a comma separated list
/groupleave<group_jid>Leave a group you belong to
/grouppicture<group_jid> <path>Set group picture
/grouppromote<group_jid> <jids>Promote admin of a group. Jids are a comma separated list
/groupsetSubject<group_jid> <subject>Change group subject
/groupscreate<subject> [jids]Create a new group with the specified subject and participants. Jids are a comma separated list but optional.
/groupslist List all groups you belong to
/help  Print this message
/ibclean<dirtyType>Send clean dirty
/imagesend<number> <path> [caption]Send an image with optional caption
/keysget<jids>Get shared keys
/messagebroadcast<numbers> <content>Broadcast message. numbers should comma separated phone numbers
/messagesend<number> <content>Send message to a friend
/ping  Ping server
/presenceavailable Set presence as available
/presencename<name>Set presence name
/presencesubscribe<contact>Subscribe to contact's presence updates
/presenceunavailable Set presence as unavailable
/presenceunsubscribe<contact>Unsubscribe from contact's presence updates
/profilegetPrivacy Get profile privacy 
/profilesetPicture<path>Set profile picture 
/profilesetPrivacy[value] [names]Profile privacy. value=all|contacts|none names=profile|status|last. Names are comma separated, defaults to all.
/profilesetStatus<text>Set status text
/seq  Send init seq
/statepaused<jid>Send paused state
/statetyping<jid>Send typing state
/statusesget<contacts>Request contacts statuses
/videosend<number> <path> [caption]Send a video with optional caption
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值