This commit is contained in:
Philippe Teuwen 2019-05-01 01:38:52 +02:00
parent 5801cfa4a8
commit 4f11ef048f
11 changed files with 38 additions and 38 deletions

View file

@ -589,7 +589,7 @@ static int CmdHFiClassELoad(const char *Cmd) {
// fast push mode
conn.block_after_ACK = true;
//Send to device
uint32_t bytes_sent = 0;
uint32_t bytes_remaining = bytes_read;
@ -607,7 +607,7 @@ static int CmdHFiClassELoad(const char *Cmd) {
conn.block_after_ACK = false;
SendCommandMIX(CMD_PING, 0, 0, 0, NULL, 0);
WaitForResponseTimeout(CMD_ACK, NULL, 1000);
PrintAndLogEx(SUCCESS, "sent %d bytes of data to device emulator memory", bytes_sent);
return 0;
}
@ -1949,7 +1949,7 @@ static int CmdHFiClassCheckKeys(const char *Cmd) {
// fast push mode
conn.block_after_ACK = true;
// main keychunk loop
for (uint32_t i = 0; i < keycnt; i += chunksize) {

View file

@ -421,7 +421,7 @@ int CmdLFSim(const char *Cmd) {
// fast push mode
conn.block_after_ACK = true;
//can send only 512 bits at a time (1 byte sent per bit...)
for (uint16_t i = 0; i < GraphTraceLen; i += PM3_CMD_DATA_SIZE) {
clearCommandBuffer();

View file

@ -592,12 +592,12 @@ int TestProxmark(void) {
if (conn.send_via_fpc) {
PrintAndLogEx(INFO, "UART Serial baudrate: " _YELLOW_("%u") "\n", conn.uart_speed);
}
// reconfigure.
if ( conn.send_via_fpc == false ) {
uart_reconfigure_timeouts(sp, UART_USB_CLIENT_RX_TIMEOUT_MS );
if (conn.send_via_fpc == false) {
uart_reconfigure_timeouts(sp, UART_USB_CLIENT_RX_TIMEOUT_MS);
}
return PM3_SUCCESS;
} else {
return PM3_ETIMEOUT;

View file

@ -63,14 +63,14 @@ static int build_segs_from_phdrs(flash_file_t *ctx, FILE *fd, Elf32_Phdr *phdrs,
continue;
}
PrintAndLogEx(NORMAL, "%d: V 0x%08x P 0x%08x (0x%08x->0x%08x) [%c%c%c] @0x%x",
i, vaddr, paddr, filesz, memsz,
(flags & PF_R) ? 'R' : ' ',
(flags & PF_W) ? 'W' : ' ',
(flags & PF_X) ? 'X' : ' ',
offset);
i, vaddr, paddr, filesz, memsz,
(flags & PF_R) ? 'R' : ' ',
(flags & PF_W) ? 'W' : ' ',
(flags & PF_X) ? 'X' : ' ',
offset);
if (filesz != memsz) {
PrintAndLogEx(ERR, "Error: PHDR file size does not equal memory size\n"
"(DATA+BSS PHDRs do not make sense on ROM platforms!)");
"(DATA+BSS PHDRs do not make sense on ROM platforms!)");
return -1;
}
if (paddr < last_end) {
@ -121,7 +121,7 @@ static int build_segs_from_phdrs(flash_file_t *ctx, FILE *fd, Elf32_Phdr *phdrs,
memcpy(new_data, prev_seg->data, prev_seg->length);
memcpy(new_data + this_offset, data, filesz);
PrintAndLogEx(NORMAL, "Note: Extending previous segment from 0x%x to 0x%x bytes",
prev_seg->length, new_length);
prev_seg->length, new_length);
if (hole)
PrintAndLogEx(NORMAL, "Note: 0x%x-byte hole created", hole);
free(data);
@ -335,9 +335,9 @@ static int wait_for_ack(PacketResponseNG *ack) {
if (ack->cmd != CMD_ACK) {
PrintAndLogEx(ERR, "Error: Unexpected reply 0x%04x %s (expected ACK)",
ack->cmd,
(ack->cmd == CMD_NACK) ? "NACK" : ""
);
ack->cmd,
(ack->cmd == CMD_NACK) ? "NACK" : ""
);
return -1;
}
return 0;

View file

@ -122,15 +122,15 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
}
int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key) {
*key = -1;
clearCommandBuffer();
clearCommandBuffer();
uint8_t data[PM3_CMD_DATA_SIZE] = {0};
data[0] = keyType;
data[1] = blockNo;
data[2] = clear_trace;
data[3] = keycnt;
memcpy(data + 4, keyBlock, 6 * keycnt);
SendCommandNG(CMD_MIFARE_CHKKEYS, data, (4 + 6 * keycnt) );
SendCommandNG(CMD_MIFARE_CHKKEYS, data, (4 + 6 * keycnt));
PacketResponseNG resp;
if (!WaitForResponseTimeout(CMD_MIFARE_CHKKEYS, &resp, 2500)) return PM3_ETIMEOUT;
if (resp.status != PM3_SUCCESS) return PM3_EUNDEF;

View file

@ -30,25 +30,25 @@ static int l_clearCommandBuffer(lua_State *L) {
/**
* Enable / Disable fast push mode for lua scripts like mfkeys
* The following params expected:
*
*
*@brief l_fast_push_mode
* @param L
* @return
*/
static int l_fast_push_mode(lua_State *L){
static int l_fast_push_mode(lua_State *L) {
luaL_checktype(L, 1, LUA_TBOOLEAN);
bool enable = lua_toboolean(L, 1);
conn.block_after_ACK = enable;
// Disable fast mode and send a dummy command to make it effective
if (enable == false) {
SendCommandMIX(CMD_PING, 0, 0, 0, NULL, 0);
WaitForResponseTimeout(CMD_ACK, NULL, 1000);
}
//Push the retval on the stack
lua_pushboolean(L, enable);
return 1;

View file

@ -209,7 +209,7 @@ local function perform_check(numsectors)
core.fast_push_mode(true)
local start_time = os.time()
for sector = 0, #keys do
-- Check if user aborted
if core.ukbhit() then
@ -231,15 +231,15 @@ local function perform_check(numsectors)
keys[sector] = {succA, succB, keyA, keyB}
end
local end_time = os.time()
print('')
print('[+] mfkeys - Checkkey execution time: '..os.difftime(end_time, start_time)..' sec')
core.fast_push_mode(false)
display_results(keys)
-- save to dumpkeys.bin
dumptofile(keys)
end
@ -282,7 +282,7 @@ local function main(args)
-- identify tag
tag, err = lib14a.read(false, true)
if not tag then return oops(err) end
-- detect sectors and print taginfo
numsectors = taginfo(tag)

View file

@ -75,7 +75,7 @@ void PrintAndLogEx(logLevel_t level, const char *fmt, ...) {
char *tmp_ptr = NULL;
// {NORMAL, SUCCESS, INFO, FAILED, WARNING, ERR, DEBUG}
static const char *prefixes[7] = { "", "[+] ", "[=] ", "[-] ", "[!] ", "[!!] ", "[#] "};
FILE* stream = stdout;
FILE *stream = stdout;
switch (level) {
case ERR:

View file

@ -107,6 +107,6 @@ uint32_t uart_get_speed(const serial_port sp);
/* Reconfigure timeouts
*/
int uart_reconfigure_timeouts(serial_port sp, uint32_t value );
int uart_reconfigure_timeouts(serial_port sp, uint32_t value);
#endif // _UART_H_

View file

@ -73,7 +73,7 @@ struct timeval timeout = {
.tv_usec = UART_FPC_CLIENT_RX_TIMEOUT_MS * 1000
};
int uart_reconfigure_timeouts(serial_port sp, uint32_t value ) {
int uart_reconfigure_timeouts(serial_port sp, uint32_t value) {
timeout.tv_usec = value * 1000;
return PM3_SUCCESS;
}

View file

@ -49,7 +49,7 @@ typedef struct {
} serial_port_windows;
int uart_reconfigure_timeouts(serial_port sp, uint32_t value) {
serial_port_windows *spw;
spw = (serial_port_windows *)sp;
spw->ct.ReadIntervalTimeout = value;
@ -152,7 +152,7 @@ bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed) {
PurgeComm(spw->hPort, PURGE_RXABORT | PURGE_RXCLEAR);
if (result)
conn.uart_speed = uiPortSpeed;
return result;
}