mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
Merge pull request #2913 from Antiklesys/master
Some checks failed
Ubuntu Build and Test / ubuntu-make-btaddon (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
MacOS Build and Test / macos-make (push) Has been cancelled
MacOS Build and Test / macos-make-btaddon (push) Has been cancelled
MacOS Build and Test / macos-cmake (push) Has been cancelled
Ubuntu Build and Test / ubuntu-make (push) Has been cancelled
Ubuntu Build and Test / ubuntu-cmake (push) Has been cancelled
Windows Build and Test / proxspace (push) Has been cancelled
Windows Build and Test / wsl (push) Has been cancelled
Some checks failed
Ubuntu Build and Test / ubuntu-make-btaddon (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
MacOS Build and Test / macos-make (push) Has been cancelled
MacOS Build and Test / macos-make-btaddon (push) Has been cancelled
MacOS Build and Test / macos-cmake (push) Has been cancelled
Ubuntu Build and Test / ubuntu-make (push) Has been cancelled
Ubuntu Build and Test / ubuntu-cmake (push) Has been cancelled
Windows Build and Test / proxspace (push) Has been cancelled
Windows Build and Test / wsl (push) Has been cancelled
Renaming and snmp data format option for sam comms
This commit is contained in:
commit
61a993de82
1 changed files with 14 additions and 4 deletions
|
@ -5914,6 +5914,7 @@ static int CmdHFiClassSAM(const char *Cmd) {
|
||||||
arg_lit0("p", "prevent", "fake epurse update"),
|
arg_lit0("p", "prevent", "fake epurse update"),
|
||||||
arg_lit0(NULL, "shallow", "shallow mod"),
|
arg_lit0(NULL, "shallow", "shallow mod"),
|
||||||
arg_strx0("d", "data", "<hex>", "DER encoded command to send to SAM"),
|
arg_strx0("d", "data", "<hex>", "DER encoded command to send to SAM"),
|
||||||
|
arg_lit0("s", "snmp", "data is in snmp format without headers"),
|
||||||
arg_lit0(NULL, "info", "get SAM infos (version, serial number)"),
|
arg_lit0(NULL, "info", "get SAM infos (version, serial number)"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
|
@ -5926,7 +5927,8 @@ static int CmdHFiClassSAM(const char *Cmd) {
|
||||||
bool break_nrmac = arg_get_lit(ctx, 5);
|
bool break_nrmac = arg_get_lit(ctx, 5);
|
||||||
bool prevent = arg_get_lit(ctx, 6);
|
bool prevent = arg_get_lit(ctx, 6);
|
||||||
bool shallow_mod = arg_get_lit(ctx, 7);
|
bool shallow_mod = arg_get_lit(ctx, 7);
|
||||||
bool info = arg_get_lit(ctx, 9);
|
bool snmp_data = arg_get_lit(ctx, 9);
|
||||||
|
bool info = arg_get_lit(ctx, 10);
|
||||||
|
|
||||||
uint8_t flags = 0;
|
uint8_t flags = 0;
|
||||||
if (disconnect_after) {
|
if (disconnect_after) {
|
||||||
|
@ -5968,6 +5970,14 @@ static int CmdHFiClassSAM(const char *Cmd) {
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (snmp_data) {
|
||||||
|
uint8_t header[4] = {0xa0, cmdlen+2 , 0x94, cmdlen };
|
||||||
|
memmove(data + 4, data, cmdlen+1);
|
||||||
|
data[0] = flags;
|
||||||
|
memcpy(data+1, header, 4);
|
||||||
|
cmdlen += 4;
|
||||||
|
}
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_SAM_PICOPASS, data, cmdlen + 1);
|
SendCommandNG(CMD_HF_SAM_PICOPASS, data, cmdlen + 1);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
@ -5976,8 +5986,8 @@ static int CmdHFiClassSAM(const char *Cmd) {
|
||||||
bool is_snmp = false;
|
bool is_snmp = false;
|
||||||
uint8_t snmp_pattern[] = {0xBD, 0x81, 0xFF, 0x8A, 0x81, 0xFF}; // SNMP Response header pattern, 0xFF is a wildcard value for message length
|
uint8_t snmp_pattern[] = {0xBD, 0x81, 0xFF, 0x8A, 0x81, 0xFF}; // SNMP Response header pattern, 0xFF is a wildcard value for message length
|
||||||
bool snmp_mask[] = {true, true, false, true, true, false}; // false means wildcard value in that position
|
bool snmp_mask[] = {true, true, false, true, true, false}; // false means wildcard value in that position
|
||||||
uint8_t ack_pattern[] = {0xBD, 0xFF, 0x8A}; // Acknowledge Response header pattern, 0xFF is a wildcard value for message length
|
uint8_t ok_pattern[] = {0xBD, 0xFF, 0x8A}; // Ok response header pattern, 0xFF is a wildcard value for message length
|
||||||
bool ack_mask[] = {true, false, true}; // false means wildcard value in that position
|
bool ok_mask[] = {true, false, true}; // false means wildcard value in that position
|
||||||
|
|
||||||
switch (resp.status) {
|
switch (resp.status) {
|
||||||
case PM3_SUCCESS:
|
case PM3_SUCCESS:
|
||||||
|
@ -6044,7 +6054,7 @@ static int CmdHFiClassSAM(const char *Cmd) {
|
||||||
}else if (match_with_wildcard(d, snmp_pattern, snmp_mask, 6)){
|
}else if (match_with_wildcard(d, snmp_pattern, snmp_mask, 6)){
|
||||||
is_snmp = true;
|
is_snmp = true;
|
||||||
PrintAndLogEx(SUCCESS, _YELLOW_("[samSNMPMessageResponse] ")"%s", sprint_hex(d + 6, resp.length - 6));
|
PrintAndLogEx(SUCCESS, _YELLOW_("[samSNMPMessageResponse] ")"%s", sprint_hex(d + 6, resp.length - 6));
|
||||||
}else if (match_with_wildcard(d,ack_pattern, ack_mask, 3)){
|
}else if (match_with_wildcard(d,ok_pattern, ok_mask, 3)){
|
||||||
PrintAndLogEx(SUCCESS, _YELLOW_("[samResponseAcknowledge] ")"%s", sprint_hex(d + 4, resp.length - 4));
|
PrintAndLogEx(SUCCESS, _YELLOW_("[samResponseAcknowledge] ")"%s", sprint_hex(d + 4, resp.length - 4));
|
||||||
}else{
|
}else{
|
||||||
print_hex(d, resp.length);
|
print_hex(d, resp.length);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue