%# BEGIN LICENSE BLOCK %# %# Copyright (c) 1996-2002 Jesse Vincent %# %# (Except where explictly superceded by other copyright notices) %# %# This work is made available to you under the terms of Version 2 of %# the GNU General Public License. A copy of that license should have %# been provided with this software, but in any event can be snarfed %# from www.gnu.org %# %# This work is distributed in the hope that it will be useful, but %# WITHOUT ANY WARRANTY; without even the implied warranty of %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU %# General Public License for more details. %# %# %# Unless otherwise specified, all modifications, corrections or %# extensions to this work which alter its source code become the %# property of Best Practical Solutions, LLC when submitted for %# inclusion in the work. %# %# %# END LICENSE BLOCK <& /RTIR/Elements/Header, Title => $title &> <& /RTIR/Tools/Elements/Tabs, current_toptab => 'RTIR/Tools/Lookup.html', current_tab => 'RTIR/Tools/Lookup.html?NewSearch=1', current_subtab => $current_subtab, Title => $title, &> % if ( $ticket ) { <&| /Widgets/TitleBox, title => loc("Current [_1]: #[_2]", $TicketType, $ticket), color=> "#993333" &> <& /Elements/TicketList, Query => "id = $ticket", Format => $Format, ShowNavigation => 0 &> % } % unless ( $HideResults ) {
<&| /Widgets/TitleBox, title => loc('Incidents: [_1]', $q) &> <& /RTIR/Elements/IncidentSummary, Type => $TicketType, ticket => $ticket, lookuptype => $type, q => $q, &> <&| /Widgets/TitleBox, title => loc('Investigations: [_1]', $q) &> <& /RTIR/Elements/ChildSummary, Queue => 'Investigations', Type => $TicketType, ticket => $ticket, lookuptype => $type, q => $q, &>
<&| /Widgets/TitleBox, title => loc('Incident Reports: [_1]', $q) &> <& /RTIR/Elements/ChildSummary, Queue => 'Incident Reports', Type => $TicketType, ticket => $ticket, lookuptype => $type, q => $q, &> % unless ( RT->Config->Get('RTIR_DisableBlocksQueue') ) { <&| /Widgets/TitleBox, title => loc('Blocks: [_1]', $q) &> <& /RTIR/Elements/ChildSummary, Queue => 'Blocks', Type => $TicketType, ticket => $ticket, lookuptype => $type, q => $q, &> % }
% }

<&|/l&>Look Up Information

WHOIS: at
Traceroute to:

% if ( $q ) {

WHOIS Results

% if ( $TicketObj && $TicketType eq 'Incident' ) {
% } % } % if ( $error ) { <% $error %> % } <%PERL> my $DoInvestigate = 0; if ( $iterator ) { while ( my $obj = $iterator->next ) { my @lines_starting_with_space = grep /^(\s+)(\w+)/, $obj->content; if ( $handparse || $#lines_starting_with_space >= 4 ) { #we couldn't parse that. suck my $content = join "", $obj->content; $m->comp( '/Elements/MakeClicky', ticket => $TicketObj, lookup_params => "ticket=". $ticket ."&server=$server", content => \$content, ); $DoInvestigate = 1 if $content =~ /Requestorbox/ig;
<% $content |n %>

% } else { Structured RIPE whois data returned. Click here to manually parse this data.
Warnings <% $obj->warnings %>
errors <% $obj->errors %>
% foreach my $attribute ( $obj->attributes ) { % foreach my $value ( $obj->$attribute() ) { <%$attribute%>: % $m->comp('/Elements/MakeClicky', ticket => $TicketObj, lookup_params => "ticket=".$ticket, content => \$value); <% $value |n %>
% } % } % } % } % } %# Don't offer the option of Investigating to unless there are addresses % if ( $DoInvestigate ) { <& /Elements/Submit, Name => "InvestigateTo", Caption => loc("Investigate to selected addresses"), Label => loc("Investigate"), &> % }
<%INIT> unless ( $server ) { # just pick the first one ($server) = map ref $servers->{$_}? $servers->{$_}->{'Host'}: $servers->{$_}, (sort keys %$servers)[0]; } my $title = loc("Lookup '[_1]' using server [_2]", $q, $server); use Net::Whois::RIPE; my ($whois, $port) = split(/\s*:\s*/, $server, 2); $port = 43 unless ($port || '') =~ /^\d+$/; my $query = Net::Whois::RIPE->new( $whois, Port => $port, Debug => 1 ); my ($iterator, $error); if ( $query ) { $iterator = $query->query_iterator($q); } else { $error = loc( "Unable to connect to WHOIS server '[_1]'", $server); } my $max_age; if ( my $tmp = RT->Config->Get('RTIR_OldestRelatedTickets') ) { $max_age = 0 - $tmp; } else { $max_age = -60; } my $now = RT::Date->new( $session{'CurrentUser'} ); $now->SetToNow; $now->AddDays( $max_age ); $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} ); my $current_subtab = 'RTIR/Tools/Lookup.html'; if ( $q ) { $current_subtab .= '?'. $m->comp('/Elements/QueryString', q => $q, server => $server ); my $query; if ( $type eq 'ip' ) { $query = "CF.{_RTIR_IP} = '$q'" } else { $query = "( ContentType = 'text/plain' " . "OR ContentType = 'text' " . "OR ContentType = 'text/html' )" . " AND Content LIKE '$q'"; } $query = "( $query ) AND TransactionDate > '". $now->ISO ."'"; my ($val, $msg) = $session{'tickets'}->FromSQL( $query ); $RT::Logger->warning( $msg ) unless $val; } my ($TicketObj, $TicketType); if ( $ticket ) { $TicketObj = LoadTicket( $ticket ); $ticket = $ARGS{'ticket'} = $TicketObj->id; $TicketType = RT::IR::TicketType( Ticket => $TicketObj ); } my $Format = RT->Config->Get('RTIRSearchResultFormats')->{$TicketType . 'Default'}; <%ARGS> $servers => RT->Config->Get('whois') $server => undef $handparse => 1 $q => undef $type => undef $ticket => undef $HideResults => 0