mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
upd: RevEng v1.5.3
This commit is contained in:
+7
-5
@@ -48,7 +48,7 @@ int CmdCrc(const char *Cmd)
|
||||
char *argv[MAX_ARGS];
|
||||
int argc = split(Cmd2, argv);
|
||||
|
||||
if (argc == 3 && memcmp(argv[1],"-g",2)==0) {
|
||||
if (argc == 3 && memcmp(argv[1], "-g", 2) == 0) {
|
||||
CmdrevengSearch(argv[2]);
|
||||
} else {
|
||||
reveng_main(argc, argv);
|
||||
@@ -56,8 +56,7 @@ int CmdCrc(const char *Cmd)
|
||||
for(int i = 0; i < argc; ++i) {
|
||||
free(argv[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//returns array of model names and the count of models returning
|
||||
@@ -396,13 +395,16 @@ char *SwapEndianStr(const char *inStr, const size_t len, const uint8_t blockSize
|
||||
|
||||
// takes hex string in and searches for a matching result (hex string must include checksum)
|
||||
int CmdrevengSearch(const char *Cmd){
|
||||
|
||||
#define NMODELS 103
|
||||
|
||||
char inHexStr[100] = {0x00};
|
||||
int dataLen = param_getstr(Cmd, 0, inHexStr, sizeof(inHexStr));
|
||||
if (dataLen < 4) return 0;
|
||||
|
||||
// these two arrays, must match preset size.
|
||||
char *Models[102];
|
||||
uint8_t width[102] = {0};
|
||||
char *Models[NMODELS];
|
||||
uint8_t width[NMODELS] = {0};
|
||||
int count = 0;
|
||||
|
||||
uint8_t crcChars = 0;
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
|
||||
extern int CmdCrc(const char *Cmd);
|
||||
|
||||
extern int CmdrevengSearch(const char *Cmd);
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
|
||||
//
|
||||
// Modified 2018 iceman <iceman at iuse.se>
|
||||
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||
// the license.
|
||||
@@ -32,14 +33,14 @@ static command_t CommandTable[] = {
|
||||
{"hf", CmdHF, 1, "{ High Frequency commands... }"},
|
||||
{"hw", CmdHW, 1, "{ Hardware commands... }"},
|
||||
{"lf", CmdLF, 1, "{ Low Frequency commands... }"},
|
||||
{"reveng", CmdRev, 1, "{ Crc calculations from the software reveng 1.51... }"},
|
||||
{"reveng", CmdRev, 1, "{ Crc calculations from the software reveng 1.53... }"},
|
||||
{"script", CmdScript, 1, "{ Scripting commands }"},
|
||||
{"trace", CmdTrace, 1, "{ Trace manipulation... }"},
|
||||
#ifdef WITH_FLASH
|
||||
{"mem", CmdFlashMem, 1, "{ RDV40, Flash Memory manipulation... }"},
|
||||
#endif
|
||||
#ifdef WITH_SMARTCARD
|
||||
{"sc", CmdSmartcard, 1, "{ RDV40, Smart card ISO7816 commands... }"},
|
||||
{"sc", CmdSmartcard, 1, "{ RDV40, Smart card ISO7816 commands... }"},
|
||||
#endif
|
||||
{"quit", CmdQuit, 1, ""},
|
||||
{"exit", CmdQuit, 1, "Exit program"},
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* bmpbit.c
|
||||
* Greg Cook, 7/Feb/2017
|
||||
* Greg Cook, 26/Jul/2018
|
||||
*/
|
||||
|
||||
/* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
|
||||
* Gregory Cook
|
||||
*
|
||||
* This file is part of CRC RevEng.
|
||||
|
||||
+11
-10
@@ -1,9 +1,9 @@
|
||||
/* cli.c
|
||||
* Greg Cook, 19/Feb/2017
|
||||
* Greg Cook, 26/Jul/2018
|
||||
*/
|
||||
|
||||
/* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
|
||||
* Gregory Cook
|
||||
*
|
||||
* This file is part of CRC RevEng.
|
||||
@@ -22,7 +22,8 @@
|
||||
* along with CRC RevEng. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* 2017-02-18: -G ignored if R_HAVEP
|
||||
/* 2018-07-26: NOFORCE renamed ALWPCK
|
||||
* 2017-02-18: -G ignored if R_HAVEP
|
||||
* 2017-02-05: added -G
|
||||
* 2016-06-27: -P sets width like -k
|
||||
* 2015-04-03: added -z
|
||||
@@ -135,7 +136,7 @@ int reveng_main(int argc, char *argv[]) {
|
||||
mode = c;
|
||||
break;
|
||||
case 'F': /* F skip preset model check pass */
|
||||
#ifndef NOFORCE
|
||||
#ifndef ALWPCK
|
||||
uflags |= C_NOPCK;
|
||||
#endif
|
||||
break;
|
||||
@@ -507,7 +508,6 @@ void
|
||||
uerror(const char *msg) {
|
||||
/* Callback function to report fatal errors */
|
||||
fprintf(stderr, "%s: %s\n", myname, msg);
|
||||
return;
|
||||
//exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -581,9 +581,8 @@ usage(void) {
|
||||
fputs(myname, stderr);
|
||||
fprintf(stderr,
|
||||
"\t-cdDesvhu? [-bBfFGlLMrStVXyz]\n"
|
||||
"\t\t[-a BITS] [-A OBITS] [-i INIT] [-k KPOLY] [-m MODEL]\n"
|
||||
"\t\t[-p POLY] [-P RPOLY] [-q QPOLY] [-w WIDTH] [-x XOROUT]\n"
|
||||
"\t\t[STRING...]\n"
|
||||
"\t\t[-a BITS] [-A OBITS] [-i INIT] [-k KPOLY] [-m MODEL] [-p POLY]\n"
|
||||
"\t\t[-p POLY] [-P RPOLY] [-q QPOLY] [-w WIDTH] [-x XOROUT] [STRING...]\n"
|
||||
"Options:\n"
|
||||
"\t-a BITS\t\tbits per character (1 to %d)\n"
|
||||
"\t-A OBITS\tbits per output character (1 to %d)\n"
|
||||
@@ -611,7 +610,8 @@ usage(void) {
|
||||
"\t-c calculate CRCs\t\t-d dump algorithm parameters\n"
|
||||
"\t-D list preset algorithms\t-e echo (and reformat) input\n"
|
||||
"\t-s search for algorithm\t\t-v calculate reversed CRCs\n"
|
||||
"\t-g search for alg given hex+crc\t-h | -u | -? show this help\n"
|
||||
"\t-g search for alg given hex+crc\n"
|
||||
"\t-h | -u | -? show this help\n"
|
||||
"Common Use Examples:\n"
|
||||
"\t reveng -g 01020304e3\n"
|
||||
"\t Searches for a known/common crc preset that computes the crc\n"
|
||||
@@ -625,7 +625,8 @@ usage(void) {
|
||||
"\t Outputs a list of all known/common crc models with their\n"
|
||||
"\t preset values\n"
|
||||
"\n"
|
||||
"Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Gregory Cook\n"
|
||||
"Copyright (C)\n"
|
||||
"2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Gregory Cook\n"
|
||||
"This is free software; see the source for copying conditions. There is NO\n"
|
||||
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
|
||||
"Version "
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* config.h
|
||||
* Greg Cook, 7/Feb/2017
|
||||
* Greg Cook, 26/Jul/2018
|
||||
*/
|
||||
|
||||
/* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
|
||||
* Gregory Cook
|
||||
*
|
||||
* This file is part of CRC RevEng.
|
||||
@@ -52,10 +52,10 @@
|
||||
/* #define BMPMACRO 1 */
|
||||
|
||||
/* Some enterprise users may wish to disable the -F switch to minimise CPU
|
||||
* usage. To do this, define the macro NOFORCE.
|
||||
* usage. To do this, define the macro ALWPCK.
|
||||
*/
|
||||
|
||||
/* #define NOFORCE 1 */
|
||||
/* #define ALWPCK 1 */
|
||||
|
||||
/* Define PRESETS to compile CRC RevEng with the preset models from the
|
||||
* CRC Catalogue. This implies BMPMACRO and so makes the code platform-
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* model.c
|
||||
* Greg Cook, 19/Feb/2017
|
||||
* Greg Cook, 26/Jul/2018
|
||||
*/
|
||||
|
||||
/* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
|
||||
* Gregory Cook
|
||||
*
|
||||
* This file is part of CRC RevEng.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* poly.c
|
||||
* Greg Cook, 7/Feb/2017
|
||||
* Greg Cook, 26/Jul/2018
|
||||
*/
|
||||
|
||||
/* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
|
||||
* Gregory Cook
|
||||
*
|
||||
* This file is part of CRC RevEng.
|
||||
@@ -22,7 +22,8 @@
|
||||
* along with CRC RevEng. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* 2016-06-27: pcmp() shortcut returns 0 when pointers identical
|
||||
/* 2017-11-28: added braces, redundant statement skipped in prev()
|
||||
* 2016-06-27: pcmp() shortcut returns 0 when pointers identical
|
||||
* 2015-07-29: discard leading $, &, 0x from argument to strtop()
|
||||
* 2015-04-03: added direct mode to strtop()
|
||||
* 2014-01-11: added LOFS(), RNDUP()
|
||||
@@ -807,9 +808,10 @@ prev(poly_t *poly) {
|
||||
*poly->bitmap = rev(*poly->bitmap >> ofs, (int) poly->length) << ofs;
|
||||
return;
|
||||
}
|
||||
|
||||
/* claim remaining bits of last word (as we use public function pshift()) */
|
||||
poly->length = fulllength;
|
||||
}
|
||||
/* claim remaining bits of last word (as we use public function pshift()) */
|
||||
poly->length = fulllength;
|
||||
|
||||
/* reverse and swap words in the array, leaving it right-justified */
|
||||
while(leftidx < rightidx) {
|
||||
|
||||
+385
-379
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
||||
/* reveng.c
|
||||
* Greg Cook, 7/Feb/2017
|
||||
* Greg Cook, 26/Jul/2018
|
||||
*/
|
||||
|
||||
/* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
|
||||
* Gregory Cook
|
||||
*
|
||||
* This file is part of CRC RevEng.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* reveng.h
|
||||
* Greg Cook, 19/Jun/2017
|
||||
* Greg Cook, 26/Jul/2018
|
||||
*/
|
||||
|
||||
/* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
|
||||
* Gregory Cook
|
||||
*
|
||||
* This file is part of CRC RevEng.
|
||||
@@ -93,7 +93,7 @@
|
||||
/* Global definitions */
|
||||
|
||||
/* CRC RevEng version string */
|
||||
#define VERSION "1.5.2"
|
||||
#define VERSION "1.5.3"
|
||||
|
||||
/* bmpbit.c */
|
||||
typedef BMP_T bmp_t;
|
||||
|
||||
+5
-4
@@ -456,15 +456,16 @@ static int l_sha1(lua_State *L) {
|
||||
|
||||
static int l_reveng_models(lua_State *L){
|
||||
|
||||
// This array needs to be adjusted if RevEng adds more crc-models.
|
||||
#define NMODELS 103
|
||||
|
||||
int count = 0;
|
||||
uint8_t in_width = luaL_checkunsigned(L, 1);
|
||||
if ( in_width > 89 ) return returnToLuaWithError(L,"Width cannot exceed 89, got %d", in_width);
|
||||
|
||||
// This array needs to be adjusted if RevEng adds more crc-models.
|
||||
uint8_t width[102];
|
||||
uint8_t width[NMODELS];
|
||||
memset(width, 0, sizeof(width));
|
||||
// This array needs to be adjusted if RevEng adds more crc-models.
|
||||
char *models[102];
|
||||
char *models[NMODELS];
|
||||
|
||||
width[0] = in_width;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user