-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkosquery
executable file
·44 lines (35 loc) · 927 Bytes
/
kosquery
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/perl -w
#
# Small program to do an encryption key query on the online services.
use strict;
use Teambox::KNP;
use Data::Dumper;
my $key;
my $knp;
my $r;
my $email;
my $i;
if (scalar(@ARGV) == 0) {
print STDERR "kosquery expects a set of email address on the command line.";
}
# Connect to the KNP.
$knp = KNP::new("eks.teambox.co", 443, 2, 1);
# This program expects to see a set of address on the command line.
$r = $knp->KNP_CMD_GET_ENC_KEY(nb_address => scalar(@ARGV),
address_array => \@ARGV);
if ($r->{ok} != 1) {
print STDERR "Error querying the server for encryption keys.\n";
exit(1);
}
print STDOUT "Results:\n";
# Loop through keys.
for ($i = 0; $i < $r->{nb_key}; $i++) {
if (length($r->{key_array}[$i]) > 0) {
print STDOUT "\t" . $ARGV[$i] . ": Ok.\n";
}
else {
print STDOUT "\t" . $ARGV[$i] . ": Not found.\n";
}
}
$knp->close();
exit(0);