AntiGuide: PetitsDebrouillards



PagePrincipale :: DerniersChangements :: ParametresUtilisateur :: Vous êtes 216.73.216.115 :: Signaler un abus :: le: 20250620 12:32:54
très mal nommée, e,n souvenir d'une prelmière solution;
en fait limite à clé usb clavier auto!

une variante de BadUsb

recup: https://www.youtube.com/watch?v=a3NxQ60E72k

beaucoup de soluce pour 32U4, voir si possible sur Digispark (qui n'a pas d'usb natif)
contact: JF29

googler BadUsb ou clavier virtuel

https://www.youtube.com/watch?v=BOxPnW_ehzQ

utilise un keyboard.h
https://www.arduino.cc/reference/en/language/functions/usb/keyboard/

avec un digispark:
https://www.calypt.com/blog/index.php/red-team-recuperer-des-identifiants-windows-avec-un-digispark/ ArduinoDigiSparkKeyboard

script python tranfort entre en clavier
https://www.geekncomics.com/emuler-un-clavier-avec-nimporte-quel-arduino/

usb sur arduino:
https://code.google.com/p/vusb-for-arduino/

"définitif":
https://dyrk.org/2015/10/27/utiliser-votre-arduino-uno-pour-simuler-des-touches-clavier/

un autre: https://blog.jeronimus.net/2019/08/

https://forum.arduino.cc/t/mauvaises-touches-avec-un-digispark/592444

4€: https://www.cdiscount.com/informatique/cartes-meres/clavier-virtuel-badusb-usb-tf-memory-keyboard-atme/f-10765-auc6458516121490.html
commandé le 20210424

https://github.com/digistump/DigisparkArduinoIntegration/blob/master/libraries/DigisparkKeyboard/DigiKeyboard.h
https://github.com/digistump/DigisparkArduinoIntegration/blob/master/libraries/DigisparkKeyboard/DigiKeyboard.h

https://github.com/digistump/DigistumpArduino

20210427 en cours sur acer w7 V 1.6.xx

https://www.arduino.cc/en/Tutorial/BuiltInExamples/KeyboardMessage#hardware-required
dit manque Keyboard.h
faut type leonardo pour compiler, mais à ce moment là ne se charge plus! (mais sans erreur!), pas mieux en 1.8.....
finalement ça roule*scan-codes: D:\Users\adminpo\Desktop\ARDUINO\arduino-1.8.14\arduino-nightly\libraries\Keyboard\src
à rapporcher de: https://www.gladir.com/LEXIQUE/PORTS/scancode.htm

/*
  Keyboard Message test

  For the Arduino Leonardo and Micro.

  Sends a text string when a button is pressed.

  The circuit:
  - pushbutton attached from pin 4 to +5V
  - 10 kilohm resistor attached from pin 4 to ground

  created 24 Oct 2011
  modified 27 Mar 2012
  by Tom Igoe
  modified 11 Nov 2013
  by Scott Fitzgerald

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/KeyboardMessage
*/

#include <Keyboard.h>

const int buttonPin = 4;          // input pin for pushbutton
int previousButtonState = HIGH;   // for checking the state of a pushButton
int counter = 0;                  // button push counter

void setup() {
  // make the pushButton pin an input:
  pinMode(buttonPin, INPUT);
  // initialize control over the keyboard:
  Keyboard.begin();
}

void loop() {
  /*
  // read the pushbutton:
  int buttonState = digitalRead(buttonPin);
  // if the button state has changed,
  if ((buttonState != previousButtonState)
      // and it's currently pressed:
      && (buttonState == HIGH)) {
    // increment the button counter
    counter++;
    // type out a message
    Keyboard.print("You pressed the button ");
    Keyboard.print(counter);
    Keyboard.println(" times.");
  }
  // save the current button state for comparison next time:
  previousButtonState = buttonState;
  */
  delay(2000);
      Keyboard.print("You pressed the button ");
 
}


aperçu (mais pas compris):
https://forum.arduino.cc/t/turning-mega-2560-board-into-a-keyboard/279718/8
https://github.com/BlitzCityDIY/arduinoMacroKeyboard (sans doute flasher la carte)

dit pour Mega2560?
https://blog.realhe.ro/how-to-turn-arduino-mega-2560-into-simple-keyboard/
aucune include
se compile et charge mais pas observé fonctionnement
pas bien compris, semble nécessiter de flasher le nono pour qu'il apparaisse comme un clavier
preuve: par une fenetre de commande: cmd < com5

/** 
* Arduino USB HID Keyboard Demo
* Keys 1, 2, 3 and 4 on pins 4, 5, 6 and 7
* 
* @info check details on my website
* @link http://blog.realhe.ro
*/
uint8_t buf[8] = {
0 }; /* Keyboard report buffer */

#define KEY_ONE     0x1E
#define KEY_TWO     0x1F
#define KEY_THREE   0x20
#define KEY_FOUR    0x21

#define PIN_ONE     4
#define PIN_TWO     5
#define PIN_THREE   6
#define PIN_FOUR    7

int state = 1;

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
  randomSeed(analogRead(0));
  delay(200);

  pinMode(PIN_ONE, INPUT);
  pinMode(PIN_TWO, INPUT);
  pinMode(PIN_THREE, INPUT);
  pinMode(PIN_FOUR, INPUT);

  digitalWrite(PIN_ONE, 1);
  digitalWrite(PIN_TWO, 1);
  digitalWrite(PIN_THREE, 1);
  digitalWrite(PIN_FOUR, 1);
}

void loop()
{
  delay(100);
  digitalWrite (LED_BUILTIN, 0);
  delay(100);
  digitalWrite (LED_BUILTIN, 1);
  
  state = digitalRead(PIN_ONE);
  if (state != 1) {
    buf[0] = 0;
    buf[2] = KEY_ONE;
    Serial.write(buf, 8);
    releaseKey();
    delay(200);
  }

  state = digitalRead(PIN_TWO);
  if (state != 1) {
    buf[0] = 0;
    buf[2] = KEY_TWO;
    Serial.write(buf, 8);
    releaseKey();
    delay(200);
  }


  state = digitalRead(PIN_THREE);
  state=0;
  if (state != 1) {
    buf[0] = 0;
    buf[2] = KEY_THREE;
    Serial.write(buf, 8);
    releaseKey();
    delay(200);
  }

  state = digitalRead(PIN_FOUR);
  if (state != 1) {
    buf[0] = 0;
    buf[2] = KEY_FOUR;
    Serial.write(buf, 8);
    releaseKey();
    delay(200);
  }

}

void releaseKey()
{
  buf[0] = 0;
  buf[2] = 0;
  Serial.write(buf, 8); // Release key
}