Skip to content

Commit

Permalink
Merge pull request #29 from charlesabarnes/f/refactor
Browse files Browse the repository at this point in the history
F/refactor
  • Loading branch information
charlesabarnes committed Jan 21, 2019
2 parents c74c3c5 + 5432c7f commit ed3501a
Show file tree
Hide file tree
Showing 154 changed files with 338 additions and 255 deletions.
50 changes: 0 additions & 50 deletions blacklist.php

This file was deleted.

Binary file added favicon.ico
Binary file not shown.
20 changes: 0 additions & 20 deletions getA.php

This file was deleted.

20 changes: 0 additions & 20 deletions getAAAA.php

This file was deleted.

20 changes: 0 additions & 20 deletions getAll.php

This file was deleted.

20 changes: 0 additions & 20 deletions getHinfo.php

This file was deleted.

20 changes: 0 additions & 20 deletions getMx.php

This file was deleted.

33 changes: 0 additions & 33 deletions getPort.php

This file was deleted.

21 changes: 0 additions & 21 deletions getTxt.php

This file was deleted.

18 changes: 0 additions & 18 deletions getWhois.php

This file was deleted.

22 changes: 12 additions & 10 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@
<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="getAll.php">All</option>
<option value="getA.php">IP</option>
<option value="getAAAA.php">IPV6</option>
<option value="getMx.php">Mx</option>
<option value="getTxt.php">SPF/TXT</option>
<option value="blacklist.php">Blacklist Check</option>
<option value="getWhois.php">Whois</option>
<option value="getPort.php">Check Ports</option>
<option value="getHinfo.php">hinfo</option>
<select onchange="showAdditionalFields()" id="file" class="form-control">
<option value="a">IP/Get A Record</option>
<option value="aaaa">IPV6/Get AAAA Record</option>
<option value="mx">Mx/Get MX Record</option>
<option value="txt">SPF/TXT</option>
<option value="blacklist">Blacklist Check</option>
<option value="whois">Whois</option>
<option value="port">Check If Port Open/Forwarded</option>
<option value="hinfo">Hinfo/Get Hardware Information</option>
<option value="all">Get All Simple DNS Records</option>
<option value="reverseLookup">Host By IP/Reverse Lookup</option>
</select>
<div style="visibility: hidden" id="port-container"><span class="form-label" sty;e>Port:&nbsp;</span><input type="text" name="port" id="port" class="form-control"></div>
<input type="button" id="submit" value="submit" class="form-control btn"/>
</div>
<div class="col-md-6"></div>
Expand Down
36 changes: 24 additions & 12 deletions javascript/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,46 @@ window.onload = function() {
var requestNum = 0;
//Choose the correct script to run based on dropdown selection
document.getElementById("submit").onclick = function callRoute() {
returnDnsDetails(document.getElementById("domain").value, document.getElementById("file").value)
returnDnsDetails(document.getElementById("domain").value, document.getElementById("file").value, document.getElementById("port").value)
}

function requestTitle(callType){
switch(callType){
case "getTxt.php":
case "txt":
return "SPF/TXT Lookup";
break;
case "getMx.php":
case "mx":
return "MX Lookup";
break;
case "getA.php":
case "a":
return "IP Lookup";
break;
case "getAll.php":
case "all":
return "All available DNS records";
break;
case "getAAAA.php":
case "aaaa":
return "IPV6 Lookup";
break;
case "getWhois.php":
case "whois":
return "Who Is Lookup";
break;
case "getHinfo.php":
case "hinfo":
return "H Info Lookup";
break;
case "blacklist.php":
case "blacklist":
return "Blacklist Lookup";
break;
case "getPort.php":
case "port":
return "Ports Lookup";
break;
case "reverseLookup":
return "Host Lookup";
break;
}
}

//Get DNS Details
function returnDnsDetails(domain, callType) {
function returnDnsDetails(domain, callType, port) {
//checks for valid input
if (domain.length == 0) {
document.getElementById("txtHint").innerHTML = " Please enter a valid domain";
Expand All @@ -67,7 +70,7 @@ window.onload = function() {
}
}
document.getElementById("loading").innerHTML = '<div class="sk-three-bounce"><div class="sk-child sk-bounce1"></div><div class="sk-child sk-bounce2"></div><div class="sk-child sk-bounce3"></div></div>'
xmlhttp.open("GET", callType + "?domain=" + domain, true);
xmlhttp.open("GET", "operations?domain=" + domain + "&request=" + callType + "&port=" + port, true);
xmlhttp.send();

}
Expand Down Expand Up @@ -115,4 +118,13 @@ window.onload = function() {
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}

}

function showAdditionalFields() {
if(document.getElementById("file").value === 'port') {
document.getElementById("port-container").style.visibility="visible" ;
} else {
document.getElementById("port-container").style.visibility="hidden";
}
}
11 changes: 11 additions & 0 deletions operations/A.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

include_once('./OperationInterface.php');
class A implements OperationInterface{
public function getOutput($hostname){
$response = dns_get_record ($hostname , DNS_A);
return json_encode($response, JSON_PRETTY_PRINT);
}
}

?>
11 changes: 11 additions & 0 deletions operations/AAAA.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
include_once('./OperationInterface.php');

class AAAA implements OperationInterface{
public function getOutput($hostname){
$response = dns_get_record ($hostname , DNS_AAAA);
return json_encode($response, JSON_PRETTY_PRINT);
}
}

?>
13 changes: 13 additions & 0 deletions operations/All.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
include_once('./OperationInterface.php');

class All implements OperationInterface{
public function getOutput($hostname){
$response = @dns_get_record($hostname , DNS_ALL);
if($response == false) {
$response = @dns_get_record($hostname , DNS_ANY);
}
return json_encode($response, JSON_PRETTY_PRINT);
}
}
?>
Loading

0 comments on commit ed3501a

Please sign in to comment.