Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

Commit c2ac510

Browse files
authored
Merge pull request #3 from DDS-Derek/main
2 parents f3f36f7 + 7f07715 commit c2ac510

File tree

7 files changed

+228
-29
lines changed

7 files changed

+228
-29
lines changed

.github/workflows/release.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: Python Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
Windows-amd64:
10+
permissions: write-all
11+
runs-on: windows-latest
12+
name: Build Windows Binary
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Init Python 3.12
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.12'
21+
cache: 'pip'
22+
23+
- name: Install Dependent Packages
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install wheel pyinstaller
27+
pip install -r requirements.txt
28+
shell: pwsh
29+
30+
- name: Pyinstaller
31+
run: |
32+
pyinstaller ticket_for_allcpp.spec
33+
shell: pwsh
34+
35+
- name: Upload Windows File
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: ticket_for_allcpp-windows-amd64
39+
path: dist/ticket_for_allcpp.exe
40+
41+
Linux-amd64:
42+
permissions: write-all
43+
runs-on: ubuntu-latest
44+
name: Build Linux Amd64
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
49+
- name: Init Python 3.12
50+
uses: actions/setup-python@v4
51+
with:
52+
python-version: '3.12'
53+
cache: 'pip'
54+
55+
- name: Install Dependent Packages
56+
run: |
57+
python -m pip install --upgrade pip
58+
pip install wheel pyinstaller
59+
pip install -r requirements.txt
60+
61+
- name: Pyinstaller
62+
run: |
63+
pyinstaller ticket_for_allcpp.spec
64+
mv dist/ticket_for_allcpp dist/ticket_for_allcpp-linux-amd64
65+
66+
- name: Upload Linux File
67+
uses: actions/upload-artifact@v3
68+
with:
69+
name: ticket_for_allcpp-linux-amd64
70+
path: dist/ticket_for_allcpp-linux-amd64
71+
72+
macos-amd64:
73+
permissions: write-all
74+
runs-on: macOS-latest
75+
name: Build macOS Amd64
76+
steps:
77+
- name: Checkout
78+
uses: actions/checkout@v4
79+
80+
- name: Init Python 3.12
81+
uses: actions/setup-python@v4
82+
with:
83+
python-version: '3.12'
84+
cache: 'pip'
85+
86+
- name: Install Dependent Packages
87+
run: |
88+
python -m pip install --upgrade pip
89+
pip install wheel pyinstaller
90+
pip install -r requirements.txt
91+
92+
- name: Pyinstaller
93+
run: |
94+
pyinstaller ticket_for_allcpp.spec
95+
mv dist/ticket_for_allcpp dist/ticket_for_allcpp-macos-amd64
96+
97+
- name: Upload macOS File
98+
uses: actions/upload-artifact@v3
99+
with:
100+
name: ticket_for_allcpp-macos-amd64
101+
path: dist/ticket_for_allcpp-macos-amd64
102+
103+
Create-release:
104+
permissions: write-all
105+
runs-on: ubuntu-latest
106+
needs: [ Windows-amd64, Linux-amd64, macos-amd64]
107+
steps:
108+
- uses: actions/checkout@v4
109+
110+
- name: Download Artifact
111+
uses: actions/download-artifact@v3
112+
113+
- name: get release_informations
114+
shell: bash
115+
run: |
116+
mkdir releases
117+
mv ./ticket_for_allcpp-macos-amd64/ticket_for_allcpp-macos-amd64 ./releases/ticket_for_allcpp-macos-amd64
118+
mv ./ticket_for_allcpp-linux-amd64/ticket_for_allcpp-linux-amd64 ./releases/ticket_for_allcpp-linux-amd64
119+
mv ./ticket_for_allcpp-windows-amd64/ticket_for_allcpp.exe ./releases/ticket_for_allcpp-windows-amd64.exe
120+
cp config.txt ./releases/config.txt
121+
cp cookie.txt ./releases/cookie.txt
122+
123+
- name: Create Release
124+
id: create_release
125+
uses: actions/create-release@latest
126+
env:
127+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128+
with:
129+
tag_name: ${{ github.ref }}
130+
release_name: ${{ github.ref }}
131+
draft: false
132+
prerelease: false
133+
134+
- name: Upload Release Asset
135+
uses: dwenegar/upload-release-assets@v1
136+
env:
137+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138+
with:
139+
release_id: ${{ steps.create_release.outputs.id }}
140+
assets_path: |
141+
./releases/

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/
2+
dist/

