2013-12-09 15:48:18 -08:00
|
|
|
package DDG::Goodie::GenerateMAC;
|
|
|
|
#generates a random network MAC address
|
|
|
|
|
|
|
|
use DDG::Goodie;
|
|
|
|
|
2013-12-16 20:32:50 -08:00
|
|
|
triggers startend => "generate mac addr",
|
|
|
|
"generate mac address",
|
|
|
|
"random mac addr",
|
|
|
|
"random mac address",;
|
2013-12-09 15:48:18 -08:00
|
|
|
|
|
|
|
zci answer_type => "MAC Address";
|
|
|
|
zci is_cached => 0;
|
|
|
|
|
2014-01-13 14:50:33 -08:00
|
|
|
primary_example_queries 'please generate mac address';
|
2013-12-09 15:48:18 -08:00
|
|
|
description 'generates a MAC address';
|
|
|
|
name "GenerateMAC";
|
|
|
|
|
2013-12-09 16:10:06 -08:00
|
|
|
attribution github => [ 'https://github.com/UnGround', 'Charlie Belmer' ],
|
2013-12-16 20:32:50 -08:00
|
|
|
web => ['http://www.charliebelmer.com','Charlie Belmer'];
|
2013-12-09 15:48:18 -08:00
|
|
|
|
|
|
|
handle remainder => sub {
|
|
|
|
my $address = join(':', map {sprintf '%0.2X', rand(255)}(1..6));
|
2014-01-13 14:50:33 -08:00
|
|
|
|
|
|
|
my $text_response = "Here's a random MAC address: $address";
|
2014-03-25 08:25:53 -07:00
|
|
|
my $html_response = "<i>Here's a random MAC address: </i>$address";
|
2014-01-13 14:50:33 -08:00
|
|
|
return $text_response, html => $html_response;
|
2013-12-09 15:48:18 -08:00
|
|
|
};
|
|
|
|
|
2014-03-25 08:25:53 -07:00
|
|
|
1;
|