3gstudent / msbuild-inline-task

184 stars 83 forks source link

Can you please describe how you create the compressed exe? #1

Closed malicious-user closed 3 years ago

malicious-user commented 6 years ago

The question is regarding the" executes mimikatz.xml" template. I first base64 the executable I want to load, as follows.

"$fileName = "executable" $fileContent = get-content $fileName $fileContentBytes = [System.Text.Encoding]::UTF8.GetBytes($fileContent) $fileContentEncoded = [System.Convert]::ToBase64String($fileContentBytes) $fileContentEncoded | set-content ($fileName + ".b64")"

Then, I understand that I should gzip compress the base64 string above. (Am I correct?)

Finally, I copy paste the gzip compressed string but I always get " error MSB4018: System.IO.EndOfStreamException: Unable to read beyond the end of the stream.\r"

Can you please describe how you create the compressed exe?

3gstudent commented 6 years ago

@malicious-user

To read the binary file,you should use this:

[System.IO.File]::ReadAllBytes('$fileName')

not get-content $fileName

eliranc22 commented 4 years ago

Hi, can you please explain how I should use the gzip compressed after i get the base64 string?

3gstudent commented 4 years ago

https://github.com/3gstudent/Homework-of-C-Sharp/blob/master/GzipandBase64.cs