pyscriptbase 1.1.1__tar.gz → 1.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/PKG-INFO +2 -7
  2. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase/net.py +0 -1
  3. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase/script.py +16 -5
  4. pyscriptbase-1.1.4/pyscriptbase/sms.py +189 -0
  5. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase.egg-info/PKG-INFO +2 -7
  6. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase.egg-info/SOURCES.txt +1 -0
  7. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/setup.py +1 -1
  8. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/README.md +0 -0
  9. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase/__init__.py +0 -0
  10. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase/app.py +0 -0
  11. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase/cipher.py +0 -0
  12. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase/database.py +0 -0
  13. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase/env.py +0 -0
  14. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase/panel.py +0 -0
  15. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase/pusher.py +0 -0
  16. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase/util.py +0 -0
  17. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase/webview.py +0 -0
  18. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase.egg-info/dependency_links.txt +0 -0
  19. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase.egg-info/requires.txt +0 -0
  20. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/pyscriptbase.egg-info/top_level.txt +0 -0
  21. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/setup.cfg +0 -0
  22. {pyscriptbase-1.1.1 → pyscriptbase-1.1.4}/test/test.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: pyscriptbase
3
- Version: 1.1.1
3
+ Version: 1.1.4
4
4
  Summary: python script base library
5
5
  Home-page:
6
6
  Author: ASMan
@@ -19,11 +19,6 @@ Requires-Dist: beautifulsoup4
19
19
  Requires-Dist: requests
20
20
  Requires-Dist: lxml
21
21
  Requires-Dist: brotli
22
- Dynamic: author
23
- Dynamic: description
24
- Dynamic: description-content-type
25
- Dynamic: requires-dist
26
- Dynamic: summary
27
22
 
28
23
  # Instructions
29
24
 
@@ -385,7 +385,6 @@ class CloudRequest:
385
385
  params=params,
386
386
  )
387
387
 
