mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
cppcheck: a few static & const stuff
This commit is contained in:
parent
f90d11912c
commit
e42932738e
10 changed files with 27 additions and 99 deletions
|
@ -106,13 +106,11 @@ END_MODE_LIST
|
||||||
* End mode list *
|
* End mode list *
|
||||||
*******************/
|
*******************/
|
||||||
|
|
||||||
void update_mode(int selected);
|
|
||||||
|
|
||||||
void ModInfo(void) {
|
void ModInfo(void) {
|
||||||
DbpString(" Multi standalone loader aka dankarmulti (Daniel Karling)");
|
DbpString(" Multi standalone loader aka dankarmulti (Daniel Karling)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_mode(int selected) {
|
static void update_mode(int selected) {
|
||||||
if (selected >= NUM_MODES) {
|
if (selected >= NUM_MODES) {
|
||||||
SpinDown(100);
|
SpinDown(100);
|
||||||
Dbprintf("Invalid mode selected");
|
Dbprintf("Invalid mode selected");
|
||||||
|
|
|
@ -67,38 +67,32 @@ typedef struct {
|
||||||
uint8_t sak;
|
uint8_t sak;
|
||||||
} PACKED card_clone_t;
|
} PACKED card_clone_t;
|
||||||
|
|
||||||
int get_block_count(iso14a_card_select_t card, uint8_t *version, uint16_t version_len);
|
static uint16_t get_ev1_version(iso14a_card_select_t card, uint8_t *version, uint16_t version_len) {
|
||||||
uint16_t get_ev1_version(iso14a_card_select_t card, uint8_t *version, uint16_t version_len);
|
|
||||||
uint16_t get_ev1_signature(iso14a_card_select_t card, uint8_t *signature, uint16_t sign_len);
|
|
||||||
uint16_t get_ev1_counter(iso14a_card_select_t card, uint8_t counter, uint8_t *response, uint16_t resp_len);
|
|
||||||
uint16_t get_ev1_tearing(iso14a_card_select_t card, uint8_t counter, uint8_t *response, uint16_t resp_len);
|
|
||||||
|
|
||||||
uint16_t get_ev1_version(iso14a_card_select_t card, uint8_t *version, uint16_t version_len) {
|
|
||||||
return mifare_sendcmd(MIFARE_ULEV1_VERSION, NULL, 0, version, version_len, NULL, NULL);
|
return mifare_sendcmd(MIFARE_ULEV1_VERSION, NULL, 0, version, version_len, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t get_ev1_signature(iso14a_card_select_t card, uint8_t *signature, uint16_t sign_len) {
|
static uint16_t get_ev1_signature(iso14a_card_select_t card, uint8_t *signature, uint16_t sign_len) {
|
||||||
uint8_t cmd[4] = {MIFARE_ULEV1_READSIG, 0x00, 0x00, 0x00};
|
uint8_t cmd[4] = {MIFARE_ULEV1_READSIG, 0x00, 0x00, 0x00};
|
||||||
AddCrc14A(cmd, 2);
|
AddCrc14A(cmd, 2);
|
||||||
ReaderTransmit(cmd, sizeof(cmd), NULL);
|
ReaderTransmit(cmd, sizeof(cmd), NULL);
|
||||||
return ReaderReceive(signature, sign_len, NULL);
|
return ReaderReceive(signature, sign_len, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t get_ev1_counter(iso14a_card_select_t card, uint8_t counter, uint8_t *response, uint16_t resp_len) {
|
static uint16_t get_ev1_counter(iso14a_card_select_t card, uint8_t counter, uint8_t *response, uint16_t resp_len) {
|
||||||
uint8_t cmd[4] = {MIFARE_ULEV1_READ_CNT, counter, 0x00, 0x00};
|
uint8_t cmd[4] = {MIFARE_ULEV1_READ_CNT, counter, 0x00, 0x00};
|
||||||
AddCrc14A(cmd, 2);
|
AddCrc14A(cmd, 2);
|
||||||
ReaderTransmit(cmd, sizeof(cmd), NULL);
|
ReaderTransmit(cmd, sizeof(cmd), NULL);
|
||||||
return ReaderReceive(response, resp_len, NULL);
|
return ReaderReceive(response, resp_len, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t get_ev1_tearing(iso14a_card_select_t card, uint8_t counter, uint8_t *response, uint16_t resp_len) {
|
static uint16_t get_ev1_tearing(iso14a_card_select_t card, uint8_t counter, uint8_t *response, uint16_t resp_len) {
|
||||||
uint8_t cmd[4] = {MIFARE_ULEV1_CHECKTEAR, counter, 0x00, 0x00};
|
uint8_t cmd[4] = {MIFARE_ULEV1_CHECKTEAR, counter, 0x00, 0x00};
|
||||||
AddCrc14A(cmd, 2);
|
AddCrc14A(cmd, 2);
|
||||||
ReaderTransmit(cmd, sizeof(cmd), NULL);
|
ReaderTransmit(cmd, sizeof(cmd), NULL);
|
||||||
return ReaderReceive(response, resp_len, NULL);
|
return ReaderReceive(response, resp_len, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_block_count(iso14a_card_select_t card, uint8_t *version, uint16_t version_len) {
|
static int get_block_count(iso14a_card_select_t card, const uint8_t *version, uint16_t version_len) {
|
||||||
// Default to MAX_DEFAULT_BLOCKS blocks
|
// Default to MAX_DEFAULT_BLOCKS blocks
|
||||||
int block_count = MAX_DEFAULT_BLOCKS;
|
int block_count = MAX_DEFAULT_BLOCKS;
|
||||||
// Most of this code is from cmdhfmfu.c
|
// Most of this code is from cmdhfmfu.c
|
||||||
|
|
|
@ -95,6 +95,11 @@ static iso14a_card_select_t colin_p_card;
|
||||||
static int colin_currline;
|
static int colin_currline;
|
||||||
static int colin_currfline;
|
static int colin_currfline;
|
||||||
static int colin_curlline;
|
static int colin_curlline;
|
||||||
|
static int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, uint8_t keyCount, const uint8_t *datain, uint64_t *key);
|
||||||
|
static int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype);
|
||||||
|
static void saMifareMakeTag(void);
|
||||||
|
static int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, const uint8_t *datain);
|
||||||
|
static void WriteTagToFlash(uint32_t uid, size_t size);
|
||||||
|
|
||||||
// TODO : Implement fast read of KEYS like in RFIdea
|
// TODO : Implement fast read of KEYS like in RFIdea
|
||||||
// also http://ext.delaat.net/rp/2015-2016/p04/report.pdf
|
// also http://ext.delaat.net/rp/2015-2016/p04/report.pdf
|
||||||
|
@ -257,7 +262,7 @@ static char *ReadSchemasFromSPIFFS(char *filename) {
|
||||||
|
|
||||||
static void add_schemas_from_json_in_spiffs(char *filename) {
|
static void add_schemas_from_json_in_spiffs(char *filename) {
|
||||||
|
|
||||||
char *jsonfile = ReadSchemasFromSPIFFS((char *)filename);
|
const char *jsonfile = ReadSchemasFromSPIFFS((char *)filename);
|
||||||
|
|
||||||
int i, len = strlen(jsonfile);
|
int i, len = strlen(jsonfile);
|
||||||
struct json_token t;
|
struct json_token t;
|
||||||
|
@ -301,7 +306,7 @@ static void ReadLastTagFromFlash(void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteTagToFlash(uint32_t uid, size_t size) {
|
static void WriteTagToFlash(uint32_t uid, size_t size) {
|
||||||
SpinOff(0);
|
SpinOff(0);
|
||||||
LED_A_ON();
|
LED_A_ON();
|
||||||
LED_B_ON();
|
LED_B_ON();
|
||||||
|
@ -763,7 +768,7 @@ readysim:
|
||||||
* - *datain used as error return
|
* - *datain used as error return
|
||||||
* - tracing is falsed
|
* - tracing is falsed
|
||||||
*/
|
*/
|
||||||
int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
static int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||||
uint8_t numSectors = numofsectors;
|
uint8_t numSectors = numofsectors;
|
||||||
uint8_t keyType = keytype;
|
uint8_t keyType = keytype;
|
||||||
|
|
||||||
|
@ -825,8 +830,8 @@ int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||||
|
|
||||||
/* the chk function is a piwi'ed(tm) check that will try all keys for
|
/* the chk function is a piwi'ed(tm) check that will try all keys for
|
||||||
a particular sector. also no tracing no dbg */
|
a particular sector. also no tracing no dbg */
|
||||||
int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace,
|
static int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace,
|
||||||
uint8_t keyCount, uint8_t *datain, uint64_t *key) {
|
uint8_t keyCount, const uint8_t *datain, uint64_t *key) {
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||||
set_tracing(false);
|
set_tracing(false);
|
||||||
|
|
||||||
|
@ -863,7 +868,7 @@ int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void saMifareMakeTag(void) {
|
static void saMifareMakeTag(void) {
|
||||||
uint8_t cfail = 0;
|
uint8_t cfail = 0;
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
cjTabulize();
|
cjTabulize();
|
||||||
|
@ -923,7 +928,7 @@ void saMifareMakeTag(void) {
|
||||||
// Matt's StandAlone mod.
|
// Matt's StandAlone mod.
|
||||||
// Work with "magic Chinese" card (email him: ouyangweidaxian@live.cn)
|
// Work with "magic Chinese" card (email him: ouyangweidaxian@live.cn)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain) {
|
static int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, const uint8_t *datain) {
|
||||||
// params
|
// params
|
||||||
uint8_t needWipe = arg0;
|
uint8_t needWipe = arg0;
|
||||||
// bit 0 - need get UID
|
// bit 0 - need get UID
|
||||||
|
|
|
@ -35,12 +35,6 @@
|
||||||
#define _XWHITE_ "\x1b[0m"
|
#define _XWHITE_ "\x1b[0m"
|
||||||
#define _XORANGE_ _XYELLOW_
|
#define _XORANGE_ _XYELLOW_
|
||||||
|
|
||||||
int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, uint8_t keyCount, uint8_t *datain, uint64_t *key);
|
|
||||||
int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype);
|
|
||||||
void saMifareMakeTag(void);
|
|
||||||
int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
|
|
||||||
void WriteTagToFlash(uint32_t uid, size_t size);
|
|
||||||
|
|
||||||
const char clearTerm[8] = {0x1b, 0x5b, 0x48, 0x1b, 0x5b, 0x32, 0x4a, '\0'};
|
const char clearTerm[8] = {0x1b, 0x5b, 0x48, 0x1b, 0x5b, 0x32, 0x4a, '\0'};
|
||||||
|
|
||||||
//void cjPrintBigArray(const char *bigar, int len, uint8_t newlines, uint8_t debug);
|
//void cjPrintBigArray(const char *bigar, int len, uint8_t newlines, uint8_t debug);
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
// main code for LF aka HID corporate brutefore by Federico Dotta & Maurizio Agazzini
|
// main code for LF aka HID corporate brutefore by Federico Dotta & Maurizio Agazzini
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
#include "standalone.h" // standalone definitions
|
#include "standalone.h" // standalone definitions
|
||||||
#include "lf_hidbrute.h"
|
|
||||||
|
|
||||||
#include "proxmark3_arm.h"
|
#include "proxmark3_arm.h"
|
||||||
#include "appmain.h"
|
#include "appmain.h"
|
||||||
|
@ -42,6 +41,8 @@
|
||||||
|
|
||||||
#define OPTS 3
|
#define OPTS 3
|
||||||
|
|
||||||
|
static void hid_corporate_1000_calculate_checksum_and_set(uint32_t *high, uint32_t *low, uint32_t cardnum, uint32_t fc);
|
||||||
|
|
||||||
void ModInfo(void) {
|
void ModInfo(void) {
|
||||||
DbpString(" LF HID corporate 1000 bruteforce - aka Corporatebrute (Federico dotta & Maurizio Agazzini)");
|
DbpString(" LF HID corporate 1000 bruteforce - aka Corporatebrute (Federico dotta & Maurizio Agazzini)");
|
||||||
}
|
}
|
||||||
|
@ -250,7 +251,7 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function that calculate next value for the brutforce of HID corporate 1000
|
// Function that calculate next value for the brutforce of HID corporate 1000
|
||||||
void hid_corporate_1000_calculate_checksum_and_set(uint32_t *high, uint32_t *low, uint32_t cardnum, uint32_t fc) {
|
static void hid_corporate_1000_calculate_checksum_and_set(uint32_t *high, uint32_t *low, uint32_t cardnum, uint32_t fc) {
|
||||||
|
|
||||||
uint32_t new_high = 0;
|
uint32_t new_high = 0;
|
||||||
uint32_t new_low = 0;
|
uint32_t new_low = 0;
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) Federico Dotta and Maurizio Agazzini, 2015
|
|
||||||
// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for the text of the license.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// PROXMARK3 - HID CORPORATE 1000 BRUTEFORCER (STAND-ALONE MODE)
|
|
||||||
//
|
|
||||||
// The new stand-alone mode allows to execute a bruteforce on HID Corporate 1000 readers, by
|
|
||||||
// reading a specific badge and bruteforcing the Card Number (incrementing and decrementing it),
|
|
||||||
// mainteining the same Facility Code of the original badge.
|
|
||||||
//
|
|
||||||
// Based on an idea of Brad Antoniewicz of McAfee® Foundstone® Professional Services (ProxBrute),
|
|
||||||
// the stand-alone mode has been rewritten in order to overcome some limitations of ProxBrute firmware,
|
|
||||||
// that does not consider parity bits.
|
|
||||||
//
|
|
||||||
// https://github.com/federicodotta/proxmark3
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
// main code for LF aka HID corporate brutefore by Federico Dotta & Maurizio Agazzini
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef __LF_HIDBRUTE_H
|
|
||||||
#define __LF_HIDBRUTE_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
void hid_corporate_1000_calculate_checksum_and_set(uint32_t *high, uint32_t *low, uint32_t cardnum, uint32_t fc);
|
|
||||||
|
|
||||||
#endif /* __LF_HIDBRUTE_H */
|
|
|
@ -37,8 +37,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "standalone.h"
|
#include "standalone.h"
|
||||||
#include <inttypes.h>
|
|
||||||
#include "lf_hidfcbrute.h"
|
|
||||||
|
|
||||||
#include "proxmark3_arm.h"
|
#include "proxmark3_arm.h"
|
||||||
#include "appmain.h"
|
#include "appmain.h"
|
||||||
|
@ -59,6 +57,8 @@
|
||||||
|
|
||||||
#define LF_HIDCOLLECT_LOGFILE "lf_hid_fcbrute.log"
|
#define LF_HIDCOLLECT_LOGFILE "lf_hid_fcbrute.log"
|
||||||
|
|
||||||
|
static void hid_calculate_checksum_and_set(uint32_t *high, uint32_t *low, uint32_t cardnum, uint32_t fc);
|
||||||
|
|
||||||
static void append(uint8_t *entry, size_t entry_len) {
|
static void append(uint8_t *entry, size_t entry_len) {
|
||||||
LED_B_ON();
|
LED_B_ON();
|
||||||
DbpString("Writing... ");
|
DbpString("Writing... ");
|
||||||
|
@ -166,7 +166,7 @@ void RunMod(void) {
|
||||||
LEDsoff();
|
LEDsoff();
|
||||||
}
|
}
|
||||||
|
|
||||||
void hid_calculate_checksum_and_set(uint32_t *high, uint32_t *low, uint32_t cardnum, uint32_t fc) {
|
static void hid_calculate_checksum_and_set(uint32_t *high, uint32_t *low, uint32_t cardnum, uint32_t fc) {
|
||||||
uint32_t newhigh = 0;
|
uint32_t newhigh = 0;
|
||||||
uint32_t newlow = 0;
|
uint32_t newlow = 0;
|
||||||
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) Stephen Shkardoon proxmark@ss23.geek.nz - ss23
|
|
||||||
// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for the text of the license.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
#ifndef __LF_HIDFCBRUTE_H
|
|
||||||
#define __LF_HIDFCBRUTE_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
void hid_calculate_checksum_and_set(uint32_t *high, uint32_t *low, uint32_t cardnum, uint32_t fc);
|
|
||||||
|
|
||||||
#endif /* __LF_HIDFCBRUTE_H */
|
|
|
@ -21,7 +21,7 @@ static unsigned int claimed_iface = 0;
|
||||||
unsigned char return_on_error = 0;
|
unsigned char return_on_error = 0;
|
||||||
unsigned char error_occurred = 0;
|
unsigned char error_occurred = 0;
|
||||||
|
|
||||||
void SendCommandBL(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len) {
|
void SendCommandBL(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, const void *data, size_t len) {
|
||||||
int ret;
|
int ret;
|
||||||
PacketCommandOLD c = {CMD_UNKNOWN, {0, 0, 0}, {{0}}};
|
PacketCommandOLD c = {CMD_UNKNOWN, {0, 0, 0}, {{0}}};
|
||||||
c.cmd = cmd;
|
c.cmd = cmd;
|
||||||
|
@ -115,7 +115,7 @@ usb_dev_handle *findProxmark(int verbose, unsigned int *iface) {
|
||||||
struct usb_device *dev;
|
struct usb_device *dev;
|
||||||
|
|
||||||
for (dev = bus->devices; dev; dev = dev->next) {
|
for (dev = bus->devices; dev; dev = dev->next) {
|
||||||
struct usb_device_descriptor *desc = &(dev->descriptor);
|
const struct usb_device_descriptor *desc = &(dev->descriptor);
|
||||||
|
|
||||||
if ((desc->idProduct == 0x4b8f) && (desc->idVendor == 0x9ac4)) {
|
if ((desc->idProduct == 0x4b8f) && (desc->idVendor == 0x9ac4)) {
|
||||||
handle = usb_open(dev);
|
handle = usb_open(dev);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
extern unsigned char return_on_error;
|
extern unsigned char return_on_error;
|
||||||
extern unsigned char error_occurred;
|
extern unsigned char error_occurred;
|
||||||
|
|
||||||
void SendCommandBL(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len);
|
void SendCommandBL(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, const void *data, size_t len);
|
||||||
bool ReceiveCommandPoll(PacketResponseOLD *c);
|
bool ReceiveCommandPoll(PacketResponseOLD *c);
|
||||||
void ReceiveCommand(PacketResponseOLD *c);
|
void ReceiveCommand(PacketResponseOLD *c);
|
||||||
struct usb_dev_handle *FindProxmark(int verbose, unsigned int *iface);
|
struct usb_dev_handle *FindProxmark(int verbose, unsigned int *iface);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue