Bugku-CTF加密篇之进制转换(二进制、八进制、十进制、十六进制,你能分的清吗?)
进制转换
二进制、八进制、十进制、十六进制,你能分的清吗?
本题要点:进制转换、常用进制类型
内容如下:
d87 x65 x6c x63 o157 d109 o145 b100000 d116 b1101111 o40 x6b b1100101 b1101100 o141 d105 x62 d101 b1101001 d46 o40 d71 x69 d118 x65 x20 b1111001 o157 b1110101 d32 o141 d32 d102 o154 x61 x67 b100000 o141 d115 b100000 b1100001 d32 x67 o151 x66 d116 b101110 b100000 d32 d102 d108 d97 o147 d123 x31 b1100101 b110100 d98 d102 b111000 d49 b1100001 d54 b110011 x39 o64 o144 o145 d53 x61 b1100010 b1100011 o60 d48 o65 b1100001 x63 b110110 d101 o63 b111001 d97 d51 o70 d55 b1100010 d125 x20 b101110 x20 b1001000 d97 d118 o145 x20 d97 o40 d103 d111 d111 x64 d32 o164 b1101001 x6d o145 x7e
从这一串进制编码来看,分别有 d、x、o、b 。
八进制(逢八进一),Octal,缩写OCT或O,一种以8为基数的计数法,用O表示,为了不与数字0混淆,有时也用Q来表示八进制数。
十进制(逢十进一),英文为Decimal System,缩写Dec或D,来源于希腊文Decem,用D表示。
十六进制(逢十六进一),英文名称:Hexadecimal,是计算机中数据的一种表示方法。它由0-9,A-F组成,字母不区分大小写,前缀用0x表示。
二进制(逢二进一),Binary,用b表示。
所以简单的来说:
D:十进制数Decima
B:二进制数Binary
0x(H):十六进制数Hexadecimal
O:八进制数Octal
因此,我们将这些统一转化为十六进制表示,然后转为字符串就可以得到答案啦~
贴上大佬的进制转换代码脚本~
注:需要python2的环境哈~
python3.8会报错~
#! /usr/bin/env python #coding=utf-8 s=["d87","x65","x6c","x63","o157","d109","o145","b100000","d116","b1101111","o40","x6b","b1100101","b1101100","o141","d105","x62","d101","b1101001","d46","o40","d71","x69","d118","x65","x20","b1111001","o157","b1110101","d32","o141","d32","d102","o154","x61","x67","b100000","o141","d115","b100000","b1100001","d32","x67","o151","x66","d116","b101110","b100000","d32","d102","d108","d97","o147","d123","x31","b1100101","b110100","d98","d102","b111000","d49","b1100001","d54","b110011","x39","o64","o144","o145","d53","x61","b1100010","b1100011","o60","d48","o65","b1100001","x63","b110110","d101","o63","b111001","d97","d51","o70","d55","b1100010","d125","x20","b101110","x20","b1001000","d97","d118","o145","x20","d97","o40","d103","d111","d111","x64","d32","o164","b1101001","x6d","o145","x7e"] s1="" t="" t1="" for i in s: s1=i for j in range(1): if s1[0:1]=='d': t=str(hex(int(s1[1:]))) t=t[2:]+" " t1=t1+t if s1[0:1]=='x': t=s1[1:]+" " t1=t1+t if s1[0:1]=='o': t=str(hex(int(s1[1:],8))) t=t[2:]+" " t1=t1+t if s1[0:1]=='b': t=str(hex(int(s1[1:],2))) t=t[2:]+" " t1=t1+t print t1
这里用到的是菜鸟工具的python2在线运行网站:
https://c.runoob.com/compile/6
我们将这一串十六进制数转换成字符串的形式~
16进制到文本字符串转换在线网站:
https://www.bejson.com/convert/ox2str/
Welcome to kelaibei. Give you a flag as a gift. flag{1e4bf81a6394de5abc005ac6e39a387b} . Have a good time~
得到答案啦~
flag{1e4bf81a6394de5abc005ac6e39a387b}
bingo~
参考资料:
https://blog.csdn.net/An_Mei_Ying/article/details/89683709
https://baike.baidu.com/item/进制转换/3117222?fr=aladdin
--------------------- ┑( ̄Д  ̄)┍ --------------------------
作者:0yst3r[一只在安全领域努力奋斗的小菜鸡]
来源:博客园[ https://www.cnblogs.com/0yst3r-2046/ ] 引用时请注明来源哦~
(๑•̀ㅂ•́)و✧ヽ(✿゚▽゚)ノ(*^▽^*) φ(≧ω≦*)♪
如果本文对你有用,本人不胜欢喜。
The world is your oyster.