Skip to content

Commit

Permalink
Fixing output message when adding a new value in the registry using t…
Browse files Browse the repository at this point in the history
…he "add" command of reg.py
  • Loading branch information
gabrielg5 committed Aug 6, 2024
1 parent 7544a3e commit 73faf18
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def add(self, dce, keyName):
if dwType == rrp.REG_MULTI_SZ:
vd = '\0'.join(self.__options.vd)
valueData = vd + 2 * '\0' # REG_MULTI_SZ ends with 2 null-bytes
valueDataToPrint = vd.replace('\0', '\n')
valueDataToPrint = vd.replace('\0', '\n\t\t')
else:
vd = self.__options.vd[0] if len(self.__options.vd) > 0 else ''
if dwType in (
Expand All @@ -315,11 +315,11 @@ def add(self, dce, keyName):
)

if ans3['ErrorCode'] == 0:
print('Successfully set key %s\\%s of type %s to value %s' % (
print('Successfully set\n\tkey\t%s\\%s\n\ttype\t%s\n\tvalue\t%s' % (
keyName, self.__options.v, self.__options.vt, valueDataToPrint
))
else:
print('Error 0x%08x while setting key %s\\%s of type %s to value %s' % (
print('Error 0x%08x while setting\n\tkey\t%s\\%s\n\ttype\t%s\n\tvalue\t%s' % (
ans3['ErrorCode'], keyName, self.__options.v, self.__options.vt, valueDataToPrint
))

Expand Down Expand Up @@ -514,7 +514,7 @@ def __parse_lp_data(valueType, valueData):
except:
print(" NULL")
elif valueType == rrp.REG_MULTI_SZ:
print("%s" % (valueData.decode('utf-16le')[:-2].replace('\0', '\n')))
print("%s" % (valueData.decode('utf-16le')[:-2]))
else:
print("Unknown Type 0x%x!" % valueType)
hexdump(valueData)
Expand Down

0 comments on commit 73faf18

Please sign in to comment.