#!/bin/env perl
#
# Minimal and Scalable Passive DNS - Web interface
#
# Copyright (C) 2010-2012 Alexandre Dulaunoy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
use Mojolicious::Lite;
use Mojolicious::Static;
use PDNSq;
# Documentation browser under "/perldoc" (this plugin requires Perl 5.10)
plugin 'pod_renderer';
get '/l/(.query)' => sub {
my $self = shift;
my $q = $self->param('query');
my $ret = PDNS::Query::Query($q);
my $json = PDNS::Query::QueryJSON($q);
$self->render(template => 'index', q => $ret, query => $q, jq => $json);
};
post '/l' => sub {
my $self = shift;
my $q = $self->param('q');
my $ret = PDNS::Query::Query($q);
my $json = PDNS::Query::QueryJSON($q);
$self->render(template => 'index', q => $ret, query => $q, jq => $json);
};
get '/js/(.query)' => sub {
my $self = shift;
my $q = $self->param('query');
$self->render_static('static/'.$q);
};
get '/__history__.html' => sub {
my $self = shift;
$self->render_static('static/__history__.html');
};
get '/' => sub {
my $self = shift;
$self->render(template => 'main');
};
app->secret('You have to change it');
app->start;
__DATA__
@@ main.html.ep
% layout 'default';
% title 'Passive DNS';
Passive DNS interface
@@ index.html.ep
% layout 'default';
% title 'PDNS Lookup';