我有一个regshot文本文件,我正在尝试清理并将必要的数据移动到新的文本文件中。我有一个程序打印已更改和移动的注册表项,但我无法删除冒号后移入十六进制数据的数据。
代码:
import re
import sys
#This allows you to specify the text file
#in commandline start of program.
with open(sys.argv[1], 'r') as f:
for i in xrange(7):
f.next()
for line in f:
#process(line)
if ':' in line:
#Remove unneeded hex data
re.sub("\W+", "", line),
#Print every line with \ on new file
if '\\' in line:
with open("completed.txt", "w") as f1:
f1.write(line)
f.close
f1.close
数据样本:
HKU\S-1-5-21-230830461-2995936100-1910591732-1107\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\Subscriptions\280810\UpdateDrivenByExpiration: 0x00000001
HKU\S-1-5-21-230830461-2995936100-1910591732-1107\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\Subscriptions\280810\UpdateDrivenByExpiration: 0x00000000
HKU\S-1-5-21-230830461-2995936100-1910591732-1107\Software\Microsoft\Windows\CurrentVersion\Search\JumplistData\E7CF176E110C211B: D6 1E 9E B8 B3 B7 D3 01
HKU\S-1-5-21-230830461-2995936100-1910591732-1107\Software\Microsoft\Windows\CurrentVersion\Search\JumplistData\E7CF176E110C211B: 08 64 2B 00 B4 B7 D3 01