I would like to run the Thales NC (Perform Diagnostics) host command directly from a linux / cygwin console.
How can this be done?
I would like to run the Thales NC (Perform Diagnostics) host command directly from a linux / cygwin console.
How can this be done?
Assuming you have xxd and nc (netcat) installed, you can peform the following:
$ echo '0006303030304e43' | xxd -r -p | nc localhost 9998
!0000ND007B44AC1DDEE2A94B0007-E000
The command 0006303030304e43 is broken down as follows:
!0000ND007B44AC1DDEE2A94B0007-E000 - this is the response from the HSM.
If you don't have xxd, you can use Perl:
echo '0006303030304e43' | perl -e 'print pack "H*", <STDIN>' | nc localhost 9998
UPDATE 1: An even simpler solution:
echo -ne '\x00\x06\x30\x30\x30\x30\x4e\x43' | nc localhost 9998
UPDATE 2: A pure perl solution:
perl -e 'use IO::Socket::INET;
my $sock = new IO::Socket::INET(PeerAddr=>"localhost:9998") or die;
$sock->send(pack "H*","0006303030304e43");
$sock->recv($data, 1024); print $data;'
(just copy and paste into your bash prompt)