mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-10-03 05:36:16 +08:00
commit
a50b58a50b
|
@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
|
|||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- Added Mifare Desfire Read/Write/Create files/records/values functionality and several fixes to `hf mfdes` (@bkerler)
|
||||
- Added CreateStdFile command to Mifare `hf mfdes` (@bkerler)
|
||||
- Rework des/3des/3k3des/aes auth. Port to mbedtls crypto library on device (@bkerler)
|
||||
- Port 'hf mfdes' Authentification to CommandNG structure, fix auth session key (@bkerler)
|
||||
|
|
|
@ -739,16 +739,6 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain, uint1
|
|||
// RCV: 61 XX => Using KEY B
|
||||
// XX: Block number
|
||||
|
||||
// iceman, u8 can never be larger than 256
|
||||
// if authenticating to a block that shouldn't exist - as long as we are not doing the reader attack
|
||||
if (((flags & FLAG_NR_AR_ATTACK) != FLAG_NR_AR_ATTACK)) {
|
||||
EmSend4bit(mf_crypto1_encrypt4bit(pcs, CARD_NACK_NA));
|
||||
FpgaDisableTracing();
|
||||
|
||||
if (DBGLEVEL >= DBG_EXTENDED) Dbprintf("Reader tried to operate (0x%02x) on out of range block: %d (0x%02x), nacking", receivedCmd_dec[0], receivedCmd_dec[1], receivedCmd_dec[1]);
|
||||
break;
|
||||
}
|
||||
|
||||
authTimer = GetTickCount();
|
||||
|
||||
// received block num -> sector
|
||||
|
|
1286
client/cmdhfmfdes.c
1286
client/cmdhfmfdes.c
File diff suppressed because it is too large
Load diff
|
@ -23,7 +23,8 @@
|
|||
#include <string.h>
|
||||
#include "cmdparser.h"
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
// #include <unistd.h>
|
||||
#include <proxmark3.h>
|
||||
|
||||
//#include "proxgui.h"
|
||||
//extern void SetWindowsPosition (void);
|
||||
|
@ -31,25 +32,27 @@ static int CmdHelp(const char *Cmd);
|
|||
static int setCmdHelp(const char *Cmd);
|
||||
|
||||
// Load all settings into memory (struct)
|
||||
static char* prefGetFilename (void) {
|
||||
/*
|
||||
static char Buffer[FILENAME_MAX+sizeof(preferencesFilename)+2] = {0};
|
||||
char PATH[FILENAME_MAX] = {0};
|
||||
|
||||
getcwd(PATH, sizeof(PATH));
|
||||
#ifdef _WIN32
|
||||
snprintf (Buffer,sizeof(Buffer)-1,"%s\\%s",PATH,preferencesFilename);
|
||||
#include <direct.h>
|
||||
#define GetCurrentDir _getcwd
|
||||
#else
|
||||
snprintf (Buffer,sizeof(Buffer)-1,"%s/%s",PATH,preferencesFilename);
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#define GetCurrentDir getcwd
|
||||
#endif
|
||||
|
||||
return Buffer;
|
||||
*/
|
||||
return preferencesFilename;
|
||||
static char* prefGetFilename (void) {
|
||||
char *Path;
|
||||
|
||||
if (searchHomeFilePath(&Path,preferencesFilename,false) == PM3_SUCCESS)
|
||||
return Path;
|
||||
else
|
||||
return preferencesFilename;
|
||||
}
|
||||
|
||||
int preferences_load (void) {
|
||||
|
||||
PrintAndLogEx(INFO,"Looking for preferences...");
|
||||
|
||||
// Set all defaults
|
||||
session.client_debug_level = OFF;
|
||||
session.window_changed = false;
|
||||
|
@ -554,6 +557,7 @@ static int CmdPrefShow (const char *Cmd) {
|
|||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
PrintAndLogEx(NORMAL," preference file........ "_GREEN_("%s"),prefGetFilename());
|
||||
showEmojiState (prefShowNone);
|
||||
showColorState (prefShowNone);
|
||||
// showPlotPosState ();
|
||||
|
|
|
@ -29,6 +29,14 @@
|
|||
#include "flash.h"
|
||||
#include "preferences.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#define GetCurrentDir _getcwd
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#define GetCurrentDir getcwd
|
||||
#endif
|
||||
|
||||
// Used to enable/disable use of preferences json file
|
||||
// #define USE_PREFERENCE_FILE
|
||||
|
||||
|
@ -391,16 +399,22 @@ static void set_my_executable_path(void) {
|
|||
}
|
||||
|
||||
static const char *my_user_directory = NULL;
|
||||
static char _cwd_Buffer [FILENAME_MAX] = {0};
|
||||
|
||||
const char *get_my_user_directory(void) {
|
||||
return my_user_directory;
|
||||
}
|
||||
|
||||
static void set_my_user_directory(void) {
|
||||
my_user_directory = getenv("HOME");
|
||||
|
||||
// if not found, default to current directory
|
||||
if (my_user_directory == NULL)
|
||||
my_user_directory = ".";
|
||||
if (my_user_directory == NULL) {
|
||||
my_user_directory = GetCurrentDir ( _cwd_Buffer,sizeof( _cwd_Buffer));
|
||||
// change all slashs to / (windows should not care...
|
||||
for (int i = 0; i < strlen(_cwd_Buffer); i++)
|
||||
if (_cwd_Buffer[i] == '\\') _cwd_Buffer[i] = '/';
|
||||
// my_user_directory = ".";
|
||||
}
|
||||
}
|
||||
|
||||
static void show_help(bool showFullHelp, char *exec_name) {
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
[
|
||||
{
|
||||
"AID": "EEEE10",
|
||||
"Vendor": "NFC Forum",
|
||||
"Country": "US",
|
||||
"Name": "NFC Forum NDEF Tag",
|
||||
"Description": "(FID 03: Capability Container)",
|
||||
"Type": "ndef"
|
||||
},
|
||||
{
|
||||
"AID": "D3494F",
|
||||
"Vendor": "HID",
|
||||
"Country": "United States",
|
||||
"Name": "SIO DESFire Ev1",
|
||||
"Description": "",
|
||||
"Type": ""
|
||||
"Type": "pacs"
|
||||
},
|
||||
{
|
||||
"AID": "4F5931",
|
||||
|
@ -13,6 +21,105 @@
|
|||
"Country": "UK",
|
||||
"Name": "Oyster Card",
|
||||
"Description": "",
|
||||
"Type": "transport"
|
||||
},
|
||||
{
|
||||
"AID": "422201",
|
||||
"Vendor": "Transport of Istanbul",
|
||||
"Country": "Turkey",
|
||||
"Name": "Istanbulkart",
|
||||
"Description": "",
|
||||
"Type": "transport"
|
||||
},
|
||||
{
|
||||
"AID": "F21190",
|
||||
"Vendor": "Metropolitan Transportation Commission",
|
||||
"Country": "US",
|
||||
"Name": "Clipper Card",
|
||||
"Description": "",
|
||||
"Type": "transport"
|
||||
},
|
||||
{
|
||||
"AID": "000357",
|
||||
"Vendor": "LEGIC",
|
||||
"Country": "DE",
|
||||
"Name": "Legic",
|
||||
"Description": "(FID 02: EF-CONF)",
|
||||
"Type": ""
|
||||
},
|
||||
{
|
||||
"AID": "578000",
|
||||
"Vendor": "NORTIC",
|
||||
"Country": "",
|
||||
"Name": "NORTIC Card Issuer",
|
||||
"Description": "(FID 0C: Card Issuer Header)",
|
||||
"Type": "transport"
|
||||
},
|
||||
{
|
||||
"AID": "578001",
|
||||
"Vendor": "NORTIC",
|
||||
"Country": "",
|
||||
"Name": "NORTIC Transport",
|
||||
"Description": "(FIDs 01: Transport Product Retailer; 02: Transport Service Provider; 03: Transport Special Event; 04: Transport Stored Value; 05: Transport General Event Log; 06: Transport SV Reload Log; 0A: Transport Environment; 0C: Transport Card Holder",
|
||||
"Type": "transport"
|
||||
},
|
||||
{
|
||||
"AID": "784000",
|
||||
"Vendor": "NO1",
|
||||
"Country": "UAE",
|
||||
"Name": "Nol Card/Dubai",
|
||||
"Description": "Nol Card/Dubai",
|
||||
"Type": ""
|
||||
},
|
||||
]
|
||||
{
|
||||
"AID": "956B19",
|
||||
"Vendor": "PING PING",
|
||||
"Country": "",
|
||||
"Name": "PingPing Tag",
|
||||
"Description": "PingPing Tag",
|
||||
"Type": ""
|
||||
},
|
||||
{
|
||||
"AID": "DB9800",
|
||||
"Vendor": "PING PING",
|
||||
"Country": "",
|
||||
"Name": "PingPing Tag",
|
||||
"Description": "PingPing Tag",
|
||||
"Type": ""
|
||||
},
|
||||
{
|
||||
"AID": "DB9801",
|
||||
"Vendor": "PING PING",
|
||||
"Country": "",
|
||||
"Name": "PingPing Tag",
|
||||
"Description": "PingPing Tag",
|
||||
"Type": ""
|
||||
},
|
||||
{
|
||||
"AID": "DB9802",
|
||||
"Vendor": "PING PING",
|
||||
"Country": "",
|
||||
"Name": "PingPing Tag",
|
||||
"Description": "PingPing Tag",
|
||||
"Type": ""
|
||||
},
|
||||
{
|
||||
"AID": "F21030",
|
||||
"Vendor": "ORCA Card",
|
||||
"Country": "",
|
||||
"Name": "ORCA Card",
|
||||
"Description": "(FIDs 02: Trip History; 04: current balance)",
|
||||
"Type": "transport"
|
||||
},
|
||||
{
|
||||
"AID": "F21190",
|
||||
"Vendor": "Clipper",
|
||||
"Country": "US",
|
||||
"Name": "Clipper Card/San Francisco Bay Area ",
|
||||
"Description": "(FIDs 02: current balance; 04: Refill History; 08: Card Information; 0E: Trip History)
|
||||
FFFFFF General Issuer Information (FIDs 00: MAD Version; 01: Card Holder; 02: Card Publisher)",
|
||||
"Type": "transport"
|
||||
},
|
||||
|
||||
|
||||
]
|
||||
|
|
|
@ -154,20 +154,28 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
|||
}
|
||||
*/
|
||||
|
||||
#elif defined(__linux__)
|
||||
#elif defined(__linux__) || defined(__CYGWIN__) || defined(__sun) || defined(WAI_USE_PROC_SELF_EXE)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined(__linux__)
|
||||
#include <linux/limits.h>
|
||||
#else
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
|
||||
#if !defined(WAI_PROC_SELF_EXE)
|
||||
#if defined(__sun)
|
||||
#define WAI_PROC_SELF_EXE "/proc/self/path/a.out"
|
||||
#else
|
||||
#define WAI_PROC_SELF_EXE "/proc/self/exe"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getExecutablePath)(char *out, int capacity, int *dirname_length) {
|
||||
|
@ -207,8 +215,12 @@ int WAI_PREFIX(getExecutablePath)(char *out, int capacity, int *dirname_length)
|
|||
#endif
|
||||
|
||||
#if !defined(WAI_PROC_SELF_MAPS)
|
||||
#if defined(__sun)
|
||||
#define WAI_PROC_SELF_MAPS "/proc/self/map"
|
||||
#else
|
||||
#define WAI_PROC_SELF_MAPS "/proc/self/maps"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__) || defined(ANDROID)
|
||||
#include <fcntl.h>
|
||||
|
@ -260,7 +272,7 @@ int WAI_PREFIX(getModulePath)(char *out, int capacity, int *dirname_length) {
|
|||
char *begin;
|
||||
char *p;
|
||||
|
||||
begin = (char *)mmap(0, offset, PROT_READ, MAP_SHARED, fd, 0);
|
||||
begin = (char*)mmap(0, offset + sizeof(p), PROT_READ, MAP_SHARED, fd, 0);
|
||||
p = begin + offset;
|
||||
|
||||
while (p >= begin) { // scan backwards
|
||||
|
@ -276,7 +288,7 @@ int WAI_PREFIX(getModulePath)(char *out, int capacity, int *dirname_length) {
|
|||
break;
|
||||
}
|
||||
|
||||
p -= 4;
|
||||
--p;
|
||||
}
|
||||
|
||||
munmap(begin, offset);
|
||||
|
@ -302,11 +314,15 @@ int WAI_PREFIX(getModulePath)(char *out, int capacity, int *dirname_length) {
|
|||
}
|
||||
|
||||
fclose(maps);
|
||||
maps = NULL;
|
||||
|
||||
if (length != -1)
|
||||
break;
|
||||
}
|
||||
|
||||
if (maps)
|
||||
fclose(maps);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue