All-Feature 1.0.4__tar.gz → 1.0.6__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.
- all_feature-1.0.6/All_Feature/All_Feature.py +186 -0
- all_feature-1.0.6/All_Feature/__init__.py +1 -0
- {all_feature-1.0.4 → all_feature-1.0.6/All_Feature.egg-info}/PKG-INFO +1 -1
- all_feature-1.0.6/All_Feature.egg-info/SOURCES.txt +19 -0
- all_feature-1.0.6/All_Feature.egg-info/dependency_links.txt +1 -0
- all_feature-1.0.6/All_Feature.egg-info/requires.txt +6 -0
- all_feature-1.0.6/All_Feature.egg-info/top_level.txt +3 -0
- all_feature-1.0.6/PKG-INFO +16 -0
- all_feature-1.0.6/build_dir/All_Feature/All_Feature.py +186 -0
- all_feature-1.0.6/build_dir/All_Feature/__init__.py +1 -0
- {all_feature-1.0.4 → all_feature-1.0.6}/pyproject.toml +2 -2
- {all_feature-1.0.4 → all_feature-1.0.6}/setup.cfg +0 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
#-*-coding: utf-8-*-
|
|
2
|
+
#------------------------------import--------------------------------------------------
|
|
3
|
+
import os
|
|
4
|
+
import webbrowser as web
|
|
5
|
+
import platform
|
|
6
|
+
import subprocess
|
|
7
|
+
import requests
|
|
8
|
+
import socket
|
|
9
|
+
from requests.exceptions import Timeout
|
|
10
|
+
import cv2
|
|
11
|
+
import qrcode
|
|
12
|
+
from PIL import Image
|
|
13
|
+
from pyzbar.pyzbar import decode
|
|
14
|
+
from cryptography.fernet import Fernet
|
|
15
|
+
import sys
|
|
16
|
+
#--------------------------------------------------------------------------------------
|
|
17
|
+
#================================Var==================================================
|
|
18
|
+
__version__ = "1.0.6"
|
|
19
|
+
#=====================================================================================
|
|
20
|
+
def found_abs(rel_path):
|
|
21
|
+
return os.path.normcase(os.path.normpath(os.path.abspath(rel_path)))
|
|
22
|
+
|
|
23
|
+
def webopen(URL):
|
|
24
|
+
web.open(URL)
|
|
25
|
+
|
|
26
|
+
def play(path):
|
|
27
|
+
abs_p = found_abs(path)
|
|
28
|
+
if os.path.exists(abs_p):
|
|
29
|
+
web.open(abs_p)
|
|
30
|
+
else:
|
|
31
|
+
return "file_not_found"
|
|
32
|
+
|
|
33
|
+
def sysdetect():
|
|
34
|
+
return f"System:{platform.system()},Version:{platform.release()}"
|
|
35
|
+
|
|
36
|
+
def ofw(file_path,software_path):
|
|
37
|
+
abs_fp = found_abs(file_path)
|
|
38
|
+
if not os.path.isfile(abs_fp):
|
|
39
|
+
return "not_exist"
|
|
40
|
+
try:
|
|
41
|
+
subprocess.Popen([software_path, abs_fp])
|
|
42
|
+
except Exception as e:
|
|
43
|
+
return "Failed"
|
|
44
|
+
|
|
45
|
+
def get_public_ip():
|
|
46
|
+
headers = {"User-Agent": "Chrome"}
|
|
47
|
+
ip_apis = [
|
|
48
|
+
"https://api.ipify.org",
|
|
49
|
+
"https://icanhazip.com",
|
|
50
|
+
"https://api.ip.sb/ip",
|
|
51
|
+
"https://ifconfig.me/ip",
|
|
52
|
+
"https://ipinfo.io/ip"
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
for api in ip_apis:
|
|
56
|
+
try:
|
|
57
|
+
response = requests.get(api, headers=headers, timeout=10)
|
|
58
|
+
response.raise_for_status()
|
|
59
|
+
return response.text.strip()
|
|
60
|
+
except requests.Timeout:
|
|
61
|
+
continue
|
|
62
|
+
except requests.RequestException:
|
|
63
|
+
continue
|
|
64
|
+
|
|
65
|
+
return "Failed"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def get_lan_ip():
|
|
70
|
+
DNS_servers = ["114.114.114.114","1.1.1.1","8.8.8.8"]
|
|
71
|
+
Port = 53
|
|
72
|
+
for DNS in DNS_servers:
|
|
73
|
+
try:
|
|
74
|
+
with socket.socket(socket.AF_INET,socket.SOCK_DGRAM) as s:
|
|
75
|
+
s.settimeout(5)
|
|
76
|
+
s.connect((DNS,Port))
|
|
77
|
+
return s.getsockname()[0]
|
|
78
|
+
except:
|
|
79
|
+
continue
|
|
80
|
+
return "Failed"
|
|
81
|
+
|
|
82
|
+
def take_photo(save_path="photo.png"):
|
|
83
|
+
cap = cv2.VideoCapture(0)
|
|
84
|
+
if not cap.isOpened():
|
|
85
|
+
return "Cannot_open_cam"
|
|
86
|
+
ret,frame = cap.read()
|
|
87
|
+
if not ret:
|
|
88
|
+
cap.release()
|
|
89
|
+
return "Failed"
|
|
90
|
+
abs_sp = found_abs(save_path)
|
|
91
|
+
cv2.imwrite(abs_sp,frame)
|
|
92
|
+
cap.release()
|
|
93
|
+
return f"Saved"
|
|
94
|
+
|
|
95
|
+
def get_lat_lon():
|
|
96
|
+
api = "https://ipinfo.io/json"
|
|
97
|
+
try:
|
|
98
|
+
data = requests.get(api,timeout=5).json()
|
|
99
|
+
loc = data.get("loc")
|
|
100
|
+
if loc:
|
|
101
|
+
lat,lon = loc.split(',')
|
|
102
|
+
return float(lat),float(lon)
|
|
103
|
+
return "format_change"
|
|
104
|
+
except:
|
|
105
|
+
return "network_Error"
|
|
106
|
+
|
|
107
|
+
def close_task_pid(pid):
|
|
108
|
+
result = os.system(f'taskkill /f /pid {pid}')
|
|
109
|
+
if result != 0:
|
|
110
|
+
return "Failed"
|
|
111
|
+
|
|
112
|
+
def gen_qrcode(content,save_path="qrcode.png",size=8,ver=3):
|
|
113
|
+
if not isinstance(content,(str,int,float,bool)):
|
|
114
|
+
try:
|
|
115
|
+
content = str(content)
|
|
116
|
+
except:
|
|
117
|
+
return "Unknown_type"
|
|
118
|
+
qr = qrcode.QRCode(version=ver,box_size=size,border=4)
|
|
119
|
+
qr.add_data(str(content))
|
|
120
|
+
qr.make(fit=True)
|
|
121
|
+
img = qr.make_image(fill_color="black",back_color="white")
|
|
122
|
+
abs_sp = found_abs(save_path)
|
|
123
|
+
img.save(abs_sp)
|
|
124
|
+
return "Done"
|
|
125
|
+
|
|
126
|
+
def de_qrcode(img_path):
|
|
127
|
+
abs_ip = found_abs(img_path)
|
|
128
|
+
if not os.path.exists(abs_ip):
|
|
129
|
+
return "file_not_found"
|
|
130
|
+
try:
|
|
131
|
+
img = Image.open(abs_ip)
|
|
132
|
+
data = decode(img)[0].data.decode("utf-8")
|
|
133
|
+
return f"{data}"
|
|
134
|
+
except:
|
|
135
|
+
return "Cannot_parse"
|
|
136
|
+
|
|
137
|
+
def gen_key(save_path="secret.key"):
|
|
138
|
+
abs_sp = found_abs(save_path)
|
|
139
|
+
key = Fernet.generate_key()
|
|
140
|
+
with open(abs_sp,"wb") as f:
|
|
141
|
+
f.write(key)
|
|
142
|
+
return "Done"
|
|
143
|
+
|
|
144
|
+
def enc_file(file_path,key_path="secret.key",encrypted_path=None):
|
|
145
|
+
abs_fp = found_abs(file_path)
|
|
146
|
+
abs_kp = found_abs(key_path)
|
|
147
|
+
if not os.path.exists(abs_fp):
|
|
148
|
+
return "file_not_found"
|
|
149
|
+
if not os.path.exists(abs_kp):
|
|
150
|
+
return "key_file_not_found"
|
|
151
|
+
with open(abs_kp,"rb") as kf:
|
|
152
|
+
key = kf.read()
|
|
153
|
+
cipher = Fernet(key)
|
|
154
|
+
with open(abs_fp,"rb") as f:
|
|
155
|
+
data = f.read()
|
|
156
|
+
if encrypted_path is None:
|
|
157
|
+
save_path = abs_fp + ".encrypted"
|
|
158
|
+
else:
|
|
159
|
+
save_path = found_abs(encrypted_path)
|
|
160
|
+
with open(save_path,"wb")as ef:
|
|
161
|
+
ef.write(cipher.encrypt(data))
|
|
162
|
+
return "Saved"
|
|
163
|
+
|
|
164
|
+
def dec_file(encrypted_path,key_path="secret.key",decrypted_path=None):
|
|
165
|
+
abs_ep = found_abs(encrypted_path)
|
|
166
|
+
abs_kp = found_abs(key_path)
|
|
167
|
+
if not os.path.exists(abs_ep):
|
|
168
|
+
return "encrypted_file_not_found"
|
|
169
|
+
if not os.path.exists(abs_kp):
|
|
170
|
+
return "key_path_not_found"
|
|
171
|
+
with open(abs_kp,"rb") as kf:
|
|
172
|
+
key = kf.read()
|
|
173
|
+
cipher = Fernet(key)
|
|
174
|
+
with open(abs_ep,"rb") as ef:
|
|
175
|
+
encrypted_data = ef.read()
|
|
176
|
+
decrypted_data = cipher.decrypt(encrypted_data)
|
|
177
|
+
if decrypted_path is None:
|
|
178
|
+
save_path = abs_ep.replace(".encrypted","")
|
|
179
|
+
else:
|
|
180
|
+
save_path = found_abs(decrypted_path)
|
|
181
|
+
with open(save_path,"wb") as df:
|
|
182
|
+
df.write(decrypted_data)
|
|
183
|
+
return "Done"
|
|
184
|
+
|
|
185
|
+
__dir__ = lambda: [k for k, v in globals().items() if (callable(v) and v.__module__ == __name__)]
|
|
186
|
+
#Test Line###123
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .All_Feature import *
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
pyproject.toml
|
|
2
|
+
../All_Feature/All_Feature.py
|
|
3
|
+
../All_Feature/__init__.py
|
|
4
|
+
../All_Feature.egg-info/PKG-INFO
|
|
5
|
+
../All_Feature.egg-info/SOURCES.txt
|
|
6
|
+
../All_Feature.egg-info/dependency_links.txt
|
|
7
|
+
../All_Feature.egg-info/requires.txt
|
|
8
|
+
../All_Feature.egg-info/top_level.txt
|
|
9
|
+
../build_dir/All_Feature/All_Feature.py
|
|
10
|
+
../build_dir/All_Feature/__init__.py
|
|
11
|
+
All_Feature/All_Feature.py
|
|
12
|
+
All_Feature/__init__.py
|
|
13
|
+
All_Feature.egg-info/PKG-INFO
|
|
14
|
+
All_Feature.egg-info/SOURCES.txt
|
|
15
|
+
All_Feature.egg-info/dependency_links.txt
|
|
16
|
+
All_Feature.egg-info/requires.txt
|
|
17
|
+
All_Feature.egg-info/top_level.txt
|
|
18
|
+
build_dir/All_Feature/All_Feature.py
|
|
19
|
+
build_dir/All_Feature/__init__.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: All_Feature
|
|
3
|
+
Version: 1.0.6
|
|
4
|
+
Summary: A Toolkit
|
|
5
|
+
Author-email: shx <q19333189819@outlook.com>
|
|
6
|
+
Maintainer-email: shx <q19333189819@outlook.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
10
|
+
Requires-Python: >=3.14
|
|
11
|
+
Requires-Dist: requests
|
|
12
|
+
Requires-Dist: opencv-python
|
|
13
|
+
Requires-Dist: qrcode
|
|
14
|
+
Requires-Dist: pillow
|
|
15
|
+
Requires-Dist: pyzbar
|
|
16
|
+
Requires-Dist: cryptography
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
#-*-coding: utf-8-*-
|
|
2
|
+
#------------------------------import--------------------------------------------------
|
|
3
|
+
import os
|
|
4
|
+
import webbrowser as web
|
|
5
|
+
import platform
|
|
6
|
+
import subprocess
|
|
7
|
+
import requests
|
|
8
|
+
import socket
|
|
9
|
+
from requests.exceptions import Timeout
|
|
10
|
+
import cv2
|
|
11
|
+
import qrcode
|
|
12
|
+
from PIL import Image
|
|
13
|
+
from pyzbar.pyzbar import decode
|
|
14
|
+
from cryptography.fernet import Fernet
|
|
15
|
+
import sys
|
|
16
|
+
#--------------------------------------------------------------------------------------
|
|
17
|
+
#================================Var==================================================
|
|
18
|
+
__version__ = "1.0.6"
|
|
19
|
+
#=====================================================================================
|
|
20
|
+
def found_abs(rel_path):
|
|
21
|
+
return os.path.normcase(os.path.normpath(os.path.abspath(rel_path)))
|
|
22
|
+
|
|
23
|
+
def webopen(URL):
|
|
24
|
+
web.open(URL)
|
|
25
|
+
|
|
26
|
+
def play(path):
|
|
27
|
+
abs_p = found_abs(path)
|
|
28
|
+
if os.path.exists(abs_p):
|
|
29
|
+
web.open(abs_p)
|
|
30
|
+
else:
|
|
31
|
+
return "file_not_found"
|
|
32
|
+
|
|
33
|
+
def sysdetect():
|
|
34
|
+
return f"System:{platform.system()},Version:{platform.release()}"
|
|
35
|
+
|
|
36
|
+
def ofw(file_path,software_path):
|
|
37
|
+
abs_fp = found_abs(file_path)
|
|
38
|
+
if not os.path.isfile(abs_fp):
|
|
39
|
+
return "not_exist"
|
|
40
|
+
try:
|
|
41
|
+
subprocess.Popen([software_path, abs_fp])
|
|
42
|
+
except Exception as e:
|
|
43
|
+
return "Failed"
|
|
44
|
+
|
|
45
|
+
def get_public_ip():
|
|
46
|
+
headers = {"User-Agent": "Chrome"}
|
|
47
|
+
ip_apis = [
|
|
48
|
+
"https://api.ipify.org",
|
|
49
|
+
"https://icanhazip.com",
|
|
50
|
+
"https://api.ip.sb/ip",
|
|
51
|
+
"https://ifconfig.me/ip",
|
|
52
|
+
"https://ipinfo.io/ip"
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
for api in ip_apis:
|
|
56
|
+
try:
|
|
57
|
+
response = requests.get(api, headers=headers, timeout=10)
|
|
58
|
+
response.raise_for_status()
|
|
59
|
+
return response.text.strip()
|
|
60
|
+
except requests.Timeout:
|
|
61
|
+
continue
|
|
62
|
+
except requests.RequestException:
|
|
63
|
+
continue
|
|
64
|
+
|
|
65
|
+
return "Failed"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def get_lan_ip():
|
|
70
|
+
DNS_servers = ["114.114.114.114","1.1.1.1","8.8.8.8"]
|
|
71
|
+
Port = 53
|
|
72
|
+
for DNS in DNS_servers:
|
|
73
|
+
try:
|
|
74
|
+
with socket.socket(socket.AF_INET,socket.SOCK_DGRAM) as s:
|
|
75
|
+
s.settimeout(5)
|
|
76
|
+
s.connect((DNS,Port))
|
|
77
|
+
return s.getsockname()[0]
|
|
78
|
+
except:
|
|
79
|
+
continue
|
|
80
|
+
return "Failed"
|
|
81
|
+
|
|
82
|
+
def take_photo(save_path="photo.png"):
|
|
83
|
+
cap = cv2.VideoCapture(0)
|
|
84
|
+
if not cap.isOpened():
|
|
85
|
+
return "Cannot_open_cam"
|
|
86
|
+
ret,frame = cap.read()
|
|
87
|
+
if not ret:
|
|
88
|
+
cap.release()
|
|
89
|
+
return "Failed"
|
|
90
|
+
abs_sp = found_abs(save_path)
|
|
91
|
+
cv2.imwrite(abs_sp,frame)
|
|
92
|
+
cap.release()
|
|
93
|
+
return f"Saved"
|
|
94
|
+
|
|
95
|
+
def get_lat_lon():
|
|
96
|
+
api = "https://ipinfo.io/json"
|
|
97
|
+
try:
|
|
98
|
+
data = requests.get(api,timeout=5).json()
|
|
99
|
+
loc = data.get("loc")
|
|
100
|
+
if loc:
|
|
101
|
+
lat,lon = loc.split(',')
|
|
102
|
+
return float(lat),float(lon)
|
|
103
|
+
return "format_change"
|
|
104
|
+
except:
|
|
105
|
+
return "network_Error"
|
|
106
|
+
|
|
107
|
+
def close_task_pid(pid):
|
|
108
|
+
result = os.system(f'taskkill /f /pid {pid}')
|
|
109
|
+
if result != 0:
|
|
110
|
+
return "Failed"
|
|
111
|
+
|
|
112
|
+
def gen_qrcode(content,save_path="qrcode.png",size=8,ver=3):
|
|
113
|
+
if not isinstance(content,(str,int,float,bool)):
|
|
114
|
+
try:
|
|
115
|
+
content = str(content)
|
|
116
|
+
except:
|
|
117
|
+
return "Unknown_type"
|
|
118
|
+
qr = qrcode.QRCode(version=ver,box_size=size,border=4)
|
|
119
|
+
qr.add_data(str(content))
|
|
120
|
+
qr.make(fit=True)
|
|
121
|
+
img = qr.make_image(fill_color="black",back_color="white")
|
|
122
|
+
abs_sp = found_abs(save_path)
|
|
123
|
+
img.save(abs_sp)
|
|
124
|
+
return "Done"
|
|
125
|
+
|
|
126
|
+
def de_qrcode(img_path):
|
|
127
|
+
abs_ip = found_abs(img_path)
|
|
128
|
+
if not os.path.exists(abs_ip):
|
|
129
|
+
return "file_not_found"
|
|
130
|
+
try:
|
|
131
|
+
img = Image.open(abs_ip)
|
|
132
|
+
data = decode(img)[0].data.decode("utf-8")
|
|
133
|
+
return f"{data}"
|
|
134
|
+
except:
|
|
135
|
+
return "Cannot_parse"
|
|
136
|
+
|
|
137
|
+
def gen_key(save_path="secret.key"):
|
|
138
|
+
abs_sp = found_abs(save_path)
|
|
139
|
+
key = Fernet.generate_key()
|
|
140
|
+
with open(abs_sp,"wb") as f:
|
|
141
|
+
f.write(key)
|
|
142
|
+
return "Done"
|
|
143
|
+
|
|
144
|
+
def enc_file(file_path,key_path="secret.key",encrypted_path=None):
|
|
145
|
+
abs_fp = found_abs(file_path)
|
|
146
|
+
abs_kp = found_abs(key_path)
|
|
147
|
+
if not os.path.exists(abs_fp):
|
|
148
|
+
return "file_not_found"
|
|
149
|
+
if not os.path.exists(abs_kp):
|
|
150
|
+
return "key_file_not_found"
|
|
151
|
+
with open(abs_kp,"rb") as kf:
|
|
152
|
+
key = kf.read()
|
|
153
|
+
cipher = Fernet(key)
|
|
154
|
+
with open(abs_fp,"rb") as f:
|
|
155
|
+
data = f.read()
|
|
156
|
+
if encrypted_path is None:
|
|
157
|
+
save_path = abs_fp + ".encrypted"
|
|
158
|
+
else:
|
|
159
|
+
save_path = found_abs(encrypted_path)
|
|
160
|
+
with open(save_path,"wb")as ef:
|
|
161
|
+
ef.write(cipher.encrypt(data))
|
|
162
|
+
return "Saved"
|
|
163
|
+
|
|
164
|
+
def dec_file(encrypted_path,key_path="secret.key",decrypted_path=None):
|
|
165
|
+
abs_ep = found_abs(encrypted_path)
|
|
166
|
+
abs_kp = found_abs(key_path)
|
|
167
|
+
if not os.path.exists(abs_ep):
|
|
168
|
+
return "encrypted_file_not_found"
|
|
169
|
+
if not os.path.exists(abs_kp):
|
|
170
|
+
return "key_path_not_found"
|
|
171
|
+
with open(abs_kp,"rb") as kf:
|
|
172
|
+
key = kf.read()
|
|
173
|
+
cipher = Fernet(key)
|
|
174
|
+
with open(abs_ep,"rb") as ef:
|
|
175
|
+
encrypted_data = ef.read()
|
|
176
|
+
decrypted_data = cipher.decrypt(encrypted_data)
|
|
177
|
+
if decrypted_path is None:
|
|
178
|
+
save_path = abs_ep.replace(".encrypted","")
|
|
179
|
+
else:
|
|
180
|
+
save_path = found_abs(decrypted_path)
|
|
181
|
+
with open(save_path,"wb") as df:
|
|
182
|
+
df.write(decrypted_data)
|
|
183
|
+
return "Done"
|
|
184
|
+
|
|
185
|
+
__dir__ = lambda: [k for k, v in globals().items() if (callable(v) and v.__module__ == __name__)]
|
|
186
|
+
#Test Line###123
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .All_Feature import *
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "All_Feature"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.6"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name = "shx", email = "q19333189819@outlook.com" }
|
|
10
10
|
]
|
|
@@ -30,4 +30,4 @@ dependencies = [
|
|
|
30
30
|
"cryptography"
|
|
31
31
|
]
|
|
32
32
|
[tool.setuptools.packages.find]
|
|
33
|
-
where = ["
|
|
33
|
+
where = ["."]
|
|
File without changes
|