All-Feature 1.0.6__tar.gz → 1.0.7__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-1.0.7}/All_Feature/All_Feature.py +35 -13
- all_feature-1.0.7/All_Feature/__init__.py +4 -0
- {all_feature-1.0.6 → all_feature-1.0.7}/All_Feature.egg-info/PKG-INFO +1 -1
- {all_feature-1.0.6 → all_feature-1.0.7}/All_Feature.egg-info/SOURCES.txt +2 -3
- {all_feature-1.0.6 → all_feature-1.0.7}/All_Feature.egg-info/top_level.txt +0 -1
- {all_feature-1.0.6 → all_feature-1.0.7}/PKG-INFO +1 -1
- all_feature-1.0.7/README.md +2 -0
- {all_feature-1.0.6 → all_feature-1.0.7}/pyproject.toml +1 -1
- all_feature-1.0.6/All_Feature/__init__.py +0 -1
- all_feature-1.0.6/build_dir/All_Feature/All_Feature.py +0 -186
- all_feature-1.0.6/build_dir/All_Feature/__init__.py +0 -1
- {all_feature-1.0.6 → all_feature-1.0.7}/All_Feature.egg-info/dependency_links.txt +0 -0
- {all_feature-1.0.6 → all_feature-1.0.7}/All_Feature.egg-info/requires.txt +0 -0
- {all_feature-1.0.6 → all_feature-1.0.7}/setup.cfg +0 -0
|
@@ -6,20 +6,20 @@ import platform
|
|
|
6
6
|
import subprocess
|
|
7
7
|
import requests
|
|
8
8
|
import socket
|
|
9
|
-
from requests.exceptions import Timeout
|
|
9
|
+
from requests.exceptions import RequestException,Timeout
|
|
10
10
|
import cv2
|
|
11
11
|
import qrcode
|
|
12
12
|
from PIL import Image
|
|
13
|
-
from pyzbar.pyzbar import decode
|
|
13
|
+
from pyzbar.pyzbar import decode
|
|
14
14
|
from cryptography.fernet import Fernet
|
|
15
15
|
import sys
|
|
16
|
+
from time import sleep
|
|
16
17
|
#--------------------------------------------------------------------------------------
|
|
17
18
|
#================================Var==================================================
|
|
18
|
-
__version__ = "1.0.
|
|
19
|
+
__version__ = "1.0.7"
|
|
19
20
|
#=====================================================================================
|
|
20
21
|
def found_abs(rel_path):
|
|
21
|
-
return os.path.normcase(os.path.normpath(os.path.abspath(rel_path)))
|
|
22
|
-
|
|
22
|
+
return os.path.normcase(os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), rel_path))))
|
|
23
23
|
def webopen(URL):
|
|
24
24
|
web.open(URL)
|
|
25
25
|
|
|
@@ -28,15 +28,15 @@ def play(path):
|
|
|
28
28
|
if os.path.exists(abs_p):
|
|
29
29
|
web.open(abs_p)
|
|
30
30
|
else:
|
|
31
|
-
return "
|
|
31
|
+
return "file_not_exist"
|
|
32
32
|
|
|
33
33
|
def sysdetect():
|
|
34
|
-
return
|
|
34
|
+
return [{platform.system()},{platform.release()}]
|
|
35
35
|
|
|
36
36
|
def ofw(file_path,software_path):
|
|
37
37
|
abs_fp = found_abs(file_path)
|
|
38
38
|
if not os.path.isfile(abs_fp):
|
|
39
|
-
return "
|
|
39
|
+
return "file_not_exist"
|
|
40
40
|
try:
|
|
41
41
|
subprocess.Popen([software_path, abs_fp])
|
|
42
42
|
except Exception as e:
|
|
@@ -57,16 +57,16 @@ def get_public_ip():
|
|
|
57
57
|
response = requests.get(api, headers=headers, timeout=10)
|
|
58
58
|
response.raise_for_status()
|
|
59
59
|
return response.text.strip()
|
|
60
|
-
except
|
|
60
|
+
except Timeout:
|
|
61
61
|
continue
|
|
62
|
-
except
|
|
62
|
+
except RequestException:
|
|
63
63
|
continue
|
|
64
64
|
|
|
65
65
|
return "Failed"
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
def
|
|
69
|
+
def lan_ip():
|
|
70
70
|
DNS_servers = ["114.114.114.114","1.1.1.1","8.8.8.8"]
|
|
71
71
|
Port = 53
|
|
72
72
|
for DNS in DNS_servers:
|
|
@@ -82,7 +82,7 @@ def get_lan_ip():
|
|
|
82
82
|
def take_photo(save_path="photo.png"):
|
|
83
83
|
cap = cv2.VideoCapture(0)
|
|
84
84
|
if not cap.isOpened():
|
|
85
|
-
return "
|
|
85
|
+
return "cannot_open_cam"
|
|
86
86
|
ret,frame = cap.read()
|
|
87
87
|
if not ret:
|
|
88
88
|
cap.release()
|
|
@@ -183,4 +183,26 @@ def dec_file(encrypted_path,key_path="secret.key",decrypted_path=None):
|
|
|
183
183
|
return "Done"
|
|
184
184
|
|
|
185
185
|
__dir__ = lambda: [k for k, v in globals().items() if (callable(v) and v.__module__ == __name__)]
|
|
186
|
-
#Test Line
|
|
186
|
+
#Test Line 123
|
|
187
|
+
if __name__ == "__main__":
|
|
188
|
+
print("Hello,This is a Python project,Please import it,instead of running it directly!\n")
|
|
189
|
+
print("Owner:https://space.bilibili.com/1803075060") #i am only 10 Years old!!!
|
|
190
|
+
exit(0) #Will exit. exit code:0
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
#--------------------------------------------------------
|
|
196
|
+
#Owenr:shx (https://space.bilibili.com/1803075060) 10y.o a Chinese
|
|
197
|
+
#All_Feature by shx
|
|
198
|
+
#Thank you for using!!!
|
|
199
|
+
#For Python! For All_Feature! For Better program!!!
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
#Also Try Deltarune!
|
|
203
|
+
#--------------------------------------------------------
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
# asdfghjkl
|
|
207
|
+
|
|
208
|
+
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
README.md
|
|
1
2
|
pyproject.toml
|
|
2
3
|
../All_Feature/All_Feature.py
|
|
3
4
|
../All_Feature/__init__.py
|
|
@@ -14,6 +15,4 @@ All_Feature.egg-info/PKG-INFO
|
|
|
14
15
|
All_Feature.egg-info/SOURCES.txt
|
|
15
16
|
All_Feature.egg-info/dependency_links.txt
|
|
16
17
|
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
|
|
18
|
+
All_Feature.egg-info/top_level.txt
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .All_Feature import *
|
|
@@ -1,186 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .All_Feature import *
|
|
File without changes
|
|
File without changes
|
|
File without changes
|