Skip to content

Instantly share code, notes, and snippets.

View rayepeng's full-sized avatar
🎯
Focusing

raye peng rayepeng

🎯
Focusing
View GitHub Profile
@rayepeng
rayepeng / 1_collision_2nd_preimage.py
Created September 1, 2019 05:34 — forked from hellman/1_collision_2nd_preimage.py
NSU CRYPTO 2017 - Problem 4 - FNV2 Hash
'''
Explanation at
https://drive.google.com/open?id=1gDRoulcbWfh-T6KBLwvV8g_xb7dT3Erx
'''
from sage.all import *
mod = 2**128
h0 = 144066263297769815596495629667062367629
g = 2**88 + 315
@rayepeng
rayepeng / xxx.py
Last active March 26, 2020 09:07
[python正则表达式]#python#re
In [7]: re.findall(r'(?i)yes', "Yes,yeS,yes")
Out[7]: ['Yes', 'yeS', 'yes']
@rayepeng
rayepeng / usb键盘流量.py
Last active May 18, 2021 15:42
USB键盘流量提取 #CTF
#!/usr/bin/python
# coding: utf-8
from __future__ import print_function
import sys,os
#declare -A lcasekey
lcasekey = {}
#declare -A ucasekey
ucasekey = {}
@rayepeng
rayepeng / mistery_picture.py
Last active May 19, 2021 01:41
mistery_picture.py #CTF
import cv2
import re
img_ = cv2.imread('./mistery_picture.bmp')
mi_ = ''.join([str(x) for x in (img_ % 2).reshape(-1)])
for off_ in range(8):
mi_1 = mi_[off_:]
xxx = (''.join([chr(int(mi_1[8*i:8*(i+1)][::-1], 2)) for i in range(len(mi_1) // 8)]))
print(re.findall('(Iron[\s\S]{,66})', xxx))
@rayepeng
rayepeng / reshape.py
Created May 19, 2021 01:22
numpy reshape用法 #Python
In [1]: import numpy as np
In [2]: arr = np.array([1,2,3,4,5,6])
In [3]: arr = arr.reshape(2,1,3)
In [4]: arr
Out[4]:
array([[[1, 2, 3]],
@rayepeng
rayepeng / get_img_name.py
Created May 19, 2021 02:25
残差网络图像分类
def get_img_name(img_dir, format="jpg"):
"""
获取文件夹下format格式的文件名
:param img_dir: str
:param format: str
:return: list
"""
file_names = os.listdir(img_dir) # 列出当前目录下所有文件
# 使用 list(filter(lambda())) 筛选出 jpg 后缀的文件
img_names = list(filter(lambda x: x.endswith(format), file_names))
@rayepeng
rayepeng / join.py
Last active June 15, 2021 06:50
多线程 #Python
# 调用join表示自身优先执行
import threading
#定义线程要调用的方法,*add可接收多个以非关键字方式传入的参数
def action(*add):
for arc in add:
#调用 getName() 方法获取当前执行该程序的线程名
print(threading.current_thread().getName() +" "+ arc)
#定义为线程方法传入的参数
@rayepeng
rayepeng / 线程池.py
Last active May 20, 2021 01:51
线程池.py #Python #多线程
import requests
from concurrent.futures import ThreadPoolExecutor, as_completed
pool = ThreadPoolExecutor(3)
task_list = set()
targets = [
'http://xxx',
'http://xxx',
'http://xxx'
@rayepeng
rayepeng / 命令记录.sh
Last active May 22, 2021 10:21
饥荒服务器搭建 #bash
# 更新源
yum update -y
yum upgrade -y
yum install glibc.i686 libstdc++.i686 libcurl.i686 vim screen -y
useradd steam
su steam
cd ~
@rayepeng
rayepeng / 添加用户.sh
Created May 21, 2021 07:43
Linux 用户操作
useradd steam
passwd steam
# 修改 /etc/sudoers 文件
chmod u+w /etc/sudoers
'''
即执行:vi /etc/sudoers