2015년 8월 19일 수요일

VM안티 기법에 취약한 명령어 확인하는 IDAPro_python_script

antivm.py

from idautils import *
from idc import *

heads = Heads(SegStart(ScreenEA()), SegEnd(ScreenEA()))
antiVM = []
for i in heads:
    if (GetMnem(i) == "sidt" or GetMnem(i) == "sgdt" or GetMnem(i) == "sldt" or GetMnem(i) == "smsw" or GetMnem(i) == "str" or GetMnem(i) == "in" or GetMnem(i) == "cpuid"):
        antiVM.append(i)   #취약한 명령어 보이면 antiVM 함수내에 i에 넣어줌

print "Number of potential Anti-VM instructions: %d" % (len(antiVM))  #발견된 명령어 갯수 출력

for i in antiVM:
    SetColor(i, CIC_ITEM, 0x0000ff)  #빨간색으로 표시
    Message("Anti-VM: %08x\n" % i)   #아래 command란에 주소 보여줌.








요즘 악성코드에서는 사용되지 않지만 혹시나 해서 정리!
(최근에는 vm 환경에서도 실사용하는 사람들이 많아져서! , 분석가들만 vm에서 하는게 아니라서 )


댓글 없음:

댓글 쓰기