Add AS and hostname to geoip
This commit is contained in:
parent
027e27d121
commit
e68af22d60
1 changed files with 9 additions and 2 deletions
|
@ -89,17 +89,24 @@ class Module(ModuleManager.BaseModule):
|
||||||
page = utils.http.request(URL_GEOIP % event["args_split"][0]).json()
|
page = utils.http.request(URL_GEOIP % event["args_split"][0]).json()
|
||||||
if page:
|
if page:
|
||||||
if page["status"] == "success":
|
if page["status"] == "success":
|
||||||
|
try:
|
||||||
|
hostname, alias, ips = socket.gethostbyaddr(page["query"])
|
||||||
|
except (socket.herror, socket.gaierror):
|
||||||
|
pass
|
||||||
|
|
||||||
data = page["query"]
|
data = page["query"]
|
||||||
|
if hostname:
|
||||||
|
data += " (%s)" % hostname
|
||||||
data += " | Organisation: %s" % page["org"]
|
data += " | Organisation: %s" % page["org"]
|
||||||
data += " | City: %s" % page["city"]
|
data += " | City: %s" % page["city"]
|
||||||
data += " | Region: %s (%s)" % (
|
data += " | Region: %s (%s)" % (
|
||||||
page["regionName"], page["countryCode"])
|
page["regionName"], page["countryCode"])
|
||||||
data += " | ISP: %s" % page["isp"]
|
data += " | ISP: %s (%s)" % (page["isp"], page["as"])
|
||||||
data += " | Lon/Lat: %s/%s" % (page["lon"], page["lat"])
|
data += " | Lon/Lat: %s/%s" % (page["lon"], page["lat"])
|
||||||
data += " | Timezone: %s" % page["timezone"]
|
data += " | Timezone: %s" % page["timezone"]
|
||||||
event["stdout"].write(data)
|
event["stdout"].write(data)
|
||||||
else:
|
else:
|
||||||
event["stderr"].write("No geoip data found")
|
event["stderr"].write("No GeoIP data found")
|
||||||
else:
|
else:
|
||||||
raise utils.EventResultsError()
|
raise utils.EventResultsError()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue