Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Commit

Permalink
Fix broken resolved ip in src field
Browse files Browse the repository at this point in the history
  • Loading branch information
jorritfolmer committed Feb 16, 2020
1 parent 1de065a commit a38b5ab
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
1 change: 0 additions & 1 deletion .sonarcloud.properties

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 3.2.1

- Fixed resolving of IP addresses in src field.
(Thanks to Martin Wright for reporting this issue)

## 3.2.0

- Added support for Splunk 8.x and Python 3.x
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ If you want to reindex an entire mailbox, you can do so by deleting the TA-dmarc
```
|inputlookup ta_dmarc_checkpointer_lookup
|search state!="*input=dmarc_imap, server=imap.gmail.com*"
|outputlookup ta_dmarc_checkpointer_lookup`
|outputlookup ta_dmarc_checkpointer_lookup
```

If you want to reindex a single DMARC report, you can do so by deleting its corresponding record from KVstore:
Expand Down Expand Up @@ -334,6 +334,7 @@ This add-on is maintained by Jorrit Folmer. These people and organisations have

- Christopher G Andrews (ChristopherGAndrews)
- John (john-9c54a80b)
- Martin Wright
- Mike Kolk
- Samuel Haper (sharperer)
- Steve Myers (stmyers)
Expand Down
2 changes: 1 addition & 1 deletion app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": {
"group": null,
"name": "TA-dmarc",
"version": "3.2.0"
"version": "3.2.1"
},
"author": [
{
Expand Down
22 changes: 15 additions & 7 deletions bin/dmarc/dir2splunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,27 @@ def rua2json(self, xmldata, validation_result=[]):
for record in records:
data_ip = record.findtext('row/source_ip')
row_tag = record.find("row")
record = yahoo.data(record)
record = self.dict2lower(record)
if self.do_resolve:
try:
self.helper.log_debug("rua2json: resolving %s" % data_ip)
resolve = socket.gethostbyaddr(data_ip)
backresolve = socket.gethostbyname_ex(resolve[0])
if data_ip == backresolve[2][0]:
# Add resolved ip to row
ip_resolution = etree.SubElement(row_tag, "ip_resolution")
ip_resolution.text = resolve[0]
except Exception:
self.helper.log_debug("rua2json: failed to resolve %s" % data_ip)
record = yahoo.data(record)
record = self.dict2lower(record)
else:
try:
self.helper.log_debug("rua2json: backresolving %s" % resolve[0])
backresolve = socket.gethostbyname_ex(resolve[0])
except Exception:
self.helper.log_debug("rua2json: backresolving failed for %s" % resolve[0])
else:
if data_ip == backresolve[2][0]:
# Add resolved ip to row
self.helper.log_debug("rua2json: backresolving success: %s resolves to %s and back" % (data_ip, resolve[0]))
record["record"]["row"]["ip_resolution"] = resolve[0]
else:
self.helper.log_debug("rua2json: backresolving failed: %s does NOT resolve to %s and back" % (data_ip, resolve[0]))
feedback_list.append(record)
# Aggregate report metadata, policy, record and xsd_validation
result_dict.update(feedback_dict)
Expand Down
2 changes: 1 addition & 1 deletion default/app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build = 1

[launcher]
author = Jorrit Folmer
version = 3.2.0
version = 3.2.1
description = TA-dmarc add-on for Splunk

[ui]
Expand Down

0 comments on commit a38b5ab

Please sign in to comment.