Programming/Python

Python - Volatility ImageInfo 에서 중요한 결과만 추출하기

pental 2019. 11. 20. 14:22
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#Written by Pental
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("image.txt""Win")
 
for sentence in result:
    extact_sentece = sentence
 
if __name__ == "__main__":
    oriText = extact_sentece
#    print('Del Special word : ', cleanText(oriText))
    del_speical_word_image = cleanText(oriText)
 
#Del SpaceBar
replace_space_bar_image = del_speical_word_image.replace(" ","")
 
image_information = replace_space_bar_image[17:28]
print ('Image Profile :',image_information)
 
#--------------------------FileAddressSpace---------------------
fileaddress = findSentence("image.txt""FileAddressSpace")
#Del Unique Word - File Space
for sentence in fileaddress:
    file_space = sentence
 
if __name__ == "__main__":
    oriText = file_space
    del_speical_word_file_space = cleanText(oriText)
 
#Del Space Bar - File Space
replace_space_bar_file_space = del_speical_word_file_space.replace(" ","")
 
file_space = replace_space_bar_file_space[24:]
print ('Image File Address :',file_space)
 
#------------Image date and time--------------
imagedataandtime = findSentence("image.txt""Image date and time")
#Del Unique Word - Image date and time
for sentence in imagedataandtime:
    image_data_and_time = sentence
 
if __name__ == "__main__":
    oriText = image_data_and_time
    del_speical_word_image_data_and_time = cleanText(oriText)
 
#Del Space Bar - Image date and time
replace_space_bar_image_data_and_time = del_speical_word_image_data_and_time.replace(" ","",12)
 
image_data_and_time = replace_space_bar_image_data_and_time[20:]
print ('Image Data And Time :',image_data_and_time)
cs

image - Volatility imageinfo - Extract Important Information