Programming/Python

Python - Volatility Cmdscan 에서 중요한 정보만 추출하기

pental 2019. 11. 21. 23:54
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#Written by Pental
#Cmdscan 결과 추출
print ("Source by Pental / Extract CmdScan Result")
import re
import string
 
# Function
#Find Unique Word
def findSentence(fileName, findText):
    file = open(fileName, mode="r", encoding="utf8")
    result = []
    data = file.read()
    data = data.splitlines()
    for line in data:
        sentences = line.split(". ")
        for sentence in sentences:
            sentence = sentence.strip(".")
            if findText in sentence:
                result.append(sentence + ".")
    file.close()
    return result
 
#Delete Special Text
def cleanText(readData):
    text = re.sub('[(),:]','',readData)
    return text
 
#---------------Find Image--------------
#Find Unique Word (Win)
result = findSentence("cmdscan.txt""Cmd")
 
for sentence in result:
    extact_sentece = sentence
    print (extact_sentece[:-1])
 
cs
image. Extract Important Information of cmdscan