- 博客(16)
- 收藏
- 关注
原创 mysql 按条件更新
update userset Y= if(Y+200<=3000,Y+200,3000)where id = X最大值3000
2019-06-21 15:46:03 1022
转载 python 让系统不识别转义字符 print的时候直接输出
一般用来加密的带转义字符的json字符串的时候使用print("\ntext_1")print(r"\ntest_2")
2019-06-20 15:20:06 3884
翻译 python aes加解密 ecb模式 加密 报错ValueError: Data must be aligned to block boundary in ECB mode
from Crypto.Util.Padding import pad, unpadfrom Crypto.Cipher import AESBLOCK_SIZE = 32 # Byteskey = 'abcdefghijklmnop'cipher = AES.new(key.encode('utf8'), AES.MODE_ECB)msg = cipher.encrypt(pad(...
2019-06-20 13:47:50 18410
转载 python 字符串填充0
python中有一个zfill方法用来给字符串前面补0,非常有用n="123" s=n.zfill(5) asserts=="00123" zfill()也可以给负数补0n="-123" s=n.zfill(5) asserts=="-0123" 对于纯数字,我们也可以通过格式化的方式来补0n=123 s="%05d"%...
2019-06-19 15:30:29 9082
转载 git 仓库地址
1、切换远程仓库地址:方式一:修改远程仓库地址【git remote set-url origin URL】 更换远程仓库地址,URL为新地址。方式二:先删除远程仓库地址,然后再添加【git remote rm origin】 删除现有远程仓库【git remote add origin url】添加新远程仓库2、【git remote -v 】查看远程仓库的地址-----...
2019-06-17 11:52:16 2891
原创 python 模拟 PHP SHA256验签
phpopenssl_verify($data, $this->urlSafeBase64decode($sign), $public_key, OPENSSL_ALGO_SHA256)from Crypto.Hash import SHA256from Crypto.PublicKey import RSAfrom Crypto.Signature import PKCS1...
2019-06-13 18:34:46 750
原创 python3 仿写PHP gzip解压缩
import zlib# gzip解压def gzinflate(compressed: bytes) -> bytes: return zlib.decompress(compressed, -zlib.MAX_WBITS)
2019-06-13 15:09:31 246
原创 python 公钥解密
import base64from cryptography.hazmat.backends.openssl.backend import backendfrom cryptography.hazmat.primitives.serialization import load_pem_public_keyfrom config import conf# base64解密def de...
2019-06-12 16:58:52 1481 2
原创 从pfx里面 解析出公私钥
openssl pkcs12 -in 1.pfx -nocerts -nodes -out 1.key输入密码openssl rsa -in 1.key -out pfx_pri.pemopenssl rsa -in 1.key -pubout -out pfx_pub.pem
2019-06-11 15:08:24 719
原创 python3 gzip 压缩/解压
import gzipt = gzip.compress('{"key":value""}'.encode())print(gzip.decompress(t).decode())
2019-06-10 16:41:36 8301 1
原创 数据恢复 从binlog文件
查看当前数据库binlog格式show global variables like "%binlog_format%";查看当前最新的binlogshow master logs;下载binlogmysqlbinlog -umolan -p -hffffffffffffff.mysql.rds.aliyuncs.com --read-from-remote-server ...
2019-06-06 14:33:40 92
原创 python3 dict 转 json 不ascii转码 去除空格
postDataJson = json.dumps(postData, separators=(',', ':'),ensure_ascii=False)
2019-06-05 13:39:48 678
原创 python3 和 python2 并存 重新安装pip3
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython3 get-pip.py
2019-06-04 15:45:10 275
转载 pyhton3 rsa长加密/解密
from Crypto.Cipher import PKCS1_v1_5 as Cipher_pkcs1_v1_5from Crypto.PublicKey import RSAimport base64'''单次加密串的长度最大为(key_size/8 - 11)加密的 plaintext 最大长度是 证书key位数/8 - 11, 例如1024 bit的证书,被加密的串最长 10...
2019-06-04 10:56:58 411
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人