%# 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) { <& /Elements/TitleBoxStart, title => loc("Current [_1]: #[_2]", $TicketType, $ticket), color=> "#993333" &> <& /Elements/TicketList, Query => "id = ".$TicketObj->id, Format => $Format, &>
<& /Elements/TitleBoxEnd &>
% } % unless ( $ARGS{'HideResults'}) {
<& /Elements/TitleBoxStart, title => loc('Incidents: [_1]', $q) &> <& /RTIR/Elements/IncidentSummary, Type => $TicketType, ticket => $ticket, q => $q &> <& /Elements/TitleBoxEnd &>
<& /Elements/TitleBoxStart, title => loc('Incident Reports: [_1]', $q), color=> "#336633"&> <& /RTIR/Elements/ChildSummary, Queue => 'Incident Reports', Type => $TicketType, ticket => $ticket, lookuptype => $type, q => $q &> <& /Elements/TitleBoxEnd&>
<& /Elements/TitleBoxStart, title => loc('Investigations: [_1]', $q), color=> "#336633" &> <& /RTIR/Elements/ChildSummary, Queue => 'Investigations', Type => $TicketType, ticket => $ticket, lookuptype => $type, q => $q &> <& /Elements/TitleBoxEnd &>
<& /Elements/TitleBoxStart, title => loc('Blocks: [_1]', $q), color=> "#336633" &> <& /RTIR/Elements/ChildSummary, Queue => 'Blocks', Type => $TicketType, ticket => $ticket, lookuptype => $type, q => $q &> <& /Elements/TitleBoxEnd &>
% }

Look Up Information

>
WHOIS: at
Traceroute to:

% if ($q) {

WHOIS Results

% if ($TicketObj && $TicketObj->QueueObj->Name eq 'Incidents') {
Id%>> % } % } % if ($error){ <%$error%> % } % 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( '/RTIR/Elements/MakeClicky', ticket => $TicketObj, url_params => "ticket=".$ticket."&server=$server", content => \$content); % if ($content =~ /Requestorbox/ig) { % $DoInvestigate = 1; % }
<%$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( '/RTIR/Elements/MakeClicky', ticket => $TicketObj, url_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> my $current_subtab; my $TicketType; my $TicketObj; my $DoInvestigate; # {{{ Set up the whois query if (!$server) { foreach my $s (sort keys %$servers) { # just pick the first one if (ref($servers->{$s}) eq 'HASH') { $server = $servers->{$s}->{'Host'} unless ($server); } else { $server = $servers->{$s} unless ($server); } last; } } 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); 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 ($RT::RTIR_OldestRelatedTickets) { $max_age = 0 - $RT::RTIR_OldestRelatedTickets; } else { $max_age = -60; } my $now = RT::Date->new($session{'CurrentUser'}); $now->SetToNow(); $now->AddDays($max_age); # Init a new search $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} ); if ($q) { $current_subtab = 'RTIR/Tools/Lookup.html?q='.$q."&server=".$server; my ( $val, $msg ) = $session{'tickets'}->FromSQL( "( ContentType = 'text/plain' " . "OR ContentType = 'text' " . "OR ContentType = 'text/html' )" . " AND Content LIKE '$q' " . " AND TransactionDate > '" . $now->ISO . "'" ); } if ($ticket) { ($TicketType, undef) = $m->comp("/RTIR/Elements/Type", Ticket => $ticket); $TicketObj = LoadTicket($ticket); } my $Format = $RT::RTIRSearchResultFormats->{$TicketType . 'Default'}; <%args> $servers => $RT::whois $server => undef $handparse => 1 $q => undef $type => undef $ticket => undef