There are quite complete python utilities already out there as part
of Benoit Micuhau's 'card' python library. They support plenty of
SIM, UICC and USIM related bits. Let's use them rather than re-
inventing the wheel here.
the modifications can be found in https://github.com/mitshell/card/pull/2
and I wouuld hope that once Benoit has merged this we can remove the
local copy here and simply rely on pypi pulling it from the repo.
If the user submints a wrong ADM1 key with the commandline, the
authentication will fail. However, by the output of the program
it mey not be clear to the user that the reason for the failure
was a wrong ADM1 key. The user might try the same command with
the same parameters a few time and lock down the card.
This commit fixes that by failing gracefully with a very clear
error message. Furthermore, if a decreased authentication counter
is detected, no further authentication attempts will be made
until the user supplies the option -f (--force).