diff --git a/docs/scripting.xml b/docs/scripting.xml
index 8146e8d16..4f7b1a961 100644
--- a/docs/scripting.xml
+++ b/docs/scripting.xml
@@ -1783,6 +1783,29 @@ host.os = {
+
+
+
+
+
+ Contains a string representation of the reason why the target host is in
+ its current state. The reason is given by the type of the packet that
+ determined the state. For example, an echo-reply from
+ an alive host.
+
+
+
+
+
+
+
+
+ Contains the TTL value of the response packet, that was used to determine
+ the status of the target host, when it arrived. This response packet is the
+ packet that is also used to set host.reason.
+
+
+
diff --git a/nse_nmaplib.cc b/nse_nmaplib.cc
index 187cb8438..a6fc7cd40 100644
--- a/nse_nmaplib.cc
+++ b/nse_nmaplib.cc
@@ -151,6 +151,9 @@ void set_hostinfo(lua_State *L, Target *currenths) {
nseU_setsfield(L, -1, "ip", currenths->targetipstr());
nseU_setsfield(L, -1, "name", currenths->HostName());
nseU_setsfield(L, -1, "targetname", currenths->TargetName());
+ nseU_setsfield(L, -1, "reason", reason_str(currenths->reason.reason_id, SINGULAR));
+ nseU_setnfield(L, -1, "reason_ttl", currenths->reason.ttl);
+
if (currenths->directlyConnectedOrUnset() != -1)
nseU_setbfield(L, -1, "directly_connected", currenths->directlyConnected());
if (currenths->MACAddress())