-
Notifications
You must be signed in to change notification settings - Fork 1
/
psis-cert
executable file
·37 lines (37 loc) · 1 KB
/
psis-cert
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
#!/bin/bash
ORIGEN="$*"
if [ -z "$ORIGEN" ]; then
ORIGEN=-
fi
#IFS="\0"
for FILE in $ORIGEN; do
if [ $# -gt 1 ]; then
echo "$FILE:"
fi
# url: http://testvalidacio.catcert.cat/psiswebclient/verifyCert.do
# param: certBase64 buit
# param: certFile fitxer amb Content-Type: application/x-x509-ca-cert
curl --silent --form "certBase64=" --form "certFile=@$FILE;application/x-x509-ca-cert" http://testvalidacio.catcert.cat/psiswebclient/verifyCert.do |
#cat psis-example.html |
# lynx -force_html -dump -stdin |
iconv -f 'ISO-8859-1' |
perl -e '
my $fu = join("", <>);
while($fu =~ /<tr[^>]*>(.*?)<\/tr[^>]*>/gsi) {
$line=$1;
$output="";
while($line =~ /<td.*?>(.*?)<\/td.*?>/gsi) {
$content = $1;
$content =~ s/<[^>]*>//gs;
$output="$output-$content";
};
$output =~ s/^[ \t\r\n-]*(.*)[ \t\r\n-]*$/\1/gm;
if(length($output) > 0 &&
! ($output eq "Camp-Valor") &&
! ($output eq " -Enrere") &&
! ($output eq " -Inici")) {
print "$output\n";
}
}'
done
echo