潘钜森 发表于 2024-6-27 17:50:49

重新创了一个号,还好只是接口改了,问题不大

本帖最后由 潘钜森 于 2024-6-27 18:05 编辑

### \# 前言(唉,老了,不中用了)

> 最近一直在用白鲸和起飞,好久没用蚂蚁了,原账号的用户名和密码忘了。唉~

### \# 抓包(雷电模拟器、HttpCanary)

!(data/attachment/forum/202406/27/172909glss2wlwl15l4cqu.png)

### \# 代码(更换接口和加了个循环)

```python
# -*- encoding: utf-8 -*-

import requests
import time
import json
from base64 import b64decode
from hashlib import sha256, md5
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes

code = ['a6aVx', 'bJSZE']# 邀请码

class Ant(object):
    def __init__(self, aff):
      self.aff = aff
      self.oauth_id = ''
      self.timestamp = ''
      self.url = 'http://antapi3.ymjxopa.com/api.php'
      self.headers = {}
      self.key = 'fjeldkb4438b1eb36b7e244b37dhg03j'
      self.hexkey = 'B496F831128E4FE1DE33F4B7A2C46E0DD4772524A4826FE4486FCC07E3E2B87F'
      self.b64key = 'tJb4MRKOT+HeM/S3osRuDdR3JSSkgm/kSG/MB+PiuH8='

    @staticmethod
    def get_timestamp(long=10):
      return str(time.time_ns())[:long]

    def decrypt(self, data: str):
      ct_iv = bytes.fromhex(data[:32])
      ct_bytes = bytes.fromhex(data)
      ciper = AES.new(b64decode(self.b64key), AES.MODE_CFB, iv=ct_iv,segment_size=128)
      plaintext = ciper.decrypt(ct_bytes)
      return plaintext.decode()

    def encrypt(self, data: str):
      cipher = AES.new(b64decode(self.b64key), AES.MODE_CFB, segment_size=128)
      ct_bytes = cipher.iv + cipher.encrypt(data.encode())
      return ct_bytes.hex().upper()

    def get_sign(self):
      template = 'appId=android&appVersion=2.1.8&data={}&timestamp={}2d5f22520633cfd5c44bacc1634a93f2'.format(
            self.encrypt_data, self.timestamp)
      sha = sha256()
      sha.update(template.encode())
      res = sha.hexdigest()
      m = md5()
      m.update(res.encode())
      res = m.hexdigest()
      return res

    def request(self, d):
      plaintext = {"version": "2.6.5", "app_type": "ss_proxy", "language": 0, "bundleId": "com.android.tnaant"}
      d.update(plaintext)
      self.timestamp = self.get_timestamp(10)
      self.encrypt_data = self.encrypt(json.dumps(d, separators=(',', ':')))
      sign = self.get_sign()
      data = {
            "appId": "android",
            "appVersion": "2.1.8",
            "timestamp": self.timestamp,
            "data": self.encrypt_data,
            "sign": sign
      }
      res = requests.post(url=self.url, data=data, headers=self.headers)
      resj = res.json()
      res = self.decrypt(resj.get('data'))
      print(res)
      return res

    def get_user(self):
      m = md5()
      m.update(get_random_bytes(16))
      oauth_id = m.hexdigest()

      data = {"oauth_id": oauth_id, "oauth_type": "android", "mod": "user", "code": "up_sign"}
      self.request(data)
      self.oauth_id = oauth_id
      print(oauth_id)

    def invite(self):
      self.get_user()
      data = {
            "oauth_id": self.oauth_id,
            "oauth_type": "android",
            "aff": self.aff,
            "mod": "user",
            "code": "exchangeAFF"
      }
      self.request(data)


if __name__ == "__main__":
    for i in code:
      ant = Ant(i)
      ant.invite()
```

### \# 总结(可上云)

!(data/attachment/forum/202406/27/180113ednfvvfsgvnzuzv9.png)

> 亲测,只是接口变了,代码不用怎么改。可上云,建议挂Github上刷,欧耶~

### \# 附录(666)

