#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use LWP::Protocol::socks; my $line = '='x80 . "\n"; my $ua = LWP::UserAgent->new(ssl_opts => {verify_hostname => 1}); $ua->timeout(60); $ua->proxy(['http','https'],'socks://127.0.0.1:9150/'); $ua->default_header('User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0'); $ua->default_header('Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'); $ua->default_header('Accept-Encoding' => 'gzip, deflate'); $ua->default_header('Accept-Language' => 'en-US,en;q=0.5'); $ua->default_header('Connection' => 'keep-alive'); $ua->default_header('Upgrade-Insecure-Requests' => '1'); $ua->default_header('Cache-Control' => 'no-cache'); $ua->default_header('Pragma' => 'no-cache'); $ua->add_handler( "request_send", sub {print $line;shift->dump; return } ); $ua->add_handler( "response_done", sub {print $line;shift->dump; return } ); my $response = $ua->get('https://www.cloudflare.com'); $response->{_content} = $response->decoded_content; print $line; print $response->{_request}->as_string,"\n\n"; print $line; print $response->as_string,"\n\n";