From 45c556a3bdb0496ea130103d6d3e084a869e8f7f Mon Sep 17 00:00:00 2001 From: Ryan Voots Date: Tue, 3 Nov 2015 18:46:27 -0500 Subject: [PATCH] Upgrade to 5.22, lie about our OS, and lie about the user agent so fox news works --- Makefile.PL | 5 +++++ bin/bb3 | 2 +- bin/evalserver | 2 +- lib/eval.pl | 20 ++++++++++++++++---- plugins/get.pm | 2 +- plugins/oeis.pm | 2 +- plugins/perldoc.pm | 1 - 7 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index e521358..5242109 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -65,4 +65,9 @@ requires 'JSON::XS' => 0; requires 'JSON::MaybeXS' => 0; requires 'Cpanel::JSON::XS' => 0; +requires 'JavaScript::V8::Context' => 0; +requires 'LWP::Protocol::https' => 0; +requires 'Text::Soundex' => 0; + + WriteAll; diff --git a/bin/bb3 b/bin/bb3 index 32a15c8..d0e69f9 100755 --- a/bin/bb3 +++ b/bin/bb3 @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use POSIX qw/setsid/; use Getopt::Std; diff --git a/bin/evalserver b/bin/evalserver index d1334b3..f3e2d2a 100755 --- a/bin/evalserver +++ b/bin/evalserver @@ -1,4 +1,4 @@ -#!/home/ryan/perl5/perlbrew/perls/perl-5.21.11/bin/perl +#!/home/ryan/perl5/perlbrew/perls/perl-5.22.0/bin/perl #use local::lib; # Guess we're being activated inside bin/, so go up a directory. diff --git a/lib/eval.pl b/lib/eval.pl index bf2fc9d..f22195e 100755 --- a/lib/eval.pl +++ b/lib/eval.pl @@ -67,7 +67,11 @@ no warnings; # deparse output being much longer than it should be. sub deparse_perl_code { my( $code ) = @_; - my $sub = eval "no strict; no warnings; no charnames; use $]; sub{ $code\n }"; + my $sub; + { + no strict; no warnings; no charnames; + $sub = eval "use $]; sub{ $code\n }"; + } if( $@ ) { print STDOUT "Error: $@"; return } my $dp = B::Deparse->new("-p", "-q", "-x7"); @@ -187,7 +191,7 @@ use Storable qw/nfreeze/; nfreeze([]); #Preload Nfreeze since it's loaded on dem my $kilo = 1024; my $meg = $kilo * $kilo; - my $limit = 512 * $meg; + my $limit = 768 * $meg; # clobber stdout before we set rlimits. otherwise we can't do anything STDOUT @@ -276,8 +280,16 @@ use Storable qw/nfreeze/; nfreeze([]); #Preload Nfreeze since it's loaded on dem local $_; - $code = "no strict; no warnings; package main; use $]; use feature qw/postderef refaliasing lexical_subs postderef_qq signatures/; $code"; - my $ret = eval $code; + my $ret; + + my @os = qw/aix bsdos darwin dynixptx freebsd haiku linux hpux irix next openbsd dec_osf svr4 sco_sv unicos unicosmk solaris sunos MSWin32 MSWin16 MSWin63 dos os2 cygwin VMS vos os390 os400 posix-bc riscos amigaos/; + + { + local $^O = $os[rand()*@os]; + no strict; no warnings; package main; + $code = "use $]; use feature qw/postderef refaliasing lexical_subs postderef_qq signatures/; $code"; + $ret = eval $code; + } local $Data::Dumper::Terse = 1; local $Data::Dumper::Quotekeys = 0; diff --git a/plugins/get.pm b/plugins/get.pm index 63457d0..e55d82f 100644 --- a/plugins/get.pm +++ b/plugins/get.pm @@ -5,7 +5,7 @@ use HTML::TreeBuilder::XPath; sub { my( $said ) = @_; - my $ua = LWP::UserAgent->new( agent => "BB3WebAgent! (mozilla)" ); + my $ua = LWP::UserAgent->new( agent => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36" ); my $url; if( $said->{body} =~ s{(http://\S+)\s*}{} ) { diff --git a/plugins/oeis.pm b/plugins/oeis.pm index c54dc6c..67d753c 100644 --- a/plugins/oeis.pm +++ b/plugins/oeis.pm @@ -4,7 +4,7 @@ use warnings; use strict; use CGI; use LWP::Simple; -use WWW::Shorten 'Metamark'; +use WWW::Shorten 'TinyURL'; sub { my($said) = @_; diff --git a/plugins/perldoc.pm b/plugins/perldoc.pm index 72499cb..94b3308 100644 --- a/plugins/perldoc.pm +++ b/plugins/perldoc.pm @@ -1,4 +1,3 @@ -use WWW::Shorten 'Metamark'; use URI::Encode qw(uri_encode); no warnings 'void';