README.md

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,56 @@
11
# ticket_for_allcpp
2-
开源免费,简单易用,多线程暴力抢票工具<br>
3-
本程序仅供学习交流, 不得用于商业用途<br>
4-
使用本程序进行违法操作产生的法律责任由操作者自行承担
2+
3+
开源免费,简单易用,多线程暴力 CPP 抢票工具。
4+
5+
> [!NOTE]
6+
> 本程序仅供学习交流, 不得用于商业用途
7+
> 使用本程序进行违法操作产生的法律责任由操作者自行承担
58
69
## 安装教程
7-
Windows 直接下载最新的release文件 [下载地址](https://github.com/Koileo/ticket_for_allcpp/releases/)<br>
8-
Linux 和 Macos 请下载源码 使用Python运行
10+
11+
### 1. 快速安装
12+
13+
前往 [Releases](https://github.com/Koileo/ticket_for_allcpp/releases) 下载最新可执行文件直接命令行运行。
14+
15+
### 2. 源码运行
16+
17+
```shell
18+
git clone https://github.com/Koileo/ticket_for_allcpp.git
19+
cd ticket_for_allcpp
20+
pip install -r requirements.txt
21+
python main.py
22+
```
923

1024
## 使用说明
11-
cookie.txt为配置地址,第一行为账号cookie值,直接F12全部复制就可以<br>
12-
第二行为ticketid,同样也是F12查看 https://www.allcpp.cn/allcpp/ticket/getTicketTypeList.do?eventMainId=xxxx 的响应 一般为4位数字<br>
13-
以此类推,第三行第四行也是这样<br>
14-
config.txt 是配置文件 包括ntp服务器,间隔时长,线程数
15-
本程序支持多线程 多账户 (默认三线程)<br>
16-
默认实名票全部按照购票人设置数量购买,你绑定几个人买几份票,即默认全选<br>
17-
同一账号支持同时购买不同票类,在第二行用“,"分开
25+
26+
### cookie.txt 配置
27+
28+
- 第一行为账号`cookie`值,浏览器登入CPP直接F12获取并全部复制即可。
29+
- 第二行为`ticketid`,同样也是F12查看 https://www.allcpp.cn/allcpp/ticket/getTicketTypeList.do?eventMainId=xxxx 的响应 一般为4位数字
30+
- 以此类推,第三行第四行也是这样
31+
32+
### config.txt 配置文件:包括ntp服务器,间隔时长,线程数
33+
34+
- 本程序支持多线程,多账户(默认三线程)。
35+
- 默认实名票全部按照购票人设置数量购买,你绑定几个人买几份票,即默认全选
36+
- 同一账号支持同时购买不同票类,在第二行用“,"分开
37+
1838
## 其他可用脚本
1939

2040
| 链接 | 主要特色 |
2141
| --------------------------------------------------------- | ---------------------- |
2242
| https://github.com/mikumifa/cppTickerBuy |图形化,对小白友好 |
2343

24-
2544
## 未来功能
45+
2646
- [ ] 微信通知
2747
- [x] 程序外部配置空隔时间和线程数
28-
- [ ] linux 和mac 打包
48+
- [x] Linux 和 MacOS 打包
2949
- [x] 时间校准
3050

31-
3251
## 项目问题
33-
反馈程序BUG或者提新功能建议: [点此链接向项目提出反馈BUG](https://github.com/Koileo/ticket_for_allcpp/issues)
52+
53+
反馈程序BUG或者提新功能建议:[点此链接向项目提出反馈BUG](https://github.com/Koileo/ticket_for_allcpp/issues)
3454

3555
## Star History
3656

config.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ ntp = ntp.aliyun.com
44
[ticket]
55
sleep = 1
66
num_thread = 3
7-

main.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
import hashlib
99
import ntplib
1010
import configparser
11-
import os
11+
12+
1213
# 定义一个全局锁用于线程同步
1314
thread_dict = {}
1415
cookie_file_path = 'cookie.txt'
@@ -29,13 +30,15 @@
2930
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
3031
}
3132

33+
3234
# 读取配置文件
3335
def getConfig(filename, section, option):
3436
conf = configparser.ConfigParser()
3537
conf.read(filename)
3638
config = conf.get(section, option)
3739
return config
3840

41+
3942
def timeconvey(ntp):
4043
chec = ntplib.NTPClient()
4144
response = chec.request(ntp)
@@ -46,6 +49,7 @@ def timeconvey(ntp):
4649
differ= timestamp - timestamp_local
4750
return differ
4851

52+
4953
def sign_for_post(ticketid):
5054
timestamp = str(int(time.time())) ##"1682074579"
5155
## 貌似并不校验 sign: a()(t + r + i + e + n)
@@ -60,6 +64,7 @@ def sign_for_post(ticketid):
6064
vital='nonce='+nonce+'&timeStamp='+timestamp+'&sign='+sign
6165
return vital
6266

67+
6368
def cookie_string_to_dict(cookie_string):
6469
cookies = {}
6570
cookie_pairs = cookie_string.split("; ")
@@ -71,7 +76,6 @@ def cookie_string_to_dict(cookie_string):
7176
return cookies
7277

7378

74-
7579
def read_cookies_and_tickets_from_file():
7680
cookies = []
7781
ticket_id = []
@@ -94,7 +98,6 @@ def read_cookies_and_tickets_from_file():
9498
return cookies, ticket_ids # 返回两个列表作为一个元组
9599

96100

97-
98101
def getpurser(cookie_str):
99102
cookies = cookie_string_to_dict(cookie_str)
100103
pur = requests.get(
@@ -107,7 +110,6 @@ def getpurser(cookie_str):
107110
return purrer_data
108111

109112

110-
111113
def check_success(cookies,ticketid):
112114
url = 'https://www.allcpp.cn/allcpp/user/getMyOrderList.do?pageindex=1&pagesize=10&enabled=0&orderby=0'
113115
list = requests.get(
@@ -117,19 +119,16 @@ def check_success(cookies,ticketid):
117119
)
118120
listing = list.content.decode("utf-8")
119121
data = json.loads(listing)
120-
# 遍历订单信息
122+
# 遍历订单信息
121123
for order in data['result']['list']:
122124
if order['ticketTypeId'] == ticketid:
123125
return True
124126
else:
125127
return False
126128

127129

128-
129-
130130
def process_thread(ticketid,cookie_str):
131131
cookies = cookie_string_to_dict(cookie_str)
132-
verify_ssl = False
133132

134133
pur = requests.get(
135134
url='https://www.allcpp.cn/allcpp/user/purchaser/getList.do',
@@ -231,7 +230,6 @@ def process_thread(ticketid,cookie_str):
231230
time.sleep(sleep_time)
232231

233232

234-
235233
def start(cookies, ticket_ids):
236234
thread_dict = {}
237235

@@ -244,7 +242,6 @@ def start(cookies, ticket_ids):
244242
thread.start()
245243

246244

247-
248245
def schedule_script_at_timestamp(target_timestamp_ms,cookies, ticket_ids):
249246
current_timestamp_ms = int(time.time() * 1000)
250247
time_difference_ms = target_timestamp_ms - current_timestamp_ms
@@ -261,7 +258,6 @@ def delayed_execution():
261258
t.start()
262259

263260

264-
265261
def main():
266262
ntp = getConfig("config.txt", 'time', 'ntp')
267263
global sleep_time
@@ -295,4 +291,4 @@ def main():
295291

296292

297293
if __name__ == "__main__":
298-
main()
294+
main()

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
requests
2+
ntplib
3+
configparser

ticket_for_allcpp.spec

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
3+
4+
a = Analysis(
5+
['main.py'],
6+
pathex=[],
7+
binaries=[],
8+
datas=[],
9+
hiddenimports=[],
10+
hookspath=[],
11+
hooksconfig={},
12+
runtime_hooks=[],
13+
excludes=[],
14+
noarchive=False,
15+
optimize=0,
16+
)
17+
pyz = PYZ(a.pure)
18+
19+
exe = EXE(
20+
pyz,
21+
a.scripts,
22+
a.binaries,
23+
a.datas,
24+
[],
25+
name='ticket_for_allcpp',
26+
debug=False,
27+
bootloader_ignore_signals=False,
28+
strip=False,
29+
upx=True,
30+
upx_exclude=[],
31+
runtime_tmpdir=None,
32+
console=True,
33+
disable_windowed_traceback=False,
34+
argv_emulation=False,
35+
target_arch=None,
36+
codesign_identity=None,
37+
entitlements_file=None,
38+
)

0 commit comments

Comments
 (0)