utf 8 - Need help in writing EICAR content in a utf8 file using PowerShell -
basically have file in windows machine of utf8 code. similar path directory , file "g:\这是一\个令人沮". , trying write eicar string (x5o!p%@ap[4\pzx54(p^)7cc)7}$eicar-standard-antivirus-test-file!$h+h*
) file using powershell.
for regular file path being done following:
#base64 of eicar string [string] $encodedeicar = 'wdvpivalqefqwzrcufpyntqouf4pn0ndktd9jevjq0fslvnuqu5eqvjelufovelwsvjvuy1urvnuluzjteuhjegrsco=' if (!(test-path -path $filepath)) { try { [byte[]] $eicarbytes = [system.convert]::frombase64string($encodedeicar) [string] $eicar = [system.text.encoding]::utf8.getstring($eicarbytes) set-content -value $eicar -encoding ascii -path $filepath -force }
tried following suggestions didnt :(
executed powershell.exe "& {import-module c:\progra~1\windowspowershell\modules\new_eicar.psm1 -force -disablenamechecking ;new-eicar -path 'n:\这是一\个令人沮' -filename 'eicar.com'; if ($?) {exit 0} else {exit 1}}". result: {'status': 1, 'stderr': '', 'stdout': 'new-eicar : cannot validate argument on parameter \'path\'. "test-path $_ \r\n-pathtype \'container\'" validation script argument value \r\n"n:\\\x8a\xa8t\x91~_\x84,?\\\x84,\xa6\x84\xaf\x0f\x84\xa7\xa7\x91\xfdr" did not return result of true. determine why \r\nvalidation script failed, , try command again.\r\nat line:1 char:116\r\n+ ... ew-eicar -path \'n:\\\x8a\xa8t\x91~_\x84,?\\\x84,\xa6\x84\xaf\x0f\x84\xa7\xa7\x91\xfdr\' -filename \'eicar.com\'; if \r\n($?) {exit ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + categoryinfo : invaliddata: (:) [new-eicar], parameterbindingva \r\n lidationexception\r\n + fullyqualifiederrorid : parameterargumentvalidationerror,new-eicar\r\n \r\n'} 2017-08-30 23:31:12 debug ssh.py:228 (tb) 10.5.22.4>> 'powershell.exe "& {import-module c:\progra~1\windowspowershell\modules\new_eicar.psm1 -force -disablenamechecking ;new-eicar -path 'n:\这是一\个令人沮' -filename 'eicar.com'; if ($?) {exit 0} else {exit 1}}"', timeout: 300 2017-08-30 23:31:13 debug ssh.py:306 (tb) 10.5.22.4<< '{ status: 1, stderr: , stdout: new-eicar : cannot validate argument on parameter 'path'. "test-path $_ -pathtype 'container'" validation script argument value "n:\t~_,?\,r" did not return result of true. determine why validation script failed, , try command again. @ line:1 char:116 + ... ew-eicar -path 'n:\t~_,?\,r' -filename 'eicar.com'; if ($?) {exit ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invaliddata: (:) [new-eicar], parameterbindingva lidationexception + fullyqualifiederrorid : parameterargumentvalidationerror,new-eicar }'
Comments
Post a Comment