1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use strict; use warnings; use 5.020; use LWP::UserAgent (); use Data::Dumper; my $ua = LWP::UserAgent->new(timeout => 10); $ua->ssl_opts( SSL_ca_file => 'X:\etc\ssl\certs\cacert.pem', verify_hostname => 1, ); $ua->agent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'); my $response = $ua->get('https://gwendragon.de'); if ($response->is_success) { print $response->decoded_content; } else { say $response->status_line; say Dumper $response; }
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
45
46
47
T:\>curl -v https://gwendragon.de/
* Host gwendragon.de:443 was resolved.
* IPv6: 2a01:4f8:130:63a2::2
* IPv4: 213.133.110.246
* Trying [2a01:4f8:130:63a2::2]:443...
* Trying 213.133.110.246:443...
* Connected to gwendragon.de (213.133.110.246) port 443
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
* ALPN: server accepted http/1.1
* using HTTP/1.x
> GET / HTTP/1.1
> Host: gwendragon.de
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
* schannel: remote party requests renegotiation
* schannel: renegotiating SSL/TLS connection
* schannel: SSL/TLS connection renegotiated
* schannel: remote party requests renegotiation
* schannel: renegotiating SSL/TLS connection
* schannel: SSL/TLS connection renegotiated
< HTTP/1.1 200 OK
< Date: Fri, 28 Jun 2024 09:07:30 GMT
< Server: Apache
< Strict-Transport-Security: max-age=15768000; includeSubDomains
< Upgrade: h2
< Connection: Upgrade
< Last-Modified: Sun, 19 May 2024 11:21:32 GMT
< ETag: "f70-618ccc96cb479"
< Accept-Ranges: bytes
< Content-Length: 3952
< Cache-Control: max-age=7200
< Expires: Fri, 28 Jun 2024 11:07:30 GMT
< Vary: Accept-Encoding
< X-Content-Type-Options: nosniff
< X-Frame-Options: sameorigin
< X-Powered-By: Perl
< X-Robots-Tag: noai, noimageai, noimageindex, noarchive, noodp
< Content-Security-Policy: script-src 'self'
< Referrer-Policy: no-referrer
< Permissions-Policy: interest-cohort=()
< Content-Type: text/html; charset=utf-8
<
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
.....
1
2
3
4
5
6
7
8
DEBUG: .../IO/Socket/SSL.pm:3020: new ctx 2719281884640
DEBUG: .../IO/Socket/SSL.pm:705: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:705: socket not yet connected
DEBUG: .../lib/Net/HTTPS.pm:67: local error: IO::Socket::IP configuration failed
DEBUG: .../IO/Socket/SSL.pm:3069: free ctx 2719281884640 open=2719281884640
DEBUG: .../IO/Socket/SSL.pm:3073: free ctx 2719281884640 callback
DEBUG: .../IO/Socket/SSL.pm:3080: OK free ctx 2719281884640
500 Can't connect to gwendragon.de:443 (Bad address)
1
2
3
4
5
6
7
8
T:\>nslookup gwendragon.de
Server: fritz.box
Address: fd**************
Nicht autorisierende Antwort:
Name: gwendragon.de
Addresses: 2a01:4f8:130:63a2::2
213.133.110.246
1 2 3
my $s = IO::Socket::INET->new("gwendragon.de:443") or die $!; # geht my $s = IO::Socket::SSL->new("gwendragon.de:443") or die $!; # geht nicht my $s = IO::Socket::SSL->new("google.de:443") or die $!; # geht
1
2
3
4
5
6
7
8
9
T:\>perl -E"use IO::Socket::SSL; use IO::Socket::SSL qw/debug3/; my $s = IO::Socket::SSL->new('gwendragon.de:443') or die $!"
DEBUG: .../IO/Socket/SSL.pm:3020: new ctx 1833333936592
DEBUG: .../IO/Socket/SSL.pm:705: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:705: socket not yet connected
DEBUG: .../lib/IO/Socket.pm:50: local error: IO::Socket::IP configuration failed
DEBUG: .../IO/Socket/SSL.pm:3069: free ctx 1833333936592 open=1833333936592
DEBUG: .../IO/Socket/SSL.pm:3073: free ctx 1833333936592 callback
DEBUG: .../IO/Socket/SSL.pm:3080: OK free ctx 1833333936592
Bad file descriptor at -e line 1.
1 2
IO::Socket::INET->new("google.de:443") or die $!; IO::Socket::SSL->new("google.de:443") or die $!;
QuotePlease be aware that with the IPv6 capable super classes, it will look first for the IPv6 address of a given hostname. If the resolver provides an IPv6 address, but the host cannot be reached by IPv6, there will be no automatic fallback to IPv4. To avoid these problems you can enforce IPv4 for a specific socket by using the Domain or Family option with the value AF_INET as described in IO::Socket::IP. Alternatively you can enforce IPv4 globally by loading IO::Socket::SSL with the option 'inet4', in which case it will use the IPv4 only class IO::Socket::INET as the super class
— https://metacpan.org/pod/IO::Socket::SSL#Descripti...
IO::Socket::SSL->new("gwendragon.de:443") or die $!; # died
1
2
3
4
1 Liste der URLs vom Server holen (sitemap.xml)
2 Über die Liste head-Requests feuern
3 im callback den http-status abfragen
4 Ergebnis in den Browser schreiben
1
2
3
4
5
6
7
8
test@debora:~$ lwp-request -USsed https://labs.gwendragon.de
GET https://labs.gwendragon.de
User-Agent: lwp-request/6.68 libwww-perl/6.68
500 Can't connect to labs.gwendragon.de:443 (Connection refused)
Content-Type: text/plain
Client-Date: Fri, 28 Jun 2024 11:49:11 GMT
Client-Warning: Internal response
1
2
3
4
5
6
7
8
T:\>lwp-request -USsed https://labs.gwendragon.de
GET https://labs.gwendragon.de
User-Agent: lwp-request/6.77 libwww-perl/6.77
500 Can't connect to labs.gwendragon.de:443 (Bad address)
Content-Type: text/plain
Client-Date: Fri, 28 Jun 2024 11:47:49 GMT
Client-Warning: Internal response