388
-
389
388
  def __req__(
390
389
  self,
391
390
  method: str,
@@ -2,6 +2,7 @@ from concurrent.futures import ThreadPoolExecutor, as_completed
2
2
  from traceback import format_exc
3
3
  from . import net
4
4
  from . import database
5
+ import random
5
6
 
6
7
 
7
8
  class ScriptApp:
@@ -11,9 +12,11 @@ class ScriptApp:
11
12
  def __init__(
12
13
  self,
13
14
  index: int = 1,
14
- useProxy: bool = True,
15
15
  debug: bool = False,
16
+ useProxy: bool = True,
17
+ randomProxy: bool = False,
16
18
  useCloud: bool = True,
19
+ randomCloud: bool = False,
17
20
  ) -> None:
18
21
  self.index = index
19
22
  self.logs = []
@@ -21,6 +24,8 @@ class ScriptApp:
21
24
  self.net = net.NetRequest()
22
25
  self.cloudNet = net.CloudRequest()
23
26
  self.cloudNet.net = self.net
27
+ self.randomProxy = randomProxy
28
+ self.randomCloud = randomCloud
24
29
  useProxy and self.__setProxy__(index)
25
30
  useCloud and self.__setCloudProxy__(index)
26
31
 
@@ -57,7 +62,10 @@ class ScriptApp:
57
62
  except:
58
63
  ScriptApp._proxies = [None]
59
64
  if len(ScriptApp._proxies):
60
- self.net.proxies = ScriptApp._proxies[index % len(ScriptApp._proxies)]
65
+ if self.randomProxy:
66
+ self.net.proxies = random.choice(ScriptApp._proxies)
67
+ else:
68
+ self.net.proxies = ScriptApp._proxies[index % len(ScriptApp._proxies)]
61
69
 
62
70
  def __setCloudProxy__(self, index: int) -> None:
63
71
  config = database.getDataConfig("account", "cloud_proxy")
@@ -84,9 +92,12 @@ class ScriptApp:
84
92
  except:
85
93
  ScriptApp._cloudProxies = []
86
94
  if len(ScriptApp._cloudProxies):
87
- self.cloudNet.cloud = ScriptApp._cloudProxies[
88
- index % len(ScriptApp._cloudProxies)
89
- ]
95
+ if self.randomCloud:
96
+ self.cloudNet.cloud = random.choice(ScriptApp._cloudProxies)
97
+ else:
98
+ self.cloudNet.cloud = ScriptApp._cloudProxies[
99
+ index % len(ScriptApp._cloudProxies)
100
+ ]
90
101
 
91
102
  def __log__(self, msg: str | dict = "", flush: bool = False):
92
103
  if flush or self.debug:
@@ -0,0 +1,189 @@
1
+ import re
2
+ from urllib.parse import urlencode
3
+ import requests
4
+
5
+
6
+ class FeiyunApp:
7
+ def __init__(
8
+ self,
9
+ username: str,
10
+ password: str,
11
+ proxy: str = None,
12
+ host: str = "https://h5.fysms.cc",
13
+ ) -> None:
14
+ self.isLogin = False
15
+ self.money = 0
16
+ self.point = 0
17
+ self.cookies = ""
18
+ self.host = host
19
+ self.username = username
20
+ self.password = password
21
+ if proxy:
22
+ self.proxies = {
23
+ "http": proxy,
24
+ "https": proxy,
25
+ }
26
+ else:
27
+ self.proxies = None
28
+ self.login()
29
+
30
+ def login(self):
31
+ url = f"{self.host}/index.php?m=user&c=Users&a=login"
32
+ headers = {
33
+ "Sec-Ch-UA": '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
34
+ "Sec-Ch-UA-Mobile": "?0",
35
+ "Sec-Ch-UA-Platform": '"Windows"',
36
+ "Upgrade-Insecure-Requests": "1",
37
+ "Sec-Fetch-Site": "none",
38
+ "Sec-Fetch-Mode": "navigate",
39
+ "Sec-Fetch-User": "?1",
40
+ "Sec-Fetch-Dest": "document",
41
+ "Accept-Language": "zh-CN,zh;q=0.9",
42
+ "Priority": "u=0, i",
43
+ "Origin": f"{self.host}",
44
+ "Referer": f"{self.host}/index.php?m=user&c=Users&a=reg",
45
+ "Accept": "text/html,application/xhtml+xml,application/xml;",
46
+ "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
47
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
48
+ }
49
+ cDict = requests.get(
50
+ url=url, headers=headers, proxies=self.proxies, verify=False
51
+ ).cookies.get_dict()
52
+ cookies = ""
53
+ for key, value in cDict.items():
54
+ cookies += key + "=" + value + "; "
55
+
56
+ url = f"{self.host}/index.php?m=user&c=Users&a=login"
57
+ body = f"username={self.username}&password={self.password}&referurl=%2Findex.php%3Fm%3Duser%26c%3DUsers%26a%3Dcentre&website=website"
58
+ headers = {
59
+ "Sec-Ch-UA": '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
60
+ "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
61
+ "X-Requested-With": "XMLHttpRequest",
62
+ "Sec-Ch-UA-Mobile": "?0",
63
+ "Sec-Ch-UA-Platform": '"Windows"',
64
+ "Origin": f"{self.host}",
65
+ "Sec-Fetch-Site": "same-origin",
66
+ "Sec-Fetch-Mode": "cors",
67
+ "Sec-Fetch-Dest": "empty",
68
+ "Referer": f"{self.host}/index.php?m=user&c=Users&a=login",
69
+ "Accept-Language": "zh-CN,zh;q=0.9",
70
+ "Cookie": cookies,
71
+ "Priority": "u=1, i",
72
+ }
73
+ cDict = requests.post(
74
+ url, data=body, headers=headers, proxies=self.proxies, verify=False
75
+ ).cookies.get_dict()
76
+ if "users_id" in cDict:
77
+ cookies += "users_id=" + cDict["users_id"] + "; "
78
+ self.cookies = cookies
79
+ self.isLogin = True
80
+ self.uid = cDict["users_id"]
81
+ else:
82
+ self.__log__("登录失败")
83
+ self.isLogin = False
84
+
85
+ def getPhone(self):
86
+ headers = {
87
+ "Sec-Ch-UA": '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
88
+ "Sec-Ch-UA-Mobile": "?0",
89
+ "Sec-Ch-UA-Platform": '"Windows"',
90
+ "Origin": f"{self.host}",
91
+ "Sec-Fetch-Site": "same-origin",
92
+ "Sec-Fetch-Mode": "cors",
93
+ "Sec-Fetch-Dest": "empty",
94
+ "Referer": f"{self.host}/",
95
+ "Accept-Language": "zh-CN,zh;q=0.9",
96
+ "Cookie": self.cookies,
97
+ "Priority": "u=1, i",
98
+ "x-requested-with": "XMLHttpRequest",
99
+ }
100
+
101
+ # url = f"{self.host}/index.php?m=home&c=Index&a=selectrmb_21&proid=wasd%5D1.5&xuanze=0&userid={self.uid}"
102
+ # text = self.net.get(url=url, headers=headers, isJson=False, timeout=60)
103
+ # if text:
104
+ # text = text.lstrip("\ufeff").strip('"')
105
+ # if text != "1":
106
+ # print(f"获取手机号失败: 预检 {text}")
107
+ # return None
108
+
109
+ url = f"{self.host}/index.php?m=home&c=Index&a=getxksjh"
110
+ text = requests.get(
111
+ url=url, headers=headers, proxies=self.proxies, verify=False
112
+ ).text
113
+ if text:
114
+ text = text.lstrip("\ufeff").strip('"')
115
+ if text and text.isdigit():
116
+ print(f"获取手机号成功:{text}")
117
+ return text
118
+ else:
119
+ print(f"获取手机号失败: {text}")
120
+ return None
121
+
122
+ def getCode(self, phone: str, project: str):
123
+ params = urlencode(
124
+ {
125
+ "gjz": project,
126
+ "m": "home",
127
+ "c": "Index",
128
+ "a": "selectrmb",
129
+ "userid": self.uid,
130
+ "phone": phone,
131
+ "zuoyong": "11",
132
+ "yzuid": int(self.uid) * 2 - 5,
133
+ }
134
+ )
135
+ url = f"{self.host}/index.php?{params}"
136
+ headers = {
137
+ "Sec-Ch-UA": '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
138
+ "Sec-Ch-UA-Mobile": "?0",
139
+ "Sec-Ch-UA-Platform": '"Windows"',
140
+ "Origin": f"{self.host}",
141
+ "Sec-Fetch-Site": "same-origin",
142
+ "Sec-Fetch-Mode": "cors",
143
+ "Sec-Fetch-Dest": "empty",
144
+ "Referer": f"{self.host}/",
145
+ "Accept-Language": "zh-CN,zh;q=0.9",
146
+ "Cookie": self.cookies,
147
+ "Priority": "u=1, i",
148
+ "x-requested-with": "XMLHttpRequest",
149
+ }
150
+ text = requests.get(
151
+ url=url, headers=headers, proxies=self.proxies, verify=False
152
+ ).text
153
+ if text:
154
+ text = text.lstrip("\ufeff").strip('"')
155
+ if text == "1":
156
+ print("未获取到验证码")
157
+ return None
158
+ elif text == "buzu":
159
+ print(f"账号余额不足: {text}")
160
+ return None
161
+ elif text and text.find(project) > -1:
162
+ codes = self.extract_verification_codes(text)
163
+ if codes:
164
+ print(f"获取验证码成功:{codes[0]}")
165
+ return codes[0]
166
+ else:
167
+ print(f"提取验证码失败: {text}")
168
+ return None
169
+ else:
170
+ print(f"获取验证码失败: {text}")
171
+ return None
172
+
173
+ def extract_verification_codes(self, text):
174
+ """
175
+ 从文本中提取所有独立的 4 位或 6 位数字验证码。
176
+
177
+ 参数:
178
+ text (str): 输入的文本字符串
179
+
180
+ 返回:
181
+ list: 包含所有匹配到的验证码列表
182
+ """
183
+ # 正则表达式解释:
184
+ # \b : 单词边界,确保数字前后不是其他数字或字母(防止匹配长数字的一部分)
185
+ # (\d{4}|\d{6}) : 匹配恰好 4 位 或 恰好 6 位的数字
186
+ pattern = r"\b(\d{4}|\d{6})\b"
187
+
188
+ matches = re.findall(pattern, text)
189
+ return matches
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: pyscriptbase
3
- Version: 1.1.1
3
+ Version: 1.1.4
4
4
  Summary: python script base library
5
5
  Home-page:
6
6
  Author: ASMan
@@ -19,11 +19,6 @@ Requires-Dist: beautifulsoup4
19
19
  Requires-Dist: requests
20
20
  Requires-Dist: lxml
21
21
  Requires-Dist: brotli
22
- Dynamic: author
23
- Dynamic: description
24
- Dynamic: description-content-type
25
- Dynamic: requires-dist
26
- Dynamic: summary
27
22
 
28
23
  # Instructions
29
24
 
@@ -9,6 +9,7 @@ pyscriptbase/net.py
9
9
  pyscriptbase/panel.py
10
10
  pyscriptbase/pusher.py
11
11
  pyscriptbase/script.py
12
+ pyscriptbase/sms.py
12
13
  pyscriptbase/util.py
13
14
  pyscriptbase/webview.py
14
15
  pyscriptbase.egg-info/PKG-INFO
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pyscriptbase", # 包名
5
- version="1.1.1", # 版本号
5
+ version="1.1.4", # 版本号
6
6
  packages=find_packages(), # 自动查找包
7
7
  author="ASMan",
8
8
  author_email="",
File without changes
File without changes
File without changes