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[] = {
|
static command_t CommandTable[] = {
|
||||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("General") "-------------------------"},
|
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("General") "-------------------------"},
|
||||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Modulation") "-------------------------"},
|
{"plot", CmdPlot, AlwaysAvailable, "Show graph window"},
|
||||||
{"biphaserawdecode", CmdBiphaseDecodeRaw, AlwaysAvailable, "Biphase decode bin stream in DemodBuffer"},
|
{"hide", CmdHide, AlwaysAvailable, "Hide graph window"},
|
||||||
{"detectclock", CmdDetectClockRate, AlwaysAvailable, "Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer"},
|
{"load", CmdLoad, AlwaysAvailable, "Load contents of file into graph window"},
|
||||||
{"fsktonrz", CmdFSKToNRZ, AlwaysAvailable, "Convert fsk2 to nrz wave for alternate fsk demodulating (for weak fsk)"},
|
{"save", CmdSave, AlwaysAvailable, "Save signal trace data"},
|
||||||
{"manrawdecode", Cmdmandecoderaw, AlwaysAvailable, "Manchester decode binary stream in DemodBuffer"},
|
{"clear", CmdBuffClear, AlwaysAvailable, "Clears various buffers used by the graph window"},
|
||||||
{"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_("Graph") "-------------------------"},
|
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Modulation") "-------------------------"},
|
||||||
{"askedgedetect", CmdAskEdgeDetect, AlwaysAvailable, "Adjust Graph for manual ASK demod"},
|
{"detectclock", CmdDetectClockRate, AlwaysAvailable, "Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer"},
|
||||||
{"autocorr", CmdAutoCorr, AlwaysAvailable, "Autocorrelation over window"},
|
{"biphaserawdecode", CmdBiphaseDecodeRaw, AlwaysAvailable, "Biphase decode bin stream in DemodBuffer"},
|
||||||
{"dirthreshold", CmdDirectionalThreshold, AlwaysAvailable, "Max rising higher up-thres/ Min falling lower down-thres"},
|
{"fsktonrz", CmdFSKToNRZ, AlwaysAvailable, "Convert fsk2 to nrz wave for alternate fsk demodulating (for weak fsk)"},
|
||||||
{"decimate", CmdDecimate, AlwaysAvailable, "Decimate samples"},
|
{"manrawdecode", Cmdmandecoderaw, AlwaysAvailable, "Manchester decode binary stream in DemodBuffer"},
|
||||||
{"envelope", CmdEnvelope, AlwaysAvailable, "Generate square envelope of samples"},
|
{"modulation", CmdDataModulationSearch, AlwaysAvailable, "Identify LF signal for clock and modulation"},
|
||||||
{"undecimate", CmdUndecimate, AlwaysAvailable, "Un-decimate samples"},
|
{"rawdemod", CmdRawDemod, AlwaysAvailable, "Demodulate the data in the GraphBuffer and output binary"},
|
||||||
{"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"},
|
|
||||||
|
|
||||||
{"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"},
|
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Operations") "-------------------------"},
|
||||||
{"setgraphmarkers", CmdSetGraphMarkers, AlwaysAvailable, "Set blue and orange marker in graph window"},
|
{"asn1", CmdAsn1Decoder, AlwaysAvailable, "ASN1 decoder"},
|
||||||
{"shiftgraphzero", CmdGraphShiftZero, AlwaysAvailable, "Shift 0 for Graphed wave + or - shift value"},
|
{"atr", CmdAtrLookup, AlwaysAvailable, "ATR lookup"},
|
||||||
{"timescale", CmdTimeScale, AlwaysAvailable, "Set cursor display timescale"},
|
{"bin2hex", Cmdbin2hex, AlwaysAvailable, "Converts binary to hexadecimal"},
|
||||||
{"zerocrossings", CmdZerocrossings, AlwaysAvailable, "Count time between zero-crossings"},
|
{"bitsamples", CmdBitsamples, IfPm3Present, "Get raw samples as bitstring"},
|
||||||
{"convertbitstream", CmdConvertBitStream, AlwaysAvailable, "Convert GraphBuffer's 0/1 values to 127 / -127"},
|
{"bmap", CmdBinaryMap, AlwaysAvailable, "Convert hex value according a binary template"},
|
||||||
{"getbitstream", CmdGetBitStream, AlwaysAvailable, "Convert GraphBuffer's >=1 values to 1 and <1 to 0"},
|
{"crypto", CmdCryptography, AlwaysAvailable, "Encrypt and decrypt data"},
|
||||||
|
{"diff", CmdDiff, AlwaysAvailable, "Diff of input files"},
|
||||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Operations") "-------------------------"},
|
{"hexsamples", CmdHexsamples, IfPm3Present, "Dump big buffer as hex bytes"},
|
||||||
{"asn1", CmdAsn1Decoder, AlwaysAvailable, "ASN1 decoder"},
|
{"hex2bin", Cmdhex2bin, AlwaysAvailable, "Converts hexadecimal to binary"},
|
||||||
{"atr", CmdAtrLookup, AlwaysAvailable, "ATR lookup"},
|
{"num", CmdNumCon, AlwaysAvailable, "Converts dec/hex/bin"},
|
||||||
{"bin2hex", Cmdbin2hex, AlwaysAvailable, "Converts binary to hexadecimal"},
|
{"print", CmdPrintDemodBuff, AlwaysAvailable, "Print the data in the DemodBuffer"},
|
||||||
{"bitsamples", CmdBitsamples, IfPm3Present, "Get raw samples as bitstring"},
|
{"samples", CmdSamples, IfPm3Present, "Get raw samples for graph window ( GraphBuffer )"},
|
||||||
{"bmap", CmdBinaryMap, AlwaysAvailable, "Convert hex value according a binary template"},
|
{"setdebugmode", CmdSetDebugMode, AlwaysAvailable, "Set Debugging Level on client side"},
|
||||||
{"clear", CmdBuffClear, AlwaysAvailable, "Clears bigbuf on deviceside and graph window"},
|
{"xor", CmdXor, AlwaysAvailable, "Xor a input string"},
|
||||||
{"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"},
|
|
||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ void save_restoreGB(uint8_t saveOpt) {
|
||||||
Savedg_GridOffsetAdj = g_GridOffset;
|
Savedg_GridOffsetAdj = g_GridOffset;
|
||||||
} else if (GB_Saved) { //restore
|
} else if (GB_Saved) { //restore
|
||||||
memcpy(g_GraphBuffer, SavedGB, sizeof(g_GraphBuffer));
|
memcpy(g_GraphBuffer, SavedGB, sizeof(g_GraphBuffer));
|
||||||
|
memcpy(g_OperationBuffer, SavedGB, sizeof(g_OperationBuffer));
|
||||||
g_GraphTraceLen = SavedGBlen;
|
g_GraphTraceLen = SavedGBlen;
|
||||||
g_GridOffset = Savedg_GridOffsetAdj;
|
g_GridOffset = Savedg_GridOffsetAdj;
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
|
@ -106,11 +107,14 @@ void setGraphBuf(const uint8_t *src, size_t size) {
|
||||||
|
|
||||||
ClearGraph(false);
|
ClearGraph(false);
|
||||||
|
|
||||||
if (size > MAX_GRAPH_TRACE_LEN)
|
if (size > MAX_GRAPH_TRACE_LEN) {
|
||||||
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_GraphBuffer[i] = src[i] - 128;
|
||||||
|
g_OperationBuffer[i] = src[i] - 128;
|
||||||
|
}
|
||||||
|
|
||||||
g_GraphTraceLen = size;
|
g_GraphTraceLen = size;
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue