mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-20 15:26:13 +08:00
make style
This commit is contained in:
parent
588f7e98f5
commit
94192d0976
|
@ -457,7 +457,8 @@ static int CmdFlashMemSpiFFSLoad(const char *Cmd) {
|
|||
static command_t CommandTable[] = {
|
||||
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||
{"copy", CmdFlashMemSpiFFSCopy, IfPm3Flash,
|
||||
{
|
||||
"copy", CmdFlashMemSpiFFSCopy, IfPm3Flash,
|
||||
"Copy a file to another (destructively) in SPIFFS FileSystem in FlashMEM (spiffs)"
|
||||
},
|
||||
{"check", CmdFlashMemSpiFFSCheck, IfPm3Flash, "Check/try to defrag faulty/fragmented Filesystem"},
|
||||
|
|
|
@ -64,14 +64,15 @@ static int usage_lf_keri_sim(void) {
|
|||
|
||||
typedef enum {Scramble = 0, Descramble = 1} KeriMSScramble_t;
|
||||
|
||||
static int CmdKeriMSScramble (KeriMSScramble_t Action, uint32_t *FC, uint32_t *ID, uint32_t *CardID)
|
||||
{
|
||||
static int CmdKeriMSScramble(KeriMSScramble_t Action, uint32_t *FC, uint32_t *ID, uint32_t *CardID) {
|
||||
// 255 = Not used/Unknown other values are the bit offset in the ID/FC values
|
||||
uint8_t CardToID [] = { 255, 255, 255, 255, 13, 12, 20, 5, 16, 6, 21, 17, 8, 255, 0, 7,
|
||||
10, 15,255, 11, 4, 1,255, 18,255, 19, 2, 14, 3, 9,255,255 };
|
||||
10, 15, 255, 11, 4, 1, 255, 18, 255, 19, 2, 14, 3, 9, 255, 255
|
||||
};
|
||||
|
||||
uint8_t CardToFC [] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 255, 255,
|
||||
255,255, 2,255,255,255, 3,255, 4,255,255,255,255,255, 1,255 };
|
||||
255, 255, 2, 255, 255, 255, 3, 255, 4, 255, 255, 255, 255, 255, 1, 255
|
||||
};
|
||||
|
||||
uint8_t CardIdx; // 0 - 31
|
||||
bool BitState;
|
||||
|
@ -93,12 +94,10 @@ static int CmdKeriMSScramble (KeriMSScramble_t Action, uint32_t *FC, uint32_t *I
|
|||
}
|
||||
}
|
||||
|
||||
if (Action == Scramble)
|
||||
{
|
||||
if (Action == Scramble) {
|
||||
*CardID = 0; // set to 0
|
||||
|
||||
for (CardIdx = 0; CardIdx < 32; CardIdx++)
|
||||
{
|
||||
for (CardIdx = 0; CardIdx < 32; CardIdx++) {
|
||||
// Card ID
|
||||
if (CardToID[CardIdx] < 32) {
|
||||
if ((*ID & (1 << CardToID[CardIdx])) > 0)
|
||||
|
|
|
@ -121,9 +121,15 @@ void preferences_save_callback (json_t *root) {
|
|||
|
||||
// Log level, convert to text
|
||||
switch (session.client_debug_level) {
|
||||
case OFF: JsonSaveStr (root,"client.debug.level","off"); break;
|
||||
case SIMPLE: JsonSaveStr (root,"client.debug.level","simple"); break;
|
||||
case FULL: JsonSaveStr (root,"client.debug.level","full"); break;
|
||||
case OFF:
|
||||
JsonSaveStr(root, "client.debug.level", "off");
|
||||
break;
|
||||
case SIMPLE:
|
||||
JsonSaveStr(root, "client.debug.level", "simple");
|
||||
break;
|
||||
case FULL:
|
||||
JsonSaveStr(root, "client.debug.level", "full");
|
||||
break;
|
||||
default:
|
||||
JsonSaveStr(root, "logging.level", "NORMAL");
|
||||
}
|
||||
|
@ -142,10 +148,18 @@ void preferences_save_callback (json_t *root) {
|
|||
|
||||
// Emoji
|
||||
switch (session.emoji_mode) {
|
||||
case ALIAS: JsonSaveStr (root,"show.emoji","alias"); break;
|
||||
case EMOJI: JsonSaveStr (root,"show.emoji","emoji"); break;
|
||||
case ALTTEXT: JsonSaveStr (root,"show.emoji","alttext"); break;
|
||||
case ERASE: JsonSaveStr (root,"show.emoji","erase"); break;
|
||||
case ALIAS:
|
||||
JsonSaveStr(root, "show.emoji", "alias");
|
||||
break;
|
||||
case EMOJI:
|
||||
JsonSaveStr(root, "show.emoji", "emoji");
|
||||
break;
|
||||
case ALTTEXT:
|
||||
JsonSaveStr(root, "show.emoji", "alttext");
|
||||
break;
|
||||
case ERASE:
|
||||
JsonSaveStr(root, "show.emoji", "erase");
|
||||
break;
|
||||
default:
|
||||
JsonSaveStr(root, "show.emoji", "ALIAS");
|
||||
}
|
||||
|
@ -257,12 +271,14 @@ static int usage_set_hints() {
|
|||
typedef enum preferenceId {prefNONE, prefHELP, prefEMOJI, prefCOLOR, prefPLOT, prefOVERLAY, prefHINTS, prefCLIENTDEBUG} preferenceId_t;
|
||||
typedef enum prefShowOpt {prefShowNone, prefShowOLD, prefShowNEW} prefShowOpt_t;
|
||||
|
||||
const char *prefShowMsg (prefShowOpt_t Opt)
|
||||
{
|
||||
const char *prefShowMsg(prefShowOpt_t Opt) {
|
||||
switch (Opt) {
|
||||
case prefShowOLD: return _YELLOW_("[old]"); //strncpy(Msg,"Before ",sizeof(Msg)-1); break;
|
||||
case prefShowNEW: return _GREEN_("[new]"); // strncpy(Msg,"After ",sizeof(Msg)-1); break;
|
||||
case prefShowNone: return "";
|
||||
case prefShowOLD:
|
||||
return _YELLOW_("[old]"); //strncpy(Msg,"Before ",sizeof(Msg)-1); break;
|
||||
case prefShowNEW:
|
||||
return _GREEN_("[new]"); // strncpy(Msg,"After ",sizeof(Msg)-1); break;
|
||||
case prefShowNone:
|
||||
return "";
|
||||
}
|
||||
|
||||
return "";
|
||||
|
@ -271,13 +287,17 @@ const char *prefShowMsg (prefShowOpt_t Opt)
|
|||
void showEmojiState(prefShowOpt_t Opt) {
|
||||
|
||||
switch (session.emoji_mode) {
|
||||
case ALIAS: PrintAndLogEx(NORMAL, " %s emoji.................. "_GREEN_("alias"),prefShowMsg (Opt));
|
||||
case ALIAS:
|
||||
PrintAndLogEx(NORMAL, " %s emoji.................. "_GREEN_("alias"), prefShowMsg(Opt));
|
||||
break;
|
||||
case EMOJI: PrintAndLogEx(NORMAL, " %s emoji.................. "_GREEN_("emoji"),prefShowMsg (Opt));
|
||||
case EMOJI:
|
||||
PrintAndLogEx(NORMAL, " %s emoji.................. "_GREEN_("emoji"), prefShowMsg(Opt));
|
||||
break;
|
||||
case ALTTEXT: PrintAndLogEx(NORMAL, " %s emoji.................. "_GREEN_("alttext"),prefShowMsg (Opt));
|
||||
case ALTTEXT:
|
||||
PrintAndLogEx(NORMAL, " %s emoji.................. "_GREEN_("alttext"), prefShowMsg(Opt));
|
||||
break;
|
||||
case ERASE: PrintAndLogEx(NORMAL, " %s emoji.................. "_GREEN_("erase"),prefShowMsg (Opt));
|
||||
case ERASE:
|
||||
PrintAndLogEx(NORMAL, " %s emoji.................. "_GREEN_("erase"), prefShowMsg(Opt));
|
||||
break;
|
||||
default:
|
||||
PrintAndLogEx(NORMAL, " %s emoji.................. "_RED_("unknown"), prefShowMsg(Opt));
|
||||
|
@ -295,11 +315,14 @@ void showColorState (prefShowOpt_t Opt) {
|
|||
void showClientDebugState(prefShowOpt_t Opt) {
|
||||
|
||||
switch (session.client_debug_level) {
|
||||
case OFF: PrintAndLogEx (NORMAL," %s client debug........... "_GREEN_("off"),prefShowMsg(Opt));
|
||||
case OFF:
|
||||
PrintAndLogEx(NORMAL, " %s client debug........... "_GREEN_("off"), prefShowMsg(Opt));
|
||||
break;
|
||||
case SIMPLE: PrintAndLogEx (NORMAL," %s client debug........... "_GREEN_("simple"),prefShowMsg(Opt));
|
||||
case SIMPLE:
|
||||
PrintAndLogEx(NORMAL, " %s client debug........... "_GREEN_("simple"), prefShowMsg(Opt));
|
||||
break;
|
||||
case FULL: PrintAndLogEx (NORMAL," %s client debug........... "_GREEN_("full"),prefShowMsg(Opt));
|
||||
case FULL:
|
||||
PrintAndLogEx(NORMAL, " %s client debug........... "_GREEN_("full"), prefShowMsg(Opt));
|
||||
break;
|
||||
default:
|
||||
PrintAndLogEx(NORMAL, " %s client debug........... "_RED_("unknown"), prefShowMsg(Opt));
|
||||
|
@ -377,8 +400,7 @@ static int setCmdEmoji (const char *Cmd) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int setCmdColor (const char *Cmd)
|
||||
{
|
||||
static int setCmdColor(const char *Cmd) {
|
||||
uint8_t cmdp = 0;
|
||||
bool errors = false;
|
||||
bool validValue = false;
|
||||
|
@ -424,8 +446,7 @@ static int setCmdColor (const char *Cmd)
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int setCmdDebug (const char *Cmd)
|
||||
{
|
||||
static int setCmdDebug(const char *Cmd) {
|
||||
uint8_t cmdp = 0;
|
||||
bool errors = false;
|
||||
bool validValue = false;
|
||||
|
@ -476,8 +497,7 @@ static int setCmdDebug (const char *Cmd)
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int setCmdHint (const char *Cmd)
|
||||
{
|
||||
static int setCmdHint(const char *Cmd) {
|
||||
uint8_t cmdp = 0;
|
||||
bool errors = false;
|
||||
bool validValue = false;
|
||||
|
@ -540,8 +560,7 @@ static int setCmdHelp(const char *Cmd) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int CmdPrefSet (const char *Cmd)
|
||||
{
|
||||
int CmdPrefSet(const char *Cmd) {
|
||||
clearCommandBuffer();
|
||||
|
||||
return CmdsParse(setCommandTable, Cmd);
|
||||
|
@ -591,8 +610,7 @@ static int CmdHelp(const char *Cmd) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int CmdPreferences (const char *Cmd)
|
||||
{
|
||||
int CmdPreferences(const char *Cmd) {
|
||||
clearCommandBuffer();
|
||||
|
||||
return CmdsParse(CommandTable, Cmd);
|
||||
|
|
|
@ -143,7 +143,8 @@ void PrintAndLogEx(logLevel_t level, const char *fmt, ...) {
|
|||
FILE *stream = stdout;
|
||||
const char *spinner[] = {_YELLOW_("[\\]"), _YELLOW_("[|]"), _YELLOW_("[/]"), _YELLOW_("[-]")};
|
||||
const char *spinner_emoji[] = {" :clock1: ", " :clock2: ", " :clock3: ", " :clock4: ", " :clock5: ", " :clock6: ",
|
||||
" :clock7: ", " :clock8: ", " :clock9: ", " :clock10: ", " :clock11: ", " :clock12: "};
|
||||
" :clock7: ", " :clock8: ", " :clock9: ", " :clock10: ", " :clock11: ", " :clock12: "
|
||||
};
|
||||
switch (level) {
|
||||
case ERR:
|
||||
if (session.emoji_mode == EMOJI)
|
||||
|
|
|
@ -49,8 +49,7 @@ void transform_D(uint8_t* ru) {
|
|||
uint8_t p = 0;
|
||||
uint32_t v1 = ((ru[3] << 24) | (ru[2] << 16) | (ru[1] << 8) | ru[0]) + c_D[p++];
|
||||
uint32_t v2 = ((ru[7] << 24) | (ru[6] << 16) | (ru[5] << 8) | ru[4]) + c_D[p++];
|
||||
for (i = 0; i < 12; i += 2)
|
||||
{
|
||||
for (i = 0; i < 12; i += 2) {
|
||||
uint32_t tempA = v1 ^ v2;
|
||||
uint32_t t1 = PM3_ROTL(tempA, v2 & 0x1F) + c_D[p++];
|
||||
uint32_t tempB = v2 ^ t1;
|
||||
|
|
Loading…
Reference in a new issue