2015-03-04 19:39:31 -08:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
2015-10-01 08:11:47 -07:00
|
|
|
use URI::Escape;
|
2015-03-04 19:39:31 -08:00
|
|
|
|
|
|
|
zci answer_type => 'onion_address';
|
2015-10-01 08:11:47 -07:00
|
|
|
zci is_cached => 1;
|
|
|
|
|
2015-03-04 19:39:31 -08:00
|
|
|
|
|
|
|
ddg_goodie_test(
|
|
|
|
[
|
|
|
|
'DDG::Goodie::OnionAddress'
|
|
|
|
],
|
2015-10-01 08:11:47 -07:00
|
|
|
|
2015-03-04 19:39:31 -08:00
|
|
|
'https://3g2upl4pq6kufc4m.onion' =>
|
2015-10-01 08:11:47 -07:00
|
|
|
test_zci(
|
|
|
|
'3g2upl4pq6kufc4m.onion',
|
|
|
|
make_structured_answer(
|
|
|
|
"3g2upl4pq6kufc4m.onion",
|
|
|
|
"Onion/Hidden service",
|
|
|
|
"You are trying to reach an onion/hidden service. To access 3g2upl4pq6kufc4m.onion via web you will have to use the Tor Browser.",
|
|
|
|
"https://www.torproject.org/projects/torbrowser.html.en#downloads",
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
2015-03-04 19:39:31 -08:00
|
|
|
'How to access https://3g2upl4pq6kufc4m.onion?' =>
|
2015-10-01 08:11:47 -07:00
|
|
|
test_zci(
|
|
|
|
'3g2upl4pq6kufc4m.onion',
|
|
|
|
make_structured_answer(
|
|
|
|
"3g2upl4pq6kufc4m.onion",
|
|
|
|
"Onion/Hidden service",
|
|
|
|
"You are trying to reach an onion/hidden service. To access 3g2upl4pq6kufc4m.onion via web you will have to use the Tor Browser.",
|
|
|
|
"https://www.torproject.org/projects/torbrowser.html.en#downloads",
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
|
|
|
'3g2upl4pq6kufc4m.onion/?q=dont+track+us' =>
|
|
|
|
test_zci(
|
|
|
|
'3g2upl4pq6kufc4m.onion',
|
|
|
|
make_structured_answer(
|
|
|
|
"3g2upl4pq6kufc4m.onion",
|
|
|
|
"Onion/Hidden service",
|
|
|
|
"You are trying to reach an onion/hidden service. To access 3g2upl4pq6kufc4m.onion via web you will have to use the Tor Browser.",
|
|
|
|
"https://www.torproject.org/projects/torbrowser.html.en#downloads",
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
2015-03-04 19:39:31 -08:00
|
|
|
'How to access https://3g2upl4pq6kufc4m.onion/privacy?' =>
|
2015-10-01 08:11:47 -07:00
|
|
|
test_zci(
|
|
|
|
'3g2upl4pq6kufc4m.onion',
|
|
|
|
make_structured_answer(
|
|
|
|
"3g2upl4pq6kufc4m.onion",
|
|
|
|
"Onion/Hidden service",
|
|
|
|
"You are trying to reach an onion/hidden service. To access 3g2upl4pq6kufc4m.onion via web you will have to use the Tor Browser.",
|
|
|
|
"https://www.torproject.org/projects/torbrowser.html.en#downloads",
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
2015-03-06 11:24:24 -08:00
|
|
|
'How to access 3g2upl4pq6kufc4m.onion/anti-censorship/?' =>
|
2015-10-01 08:11:47 -07:00
|
|
|
test_zci(
|
|
|
|
'3g2upl4pq6kufc4m.onion',
|
|
|
|
make_structured_answer(
|
|
|
|
"3g2upl4pq6kufc4m.onion",
|
|
|
|
"Onion/Hidden service",
|
|
|
|
"You are trying to reach an onion/hidden service. To access 3g2upl4pq6kufc4m.onion via web you will have to use the Tor Browser.",
|
|
|
|
"https://www.torproject.org/projects/torbrowser.html.en#downloads",
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
2016-02-21 05:14:57 -08:00
|
|
|
'http://3g2upl4pq6kufc4m.onion.link' =>
|
2015-10-01 08:11:47 -07:00
|
|
|
test_zci(
|
|
|
|
'3g2upl4pq6kufc4m.onion',
|
|
|
|
make_structured_answer(
|
|
|
|
"3g2upl4pq6kufc4m.onion",
|
|
|
|
"Onion/Hidden service",
|
|
|
|
"You are trying to reach an onion/hidden service. To access 3g2upl4pq6kufc4m.onion via web you will have to use the Tor Browser.",
|
|
|
|
"https://www.torproject.org/projects/torbrowser.html.en#downloads",
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
|
|
|
'https://0123456789abcdef.onion' =>
|
|
|
|
test_zci(
|
|
|
|
'0123456789abcdef.onion',
|
|
|
|
make_structured_answer(
|
|
|
|
"0123456789abcdef.onion",
|
|
|
|
"Onion/Hidden service",
|
|
|
|
"You are trying to reach an onion/hidden service. To access 0123456789abcdef.onion via web you will have to use the Tor Browser.",
|
|
|
|
"https://www.torproject.org/projects/torbrowser.html.en#downloads",
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
2015-03-06 11:24:24 -08:00
|
|
|
'0123456789abcdef.onion:123/' =>
|
2015-10-01 08:11:47 -07:00
|
|
|
test_zci(
|
|
|
|
'0123456789abcdef.onion',
|
|
|
|
make_structured_answer(
|
|
|
|
"0123456789abcdef.onion",
|
|
|
|
"Onion/Hidden service",
|
|
|
|
"You are trying to reach an onion/hidden service. To access 0123456789abcdef.onion via web you will have to use the Tor Browser.",
|
|
|
|
"https://www.torproject.org/projects/torbrowser.html.en#downloads",
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
2015-03-04 19:39:31 -08:00
|
|
|
'https://0123456789abcdef.onion:5000/about-us' =>
|
2015-10-01 08:11:47 -07:00
|
|
|
test_zci(
|
|
|
|
'0123456789abcdef.onion',
|
|
|
|
make_structured_answer(
|
|
|
|
"0123456789abcdef.onion",
|
|
|
|
"Onion/Hidden service",
|
|
|
|
"You are trying to reach an onion/hidden service. To access 0123456789abcdef.onion via web you will have to use the Tor Browser.",
|
|
|
|
"https://www.torproject.org/projects/torbrowser.html.en#downloads",
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
2015-03-04 19:39:31 -08:00
|
|
|
'http://0000000000000000.onion/' =>
|
2015-10-01 08:11:47 -07:00
|
|
|
test_zci(
|
|
|
|
'0000000000000000.onion',
|
|
|
|
make_structured_answer(
|
|
|
|
"0000000000000000.onion",
|
|
|
|
"Onion/Hidden service",
|
|
|
|
"You are trying to reach an onion/hidden service. To access 0000000000000000.onion via web you will have to use the Tor Browser.",
|
|
|
|
"https://www.torproject.org/projects/torbrowser.html.en#downloads",
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
2015-03-06 11:24:24 -08:00
|
|
|
'what is aaaaaaaaaaaaaaaa.onion?' =>
|
2015-10-01 08:11:47 -07:00
|
|
|
test_zci(
|
|
|
|
'aaaaaaaaaaaaaaaa.onion',
|
|
|
|
make_structured_answer(
|
|
|
|
"aaaaaaaaaaaaaaaa.onion",
|
|
|
|
"Onion/Hidden service",
|
|
|
|
"You are trying to reach an onion/hidden service. To access aaaaaaaaaaaaaaaa.onion via web you will have to use the Tor Browser.",
|
|
|
|
"https://www.torproject.org/projects/torbrowser.html.en#downloads",
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
|
|
|
'ftp://3g2upl4pq6kufc4m.onion' => undef,
|
|
|
|
'ssh://3g2upl4pq6kufc4m.onion' => undef,
|
|
|
|
'irc://3g2upl4pq6kufc4m.onion' => undef,
|
|
|
|
|
2015-03-04 19:39:31 -08:00
|
|
|
);
|
|
|
|
|
2015-10-01 08:11:47 -07:00
|
|
|
sub make_structured_answer {
|
|
|
|
my ($onion_name) = @_;
|
|
|
|
|
|
|
|
return structured_answer => {
|
|
|
|
id => 'onion_address',
|
|
|
|
name => 'OnionAddress',
|
|
|
|
data => {
|
|
|
|
title => $onion_name,
|
|
|
|
subtitle => 'Onion/Hidden service',
|
|
|
|
description => 'You are trying to reach an onion/hidden service. To access '.$onion_name.' via web you will have to use the Tor Browser.'
|
|
|
|
},
|
|
|
|
meta => {
|
|
|
|
sourceName => "Tor Project",
|
|
|
|
sourceUrl => "https://www.torproject.org/projects/torbrowser.html.en#downloads"
|
|
|
|
},
|
|
|
|
templates => {
|
|
|
|
group => 'text',
|
|
|
|
options => {
|
|
|
|
moreAt => 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
done_testing;
|