Open lap1nou opened 2 years ago
Hey,
I had a bug with a simple VBA macro like this one:
Sub Auto_Open() FileTest = "C:\Users\test\test.txt" Open FileTest For Output As #1 Write #1, "Test" Close #1 End Sub
The actual ViperMonkey commit transformed the source code into this:
Sub Auto_Open() FileTest = "C:\Users\test\test.txt" Open FileTest For Output As #1 Write 1, "Test" Close #1 End Sub
As you can see there is a missing # in the Write call, to fix this I've added these two lines:
#
Write
vba_code = re.sub(r"[Ww]rite\s+#", "write__HASH", vba_code) r = r.replace("write__HASH", "Write #")
I also had to modify the Write class defined in vba_library.py, the original file had this:
vba_library.py
# Get the data. data = str(params[0])
But the data are actually stored in the second parameter like the Put call:
Put
# Get the data. data = str(params[1])
I have tested with the code I've put above and it seems to work fine.
Like the Put call they may be more than on input so we might need to mimic Put class regarding this.
Hey,
I had a bug with a simple VBA macro like this one:
The actual ViperMonkey commit transformed the source code into this:
As you can see there is a missing
#
in theWrite
call, to fix this I've added these two lines:I also had to modify the
Write
class defined invba_library.py
, the original file had this:But the data are actually stored in the second parameter like the
Put
call:I have tested with the code I've put above and it seems to work fine.
Like the
Put
call they may be more than on input so we might need to mimicPut
class regarding this.