From 9e47587396d4bd6f25a7f6eb1892eff084185533 Mon Sep 17 00:00:00 2001 From: William Heimbigner Date: Thu, 24 Apr 2014 06:28:42 +0400 Subject: Fixed the urlcrunch detection rule --- modules/event.pl | 18 +++++++++--------- modules/inspect.pl | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'modules') diff --git a/modules/event.pl b/modules/event.pl index d3e3fa5..4978432 100644 --- a/modules/event.pl +++ b/modules/event.pl @@ -338,15 +338,15 @@ sub on_public $::sc{lc $event->{to}->[0]}{users}{lc $event->{nick}}{msgtime} = time; $::log->logg( $event ); $::db->logg( $event ); -# if ($event->{args}->[0] =~ /(https?:\/\/bitly.com\/\w+)|(https?:\/\/bit.ly\/\w+)|(https?:\/\/j.mp\/\w+)/i) { -# my $reqid = $::async->add( HTTP::Request->new( GET => $1 ) ); -# $::httpRequests{$reqid} = $event; -# my ($response, $id) = $::async->wait_for_next_response( 1 ); -# if (defined($response)) { -# on_httpResponse($conn, $id, $response); -# } -# else { $conn->schedule( 1, sub { checkHTTP($conn); } ); } -# } + if ($event->{args}->[0] =~ /(https?:\/\/bitly.com\/\w+|https?:\/\/bit.ly\/\w+|https?:\/\/j.mp\/\w+)/i) { + my $reqid = $::async->add( HTTP::Request->new( GET => $1 ) ); + $::httpRequests{$reqid} = $event; + my ($response, $id) = $::async->wait_for_next_response( 1 ); + if (defined($response)) { + on_httpResponse($conn, $id, $response); + } + else { $conn->schedule( 1, sub { checkHTTP($conn); } ); } + } $::inspector->inspect( $conn, $event ); $::commander->command( $conn, $event ); } diff --git a/modules/inspect.pl b/modules/inspect.pl index f5914cb..5c7ce73 100644 --- a/modules/inspect.pl +++ b/modules/inspect.pl @@ -44,7 +44,6 @@ sub inspect { next unless ( grep { $event->{type} eq $_ } split(/[,:; ]+/, $aonx{$id}{type}) ); next if ($aonx{$id}{class} eq 'dnsbl') && ($event->{host} =~ /(fastwebnet\.it|fastres\.net)$/); #this is a bad hack if (defined($response)) { - print Dumper($response); if ($aonx{$id}{class} ne 'urlcrunch') { next; } #don't run our regular checks if this is being called from a URL checking function else { $xresult = $::classes->check($aonx{$id}{class}, $aonx{$id}, $id, $event, $chan, $response); } } -- cgit v1.2.3