Created
March 1, 2018 14:11
-
-
Save Yetangitu/83fc77acf3d381a32c40a8f89f7354a1 to your computer and use it in GitHub Desktop.
Random domain name generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -a ADJECTIVE | |
declare -a CRITTER | |
ADJECTIVE=(white red blue pink green brown dark light big small tiny earth glass air) | |
# or, for more variation, feed it a list of adjectives from a file, one word per line. | |
# the same could be done for the CRITTER array | |
#ADJECTIVE=($(cat /home/frank/adjectives)) | |
CRITTER=(frog hound fish lizard gator moose monkey whale hippo fox bird weasel owl cow pig hog donkey duck executive manager lawyer accountant) | |
COMPANY=${ADJECTIVE[$(($RANDOM % ${#ADJECTIVE[*]}))]^}${CRITTER[$(($RANDOM % ${#CRITTER[*]}))]^} | |
dotcom=$(whois $COMPANY.com|sed -e ':a;N;$!ba;s/.*detailed information.\n\n//;s/>>> Last update .*//') | |
dotnet=$(whois $COMPANY.net|sed -e ':a;N;$!ba;s/.*detailed information.\n\n//;s/>>> Last update .*//') | |
dotinfo=$(whois $COMPANY.info|sed -e ':a;N;$!ba;s/.*abide by this policy//;s/UTC <<<.*//') | |
function corplink () { | |
echo $2|egrep -q 'NOT FOUND|No match for' | |
if [ $? -gt 0 ]; then echo "<a target="_CORPORATE" href='http://$1'>$1</a>"; else echo $1;fi | |
} | |
function corpcolour () { | |
echo $1|egrep -q 'NOT FOUND|No match for' | |
if [ $? -gt 0 ]; then echo white;else echo '#EEE';fi | |
} | |
corplinkcom=$(corplink "$COMPANY.com" "$dotcom") | |
corplinknet=$(corplink "$COMPANY.net" "$dotnet") | |
corplinkinfo=$(corplink "$COMPANY.info" "$dotinfo") | |
corpcolourcom=$(corpcolour "$dotcom") | |
corpcolournet=$(corpcolour "$dotnet") | |
corpcolourinfo=$(corpcolour "$dotinfo") | |
cat << EOF | |
Content-Type: text/html | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="/css/corporate.css"> | |
<title>$COMPANY inc.</title> | |
</head> | |
<body> | |
<div align="center" valign="middle">Welcome to <span id="corpid">$COMPANY</span> inc.</div> | |
<hr> | |
<table width="100%" id="factbox"> | |
<tr><td class="corpname">$corplinkcom</td><td class="corpinfo" style="background-color: $corpcolourcom;"><pre>$dotcom</pre></td></tr> | |
<tr><td class="corpname">$corplinknet</td><td class="corpinfo" style="background-color: $corpcolournet;"><pre>$dotnet</pre></td></tr> | |
<tr><td class="corpname">$corplinkinfo</td><td class="corpinfo" style="background-color: $corpcolourinfo;"><pre>$dotinfo</pre></td></tr> | |
</table> | |
</body> | |
</html> | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment