Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Automat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冯佳佳
Automat
Commits
678e6045
Commit
678e6045
authored
Jan 18, 2022
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
78d26505
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
2 additions
and
7 deletions
+2
-7
myapps/automat/api/rent_portal.py
+0
-2
myapps/pc_management/api/file_protal.py
+0
-1
myapps/pc_management/api/hatch_portal.py
+0
-1
myapps/pc_management/api/machine_portal.py
+0
-1
utils/middlewares.py
+0
-0
utils/wechat/WXBizDataCrypt.py
+2
-2
No files found.
myapps/automat/api/rent_portal.py
View file @
678e6045
...
...
@@ -83,7 +83,6 @@ def create_rent():
Hatch
.
left_count
>=
1
)
.
order_by
(
func
.
random
())
.
first
()
if
not
open_hatch
:
print
(
"...."
)
return
jsonify
(
HATCH_NOT_EXIST_ERROR
)
break
...
...
@@ -212,7 +211,6 @@ def wx_pay_callback():
logger
.
info
(
xml_data
)
logger
.
info
(
callback_data
)
attach
=
re
.
sub
(
'
\'
'
,
'
\"
'
,
callback_data
[
"attach"
])
print
(
attach
)
rent_data
=
json
.
loads
(
attach
)
platform
=
rent_data
[
"platform"
]
machine_no
=
rent_data
[
"machine_no"
]
...
...
myapps/pc_management/api/file_protal.py
View file @
678e6045
...
...
@@ -33,7 +33,6 @@ def run_upload_img():
if
filetype
and
filetype
in
ALLOWED_EXTENSIONS
:
# 后缀格式必须是bmp结尾
uid
=
uuid
.
uuid4
()
# 生成随机名称
save_file_name
=
str
(
uid
)
+
"."
+
filetype
# 拼接名称
print
(
os
.
path
.
join
(
img_file_path
,
filename
))
file
.
save
(
os
.
path
.
join
(
img_file_path
,
save_file_name
))
# 保存文件
return
BaseResponse
(
data
=
{
"filename"
:
save_file_name
})
...
...
myapps/pc_management/api/hatch_portal.py
View file @
678e6045
...
...
@@ -66,7 +66,6 @@ def run_hatch_list():
return
BaseResponse
(
data
=
{
"list"
:
[],
"page"
:
page
,
"pageSize"
:
page_size
,
"total_count"
:
0
})
else
:
total_count
=
count_result
.
total_count
print
(
select_sql
+
from_sql
+
where_sql
+
order_sql
+
limit_sql
)
result
=
db
.
session
.
execute
(
select_sql
+
from_sql
+
where_sql
+
order_sql
+
limit_sql
)
.
fetchall
()
return_data
=
[]
...
...
myapps/pc_management/api/machine_portal.py
View file @
678e6045
...
...
@@ -62,7 +62,6 @@ def run_machine_list():
return
BaseResponse
(
data
=
{
"list"
:
[],
"page"
:
page
,
"pageSize"
:
page_size
,
"total_count"
:
0
})
else
:
total_count
=
count_result
.
total_count
print
(
select_sql
+
from_sql
+
where_sql
+
order_sql
+
limit_sql
)
result
=
db
.
session
.
execute
(
select_sql
+
from_sql
+
where_sql
+
order_sql
+
limit_sql
)
.
fetchall
()
return_data
=
[]
...
...
utils/middlewares.py
View file @
678e6045
This diff is collapsed.
Click to expand it.
utils/wechat/WXBizDataCrypt.py
View file @
678e6045
import
base64
import
json
from
Crypto.Cipher
import
AES
class
WXBizDataCrypt
:
def
__init__
(
self
,
appId
,
sessionKey
):
self
.
appId
=
appId
self
.
sessionKey
=
sessionKey
def
decrypt
(
self
,
encryptedData
,
iv
):
sessionKey
=
base64
.
decodebytes
(
bytes
(
self
.
sessionKey
,
encoding
=
'utf8'
))
encryptedData
=
base64
.
decodebytes
(
bytes
(
encryptedData
,
encoding
=
'utf8'
))
iv
=
base64
.
decodebytes
(
bytes
(
iv
,
encoding
=
'utf8'
))
cipher
=
AES
.
new
(
sessionKey
,
AES
.
MODE_CBC
,
iv
)
des_str
=
cipher
.
decrypt
(
encryptedData
)
print
(
"=================================="
)
print
(
des_str
)
des_str
=
self
.
_unpad
(
des_str
)
print
(
des_str
)
des_str
=
str
(
des_str
,
encoding
=
'utf-8'
)
decrypted
=
json
.
loads
(
des_str
)
if
decrypted
[
'watermark'
][
'appid'
]
!=
self
.
appId
:
raise
Exception
(
'Invalid Buffer'
)
return
decrypted
def
_unpad
(
self
,
s
):
return
s
[:
-
ord
(
s
[
len
(
s
)
-
1
:])]
if
__name__
==
'__main__'
:
appId
=
'wx3185fb4a3633beb0'
sessionKey
=
'S7CMDfC6jXJKSaWKanG8oQ=='
encryptedData
=
'E7LZhvK7mOcaYsv9xcAfsBN9eSbzFh9FyMtFJ0zsFB0M62zRJ0cosZWksUujUR5WYUmNoIfIJnTIF8gRskxxbFU3fm5X7z4ChZecMSaFM65aEK1suRUD1U0ubB7mOwBBlY4ftdPT5kRwWgXKVkM4VAkYGN8A4fjWE93yGtjzxXs9dypQkCLSNWs6Kw5USEzjhtDZnptVy+lHF5fTXRuzoCstW2Cto4YI3G9hmnS64QuWjRteSqIgh8GN1zEPN0dROJjaWBjqraBCt/BfMsk4HBeL4PA75K8WdqVgKGfQ7/rnmPFOsNXWfajx9jl7XcrfoPaaPL1DmIJ1BlQne2GuLFtzZ3O4/8cdVQ9Lb0N/3kFAzjgzNFNLSYj2VNctmWyLdWi8hH90yslvrODIhMzIsuux2GIAfp0rQd/iVIVvtd7PXBOCe5iZ7aaqD0b0mLF4CmsuBpl8Eh20ZHkYw2SqO0x9uFrS/gy1vwtkmsTpcDw='
iv
=
'DQcmcXyQkU+VKqb2mKmasQ=='
pc
=
WXBizDataCrypt
(
appId
,
sessionKey
)
pc
.
decrypt
(
encryptedData
,
iv
)
#
\ No newline at end of file
import
base64
import
json
from
Crypto.Cipher
import
AES
class
WXBizDataCrypt
:
def
__init__
(
self
,
appId
,
sessionKey
):
self
.
appId
=
appId
self
.
sessionKey
=
sessionKey
def
decrypt
(
self
,
encryptedData
,
iv
):
sessionKey
=
base64
.
decodebytes
(
bytes
(
self
.
sessionKey
,
encoding
=
'utf8'
))
encryptedData
=
base64
.
decodebytes
(
bytes
(
encryptedData
,
encoding
=
'utf8'
))
iv
=
base64
.
decodebytes
(
bytes
(
iv
,
encoding
=
'utf8'
))
cipher
=
AES
.
new
(
sessionKey
,
AES
.
MODE_CBC
,
iv
)
des_str
=
cipher
.
decrypt
(
encryptedData
)
des_str
=
self
.
_unpad
(
des_str
)
des_str
=
str
(
des_str
,
encoding
=
'utf-8'
)
decrypted
=
json
.
loads
(
des_str
)
if
decrypted
[
'watermark'
][
'appid'
]
!=
self
.
appId
:
raise
Exception
(
'Invalid Buffer'
)
return
decrypted
def
_unpad
(
self
,
s
):
return
s
[:
-
ord
(
s
[
len
(
s
)
-
1
:])]
if
__name__
==
'__main__'
:
appId
=
'wx3185fb4a3633beb0'
sessionKey
=
'S7CMDfC6jXJKSaWKanG8oQ=='
encryptedData
=
'E7LZhvK7mOcaYsv9xcAfsBN9eSbzFh9FyMtFJ0zsFB0M62zRJ0cosZWksUujUR5WYUmNoIfIJnTIF8gRskxxbFU3fm5X7z4ChZecMSaFM65aEK1suRUD1U0ubB7mOwBBlY4ftdPT5kRwWgXKVkM4VAkYGN8A4fjWE93yGtjzxXs9dypQkCLSNWs6Kw5USEzjhtDZnptVy+lHF5fTXRuzoCstW2Cto4YI3G9hmnS64QuWjRteSqIgh8GN1zEPN0dROJjaWBjqraBCt/BfMsk4HBeL4PA75K8WdqVgKGfQ7/rnmPFOsNXWfajx9jl7XcrfoPaaPL1DmIJ1BlQne2GuLFtzZ3O4/8cdVQ9Lb0N/3kFAzjgzNFNLSYj2VNctmWyLdWi8hH90yslvrODIhMzIsuux2GIAfp0rQd/iVIVvtd7PXBOCe5iZ7aaqD0b0mLF4CmsuBpl8Eh20ZHkYw2SqO0x9uFrS/gy1vwtkmsTpcDw='
iv
=
'DQcmcXyQkU+VKqb2mKmasQ=='
pc
=
WXBizDataCrypt
(
appId
,
sessionKey
)
pc
.
decrypt
(
encryptedData
,
iv
)
#
\ No newline at end of file
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment