mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
Command Organization in cmddata.c
Getting ready to do some refactoring!
This commit is contained in:
parent
c2e43c3f46
commit
6b72e39f51
2 changed files with 56 additions and 53 deletions
|
@ -3788,60 +3788,59 @@ static int CmdXor(const char *Cmd) {
|
|||
}
|
||||
|
||||
static command_t CommandTable[] = {
|
||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("General") "-------------------------"},
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Modulation") "-------------------------"},
|
||||
{"biphaserawdecode", CmdBiphaseDecodeRaw, AlwaysAvailable, "Biphase decode bin stream in DemodBuffer"},
|
||||
{"detectclock", CmdDetectClockRate, AlwaysAvailable, "Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer"},
|
||||
{"fsktonrz", CmdFSKToNRZ, AlwaysAvailable, "Convert fsk2 to nrz wave for alternate fsk demodulating (for weak fsk)"},
|
||||
{"manrawdecode", Cmdmandecoderaw, AlwaysAvailable, "Manchester decode binary stream in DemodBuffer"},
|
||||
{"modulation", CmdDataModulationSearch, AlwaysAvailable, "Identify LF signal for clock and modulation"},
|
||||
{"rawdemod", CmdRawDemod, AlwaysAvailable, "Demodulate the data in the GraphBuffer and output binary"},
|
||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("General") "-------------------------"},
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||
{"plot", CmdPlot, AlwaysAvailable, "Show graph window"},
|
||||
{"hide", CmdHide, AlwaysAvailable, "Hide graph window"},
|
||||
{"load", CmdLoad, AlwaysAvailable, "Load contents of file into graph window"},
|
||||
{"save", CmdSave, AlwaysAvailable, "Save signal trace data"},
|
||||
{"clear", CmdBuffClear, AlwaysAvailable, "Clears various buffers used by the graph window"},
|
||||
|
||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Graph") "-------------------------"},
|
||||
{"askedgedetect", CmdAskEdgeDetect, AlwaysAvailable, "Adjust Graph for manual ASK demod"},
|
||||
{"autocorr", CmdAutoCorr, AlwaysAvailable, "Autocorrelation over window"},
|
||||
{"dirthreshold", CmdDirectionalThreshold, AlwaysAvailable, "Max rising higher up-thres/ Min falling lower down-thres"},
|
||||
{"decimate", CmdDecimate, AlwaysAvailable, "Decimate samples"},
|
||||
{"envelope", CmdEnvelope, AlwaysAvailable, "Generate square envelope of samples"},
|
||||
{"undecimate", CmdUndecimate, AlwaysAvailable, "Un-decimate samples"},
|
||||
{"hide", CmdHide, AlwaysAvailable, "Hide graph window"},
|
||||
{"hpf", CmdHpf, AlwaysAvailable, "Remove DC offset from trace"},
|
||||
{"iir", CmdDataIIR, AlwaysAvailable, "Apply IIR buttersworth filter on plot data"},
|
||||
{"grid", CmdGrid, AlwaysAvailable, "overlay grid on graph window"},
|
||||
{"ltrim", CmdLtrim, AlwaysAvailable, "Trim samples from left of trace"},
|
||||
{"mtrim", CmdMtrim, AlwaysAvailable, "Trim out samples from the specified start to the specified stop"},
|
||||
{"norm", CmdNorm, AlwaysAvailable, "Normalize max/min to +/-128"},
|
||||
{"plot", CmdPlot, AlwaysAvailable, "Show graph window"},
|
||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Modulation") "-------------------------"},
|
||||
{"detectclock", CmdDetectClockRate, AlwaysAvailable, "Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer"},
|
||||
{"biphaserawdecode", CmdBiphaseDecodeRaw, AlwaysAvailable, "Biphase decode bin stream in DemodBuffer"},
|
||||
{"fsktonrz", CmdFSKToNRZ, AlwaysAvailable, "Convert fsk2 to nrz wave for alternate fsk demodulating (for weak fsk)"},
|
||||
{"manrawdecode", Cmdmandecoderaw, AlwaysAvailable, "Manchester decode binary stream in DemodBuffer"},
|
||||
{"modulation", CmdDataModulationSearch, AlwaysAvailable, "Identify LF signal for clock and modulation"},
|
||||
{"rawdemod", CmdRawDemod, AlwaysAvailable, "Demodulate the data in the GraphBuffer and output binary"},
|
||||
|
||||
{"cthreshold", CmdCenterThreshold, AlwaysAvailable, "Average out all values between"},
|
||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Graph") "-------------------------"},
|
||||
{"norm", CmdNorm, AlwaysAvailable, "Normalize max/min to +/-128"},
|
||||
{"askedgedetect", CmdAskEdgeDetect, AlwaysAvailable, "Adjust Graph for manual ASK demod"},
|
||||
{"autocorr", CmdAutoCorr, AlwaysAvailable, "Autocorrelation over window"},
|
||||
{"cthreshold", CmdCenterThreshold, AlwaysAvailable, "Average out all values between"},
|
||||
{"dirthreshold", CmdDirectionalThreshold, AlwaysAvailable, "Max rising higher up-thres/ Min falling lower down-thres"},
|
||||
{"envelope", CmdEnvelope, AlwaysAvailable, "Generate square envelope of samples"},
|
||||
{"decimate", CmdDecimate, AlwaysAvailable, "Decimate samples"},
|
||||
{"undecimate", CmdUndecimate, AlwaysAvailable, "Un-decimate samples"},
|
||||
{"hpf", CmdHpf, AlwaysAvailable, "Remove DC offset from trace"},
|
||||
{"iir", CmdDataIIR, AlwaysAvailable, "Apply IIR buttersworth filter on plot data"},
|
||||
{"grid", CmdGrid, AlwaysAvailable, "overlay grid on graph window"},
|
||||
{"ltrim", CmdLtrim, AlwaysAvailable, "Trim samples from left of trace"},
|
||||
{"rtrim", CmdRtrim, AlwaysAvailable, "Trim samples from right of trace"},
|
||||
{"mtrim", CmdMtrim, AlwaysAvailable, "Trim out samples from the specified start to the specified stop"},
|
||||
{"setgraphmarkers", CmdSetGraphMarkers, AlwaysAvailable, "Set blue and orange marker in graph window"},
|
||||
{"shiftgraphzero", CmdGraphShiftZero, AlwaysAvailable, "Shift 0 for Graphed wave + or - shift value"},
|
||||
{"timescale", CmdTimeScale, AlwaysAvailable, "Set cursor display timescale"},
|
||||
{"zerocrossings", CmdZerocrossings, AlwaysAvailable, "Count time between zero-crossings"},
|
||||
{"convertbitstream", CmdConvertBitStream, AlwaysAvailable, "Convert GraphBuffer's 0/1 values to 127 / -127"},
|
||||
{"getbitstream", CmdGetBitStream, AlwaysAvailable, "Convert GraphBuffer's >=1 values to 1 and <1 to 0"},
|
||||
|
||||
{"rtrim", CmdRtrim, AlwaysAvailable, "Trim samples from right of trace"},
|
||||
{"setgraphmarkers", CmdSetGraphMarkers, AlwaysAvailable, "Set blue and orange marker in graph window"},
|
||||
{"shiftgraphzero", CmdGraphShiftZero, AlwaysAvailable, "Shift 0 for Graphed wave + or - shift value"},
|
||||
{"timescale", CmdTimeScale, AlwaysAvailable, "Set cursor display timescale"},
|
||||
{"zerocrossings", CmdZerocrossings, AlwaysAvailable, "Count time between zero-crossings"},
|
||||
{"convertbitstream", CmdConvertBitStream, AlwaysAvailable, "Convert GraphBuffer's 0/1 values to 127 / -127"},
|
||||
{"getbitstream", CmdGetBitStream, AlwaysAvailable, "Convert GraphBuffer's >=1 values to 1 and <1 to 0"},
|
||||
|
||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Operations") "-------------------------"},
|
||||
{"asn1", CmdAsn1Decoder, AlwaysAvailable, "ASN1 decoder"},
|
||||
{"atr", CmdAtrLookup, AlwaysAvailable, "ATR lookup"},
|
||||
{"bin2hex", Cmdbin2hex, AlwaysAvailable, "Converts binary to hexadecimal"},
|
||||
{"bitsamples", CmdBitsamples, IfPm3Present, "Get raw samples as bitstring"},
|
||||
{"bmap", CmdBinaryMap, AlwaysAvailable, "Convert hex value according a binary template"},
|
||||
{"clear", CmdBuffClear, AlwaysAvailable, "Clears bigbuf on deviceside and graph window"},
|
||||
{"crypto", CmdCryptography, AlwaysAvailable, "Encrypt and decrypt data"},
|
||||
{"diff", CmdDiff, AlwaysAvailable, "Diff of input files"},
|
||||
{"hexsamples", CmdHexsamples, IfPm3Present, "Dump big buffer as hex bytes"},
|
||||
{"hex2bin", Cmdhex2bin, AlwaysAvailable, "Converts hexadecimal to binary"},
|
||||
{"load", CmdLoad, AlwaysAvailable, "Load contents of file into graph window"},
|
||||
{"num", CmdNumCon, AlwaysAvailable, "Converts dec/hex/bin"},
|
||||
{"print", CmdPrintDemodBuff, AlwaysAvailable, "Print the data in the DemodBuffer"},
|
||||
{"samples", CmdSamples, IfPm3Present, "Get raw samples for graph window ( GraphBuffer )"},
|
||||
{"save", CmdSave, AlwaysAvailable, "Save signal trace data ( GraphBuffer )"},
|
||||
{"setdebugmode", CmdSetDebugMode, AlwaysAvailable, "Set Debugging Level on client side"},
|
||||
{"xor", CmdXor, AlwaysAvailable, "Xor a input string"},
|
||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Operations") "-------------------------"},
|
||||
{"asn1", CmdAsn1Decoder, AlwaysAvailable, "ASN1 decoder"},
|
||||
{"atr", CmdAtrLookup, AlwaysAvailable, "ATR lookup"},
|
||||
{"bin2hex", Cmdbin2hex, AlwaysAvailable, "Converts binary to hexadecimal"},
|
||||
{"bitsamples", CmdBitsamples, IfPm3Present, "Get raw samples as bitstring"},
|
||||
{"bmap", CmdBinaryMap, AlwaysAvailable, "Convert hex value according a binary template"},
|
||||
{"crypto", CmdCryptography, AlwaysAvailable, "Encrypt and decrypt data"},
|
||||
{"diff", CmdDiff, AlwaysAvailable, "Diff of input files"},
|
||||
{"hexsamples", CmdHexsamples, IfPm3Present, "Dump big buffer as hex bytes"},
|
||||
{"hex2bin", Cmdhex2bin, AlwaysAvailable, "Converts hexadecimal to binary"},
|
||||
{"num", CmdNumCon, AlwaysAvailable, "Converts dec/hex/bin"},
|
||||
{"print", CmdPrintDemodBuff, AlwaysAvailable, "Print the data in the DemodBuffer"},
|
||||
{"samples", CmdSamples, IfPm3Present, "Get raw samples for graph window ( GraphBuffer )"},
|
||||
{"setdebugmode", CmdSetDebugMode, AlwaysAvailable, "Set Debugging Level on client side"},
|
||||
{"xor", CmdXor, AlwaysAvailable, "Xor a input string"},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ void save_restoreGB(uint8_t saveOpt) {
|
|||
Savedg_GridOffsetAdj = g_GridOffset;
|
||||
} else if (GB_Saved) { //restore
|
||||
memcpy(g_GraphBuffer, SavedGB, sizeof(g_GraphBuffer));
|
||||
memcpy(g_OperationBuffer, SavedGB, sizeof(g_OperationBuffer));
|
||||
g_GraphTraceLen = SavedGBlen;
|
||||
g_GridOffset = Savedg_GridOffsetAdj;
|
||||
RepaintGraphWindow();
|
||||
|
@ -106,11 +107,14 @@ void setGraphBuf(const uint8_t *src, size_t size) {
|
|||
|
||||
ClearGraph(false);
|
||||
|
||||
if (size > MAX_GRAPH_TRACE_LEN)
|
||||
if (size > MAX_GRAPH_TRACE_LEN) {
|
||||
size = MAX_GRAPH_TRACE_LEN;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
g_GraphBuffer[i] = src[i] - 128;
|
||||
g_OperationBuffer[i] = src[i] - 128;
|
||||
}
|
||||
|
||||
g_GraphTraceLen = size;
|
||||
RepaintGraphWindow();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue