Skip to content

Commit

Permalink
Merge pull request #10 from bulbajackel/feature/UI
Browse files Browse the repository at this point in the history
WIP: UI Updates
  • Loading branch information
charlesabarnes authored Jul 25, 2017
2 parents 9bf0102 + 1b3cf0d commit 77cf244
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 62 deletions.
2 changes: 1 addition & 1 deletion getWhois.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
$query = $_GET['domain'];
$result = $whois->lookup($query);
echo "[\n";
echo json_encode($result, JSON_PRETTY_PRINT);
echo json_encode($result['rawdata'], JSON_PRETTY_PRINT);
echo "\n]";
?>
53 changes: 30 additions & 23 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,43 @@

</head>
<body>
<script>
$(document).ready(function(){
$("#domain").keyup(function(event){
if(event.keyCode == 13){
$("#submit").click();
}
});
});
</script>
<a href="https://github.com/bulbajackel/SPFtoolbox" class="github-corner" aria-label="View source on Github"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#44c0f0; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="#fff" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="#fff" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
<div class="container">
<div class="row" id="top-row">
Domain: <input type="text" name="domain" id="domain"><span id="txtHint" style="color: red;"></span><br>
<input type="button" onclick="callRoute(file.value)" value="Submit" id="submit"/>
<select id="file">
<option value="getTxt.php">SPF/TXT</option>
<option value="getA.php">IP</option>
<option value="getAAAA.php">IPV6</option>
<option value="getMx.php">Mx</option>
<option value="getWhois.php">Whois</option>
<option value="getHinfo.php">hinfo</option>
<option value="getAll.php">All</option>
</select>
<div class="col-md-12">
<H1 class="logo"><Span class = "logo-style1">SPF</Span>Toolbox</H1>
</div>
</div>
<div class="row">
<div class="col-md-6">
<span class="form-label">Domain:&nbsp;</span><input type="text" name="domain" id="domain" class="form-control">
<select id="file" class="form-control">
<option value="getTxt.php">SPF/TXT</option>
<option value="getA.php">IP</option>
<option value="getAAAA.php">IPV6</option>
<option value="getMx.php">Mx</option>
<option value="getWhois.php">Whois</option>
<option value="getHinfo.php">hinfo</option>
<option value="getAll.php">All</option>
</select>
<input type="button" id="submit" value="submit" class="form-control btn"/>
</div>
<div class="col-md-6"></div>
<div>

<div class="col-md-6"></div>
</div>
</div>
<div class="row">
<div class="col-md-6"><span id="txtHint" style="color: red;"></span></div>
</div>
<div class="row">
<div id="responseArea">
<div class="responseTable">

</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
</html>
75 changes: 58 additions & 17 deletions javascript/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,42 @@
$(document).ready(function(){
$("#domain").keyup(function(event){
if(event.keyCode == 13){
$("#submit").click();
}
});
});
window.onload = function() {
//Counts the number of requests in this session
var requestNum = 0;
//Choose the correct script to run based on dropdown selection
function callRoute(callType) {
returnDnsDetails(document.getElementById("domain").value, callType)
document.getElementById("submit").onclick = function callRoute() {
returnDnsDetails(document.getElementById("domain").value, document.getElementById("file").value)
}

function requestTitle(callType){
switch(callType){
case "getTxt.php":
return "SPF/TXT Lookup";
break;
case "getMx.php":
return "MX Lookup";
break;
case "getA.php":
return "IP Lookup";
break;
case "getAll.php":
return "All available DNS records";
break;
case "getAAAA.php":
return "IPV6 Lookup";
break;
case "getWhois.php":
return "Who Is Lookup";
break;
case "getHinfo.php":
return "H Info Lookup";
break;
}
}

//Get DNS Details
Expand All @@ -16,7 +50,6 @@

xmlhttp.onreadystatechange = function () {
var date = new Date();
var requestNum = date.getTime();
if (this.readyState == 4 && this.status == 200) {
//Clears the hint field
document.getElementById("txtHint").innerHTML = "";
Expand All @@ -27,29 +60,37 @@
console.log(dnsResp);
console.log(dnsResp.length);

//creates thes the table to store the response details each table has a unique class
$(".responseTable").prepend("<table class=\"responseRow" + requestNum + "\"></table>");

for (i = 0, len = dnsResp.length; i < len; i++) {
var jsonData = dnsResp[i];
console.log(jsonData);
$(".responseRow" + requestNum).append('___________________________________');
//iterates through object keys
for (j = 0, len = Object.keys(jsonData).length; j < len; j++) {
$(".responseRow" + requestNum).append("<tr><td>" + Object.getOwnPropertyNames(jsonData)[j] + ":</td><td>" + jsonData[Object.keys(jsonData)[j]] + "</td></tr>");
if (dnsResp.length == 0) {
$(".responseTable").prepend("<table class=\"responseRow" + requestNum + "\"></table>");
$(".responseRow" + requestNum).append("<td colspan='2' class='thead'>" + requestTitle(callType) + "</td>");
$(".responseRow" + requestNum).append("<tr><td colspan='2' style='text-align:center'>NO DATA FOUND</td></tr>");
} else {

//creates thes the table to store the response details each table has a unique class
$(".responseTable").prepend("<table class=\"responseRow" + requestNum + "\"></table>");
$(".responseRow" + requestNum).append("<td colspan='2' class='thead'>" + requestTitle(callType) + "</td>");
for (i = 0, len = dnsResp.length; i < len; i++) {
var jsonData = dnsResp[i];
console.log(jsonData);

//iterates through object keys
for (j = 0, len = Object.keys(jsonData).length; j < len; j++) {
$(".responseRow" + requestNum).append("<tr><td class='left-row'>" + Object.getOwnPropertyNames(jsonData)[j] + ":</td><td>" + jsonData[Object.keys(jsonData)[j]] + "</td></tr>");
}
$(".responseRow" + requestNum).append("<tr><td colspan='2' class='last-row'></td></tr>");
}
}


//$(".responseRow" + requestNum).append("<tr><td>" + dnsResp[0].host + "</td></tr>");
}




requestNum++;
}
};
xmlhttp.open("GET", callType + "?domain=" + domain, true);
xmlhttp.send();

}
requestNum++;
}
}
103 changes: 82 additions & 21 deletions styles/style.css
Original file line number Diff line number Diff line change
@@ -1,35 +1,96 @@
h4 {
margin-top: 25px;
}
.row {
margin: 20px;
* {
color: #333;
}

[class*="responseRow"] {
margin: 20px;
padding-top: 15px;
padding-bottom: 15px;
background-color: #eee;
background-color: rgba(86,61,124,.15);
border: 1px solid #ddd;
border: 1px solid rgba(86,61,124,.2);
background-color: #ccc;
margin: 10px;
}

[class*="responseRow"] td {
margin: 5px;
background-color: white;
background-color: #ccc;
}

table {
width: 100%;
border: 0;
border-radius: 10px;
}

.btn, .thead {
background-color: #44c0f0 !important;
}
.thead {
text-align: center;
font-weight: bold;
font-size: 1.5em;
color: white;

}

.thead {

border-radius: 10px 10px 0 0;
}

td {
padding: 5px;
text-align: left;
}

.left-row {
width: 60px;
}

.last-row {
height: 1em;
background-color: white !important;
}


hr {
margin-top: 40px;
margin-bottom: 40px;

}

caption {
background-color: rgb(90,85,90);
font-weight: bold;
color: #44c0f0;
padding-top: .7em;
padding-bottom: .7em;
letter-spacing: .085em;
text-align: center !important;
}

#top-row {
margin: 25px;

}

input, select, .form-label {

}

input {
margin: 10px;
}
.form-control {
align-items: center;
width:auto;
float: left;
margin: 10px;
text-align: center;
}

.form-label {
align-items: center;
width:auto;
float: left;
margin: 10px 10px 10px 0;
text-align: center;
padding:10 0 10 0;
}

* {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.logo-style1 {
color:#44c0f0;
font-weight: bold;
}

0 comments on commit 77cf244

Please sign in to comment.