Exemplo n.º 1
0
// Simulation is still not working very good
int CmdHF15Sim(const char *Cmd)
{
	char cmdp = param_getchar(Cmd, 0);
	uint8_t uid[8] = {0x00};

	//E0 16 24 00 00 00 00 00
	if (cmdp == 'h' || cmdp == 'H') {
		PrintAndLog("Usage:  hf 15 sim <UID>");
		PrintAndLog("");
		PrintAndLog("     sample: hf 15 sim E016240000000000");
		return 0;
	}

	if (param_gethex(Cmd, 0, uid, 16)) {
		PrintAndLog("UID must include 16 HEX symbols");
		return 0;
	}
	
	PrintAndLog("Starting simulating UID %02X %02X %02X %02X %02X %02X %02X %02X",
			uid[0],uid[1],uid[2],uid[3],uid[4], uid[5], uid[6], uid[7]);

	UsbCommand c = {CMD_SIMTAG_ISO_15693, {0, 0, 0}};
	memcpy(c.d.asBytes,uid,8);
	
	SendCommand(&c);
	return 0;
}
Exemplo n.º 2
0
int CmdLFPCF7931Config(const char *Cmd) {

    uint8_t ctmp = param_getchar(Cmd, 0);
    if ( ctmp == 0) return pcf7931_printConfig();
    if ( ctmp == 'H' || ctmp == 'h' ) return usage_pcf7931_config();
    if ( ctmp == 'R' || ctmp == 'r' ) return pcf7931_resetConfig();

    if ( param_gethex(Cmd, 0, configPcf.Pwd, 14) ) return usage_pcf7931_config();

    configPcf.InitDelay = (param_get32ex(Cmd,1,0,10) & 0xFFFF);
    configPcf.OffsetWidth = (int)(param_get32ex(Cmd,2,0,10) & 0xFFFF);
    configPcf.OffsetPosition = (int)(param_get32ex(Cmd,3,0,10) & 0xFFFF);

    pcf7931_printConfig();
    return 0;
}
Exemplo n.º 3
0
// Simulation is still not working very good
// helptext
int CmdHF15Sim(const char *Cmd) {
	char cmdp = param_getchar(Cmd, 0);
	if (strlen(Cmd) < 1 || cmdp == 'h' || cmdp == 'H') return usage_15_sim();

	uint8_t uid[8] = {0,0,0,0,0,0,0,0};	
	if (param_gethex(Cmd, 0, uid, 16)) {
		PrintAndLogEx(NORMAL, "UID must include 16 HEX symbols");
		return 0;
	}
	
	PrintAndLogEx(NORMAL, "Starting simulating UID %s", sprint_hex(uid, sizeof(uid)) );

	UsbCommand c = {CMD_SIMTAG_ISO_15693, {0, 0, 0}};
	memcpy(c.d.asBytes, uid, 8);
	clearCommandBuffer();
	SendCommand(&c);
	return 0;
}
Exemplo n.º 4
0
int CmdLegicCalcCrc8(const char *Cmd){

	int len =  strlen(Cmd);	
	if ( len & 1 ) return usage_legic_calccrc8(); 
	
	// add 1 for null terminator.
	uint8_t *data = malloc(len+1);
	if ( data == NULL ) return 1;
		
	if (param_gethex(Cmd, 0, data, len )) {
		free(data);
		return usage_legic_calccrc8();	
	}
	
	uint32_t checksum =  CRC8Legic(data, len/2);	
	PrintAndLog("Bytes: %s || CRC8: %X", sprint_hex(data, len/2), checksum );
	free(data);
	return 0;
}