- **原文**
- [【思否】记一次某加速器APP算法解密实现刷邀请](https://segmentfault.com/a/1190000040012580)
- [【吾爱】记一次某加速器APP算法解密实现刷邀请](https://www.52pojie.cn/thread-1441989-1-1.html)

- **软件**
- Visual Studio Code([https://code.visualstudio.com/#alt-downloads](https://code.visualstudio.com/#alt-downloads))
- 雷电模拟器([https://www.ldmnq.com](https://www.ldmnq.com))
- HttpCanary(不提供下载)
- 蚂蚁加速器(不提供下载)
- 白鲸加速器(不提供下载)
- 起飞加速器(不提供下载)

涛之雨 发表于 2024-6-29 23:10:43

之前闲着无聊改过这个app,然后不知道是bug还是特性,

把我账号改成vip了。。。

(不是本地爆破,是把我账号搞成vip了)

(就是在正版的app上登录,也是vip)

(可惜后来包丢了)

潘钜森 发表于 2024-6-30 12:49:42

涛之雨 发表于 2024-6-29 23:10
之前闲着无聊改过这个app,然后不知道是bug还是特性,

把我账号改成vip了。。。


我之前也是,就单纯挂Github刷免费时长,然后莫名其妙变成了付费会员,但是几周后就掉了,变回了免费会员{:4_110:}

涛之雨 发表于 2024-6-30 17:24:10

潘钜森 发表于 2024-6-30 12:49
我之前也是,就单纯挂Github刷免费时长,然后莫名其妙变成了付费会员,但是几周后就掉了,变回了免费会员 ...

不是挂时长,是改app中的vip判断,结果把我改成服务器vip 了

潘钜森 发表于 2024-6-30 18:33:57

涛之雨 发表于 2024-6-30 17:24
不是挂时长,是改app中的vip判断,结果把我改成服务器vip 了

ggnb!!但是我之前确实有一段时间莫名其妙变成了收费会员,现在也一直不知道怎么回事{:4_88:}

juelian 发表于 2025-8-28 10:53:30

一直报错怎么办?

juelian 发表于 2025-8-28 10:54:52

## 开始执行... 2025-08-28 10:52:31


Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 534, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urllib3/connection.py", line 565, in getresponse
    httplib_response = super().getresponse()
                     ^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/http/client.py", line 1390, in getresponse
    response.begin()
File "/usr/lib/python3.11/http/client.py", line 325, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/http/client.py", line 286, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
         ^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
         ^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 841, in urlopen
    retries = retries.increment(
            ^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urllib3/util/retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urllib3/util/util.py", line 38, in reraise
    raise value.with_traceback(tb)
File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 534, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urllib3/connection.py", line 565, in getresponse
    httplib_response = super().getresponse()
                     ^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/http/client.py", line 1390, in getresponse
    response.begin()
File "/usr/lib/python3.11/http/client.py", line 325, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/http/client.py", line 286, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
         ^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/ql/data/scripts/蚂蚁刷邀请.py", line 94, in <module>
    ant.invite()
File "/ql/data/scripts/蚂蚁刷邀请.py", line 81, in invite
    self.get_user()
File "/ql/data/scripts/蚂蚁刷邀请.py", line 76, in get_user
    self.request(data)
File "/ql/data/scripts/蚂蚁刷邀请.py", line 64, in request
    res = requests.post(url=self.url, data=data, headers=self.headers)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/requests/api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/requests/adapters.py", line 682, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

## 执行结束... 2025-08-28 10:52:32耗时 1 秒     

你的。油猴脚本可以使用,不知道为啥,这个不可以使用

潘钜森 发表于 2025-8-28 23:01:28

juelian 发表于 2025-8-28 10:54
## 开始执行... 2025-08-28 10:52:31




刚刚测试了一下,Python代码依然是正常可用的。哥哥要不自己查查报错,是不是Python环境没有配好

```
pip install requests
pip install pycryptodome
```
页: [1]
查看完整版本: 重新创了一个号,还好只是接口改了,问题不大