标签:winhex range open 扫描 base bin code misc 分析
十六进制转ASCII输出到文件
with open(‘hex.txt‘,‘r‘) as h:
h=h.read()
tem=‘‘
f = open("ascii.txt", "w")
for i in range(0,len(h),2):
tem=‘0x‘+h[i]+h[i+1]
tem=int(tem,base=16)
print(chr(tem),end=‘‘,file=f)
去掉括号后输出到文件
with open(‘ascii.txt‘,‘r‘)as a:
a=a.read()
a=a.split()
tem=‘‘
f=open(‘plot.txt‘,‘w‘)
for i in range(0,len(a)):
tem=a[i]
tem=tem.lstrip(‘(‘)
tem=tem.rstrip(‘)‘)
for j in range(0,len(tem)):
if tem[j]==‘,‘:
tem=tem[:j]+‘ ‘+tem[j+1:]
print(tem,file=f)
标签:winhex range open 扫描 base bin code misc 分析
原文地址:https://www.cnblogs.com/wjun336/p/13961726.html