-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Decode VBE #183
Added Decode VBE #183
Conversation
src/core/operations/VBE.js
Outdated
runDecodeVBE: function (data, args) { | ||
let matcher = /#@~\^......==(.+)......==\^#~@/; | ||
let encodedData = matcher.exec(data); | ||
console.log(encodedData[1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this logging call intended to be part of the PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, my bad. Added it to find a looping issue. I took it out.
I was just looking at the issues. I guess this would solve #165. Maybe it should be renamed Microsoft Script decoder. |
Oh, it works for both does it?
…On Mon, 28 Aug 2017 16:11 bwhitn ***@***.***> wrote:
I was just looking at the issues. I guess this would solve #165
<#165>. Maybe it should be
renamed Microsoft Script decoder.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#183 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACAWfuTNwrioag1kjGh9TOi7G7DkZ_cJks5sctiHgaJpZM4PDzX4>
.
|
Yea, it should. Haven't seen anything saying different. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much, this looks great. There are a few things to tidy up then we can get it merged.
src/core/operations/MS.js
Outdated
data = data.replace(/@#/g, String.fromCharCode(13)); | ||
data = data.replace(/@\*/g, ">"); | ||
data = data.replace(/@!/g, "<"); | ||
data = data.replace(/@\$/g, "@"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These .replace
calls should be chained i.e.
data = data
.replace(...)
.replace(...)
.replace(...);
src/core/operations/MS.js
Outdated
* @param {string} data | ||
* @returns {string} | ||
*/ | ||
decode: function (data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Private functions should start with an underscore.
src/core/operations/MS.js
Outdated
|
||
/** | ||
* @param {string} data | ||
* @returns {string} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add @private
tag.
return result.join(""); | ||
}, | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add 'Microsoft Script Decoder operation.' to this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/core/config/OperationConfig.js
Outdated
@@ -3204,6 +3205,13 @@ const OperationConfig = { | |||
} | |||
] | |||
}, | |||
"Micrsoft Script Decoder": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo - missing 'o' in 'Microsoft'.
src/core/config/OperationConfig.js
Outdated
@@ -3204,6 +3205,13 @@ const OperationConfig = { | |||
} | |||
] | |||
}, | |||
"Micrsoft Script Decoder": { | |||
description: "Decodes Microsoft Encoded Script files that have been encoded with Microsoft's custom encoding.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a bit more detail here to describe what kind of script files this works on (Jscript.Encode, VBE etc.)? This is important as users may search for these terms and this operation should be listed for them. It might also be worth including an example in <code>
tags. The one in your test could be suitable.
src/core/operations/MS.js
Outdated
* @returns {string} | ||
*/ | ||
runDecodeScript: function (input, args) { | ||
let matcher = /#@~\^......==(.+)......==\^#~@/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dots in this regex can be collapsed using range notation e.g. #@~\^.{6}==(.+).{6}==\^#~@
. This seems a little easier to read to me.
}, | ||
], | ||
}, | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test to confirm that this works for JScript.Encode as well as VBE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the VBS script from https://gallery.technet.microsoft.com/scriptcenter/16439c02-3296-4ec8-9134-6eb6fb599880 I was able check both JS and VBS and noticed that they produce the same file output given the same file input even when you specify a different script type in the EncodeScriptFile function. I did create a more complex test though.
test/tests/operations/MS.js
Outdated
@@ -0,0 +1,22 @@ | |||
/** | |||
* CharEnc tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this to 'MS tests."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/tests/operations/MS.js
Outdated
/** | ||
* CharEnc tests. | ||
* | ||
* @author tlwr [toby@toby.codes] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to your author tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
[FEATURE] Better Loading UX
This will allow the decoding of Microsoft VBE files. Wasn't sure where to put this so I put it in "Data Format".