forked from fnmsd/awvs_script_decode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmtp_commands.script
More file actions
63 lines (60 loc) · 1.84 KB
/
Copy pathsmtp_commands.script
File metadata and controls
63 lines (60 loc) · 1.84 KB
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
#include ip_helpers.inc;
#include reporting_helpers.inc;
/* required by:
* smtp_exim_overflow.script use smtp/info (array of objects with port & banner property)
*/
var smtpInfo = new Array();
// try to get a list of SMTP commands
function get_smtp_info(port){
var result = "";
if (IsPortOpen(port)){
socket = new TSocket("TCP");
socket.Host = ScanHost;
socket.Port = port;
socket.Timeout = 3;
socket.Connect();
if (socket.IsConnected) {
// receive banner
data = socket.Receive(true);
smtpInfo.push({"port" : port, "banner" : data});
//trace(data);
socket.send("EHLO acunetix.com\r\n");
var res = "";
while( (data = socket.Receive(true)) != ""){
res += data;
}
//trace(res);
if (res.match(/^250.*/)) {
result += "EHLO returns: \r\n " + res;
}
socket.send("HELP\r\n");
var res = "";
while( (data = socket.Receive(true)) != ""){
res += data;
}
//trace(res);
if (res.match(/^2.*/)) {
result += "HELP returns: \r\n " + res;
}
socket.Close();
}
}
return result;
}
// start
var res = get_smtp_info(25);
if (res.length > 0){
trace("smtp info port 25 " + res);
KBase("SMTP server running", "A SMTP server is running on TCP port 25. Information gathered from this service: [pre]" + res + "[/pre]");
}
var res = get_smtp_info(587);
if (res.length > 0){
trace("smtp info port 587 " + res);
KBase("SMTP server running", "A SMTP server is running on TCP port 587. Information gathered from this service: [pre]" + res + "[/pre]");
}
var res = get_smtp_info(465);
if (res.length > 0){
trace("smtp info port 465 " + res);
KBase("SMTP server running", "A SMTP server is running on TCP port 465. Information gathered from this service: [pre]" + res + "[/pre]");
}
SetGlobalValue("smtp/info", smtpInfo, true);