2013-12-09 15:48:18 -08:00
|
|
|
package DDG::Goodie::GenerateMAC;
|
2014-08-20 11:45:33 -07:00
|
|
|
# ABSTRACT: generates a random network MAC address
|
2013-12-09 15:48:18 -08:00
|
|
|
|
|
|
|
use DDG::Goodie;
|
|
|
|
|
2014-10-28 11:36:15 -07:00
|
|
|
triggers startend => "generate mac addr",
|
|
|
|
"generate mac address",
|
2014-03-25 13:25:58 -07:00
|
|
|
"random mac addr",
|
|
|
|
"random mac address",
|
|
|
|
"mac address generator",
|
|
|
|
"mac address random";
|
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";
|
|
|
|
|
2014-10-15 07:28:13 -07:00
|
|
|
attribution github => ['https://github.com/UnGround', 'Charlie Belmer'],
|
|
|
|
web => ['http://www.charliebelmer.com', 'Charlie Belmer'];
|
2013-12-09 15:48:18 -08:00
|
|
|
|
|
|
|
handle remainder => sub {
|
2014-10-15 07:28:13 -07:00
|
|
|
# Ensure rand is seeded for each process
|
|
|
|
srand();
|
2014-07-04 15:59:22 -07:00
|
|
|
|
2014-10-15 07:28:13 -07:00
|
|
|
my $address = join(':', map { sprintf '%0.2X', rand(255) } (1 .. 6));
|
2014-07-04 15:59:22 -07:00
|
|
|
|
2014-10-15 07:28:13 -07:00
|
|
|
return "Here's a random MAC address: $address",
|
|
|
|
structured_answer => {
|
|
|
|
input => [],
|
|
|
|
operation => 'random MAC address',
|
|
|
|
result => $address
|
|
|
|
};
|
2013-12-09 15:48:18 -08:00
|
|
|
};
|
|
|
|
|
2014-03-25 08:25:53 -07:00
|
|
|
1;
|