update e5api

This commit is contained in:
jie Ago 2022-12-06 16:42:55 +08:00
commit 7e49ceacde
13 changed files with 690 additions and 0 deletions

46
.github/workflows/AutoApiSuper.yml vendored Normal file
View File

@ -0,0 +1,46 @@
#AutoApiS 多功能版
name: Auto Api Super
on:
release:
types: [published]
push:
tags:
- 'v*'
# branches:
# - master
schedule:
- cron: '0 1,5,8 * * 1-5'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python #安装python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install requests #安装requests
run: |
pip install requests
- name: Read config from secrets #读取机密
env:
ID_LIST: ${{ secrets.ID_LIST }} # secrets_id 提供
KEY_LIST: ${{ secrets.KEY_LIST }} # secrets_key 提供
ID_LIST2: ${{ secrets.ID_LIST2 }} # secrets_id 提供
KEY_LIST2: ${{ secrets.KEY_LIST2 }} # secrets_key 提供
run: |
echo $ID_LIST > idlist.txt
echo $KEY_LIST > keylist.txt
sed -i '10 r idlist.txt' testapi.py
sed -i '11 r keylist.txt' testapi.py
echo $ID_LIST2 > idlist2.txt
echo $KEY_LIST2 > keylist2.txt
sed -i '12 r idlist2.txt' testapi.py
sed -i '13 r keylist2.txt' testapi.py
- name: Test Api #Api调用
run: |
python testapi.py

38
.github/workflows/randomapi.yml vendored Normal file
View File

@ -0,0 +1,38 @@
#更新api排序
name: update randapi
on:
release:
types: [published]
push:
tags:
- 'v*'
# branches:
# - master
schedule:
- cron: '50 5 * * 1,3,5'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python #安装python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Update randapi #更新api排序
run: |
python updaterand.py
- name: Commit #上传新的排序到仓库
run: |
git config --global user.email AutoupdateRobot@email.com
git config --global user.name AutoupdateRobot
git add .
git commit -m "update new randapi" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

65
.github/workflows/uaptetoken.yml vendored Normal file
View File

@ -0,0 +1,65 @@
#更新refresh_token
name: update refresh_token
on:
release:
types: [published]
push:
tags:
- 'v*'
# branches:
# - master
schedule:
- cron: '45 0 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python #安装python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install requests #安装requests
run: |
pip install requests
- name: Read config from secrets #读取机密
env:
ID_LIST: ${{ secrets.ID_LIST }} # secrets_id 提供
KEY_LIST: ${{ secrets.KEY_LIST }} # secrets_key 提供
ID_LIST2: ${{ secrets.ID_LIST2 }} # secrets_id 提供
KEY_LIST2: ${{ secrets.KEY_LIST2 }} # secrets_key 提供
run: |
cp updatetoken.py updatetoken2.py
echo $ID_LIST > idlist.txt
echo $KEY_LIST > keylist.txt
sed -i '10 r idlist.txt' updatetoken2.py
sed -i '11 r keylist.txt' updatetoken2.py
echo $ID_LIST2 > idlist2.txt
echo $KEY_LIST2 > keylist2.txt
sed -i '12 r idlist2.txt' updatetoken2.py
sed -i '13 r keylist2.txt' updatetoken2.py
- name: Update token #更新token
run: |
python updatetoken2.py
- name: Delete secrets config #删除机密
run: |
rm -f updatetoken2.py
rm -f idlist.txt
rm -f keylist.txt
rm -f idlist2.txt
rm -f keylist2.txt
- name: Commit #上传新的refresh_token到仓库
run: |
git config --global user.email AutoupdateRobot@email.com
git config --global user.name AutoupdateRobot
git add .
git commit -m "update new refresh_token" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

201
README.md Normal file
View File

@ -0,0 +1,201 @@
# AutoApiS-超级版
AutoApi系列AutoApi、AutoApiSecret、AutoApiSR、AutoApiS
# 置顶 #
* 本项目是建立在[原教程](https://blog.432100.xyz/index.php/archives/50/)可以正确调用api的**假设**上的核心是paran/黑幕大佬的py脚本。
* 本项目只是提供一个自动、免费、无需额外设备的脚本运行方式,换句话说,**借用github的电脑/服务器来干活**。(因为原教程需要服务器/超长时间运转的设备,大部分人都不具备,本项目应运而生)
* 本项目运行依赖**github action**服务此功能github固有而**非私人提供**的服务器且整个运行过程只涉及你与github。
* 请务必先阅读理解[原教程](https://blog.432100.xyz/index.php/archives/50/)的**原理说明、设计理念**。
* **不保证一定能续期!不保证一定能续期!不保证一定能续期**!或者说,**只是增大续订可能性**。过期前、后30天都可能续期
* 若理解并接受上述说明,请接着操作;**若否,请点击浏览器右上角 X 。**
### 项目说明 ###
* 全自定义版本
* 支持多账号、随机时间调用、api随机抽取排序、副应用模式等
### 特别说明/Thanks ###
* 原教程博主-黑幕酷安id-Paranhttps://blog.432100.xyz/index.php/archives/50/
* 普通版地址https://github.com/wangziyingwen/AutoApi
* 加密版地址推荐https://github.com/wangziyingwen/AutoApiSecret
* 模仿人为应用开发版包含升级步骤https://github.com/wangziyingwen/AutoApiSR
* 超级版地址: https://github.com/wangziyingwen/AutoApiS
* **常见错误及解决办法/更新日志**https://github.com/wangziyingwen/Autoapi-test
* 网页获取refresh_token小工具不建议使用https://github.com/wangziyingwen/GetAutoApiToken
* 视频教程:(我操作很慢,自行倍速/快进Secret版的教程将就看吧
* 在线/下载地址https://kino-onemanager.herokuapp.com/Video/AutoApi%E6%95%99%E7%A8%8B.mp4?preview
* B站https://www.bilibili.com/video/av95688306/
### 区别 ###
[普通版(弃用)](https://github.com/wangziyingwen/AutoApi):密钥暴露,不在乎的话可以使用
[加密版(推荐)](https://github.com/wangziyingwen/AutoApiSecret)应用id机密加密隐藏提高安全性
[模仿人为应用开发版(半弃用)](https://github.com/wangziyingwen/AutoApiSR):顾名思义,加密版的升级版。由于超级版兼容模拟版的功能,此版本处于一种尴尬位置。(当然也可以正常使用)
[超级版(不建议)](https://github.com/wangziyingwen/AutoApiS):进一步升级版,增加自定义参数、模式。按目前情况,微软续订要求很低,暂时不需要使用此项目。
**以上推荐/不建议等只是个人意见,请自行选择版本,可同时使用**
--------------------------------------------------------------
### 步骤 ###
*** **有错误/问题请看**: [常见错误及解决办法/更新日志](https://github.com/wangziyingwen/Autoapi-test) ***
* 第一步,先大致浏览[原教程](https://blog.432100.xyz/index.php/archives/50/)了解如何获取应用id、机密、refresh_token 3样东西以方便接下来的操作。
* 第二步,登陆/新建github账号回到本项目页面点击右上角fork本项目的代码到你自己的账号然后你账号下会出现一个一模一样的项目接下来的操作均在你的这个项目下进行。看不到图片/图裂请科学上网)
![image](https://github.com/wangziyingwen/ImageHosting/blob/master/AutoApi/fork.png)
* 根据[原教程](https://blog.432100.xyz/index.php/archives/50/)获取应用id、机密、refresh_token自己复制保存注意区分id机密千万别弄混了
**注意**
**赋予api权限的时候选择以下几个**
Calendars.ReadWrite、Contacts.ReadWrite、Directory.ReadWrite.All、
Files.ReadWrite.All、MailboxSettings.Read、Mail.ReadWrite、
Notes.ReadWrite.All、People.Read.All、Sites.ReadWrite.All、
Tasks.ReadWrite、User.ReadWrite.All
在你电脑上新建多个txt文本例如你有两个账号则账号 0 对应为 0.txt , 账号 1 对应为 1.txt , 以此类推。(只有一个账号则只需一个0.txt一定要从0开始数)
再把各个账号对应的refresh_token粘贴进对应的txt文件。
> refresh_token位置如图下。复制refresh_token紧接着的双引号里的内容红竖线框起来的不要把双引号复制进去。复制进txt后留意结尾不要留空格或者空行
![image](https://github.com/wangziyingwen/ImageHosting/blob/master/AutoApi/token地方.png)
再然后把你项目token文件夹里的文件全删掉记得点commint确认删除再把你的0.txt...n.txt上传到token文件夹下。
* 第三步,依次点击上栏 Setting > Secrets > Add a new secret新建两个secret如图ID_LIST、KEY_LIST 。
内容分别如下: ( 把账号X应用id改成你账号X的应用id , 账号X应用机密改成你账号X的机密直接替换单引号里的内容单引号不要动 )
(需要配置更多账号的话,以此类推,直接复制增加;如果**只需一个账号,则 id_list = [r'账号0应用id']** )
**注意所有符号均是英文条件下的符合**
ID_LIST
```shell
id_list = [r'账号0应用id',r'账号n应用id']
```
KEY_LIST
```shell
secret_list = [r'账号0应用机密',r'账号n应用机密']
```
![image](https://github.com/wangziyingwen/ImageHosting/blob/master/AutoApi/机密2.png)
最终格式应该是类似这样的:
![image](https://github.com/wangziyingwen/ImageHosting/blob/master/AutoApi/格式2.png)
* 第四步,修改参数配置
你项目的testapi.py文件第15行有个config_list更改相应选项完成配置**看不懂可直接掠过**
各参数说明:
* 每次轮数每启动一次运行多少轮api调用一轮调用10个api
* 是否启动随机时间:每一轮结束隔“多久”才开始下一轮调用,这个“多久”会根据后面的参数随机生成
* 延时范围起始结束例如设置600跟1200则“多久”会在600到1200秒这个范围随机生成一个数到时间开启下一轮调用
* 是否开启随机api顺序:根据一定规则从28个api抽13个随机排序我设置的是30天换一次顺序。不开启则默认原教程10个api。
* 是否开启各api延时就是每个api调用要不要停一下才开始下一个api调用。个人建议不开
同样有范围例如api延时范围开始跟api延时结束分别设置为1020.则会在10到20秒这个范围随机生成一个数然后调用下一个api
* 是否开启各账号延时:就是每个账号调用要不要停一下才开始下一个账号调用。
同样有范围例如账号延时范围开始跟分结束分别设置为60120.则会在60到120秒这个范围随机生成一个数然后调用下一个账号
* 是否开启备用应用更换应用id调用api。同样每30天更换一次应用id。目前每个账号只至支持1个副应用
开启后需分别为各账号再注册一个应用然后在设置的secret再增加两条
ID_LIST2
内容为: id_list2=[r'帐号1副应用id',r'帐号n副应用id']
KEY_LIST2
内容为: secret_list2=[r'帐号1副应用机密',r'帐号n副应用机密']
然后类似的在backuptoken文件夹里放入对应的副应用的0.txt....n.txt。
这里看不懂的话直接选N吧
* 是否开启测试瞬间完成运行以便查看id、机密、token等是否填写错误能否正确运行。
若配合备用应用模式使用则会同时测试各账号的主副应用看看主副应用是否都能成功调用api
测试完务必改回N
* 第五步,进入你的个人设置页面(右上角头像 Settings不是仓库里的 Settings),选择 Developer settings > Personal access tokens > Generate new token,
![image](https://github.com/wangziyingwen/ImageHosting/blob/master/AutoApi/Settings.png)
![image](https://github.com/wangziyingwen/ImageHosting/blob/master/AutoApi/token.png)
设置名字为GITHUB_TOKEN , 然后勾选 repo , admin:repo_hook , workflow 等选项最后点击Generate token即可。
![image](https://github.com/wangziyingwen/ImageHosting/blob/master/AutoApi/repo.png)
![image](https://github.com/wangziyingwen/ImageHosting/blob/master/AutoApi/adminrepo.png)
![image](https://github.com/wangziyingwen/ImageHosting/blob/master/AutoApi/workflow.png)
* 第六步,点击右上角星星/star立马调用一次再点击上面的Action就能看到每次的运行日志看看运行状况
必需点进去Test Api看下api有没有调用到位有没有出错。外面的Auto Api打勾只能说明运行是正常的我们还需要确认10个api调用成功了就像图里的一样。如果少了几个api要么是注册应用的时候赋予api权限没弄好要么是没登录激活onedrive登录激活一下
![image](https://github.com/wangziyingwen/ImageHosting/blob/master/AutoApi/日志.png)
* 第七步,没出错的话,就搞定啦!!再看看下面的定时次数要不要修改,不打算改就忽略。
**然后第二天回来确认下是否自动运行了ation里是否多出来几个**,是的话就不用管了,完结。
我设定的每天9、13、16点自动运行一次点击右上角星星/star也可以立马调用一次你们自行斟酌修改我也不知道保持活跃要调用多少次、多久
* 定时自动启动修改地方:(在.github/workflow/autoapi.yml文件里自行百度cron定时任务格式最短每5分钟一次
![image](https://github.com/wangziyingwen/ImageHosting/blob/master/AutoApi/定时.png)
------------------------------------------------------------
### 题外话 ###
> Api调用
你们可以自己去graph浏览器看一下学着自己修改要调用什么api(最重要的是调用outlook、onedrive)
https://developer.microsoft.com/zh-CN/graph/graph-explorer/preview
### GithubAction介绍 ###
提供的虚拟环境:
· 2-core CPU
· 7 GB RAM 内存
· 14 GB SSD 硬盘空间
使用限制:
* 每个仓库只能同时支持20个 workflow 并行。
* 每小时可以调用1000次 GitHub API 。
* 每个 job 最多可以执行6个小时。
* 免费版的用户最大支持20个 job 并发执行macOS 最大只支持5个。
* 私有仓库每月累计使用时间为2000分钟超过后$ 0.008/分钟,公共仓库则无限制。
我们这里用的公共仓库按理你们可以设定无限循环调用然后6小时启动一次保证24小时全天候调用
### 最后 ###
教程很直白了,应该都会弄吧!
代码小白,多包涵!有问题/修改建议可以点击上方issues发布一下或者PY给我:
wz.lxh@outlook.com
Q群[657581700](https://jq.qq.com/?_wv=1027&k=5FQJbWmV) (项目相关讨论)
tg群[OneDrive E5](https://t.me/joinchat/OLlK9RsbBlmTYOJS_BU4Mg) **非项目相关**讨论!**tg可能不会及时在线回答问题**任何项目相关的问题或出错请进Q群/邮箱/issue
最后的最后,再次感谢黑幕/paran大佬
————wangziyingwen/酷安id-卷腿毛菌

1
backuptoken/0.txt Normal file
View File

@ -0,0 +1 @@
OAQABAAAAAAAGV_bv21oQQ4ROqh0_1-tAsgi09tWC8vqsLZmSmmgKR8TkWx6DoAuxu300uKdi_Dceq9QlZIbOvp7pGyLfSGqqFpuQh2st9nSc8A4eyECbZn_klaekSsi-Fvia3Kicvu3j7k-9k0SHI6VLZZlK6OW3_jYZRmKLOxJaVbVWPym-bcebBOZVy3anslSShyuPQD0VXKA82wGHiqpJmMkdJ__2tfCjR93Tx-rSDlU7KpXzoukLCliu3xX26-eQOI4Fkm9w3fkFojJP3x4c-h4v3tZMEfsRWUqWAk-sJTqYmxxMsxdvIPJeg3IAaifUYFeAznWHB0TsMAZwQT0qSZNqEL9NJo02D9qbnud_aNkwqbw9V9-CuGlq5u2wQGQSjdcVO3GE8cpU0V24mfF4QKZErcHGyMZHsEdZEKmu6jdlVWdN2y1VpTOBbn2fkco5_FChVUPV04ipoNJcNrTOm3mSLYdg0t_ahGjIh_AK6-QzGKCwU039bzWhqEIMBt3UZxOcdBVxvs3LemQhKRbPZ7cWWy5yFIukYw882_QAYBYQA4A0TyvtNQeS8iobr-5-H-EHxt4TNo5Pdhbpos2oaxL5uaCTe5BEuYwEOEkCRUbakmVr6PpDufmVURv38_KbsHgBIq1F7HtS-vEP-fNAQyxug2SJxVSxUIEYXtIpa7j9mQJBT_TCjNvRlh6ymLjrSqwn1Xm1tM7ZM93oB4Kv-yfLuINZZhfIZ3gSDF9sN0ZR2nDVd4kZcCzhiUoLiHOtB8Jf97v46wI797Zf0tz-D0_DaUDnt22aMAaIaOPSSpsbiBhbJWQ6MXgWGj08KNbQVozeY6_DLxhuuL1TAaUaArYAYdHBxSfAfcQ0K-GfI47FZWSBRiTuVvkIOu9FTWcXObo-HR5HqNclN3MxEs18Bp3tC2C6iWGxHMNvPg7SdsoC1oB6eDhbyvvEjCYI0DGrmnAtRZggAA

1
backuptoken/1.txt Normal file
View File

@ -0,0 +1 @@
OAQABAAAAAAAGV_bv21oQQ4ROqh0_1-tASWbXWH8c7NnTA9VLzfk9CpSPJPRgaB7yYAGb6TCyvRP7AJKMz900bcMgc2Hid1XSC_hPLzEKLxqKeUJxFSx0OPR6O_46pcg5zZ3XewoY0y3A1ZVqlz8dNbjDeTl5PS_7cK1ylyYOmTdq77baSbVcMKIFB2ItOqwvfKuW663Wu_ChKajhRlsEUm6fTmCJIbA8B9Fi-ed9X1mKibpJjwQShW214hJV0tYRJ3irAJrCU_dHs3g6-a2MgdiIg6Y6cReiNUMo8IRB4ZiQB5liCefOhwr4S2qU0G7IdB_FmXrGRxP7OLHiqQMXqlSAr_eGJeFOHiQCGIFnxsEyVGuTocUlYjnbP4Ytt9j8tw53FkquTqxOYUtTBea_xNTKNTutyVbsSqzzgSZLYZAjbD5Tdyu_qpPGD5xJ7BZjiiXgAVSP-iHTZ76HINRel0h7TUWd8zJmp0iCofjaRf0zfySoJG_7wXrx0Ge00cg3lkArSw_8Ay-XtrO_HEFD0wLxMnr7k8UlUvPoodYbzBHyQ5FDrpg_-HqCIvZuD5hwwiQ92yl61yZBzgnQ3qcGuRLxBjmi5c3ddVEUSNb-WQXPCzDAnFP_FkqkR-7p608GCgNZ9bsqnodVCfufuiZLwpAF66hKy0WZpoLc-lY6ISsyQMyNseT-8Q8Xddu6WXI6DaJCIrA7ZLE56QDnKZyRG4PqxSge-uZSD7P6nMwf9YWIdNsnqKiK7ZWMFiLPkN1gKgfV3UY0xI2Zg_x6bMr2pj2Ptc3x1-EwdqYkPHDuSpw_4DAxPBfuLWoujTW3HUehm0O2GMsR9wh3yOVSh6gmkjJAIM4kMv_ZJgh4B0-nR59KgaE14FBmkyxAQErF8TN0KR0oV5Lpkmcxqp0Bnu_tVud5jjSMXqk9rRqaK6OPPZY0RunoBXS1qkmZlk1SJ0EQDwkTIuAvcWogAA

1
config/1.txt Normal file
View File

@ -0,0 +1 @@

1
config/buconfig.txt Normal file
View File

@ -0,0 +1 @@
N

1
config/randomapi.txt Normal file
View File

@ -0,0 +1 @@
29,9,22,1,6,27,20,21,19,26,4,7,2,10

235
testapi.py Normal file
View File

@ -0,0 +1,235 @@
# -*- coding: UTF-8 -*-
import requests as req
import json,sys,time,random
#注册后一定要再点代表xxx授予管理员同意,否则outlook api无法调用
#以下空行不要删除,以便运行时插入机密
id_list2 = [1]
secret_list2 = [1]
config_list = {'每次轮数':6,
'是否启动随机时间':'Y','延时范围起始':600,'结束':1200,
'是否开启随机api顺序':'Y',
'是否开启各api延时':'N','api延时范围开始':2,'api延时结束':5,
'是否开启各账号延时':'Y','账号延时范围开始':60,'账号延时结束':120,
'是否开启备用应用':'N','是否开启测试':'N'}
num1 = [0]*len(id_list)
path2=sys.path[0]+r'/config/randomapi.txt'
path3=sys.path[0]+r'/config/buconfig.txt'
rapi = {'1':r'https://graph.microsoft.com/v1.0/me/',
'2':r'https://graph.microsoft.com/v1.0/users',
'3':r'https://graph.microsoft.com/v1.0/me/people',
'4':r'https://graph.microsoft.com/v1.0/groups',
'5':r'https://graph.microsoft.com/v1.0/me/contacts',
'6':r'https://graph.microsoft.com/v1.0/me/drive/root',
'7':r'https://graph.microsoft.com/v1.0/me/drive/root/children',
'8':r'https://graph.microsoft.com/v1.0/drive/root',
'9':r'https://graph.microsoft.com/v1.0/me/drive',
'10':r'https://graph.microsoft.com/v1.0/me/drive/recent',
'11':r'https://graph.microsoft.com/v1.0/me/drive/sharedWithMe',
'12':r'https://graph.microsoft.com/v1.0/me/calendars',
'13':r'https://graph.microsoft.com/v1.0/me/events',
'14':r'https://graph.microsoft.com/v1.0/sites/root',
'15':r'https://graph.microsoft.com/v1.0/sites/root/sites',
'16':r'https://graph.microsoft.com/v1.0/sites/root/drives',
'17':r'https://graph.microsoft.com/v1.0/sites/root/columns',
'18':r'https://graph.microsoft.com/v1.0/me/onenote/notebooks',
'19':r'https://graph.microsoft.com/v1.0/me/onenote/sections',
'20':r'https://graph.microsoft.com/v1.0/me/onenote/pages',
'21':r'https://graph.microsoft.com/v1.0/me/messages',
'22':r'https://graph.microsoft.com/v1.0/me/mailFolders',
'23':r'https://graph.microsoft.com/v1.0/me/outlook/masterCategories',
'24':r'https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages/delta',
'25':r'https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messageRules',
'26':r"https://graph.microsoft.com/v1.0/me/messages?$filter=importance eq 'high'",
'27':r'https://graph.microsoft.com/v1.0/me/messages?$search="hello world"',
'28':r'https://graph.microsoft.com/beta/me/messages?$select=internetMessageHeaders&$top',
'29':r'https://api.powerbi.com/v1.0/myorg/apps'}
rapi2 = {'1':r'https://graph.microsoft.com/v1.0/me/drive/root',
'2':r'https://graph.microsoft.com/v1.0/me/drive',
'3':r'https://graph.microsoft.com/v1.0/drive/root',
'4':r'https://graph.microsoft.com/v1.0/users',
'5':r'https://graph.microsoft.com/v1.0/me/messages',
'6':r'https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messageRules',
'7':r'https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages/delta',
'8':r'https://graph.microsoft.com/v1.0/me/drive/root/children',
'9':r'https://graph.microsoft.com/v1.0/me/mailFolders',
'10':r'https://graph.microsoft.com/v1.0/me/outlook/masterCategories',
'11':r'https://api.powerbi.com/v1.0/myorg/apps'}
fc = open(path2, "r+")
randapi = fc.read()
fc.close()
fh = open(path3, "r+")
buconfig = fh.read()
fh.close()
randomapi = randapi.split(',')
def gettoken(refresh_token,a):
headers={'Content-Type':'application/x-www-form-urlencoded'
}
data={'grant_type': 'refresh_token',
'refresh_token': refresh_token,
'client_id':id_lists[a],
'client_secret':secret_lists[a],
'redirect_uri':'http://localhost:53682/'
}
html = req.post('https://login.microsoftonline.com/common/oauth2/v2.0/token',data=data,headers=headers)
jsontxt = json.loads(html.text)
refresh_token = jsontxt['refresh_token']
access_token = jsontxt['access_token']
return access_token
def testapi(path,a,ls):
fo = open(path, "r+")
refresh_token = fo.read()
fo.close()
localtime = time.asctime( time.localtime(time.time()) )
access_token=gettoken(refresh_token,a)
headers={
'Authorization':access_token,
'Content-Type':'application/json'
}
print('账号 '+str(a)+'\n'+str(ls)+' 轮运行开始时间为 :', localtime)
if config_list['是否开启随机api顺序'] == 'Y':
print('总api数13个请自行确认个数')
for ra in range(14):
rana = str(randomapi[ra])
try:
if req.get(rapi[rana],headers=headers).status_code == 200:
num1[a]+=1
print("账号"+str(a)+""+rana+"号api调用成功,所有api总成功"+str(num1[a])+'')
if config_list['是否开启各api延时'] != 'N':
gg = random.randint(config_list['api延时范围开始'],config_list['api延时结束'])
time.sleep(gg)
except:
print("pass")
pass
else:
print('总api数10个请自行确认个数')
for ra in range(1,12):
rana = str(ra)
try:
if req.get(rapi2[rana],headers=headers).status_code == 200:
num1[a]+=1
print("账号"+str(a)+""+rana+"号api调用成功,所有api总成功"+str(num1[a])+'')
if config_list['是否开启各api延时'] != 'N':
gg = random.randint(config_list['api延时范围开始'],config_list['api延时结束'])
time.sleep(gg)
except:
print("pass")
pass
def testapi2(path,a,ls):
fo = open(path, "r+")
refresh_token = fo.read()
fo.close()
localtime = time.asctime( time.localtime(time.time()) )
access_token=gettoken(refresh_token,a)
headers={
'Authorization':access_token,
'Content-Type':'application/json'
}
print('账号 '+str(a)+' 备用应用\n'+str(ls)+' 轮运行开始时间为 :', localtime)
if config_list['是否开启随机api顺序'] == 'Y':
print('总api数13个请自行确认个数')
else:
print('总api数10个请自行确认个数')
if config_list['是否开启随机api顺序'] == 'Y':
for ra in range(14):
rana = str(randomapi[ra])
try:
if req.get(rapi[rana],headers=headers).status_code == 200:
num1[a]+=1
print("账号"+str(a)+"备用的"+rana+"号api调用成功,所有api总成功"+str(num1[a])+'')
if config_list['是否开启各api延时'] != 'N':
gg = random.randint(config_list['api延时范围开始'],config_list['api延时结束'])
time.sleep(gg)
except:
print("pass")
pass
else:
for ra in range(1,12):
rana = str(ra)
try:
if req.get(rapi2[rana],headers=headers).status_code == 200:
num1[a]+=1
print("账号"+str(a)+"备用的"+rana+"号api调用成功,所有api总成功"+str(num1[a])+'')
if config_list['是否开启各api延时'] != 'N':
gg = random.randint(config_list['api延时范围开始'],config_list['api延时结束'])
time.sleep(gg)
except:
print("pass")
pass
def main():
if config_list['是否启动随机时间'] == 'Y':
for ls in range(config_list['每次轮数']):
b=random.randint(config_list['延时范围起始'],config_list['结束'])
time.sleep(b)
for a in range(0, len(id_lists)):
if config_list['是否开启各账号延时'] == 'Y':
c = random.randint(config_list['账号延时范围开始'],config_list['账号延时结束'])
time.sleep(c)
path=sys.path[0]+r'/token/'+str(a)+'.txt'
testapi(path,a,ls)
else:
for ls in range(config_list['每次轮数']):
for a in range(0, len(id_lists)):
if config_list['是否开启各账号延时'] == 'Y':
c = random.randint(config_list['账号延时范围开始'],config_list['账号延时结束'])
time.sleep(c)
path=sys.path[0]+r'/token/'+str(a)+'.txt'
testapi(path,a,ls)
def main2():
if config_list['是否启动随机时间'] == 'Y':
for ls in range(config_list['每次轮数']):
b=random.randint(config_list['延时范围起始'],config_list['结束'])
time.sleep(b)
for a in range(0, len(id_lists)):
if config_list['是否开启各账号延时'] == 'Y':
c = random.randint(config_list['账号延时范围开始'],config_list['账号延时结束'])
time.sleep(c)
path=sys.path[0]+r'/backuptoken/'+str(a)+'.txt'
testapi2(path,a,ls)
else:
for ls in range(config_list['每次轮数']):
for a in range(0, len(id_lists)):
if config_list['是否开启各账号延时'] == 'Y':
c = random.randint(config_list['账号延时范围开始'],config_list['账号延时结束'])
time.sleep(c)
path=sys.path[0]+r'/backuptoken/'+str(a)+'.txt'
testapi2(path,a,ls)
if config_list['是否开启测试'] == 'Y':
config_list = {'每次轮数':1,'是否启动随机时间':'N','延时范围起始':600,'结束':1200,'是否开启随机api顺序':'Y','是否开启各api延时':'N','api延时范围开始':2,'api延时结束':5,'是否开启各账号延时':'N','账号延时范围开始':60,'账号延时结束':120,'是否开启备用应用':'N','是否开启测试':'N'}
id_lists=id_list
secret_lists=secret_list
main()
if id_list2 != [1]:
id_lists=id_list2
secret_lists=secret_list2
main2()
else:
if config_list['是否开启备用应用'] == 'Y':
if buconfig == 'Y':
id_lists=id_list
secret_lists=secret_list
main()
else:
if id_list2 == [1]:
id_lists=id_list
secret_lists=secret_list
main()
else:
id_lists=id_list2
secret_lists=secret_list2
main2()
else:
id_lists=id_list
secret_lists=secret_list
main()

1
token/0.txt Normal file
View File

@ -0,0 +1 @@
0.AVUACC1wGhStWEqTA-UN3CqivDA1uX7ZEpFHi5VJ3mgzSE2IAHg.AgABAAEAAAD--DLA3VO7QrddgJg7WevrAgDs_wQA9P8tqKhqVGlpesspUO5EsVbHWsHxINzQ0gGNU_5hByoB0K6AcXDJ94UY19fa01VE8xBYtCCHOWhwCbcJFbRvxKINThgd9HkxNqE7qcDM6uoAjevbR92wxFiPiEaYCQCkjZBxRAfIQdeqJXpItbawdaTrDPHPpqHaNEpcANYSmCjkba_CzX6eQDZj9oUlWoe47u21qyjjEqjIRRRDvFVfAfEgIA8fDbSHNL-UeqUhzsdnz8lnKGqcbXuQcsibjnUgyb_xLg1xoZojcXeunx3M32etx_dIgn8Q_MnISHiG1Z-wa2BwqbYs5e3h7wrSyPABGheFPAerOoebz3jXIO8aizoGYXmv6S1_HLWZu9WcNKzLBmMWHQ1kTgDbM3osstYiu__0Gy8hYhBuQaRSYqi1c5_sC8IPJ5tuAvOh26BEi3Hf1tVtBt804qjRyIWB5DV4j3FOg3Lm4aXccZqt-BDpsIFu0dPfHVIIPWfeUHy9ZJv7mBl0GSMrRiruhMuN0zNgvQa8VoAL2SdF0mt23890xp818wTtZR-aAnwh9jAsMT4nKWLZ1N8dduHqN1hY4oiE56f2Zq37YB5EH4c-qFY2UynAhloxaWa1P-0vkWSbMpS7nFyyo7dTFo1gMLIWCxaBpFiPPqbcS02vgL3dc_bToAKuqTgmWILA5WCYs6C3ydFizSByFvngXe9BRo4CFW7i7yuPCQBqzWXJ6Oc6jWlPFLCda8AxYodp6hJqAvIvgFm_T3EXY2UWc_ZheQDmdrYJ

52
updaterand.py Normal file
View File

@ -0,0 +1,52 @@
# -*- coding: UTF-8 -*-
import json,sys,time,random
#先注册azure应用,确保应用有以下权限:
#files: Files.Read.All、Files.ReadWrite.All、Sites.Read.All、Sites.ReadWrite.All
#user: User.Read.All、User.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All
#mail: Mail.Read、Mail.ReadWrite、MailboxSettings.Read、MailboxSettings.ReadWrite
#注册后一定要再点代表xxx授予管理员同意,否则outlook api无法调用
#以下空行不要删除,以便运行时插入机密
slice1 = [0]*8
randomapi=[1,2,6,7,21,22,29]
list1 = [[3,4,5],[8,9,10,11],[23,24,25,26,27,28],[14,15,16,17],[18,19,20],[12,13]]
list2 = [1,2,2,2,2,2]
path=sys.path[0]+r'/config/randomapi.txt'
path5=sys.path[0]+r'/config/buconfig.txt'
for i in range(0,3):
slice1[i] = random.sample(list1[i], list2[i])
gk=slice1[0]
randomapi.append(gk[0])
b = random.randint(0,2)
if b == 0:
slice1[3]=random.sample(list1[5],2)
if b == 1:
slice1[3]=random.sample(list1[3],2)
if b == 2:
slice1[3]=random.sample(list1[4],2)
print(str(slice1[1]))
print(str(slice1[2]))
print(str(slice1[3]))
for h in range(1,4):
gg=slice1[h]
for h1 in range(0,2):
gd=gg[h1]
randomapi.append(gd)
random.shuffle(randomapi)
str2 = ','.join([str(x) for x in randomapi])
with open(path, 'w+') as f:
f.write(str2)
fe = open(path5, "r+")
rfv = fe.read()
fe.close()
if rfv == 'Y':
str5 = 'N'
with open(path5, 'w+') as fn:
fn.write(str5)
else:
str5 = 'Y'
with open(path5, 'w+') as fn:
fn.write(str5)

47
updatetoken.py Normal file
View File

@ -0,0 +1,47 @@
# -*- coding: UTF-8 -*-
import requests as req
import json,sys,time,random
dd2=[1]
id_list2=[1]
def gettoken(refresh_token):
headers={'Content-Type':'application/x-www-form-urlencoded'
}
data={'grant_type': 'refresh_token',
'refresh_token': refresh_token,
'client_id':id_lists[a],
'client_secret':secret_lists[a],
'redirect_uri':'http://localhost:53682/'
}
html = req.post('https://login.microsoftonline.com/common/oauth2/v2.0/token',data=data,headers=headers)
jsontxt = json.loads(html.text)
refresh_token = jsontxt['refresh_token']
access_token = jsontxt['access_token']
with open(path, 'w+') as f:
f.write(refresh_token)
def main():
fo = open(path, "r+")
refresh_token = fo.read()
fo.close()
access_token=gettoken(refresh_token)
for a in range(0, len(id_list)):
path=sys.path[0]+r'/token/'+str(a)+'.txt'
id_lists=id_list
secret_lists=secret_list
main()
if id_list2 != dd2:
for a in range(0, len(id_list2)):
path=sys.path[0]+r'/backuptoken/'+str(a)+'.txt'
id_lists=id_list2
secret_lists=secret_list2
main()