本系列主要内容来自《K A, Monnappa. Learning Malware Analysis: Explore the concepts, tools, and techniques to analyze and investigate Windows malware (pp. 95-96). Packt Publishing. Kindle 版本. 》的记录
工具:
Windows systems, HxD hex editor (https://mh-nexus.de/en/hxd/)
Linux systems, to look for the file signature, the xxd command can be used.
工具方式识别文件类型
On Windows, CFF Explorer, part of Explorer Suite (http://www.ntcore.com/exsuite.php), can be used to determine the file type; windows下也可以在网上找到file.exe,通过file进行文件类型识别。
Linux system,the file command can be used.
#!/usr/bin/env python# This script tells if a File, IP, Domain or URL may be malicious according to the data in OTXfrom OTXv2 import OTXv2
import argparse
import get_malicious
import hashlib
# Your API keyAPI_KEY ='<API KEY>'OTX_SERVER ='https://otx.alienvault.com/'otx = OTXv2(API_KEY, server=OTX_SERVER)
parser = argparse.ArgumentParser(description='OTX CLI Example')
parser.add_argument('-ip', help='IP eg; 4.4.4.4', required=False)
parser.add_argument('-host',
help='Hostname eg; www.alienvault.com', required=False)
parser.add_argument(
'-url', help='URL eg; http://www.alienvault.com', required=False)
parser.add_argument(
'-hash', help='Hash of a file eg; 7b42b35832855ab4ff37ae9b8fa9e571', required=False)
parser.add_argument(
'-file', help='Path to a file, eg; malware.exe', required=False)
args = vars(parser.parse_args())
if args['ip']:
alerts = get_malicious.ip(otx, args['ip'])
if len(alerts) >0:
print('Identified as potentially malicious')
print(str(alerts))
else:
print('Unknown or not identified as malicious')
if args['host']:
alerts = get_malicious.hostname(otx, args['host'])
if len(alerts) >0:
print('Identified as potentially malicious')
print(str(alerts))
else:
print('Unknown or not identified as malicious')
if args['url']:
alerts = get_malicious.url(otx, args['url'])
if len(alerts) >0:
print('Identified as potentially malicious')
print(str(alerts))
else:
print('Unknown or not identified as malicious')
if args['hash']:
alerts = get_malicious.file(otx, args['hash'])
if len(alerts) >0:
print('Identified as potentially malicious')
print(str(alerts))
else:
print('Unknown or not identified as malicious')
if args['file']:
hash = hashlib.md5(open(args['file'], 'rb').read()).hexdigest()
alerts = get_malicious.file(otx, hash)
if len(alerts) >0:
print('Identified as potentially malicious')
print(str(alerts))
else:
print('Unknown or not identified as malicious')