-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SetKey request #126
Comments
In which format do you want to pass the key? I think something like
Another - much simpler - idea would be to hard-code the offsets and thus suppose that the user separates the parameters only with one whitespace. I also suppose that you have meant Commands.c instead of .h? Another very important thing is that you have declared your function in CommandLine.c as ExecParamFunc. |
The format for passing the key is not important for me. Since it is a quick and dirty code, I can go for hard-coding the offsets, and I don't see any problem using strtok.
Yes
Actually, it is declared as ".SetFunc = CommandSetKey,". Right now, the command looks like: KEY=00AA11223344@15@1. My question is regarding the Sector value that must be set. |
If you want to use sscanf, this is from another project of mine that stems from the same original CommandLine sources. The command syntax here is
|
@skuep Thanks for the suggestion. I think it's actually a better approach. @geo-rg I already looked at the suggested lines in Application/MifareClassic.c. I think my problem is still on the parsing and setting the function parameters. I am now trying to debug the code, but I can't get any output from printf inside my functions. Ultimately, I need to call the function from Software/chamlog.py. So again, I looked for something similar, which is the setUID command. The problem is that even this function (called in chamlog.py with chameleon.cmdUID("99999999") ) returns an error (below). The UID is set, but the python script halts. Can you reproduce the issue?
Thanks |
SetKey now works, thanks for the help. Regarding the python command, maybe I am calling it wrong? Right now i am bypassing the error with try/except:pass, but it would be nice to see a response. |
Closing this, as SetKey now works and setUID in not related to this topic. |
Hi,
I am doing a project which requires to change the keys on the go. Taking the SetUid command as an example, I made the SetKey function which should be something like this:
void MifareClassicSetKey( uint8_t Key[6], uint8_t Sector, bool Auth)
{
uint8_t SectorAddress = Sector & MEM_SECTOR_ADDR_MASK;
uint16_t KeyAddress;
}`
The parsing is made in Commands.h with strtok:
CommandStatusIdType CommandSetKey(char* OutMessage, const char* InParam)
{
uint8_t KeyBuffer[COMMAND_KEY_BUFSIZE];
ApplicationReset();
char *input = InParam;
char *token = strtok(input, "@");
uint8_t *token1 = atoi(strtok(NULL, "@"));
uint8_t token2 = atoi(strtok(NULL, "@"));
....
The problem is that this functions only change the key A form sector 0, no matter which parameters I enter. Any help would be appreciated.
The text was updated successfully, but these errors were encountered: