本站vip特权 - 全站资源免费下载

限时特惠

IDApython提取信息

数据提取:以Hitcon-Training LAB1为例 | IDApython

1919808-20200913203620597-1783608277.png

1919808-20200913204401003-1100083111.png

ea=here()
print hex(ea),idc.GetDisasm(ea)
ch=idc.GetDisasm(ea)
print ch[-9:]
ea=here()
print hex(ea),idc.GetDisasm(ea)
ch=idc.GetDisasm(ea)
print ch[-9:]
print hex(ea+7),idc.GetDisasm(ea+7)

ch=idc.GetDisasm(ea+7)
print ch[-9:]

1919808-20200913232747585-1793162165.png

#脚本的制约条件:锁定.text的具体定位,只能在类似数组结构的开头
ea=here()
test=''
for i in range(12):
    ch=idc.GetDisasm(ea+i*7)
    test+=('0x'+ch[-9:]).rstrip('h')
    test+=','
#print test
    #print type(ch)
la=idc.GetDisasm(ea+12*7)
org=la[-3:]
num='0x'+org.rstrip('h')
test+=num
#print test
l=test.split(',')
#print l
list=[int(x.lstrip('0x'),16) for x in l]
#print list
str=""
for i in list:
    str+=chr(i%0x100)
    str+=chr(int(i%0x10000/0x100))
    str+=chr(int(i%0x1000000/0x10000))
    str+=chr(int((i%0x100000000/0x1000000)))
#str+=chr(0x3f)
print(str)

1919808-20200915064932039-138787263.png

ea=here()
print ea,idc.GetDisasm(ea)
l=[]
    #数据的提取,大致分为两种类型
for n in range(49):
    i=idc.GetDisasm(ea+n*4)
    if(i[-1:]=='h'):  #可以已结尾是否是h作为判断标志对数据进行提取
        cn=int("0x"+i[-3:-1],16)

    else:
        cn=int(i[-1:],10)
    l.append(cn)
print l

1919808-20200915070821720-1362506405.png

#脚本的制约条件:锁定.text的具体定位,只能在类似数组结构的开头
ea=here()
test=''
for i in range(12):
    ch=idc.GetDisasm(ea+i*7)
    test+=('0x'+ch[-9:]).rstrip('h')
    test+=','
#print test
    #print type(ch)
la=idc.GetDisasm(ea+12*7)
org=la[-3:]
num='0x'+org.rstrip('h')
test+=num
#print test
l=test.split(',')
#print l
list=[int(x.lstrip('0x'),16) for x in l]
#print list
str=""
for i in list:
    str+=chr(i%0x100)
    str+=chr(int(i%0x10000/0x100))
    str+=chr(int(i%0x1000000/0x10000))
    str+=chr(int((i%0x100000000/0x1000000)))
#str+=chr(0x3f)
##print(str)
#ea=here()
#print ea,idc.GetDisasm(ea)

l=[]
    #数据的提取,大致分为两种类型
for n in range(49):
    i=idc.GetDisasm(ea+90+n*4)
    if(i[-1:]=='h'):  #可以已结尾是否是h作为判断标志对数据进行提取
        cn=int("0x"+i[-3:-1],16)

    else:
        cn=int(i[-1:],10)
    l.append(cn)
##print l
flag=""
for i in range(49):
    flag+=chr(ord(str[i])^l[i])
print flag

1919808-20200915071019317-1067745949.png

1919808-20200915071041468-98535267.png

上述两个地址的差值是用来计算两组数据的偏移的,用来具体的数据提取。

工具

MoveKit:一款功能强大的Cobalt Strike横向渗透套件

2021-5-9 12:00:52

工具

Cobalt Strike 4.0 学习笔记-基础(一)

2021-5-10 11:54:32

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索