-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharupec.php
141 lines (136 loc) · 5.77 KB
/
arupec.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<?php
/*
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
?>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ARUPEC</title>
<link rel="stylesheet" href="../dist/chota.css" />
<style>
body.dark {
--bg-color: #000;
--bg-secondary-color: #131316;
--font-color: #f5f5f5;
--color-grey: #ccc;
--color-darkGrey: #777;
}
</style>
</head>
<body>
<div id="top" class="container" role="document">
<header role="banner">
<h1 class="pull-right" style="margin: 0;">
<a href="javascript:void(0)" onclick="switchMode(this)">☀️</a>
</h1>
<h1>Validator: Aruba PEC su dominio</h1>
<div class="clearfix"></div>
</header>
<main role="main">
<section id="forms">
<form method="get">
<fieldset id="forms__input">
<legend>Domain</legend>
<p>
<label for="input__webaddress">Web Address</label>
<input
id="input__webaddress"
placeholder="yoursite.com"
name="input__webaddress"
/>
<hr>
<button class="button primary">Submit</button>
</p>
</fieldset>
<fieldset id="forms__checkbox">
<legend>Result</legend>
<?php
if (!function_exists("is_valid_domain_name")) {
function is_valid_domain_name($domain_name)
{
return preg_match(
"/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i",
$domain_name
) &&
preg_match("/^.{1,253}$/", $domain_name) &&
preg_match(
"/^[^\.]{1,63}(\.[^\.]{1,63})*$/",
$domain_name
);
}
}
$invalid = "0";
$dom = is_valid_domain_name($_GET["input__webaddress"]);
if ($dom === true) {
$hostname = $_GET["input__webaddress"];
} else {
$hostname = "none";
$invalid = "1";
}
if ($invalid === "0") {
$mxhosts = [];
$weight = [];
$notok = "false";
echo "🌐 Domain: " .
htmlspecialchars($hostname) .
"<br>";
if (getmxrr($hostname, $mxhosts, $weight)) {
for ($i = 0; $i < count($mxhosts); $i++) {
if ($mxhosts[$i] == "mx.pec.aruba.it") {
echo "✅ MX record is pointing to mx.pec.aruba.it<br>";
if ($weight[$i] === 10) {
echo "✅ Prio is set to 10.";
} else {
echo "🔘 Prio is not set to 10.";
break;
}
} else {
echo "⛔️ NOT OK! MX record is NOT pointing to mx.pec.aruba.it. It is actually pointing to" .
htmlspecialchars($mxhosts[$i]) .
", Prio: " .
htmlspecialchars($weight[$i]);
$notok = "true";
}
}
} else {
echo "⛔️ No MX record found.";
}
$dns = dns_get_record($hostname, DNS_TXT);
echo "<br>";
// var_dump($dns);
foreach ($dns as $record) {
if ($record["txt"] == "v=spf1 a mx -all") {
echo "✅ SPF record OK!";
} else {
echo "🔘 SPF record likely not as suggested.";
break;
}
}
} else {
echo "No result.";
}
?>
</fieldset>
<fieldset id="forms__checkbox">
<legend>Example config</legend>
<pre>demo.tld MX mx.pec.aruba.it. 10
demo.tld TXT "v=spf1 a mx -all"
</pre>
</fieldset>
</form>
</section>
<!-- <hr> -->
</main>
</div>
<script src="../dist/main.js"></script>
</body>
</html>