有的时候使用Visual Studio用几行代码就可以任意操纵数据格式,免去查找各类转换网站的苦恼。
flag = ['g','x','u','c','t','f','{','l','u','c','k','y','!','}'] print(str(flag).replace("'","").replace(",","").replace(" ",""))
s = "union select" sasc = [] #ASCII sbin = [] #二进制 soct = [] #八进制 shex = [] #十六进制 for c in list(s): asc = ord(c) sasc.append(asc) sbin.append(bin(asc)) soct.append(oct(asc)) shex.append(hex(asc)) print("string:" + s) print("asc:" + str(sasc)) print("bin:" + str(sbin)) print("oct:" + str(soct)) print("hex:" + str(shex))
#ASCII码转字符串 sasc = [103, 120, 117, 99, 116, 102, 123, 108, 117, 99, 107, 121, 33, 125] flag = "" for c in sasc: flag+=chr(c) print(flag) #二进制转字符串 sbin = ['0b1100111', '0b1111000', '0b1110101', '0b1100011', '0b1110100', '0b1100110', '0b1111011', '0b1101100', '0b1110101', '0b1100011', '0b1101011', '0b1111001', '0b100001', '0b1111101'] flag = "" for c in sbin: flag+=chr(int(c,2)) print(flag) #八进制转字符串 soct = ['0o147', '0o170', '0o165', '0o143', '0o164', '0o146', '0o173', '0o154', '0o165', '0o143', '0o153', '0o171', '0o41', '0o175'] flag = "" for c in soct: flag+=chr(int(c,8)) print(flag) #十六进制转字符串 shex = ['0x67', '0x78', '0x75', '0x63', '0x74', '0x66', '0x7b', '0x6c', '0x75', '0x63', '0x6b', '0x79', '0x21', '0x7d'] flag = "" for c in shex: flag+=chr(int(c,16)) print(flag)