Compare commits

...

4 Commits

Author SHA1 Message Date
ibuler
6a2953e8fe fix: 修复默认 gcm key padding 2022-08-22 14:25:48 +08:00
吴小白
c49f30fc99 fix: 修正任务报错 2022-08-22 14:11:49 +08:00
feng626
5e7a35bd9a fix: 表单提交csrftoken问题 2022-08-19 17:23:24 +08:00
吴小白
cd5d860fb4 fix: 添加 openssh-client 依赖包 2022-08-19 17:13:32 +08:00
6 changed files with 18 additions and 8 deletions

View File

@@ -17,6 +17,7 @@ ARG DEPENDENCIES=" \
libxmlsec1-dev \ libxmlsec1-dev \
libxmlsec1-openssl \ libxmlsec1-openssl \
libaio-dev \ libaio-dev \
openssh-client \
sshpass" sshpass"
ARG TOOLS=" \ ARG TOOLS=" \

View File

@@ -79,6 +79,9 @@ function doRequestAuth() {
requestApi({ requestApi({
url: url, url: url,
method: "GET", method: "GET",
headers: {
"X-JMS-LOGIN-TYPE": "W"
},
success: function (data) { success: function (data) {
if (!data.error && data.msg === 'ok') { if (!data.error && data.msg === 'ok') {
window.onbeforeunload = function(){}; window.onbeforeunload = function(){};
@@ -98,9 +101,6 @@ function doRequestAuth() {
}, },
error: function (text, data) { error: function (text, data) {
}, },
beforeSend: function(request) {
request.setRequestHeader("X-JMS-LOGIN-TYPE", "W");
},
flash_message: false, // 是否显示flash消息 flash_message: false, // 是否显示flash消息
}) })
} }

View File

@@ -4,6 +4,7 @@ import re
from Cryptodome.Cipher import AES, PKCS1_v1_5 from Cryptodome.Cipher import AES, PKCS1_v1_5
from Cryptodome.Random import get_random_bytes from Cryptodome.Random import get_random_bytes
from Cryptodome.PublicKey import RSA from Cryptodome.PublicKey import RSA
from Cryptodome.Util.Padding import pad
from Cryptodome import Random from Cryptodome import Random
from gmssl.sm4 import CryptSM4, SM4_ENCRYPT, SM4_DECRYPT from gmssl.sm4 import CryptSM4, SM4_ENCRYPT, SM4_DECRYPT
@@ -107,7 +108,15 @@ class AESCryptoGCM:
""" """
def __init__(self, key): def __init__(self, key):
self.key = padding_key(key) self.key = self.process_key(key)
@staticmethod
def process_key(key):
if not isinstance(key, bytes):
key = bytes(key, encoding='utf-8')
if len(key) >= 32:
return key[:32]
return pad(key, 32)
def encrypt(self, text): def encrypt(self, text):
""" """

View File

@@ -270,13 +270,13 @@ function requestApi(props) {
if (typeof(dataBody) === "object") { if (typeof(dataBody) === "object") {
dataBody = JSON.stringify(dataBody) dataBody = JSON.stringify(dataBody)
} }
var beforeSend = props.beforeSend || function (request) {} var headers = props.headers || {}
$.ajax({ $.ajax({
url: props.url, url: props.url,
type: props.method || "PATCH", type: props.method || "PATCH",
headers: headers,
data: dataBody, data: dataBody,
beforeSend: beforeSend,
contentType: props.content_type || "application/json; charset=utf-8", contentType: props.content_type || "application/json; charset=utf-8",
dataType: props.data_type || "json" dataType: props.data_type || "json"
}).done(function (data, textStatue, jqXHR) { }).done(function (data, textStatue, jqXHR) {

View File

@@ -2,4 +2,4 @@
apt install \ apt install \
g++ make iputils-ping default-libmysqlclient-dev libpq-dev \ g++ make iputils-ping default-libmysqlclient-dev libpq-dev \
libffi-dev libldap2-dev libsasl2-dev sshpass pkg-config libxml2-dev \ libffi-dev libldap2-dev libsasl2-dev sshpass pkg-config libxml2-dev \
libxmlsec1-dev libxmlsec1-openssl libaio-dev freetds-dev libxmlsec1-dev libxmlsec1-openssl libaio-dev openssh-client freetds-dev

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
yum -y install \ yum -y install \
gcc-c++ sshpass mariadb-devel openldap-devel libxml2-devel \ gcc-c++ sshpass mariadb-devel openldap-devel openssh-clients libxml2-devel \
xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel \ xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel \
postgresql-devel postgresql-devel