- md5碰撞(misc)
1
2
3
4
5
6
7
8
9
10
11
12#!/user/bin/env python2
# -*-coding:utf-8 -*-
import hashlib,sys
def getMD5(Cap):
for x in range(1000000,100000000):
captcha=x
MD5=hashlib.md5(str(captcha)).hexdigest()
if MD5[0:6]==Cap:
return captcha
print getMD5(sys.argv[1])
关于含有大小写字母及数字的凯撒移位(encry)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#!/user/bin env python2
# -*-coding:utf-8 -*-
sr1="abcdefghijklmnopqrstuvwxyz"
sr2="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
sr3="0123456789"
src=sr1+sr1+sr2+sr2
result=""
str="LyjtL3fvnSRlo2xvKIjrK2ximSHkJ3ZhJ2Hto3x9"
for a in range(1,27):
for i in str:
if i==" ":
result=result+" "
elif sr3.find(i)>-1:
result=result+sr3[sr3.find(i)]
else:
j=src.find(i)
if (j>-1):
result=result+src[j+a]
print result二维码生成脚本(misc)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Image
import numpy as np
def hex2bin(hexmat):
binmattemp = [bin(m)[2:] for m in hexmat]
rowlen = max([len(m) for m in binmattemp])
binmat = [[0]+[int(b) for b in row.zfill(rowlen)] for row in binmattemp]
print rowlen+1, 'x', len(binmat)
for i in xrange(len(binmat)):
print ''.join([str(b) for b in binmat[i]])
return binmat, rowlen+1, len(binmat)
def rm_col(binmat, col):
return [row[:col]+row[col+1:] for row in binmat]
def make_bw_img(binmat, w, h, outfilename, blackbit=0):
bwmat = [[0 if b==blackbit else 255 for b in row] for row in binmat]
imagesize = (w, h)
img = Image.fromarray(np.uint8(np.array(bwmat)))
img.save(outfilename)
if __name__ == '__main__':
hexmat = [0x00000000,
0xff71fefe,
0x83480082,
0xbb4140ba,
0xbb6848ba,
0xbb4a80ba,
0x83213082,
# 0xff5556fe,
0xff5556fe,
0x00582e00,
0x576fb9be,
0x707ef09e,
0xe74b41d6,
0xa82c0f16,
0x27a15690,
0x8c643628,
0xbfcbf976,
0x4cd959aa,
0x2f43d73a,
0x5462300a,
0x57290106,
0xb02ace5a,
# 0xef53f7fc,
0xef53f7fc,
0x00402e36,
0xff01b6a8,
0x83657e3a,
0xbb3b27fa,
0xbb5eaeac,
0xbb1017a0,
0x8362672c,
0xff02a650,
0x00000000]
binmat, w, h = hex2bin(hexmat)
binmat = rm_col(binmat, 22)
binmat = rm_col(binmat, 7)
make_bw_img(binmat, w, h, 'matrix_rmcol.png', blackbit=1)水印图片显示(misc)
链接曼彻斯特编码解码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#!/user/bin/env python2
# -*-coding:utf-8 -*-
n=0x5555555595555A65556AA696AA6666666955
flag=''
bs='0'+bin(n)[2:]
r=''
def conv(s):
return hex(int(s,2))[2:]
for i in range(0,len(bs),2):
if bs[i:i+2]=='01':
r+='1'
else:
r+='0'
for i in range(0,len(r),8):
tmp=r[i:i+8][::-1]
flag+=conv(tmp[:4])
flag+=conv(tmp[4:])
print flag.upper()图片base64编码转图片
1
2
3
4
5
6
7#!/user/bin/env python2
# -*-coding:utf-8 -*-
import base64
image="图片base64编码"
fp=open("test.png","wb") //图片后缀根据所提供的图片的base64编码情况来写
fp.write(base64.b64decode(image))
fp.close()二进制数转ascii码
1
2
3
4
5#!/user/bin/env python3
# -*-coding:utf-8 -*-
s='二进制字符串'
for i in range(0,len(s),8):
print (chr(int(s[i:i+8],2)),end='')