make style

This commit is contained in:
Philippe Teuwen 2022-01-23 20:02:57 +01:00
commit 140a7f34a4
9 changed files with 53 additions and 50 deletions

View file

@ -1128,7 +1128,7 @@ bool SimulateIso14443aInit(uint8_t tagType, uint16_t flags, uint8_t *data, tag_r
}
// if uid not supplied then get from emulator memory
if ( (memcmp(data, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 10) == 0) || ((flags & FLAG_UID_IN_EMUL) == FLAG_UID_IN_EMUL)) {
if ((memcmp(data, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 10) == 0) || ((flags & FLAG_UID_IN_EMUL) == FLAG_UID_IN_EMUL)) {
if (tagType == 2 || tagType == 7) {
uint16_t start = MFU_DUMP_PREFIX_LENGTH;
uint8_t emdata[8];

View file

@ -832,7 +832,7 @@ void annotateIso7816(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
void annotateMfDesfire(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
// it's basically a ISO14443a tag, so try annotation from there
if (applyIso14443a(exp, size, cmd, cmdsize, false) != PM3_SUCCESS ) {
if (applyIso14443a(exp, size, cmd, cmdsize, false) != PM3_SUCCESS) {
// S-block 11xxx010
if ((cmd[0] & 0xC0) && (cmdsize == 3)) {

View file

@ -529,7 +529,7 @@ static int ndefDecodeMime_vcard(NDEFHeader_t *ndef) {
PrintAndLogEx(INFO, "");
PrintAndLogEx(INFO, "%.*s", (int)ndef->PayloadLen, ndef->Payload);
char *s = strstr((char*)ndef->Payload, "PHOTO");
char *s = strstr((char *)ndef->Payload, "PHOTO");
if (s) {
s = strtok(s, ";");
while (s) {

View file

@ -32,7 +32,7 @@
#if defined(HAVE_READLINE)
static char* rl_command_generator(const char *text, int state) {
static char *rl_command_generator(const char *text, int state) {
static int index;
static size_t len;
size_t rlen = strlen(rl_line_buffer);
@ -48,14 +48,14 @@ static char* rl_command_generator(const char *text, int state) {
// When no pm3 device present
// and the command is not available offline,
// we skip it.
if ((g_session.pm3_present == false) && (vocabulory[index].offline == false )) {
if ((g_session.pm3_present == false) && (vocabulory[index].offline == false)) {
index++;
continue;
}
index++;
if (strncmp (command, rl_line_buffer, rlen) == 0) {
if (strncmp(command, rl_line_buffer, rlen) == 0) {
const char *next = command + (rlen - len);
const char *space = strstr(next, " ");
if (space != NULL) {
@ -70,7 +70,7 @@ static char* rl_command_generator(const char *text, int state) {
static char **rl_command_completion(const char *text, int start, int end) {
rl_attempted_completion_over = 0;
return rl_completion_matches (text, rl_command_generator);
return rl_completion_matches(text, rl_command_generator);
}
#endif // HAVE_READLINE
@ -94,7 +94,7 @@ static void sigint_handler(int signum) {
}
#endif
void pm3line_install_signals(void){
void pm3line_install_signals(void) {
# if defined(_WIN32)
// SetConsoleCtrlHandler((PHANDLER_ROUTINE)terminate_handler, true);
# else

View file

@ -21,7 +21,7 @@
void pm3line_init(void);
void pm3line_install_signals(void);
char *pm3line_read(const char* s);
char *pm3line_read(const char *s);
void pm3line_free(void *ref);
void pm3line_update_prompt(const char *prompt);
int pm3line_load_history(const char *path);

View file

@ -165,10 +165,10 @@ uint32_t ul_ev1_pwdgenE(const uint8_t *uid) {
uint8_t hash[20];
mbedtls_sha1(uid, 7, hash);
uint32_t pwd = 0;
pwd |= ( hash[ hash[0] % 20 ] ) << 24 ;
pwd |= ( hash[ (hash[0] + 5 ) % 20 ] ) << 16;
pwd |= ( hash[ (hash[0] + 13) % 20 ] ) << 8;
pwd |= ( hash[ (hash[0] + 17) % 20 ] );
pwd |= (hash[ hash[0] % 20 ]) << 24 ;
pwd |= (hash[(hash[0] + 5) % 20 ]) << 16;
pwd |= (hash[(hash[0] + 13) % 20 ]) << 8;
pwd |= (hash[(hash[0] + 17) % 20 ]);
return pwd;
}
@ -205,7 +205,7 @@ uint16_t ul_ev1_packgenD(const uint8_t *uid) {
uint16_t ul_ev1_packgenE(const uint8_t *uid) {
uint32_t pwd = ul_ev1_pwdgenE(uid);
return (0xAD << 8 | ((pwd >> 24) & 0xFF) );
return (0xAD << 8 | ((pwd >> 24) & 0xFF));
}

View file

@ -4339,9 +4339,9 @@
"0..3: number of keys stored within the application (max. 14 keys)",
"4: ks3 is present",
"5: use of 2 byte iso fid, 0: no, 1: yes",
"6..7: crypto method 00: des/2tdea, 01: 3tdea, 10: aes, 11: rfu",
"6..7: crypto method 00: des|2tdea, 01: 3tdea, 10: aes, 11: rfu",
"example:",
"2e = with fid, des/2tdea, 14 keys",
"2e = with fid, des|2tdea, 14 keys",
"6e = with fid, 3tdea, 14 keys",
"ae = with fid, aes, 14 keys",
"",
@ -4354,25 +4354,25 @@
"-h, --help this help",
"-a, --apdu show apdu requests and responses",
"-v, --verbose show technical data",
"-n, --keyno <keyno> key number",
"-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes",
"-k, --key <key> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)",
"-f, --kdf <none/an10922/gallagher> key derivation function (kdf): none, an10922, gallagher",
"-n, --keyno <dec> key number",
"-t, --algo <des|2tdea|3tdea|aes> crypt algo: des, 2tdea, 3tdea, aes",
"-k, --key <hex> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)",
"-f, --kdf <none|an10922|gallagher> key derivation function (kdf): none, an10922, gallagher",
"-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)",
"-m, --cmode <plain/mac/encrypt> communicaton mode: plain/mac/encrypt",
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso",
"-s, --schann <d40/ev1/ev2/lrp> secure channel: d40/ev1/ev2/lrp",
"--rawdata <rawdata hex> rawdata that sends to command",
"--aid <app id hex> application id for create. mandatory. (3 hex bytes, big endian)",
"--fid <file id hex> iso file id. forbidden values: 0000 3f00, 3fff, ffff. (2 hex bytes, big endian). if specified - enable iso file id over all the files in the app.",
"--dfname <df name str> iso df name 1..16 chars string",
"--ks1 <key settings hex> key settings 1 (hex 1 byte). application master key settings. default 0x0f",
"--ks2 <key settings hex> key settings 2 (hex 1 byte). default 0x0e",
"--dstalgo <des/2tdea/3tdea/aes> application key crypt algo: des, 2tdea, 3tdea, aes. default des",
"--numkeys <number of keys> keys count. 0x00..0x0e. default 0x0e",
"-m, --cmode <plain|mac|encrypt> communicaton mode: plain/mac/encrypt",
"-c, --ccset <native|niso|iso> communicaton command set: native/niso/iso",
"-s, --schann <d40|ev1|ev2|lrp> secure channel: d40/ev1/ev2/lrp",
"--rawdata <hex> raw data that sends to command",
"--aid <hex> application id for create. mandatory. (3 hex bytes, big endian)",
"--fid <hex> iso file id. forbidden values: 0000 3f00, 3fff, ffff. (2 hex bytes, big endian). if specified - enable iso file id over all the files in the app.",
"--dfname <string> iso df name 1..16 chars string",
"--ks1 <hex> key settings 1 (hex 1 byte). application master key settings. default 0x0f",
"--ks2 <hex> key settings 2 (hex 1 byte). default 0x0e",
"--dstalgo <des|2tdea|3tdea|aes> application key crypt algo: des, 2tdea, 3tdea, aes. default des",
"--numkeys <dec> number of keys 0x00..0x0e. default 0x0e",
"--no-auth execute without authentication"
],
"usage": "hf mfdes createapp [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2/lrp>] [--rawdata <rawdata hex>] [--aid <app id hex>] [--fid <file id hex>] [--dfname <df name str>] [--ks1 <key settings hex>] [--ks2 <key settings hex>] [--dstalgo <des/2tdea/3tdea/aes>] [--numkeys <number of keys>] [--no-auth]"
"usage": "hf mfdes createapp [-hav] [-n <dec>] [-t <des|2tdea|3tdea|aes>] [-k <hex>] [-f <none|an10922|gallagher>] [-i <kdfi>] [-m <plain|mac|encrypt>] [-c <native|niso|iso>] [-s <d40|ev1|ev2|lrp>] [--rawdata <hex>] [--aid <hex>] [--fid <hex>] [--dfname <string>] [--ks1 <hex>] [--ks2 <hex>] [--dstalgo <des|2tdea|3tdea|aes>] [--numkeys <dec>] [--no-auth]"
},
"hf mfdes createfile": {
"command": "hf mfdes createfile",
@ -9983,22 +9983,25 @@
"description": "help this help list list protocol data in trace buffer load load trace from file save save trace buffer to file --------------------------------------------------------------------------------------- trace list available offline: yes annotate trace buffer with selected protocol data you can load a trace from file (see `trace load -h`) or it be downloaded from device by default",
"notes": [
"trace list -t raw -> just show raw data without annotations",
"",
"trace list -t 14a -> interpret as iso14443-a",
"trace list -t thinfilm -> interpret as thinfilm",
"trace list -t topaz -> interpret as topaz",
"trace list -t mf -> interpret as mifare classic and decrypt crypto1 stream",
"trace list -t des -> interpret as mifare desfire",
"trace list -t 14b -> interpret as iso14443-b",
"trace list -t 7816 -> interpret as iso7816-4",
"trace list -t 15 -> interpret as iso15693",
"trace list -t iclass -> interpret as iclass",
"trace list -t legic -> interpret as legic",
"trace list -t 7816 -> interpret as iso7816-4",
"trace list -t cryptorf -> interpret as cryptorf",
"",
"trace list -t des -> interpret as mifare desfire",
"trace list -t felica -> interpret as iso18092 / felica",
"trace list -t hitag1 -> interpret as hitag1",
"trace list -t hitag2 -> interpret as hitag2",
"trace list -t hitags -> interpret as hitags",
"trace list -t iclass -> interpret as iclass",
"trace list -t legic -> interpret as legic",
"trace list -t lto -> interpret as lto-cm",
"trace list -t cryptorf -> interpret as cryptorf",
"trace list -t mf -> interpret as mifare classic and decrypt crypto1 stream",
"trace list -t seos -> interpret as seos",
"trace list -t thinfilm -> interpret as thinfilm",
"trace list -t topaz -> interpret as topaz",
"",
"trace list -t mf --dict <mfc_default_keys> -> use dictionary keys file",
"trace list -t 14a -f -> show frame delay times",
@ -10205,6 +10208,6 @@
"metadata": {
"commands_extracted": 598,
"extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2022-01-17T10:37:00"
"extracted_on": "2022-01-23T19:02:27"
}
}