Hardcore "do it yourself" - the entrance to the operating system for NFC-map
Do It Yourself / / December 19, 2019
Until now, users of popular desktop operating systems did not have any other possibility in the OS entry, except the password. Enough tolerating this! It's time to pick up a soldering iron and do the authentication procedure is comparable in simplicity with stroking her cat.
Today in the category DIY, we will share peeped at Instructables way to enter a password to login to the OS using NFC-card.
Step 1: Details
We need:
- Arduino Leonardo
- Adafriut NFC Shield
- NFC card (comes complete with Adafriut NFC Shield)
- a small piece of wire
- a sharp knife
- solder
- tool for cutting and stripping wires
- a computer
- micro-USB cable
Step 2: iron
The procedure for creating a hardware module is very simple.
The only modification required for operation of the device is to break the connection between pin and pin IRQ 2. For this handy knife.
Then you need to connect the IRQ and 6 pins with a jumper wire.
Check the absence / presence of a contact, you can use a multimeter, and for a clearer understanding of the build process and Leonardo NFC-module offer here this short video. Everything is shown step by step and very clearly:
Step 3: Software
Below is the code that must be filled in Arduino. Before starting the download you need to make sure that the Adafruit NFC library. Read more about it here.
#include
#include
#define IRQ 6 // this trace must be cut and rewired!
#define RESET 8
Adafruit_NFCShield_I2C nfc (IRQ, RESET);
//////////////////////////////////// SETUP
void setup () {
// set up Serial library at 9600 bps
Serial.begin (9600);
// find Adafruit RFID / NFC shield
nfc.begin ();
uint32_t versiondata = nfc.getFirmwareVersion ();
if (! versiondata) {
Serial.print ( «Did not find PN53x board»);
while (1); // halt
}
// Got ok data, print it out!
Serial.print ( «Found chip PN5»); Serial.println ((versiondata >> 24) & 0xFF, HEX);
Serial.print ( «Firmware ver. «); Serial.print ((versiondata >> 16) & 0xFF, DEC);
Serial.print ( '.'); Serial.println ((versiondata >> 8) & 0xFF, DEC);
// configure board to read RFID tags
nfc. SAMConfig ();
Keyboard.begin (); // initiate the Keyboard
}
/////////////////////////////////// LOOP
unsigned digit = 0;
void loop () {
uint8_t success;
uint8_t uid [] = {0, 0, 0, 0, 0, 0, 0}; // Buffer to store the returned UID
uint8_t uidLength; // Length of the UID (4 or 7 bytes depending on ISO14443A card type)
// wait for RFID card to show up!
Serial.println ( «Waiting for an ISO14443A Card ...»);
// Wait for an ISO14443A type cards (Mifare, etc.). When one is found
// 'uid' will be populated with the UID, and uidLength will indicate
// if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
success = nfc.readPassiveTargetID (PN532_MIFARE_ISO14443A, uid, & uidLength);
uint32_t cardidentifier = 0;
if (success) {
// Found a card!
Serial.print ( «Card detected #»);
// turn the four byte UID of a mifare classic into a single variable #
cardidentifier = uid [3];
cardidentifier << = 8; cardidentifier | = uid [2];
cardidentifier << = 8; cardidentifier | = uid [1];
cardidentifier << = 8; cardidentifier | = uid [0];
Serial.println (cardidentifier);
if (cardidentifier == 606,061,173) {
Keyboard.write ( 'm');
Keyboard.write ( 'y');
Keyboard.write ( 'p');
Keyboard.write ( 'a');
Keyboard.write ( 's');
Keyboard.write ( 's');
Keyboard.write ( 'w');
Keyboard.write ( 'o');
Keyboard.write ( 'r');
Keyboard.write ( 'd');
delay (5000); // makes sure the password is not repeated
}
}
}
Once the code is loaded, open the serial monitor set to 9600 baud. A second tray NFC-card to the reader and remove. The monitor should display a message «Card detected #card number». Replace «cardidentifier ==» received number of the current card number in line.
Now change the section of code that is responsible for the password. As you can see, the default password is a combination of «mypassword». Replace it to our current password entry into the operating system (the number of characters of the password is changed by simply adding / out lines with «Keyboard.write team).
Restarting the final code in the Arduino, and now, just as soon as we bring this card to the NFC-reader, the password will be immediately entered in the input field. Hit Enter and rejoice.
In comments to the project found a man who offered to complement the series of command input password final Keyboard.write (KEY_RETURN); to eliminate the need to press Enter, but this decision has not been verified.