Skip to content

Commit 3669807

Browse files
authored
Merge pull request #13 from userjack6880/dev
Dev
2 parents be631c5 + df30e58 commit 3669807

File tree

7 files changed

+77
-16
lines changed

7 files changed

+77
-16
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ A clear and concise description of what you expected to happen.
2424
If applicable, add screenshots to help explain your problem.
2525

2626
**Software Version**
27+
[] Version 0 Alpha 5
28+
[] Version 0 Alpha 4
2729
[] Version 0 Alpha 3
2830
[] Version 0 Alpha 2
2931

.github/ISSUE_TEMPLATE/critical_report.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ A clear and concise description of what you expected to happen.
2424
If applicable, add screenshots to help explain your problem.
2525

2626
**Software Version**
27+
[] Version 0 Alpha 5
28+
[] Version 0 Alpha 4
2729
[] Version 0 Alpha 3
2830
[] Version 0 Alpha 2
2931
[] Other

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A Perl based tool to parse DMARC reports, based on John Levine's [rddmarc](http:
88

99
Open Report Parser is a fork of [techsneeze's dmarcts-report-parser](https://github.com/techsneeze/dmarcts-report-parser), and was forked to more closely match the needs of [Open DMARC Analyzer](https://github.com/userjack6880/Open-DMARC-Analyzer).
1010

11-
Open Report Parser Version 0 Alpha 4 (0-α4) is an [Anomaly \<Codebase\>](https://systemanomaly.com/codebase) project by John Bradley ([email protected]).
11+
Open Report Parser Version 0 Alpha 5 (0-α5) is an [Anomaly \<Codebase\>](https://systemanomaly.com/codebase) project by John Bradley ([email protected]).
1212

1313
# Minimum Requirements
1414

@@ -224,9 +224,9 @@ Currently, processing of both DMARC and TLS reports during the same run is only
224224

225225
# Latest Changes
226226

227-
## 0-α4
228-
- Fixed Issue #8 again - some errornous code was introduced at some point that skips DB checks if not using Oauth2.
229-
- Updated documentation to fix minimum requirements regarding MariaDB vs MySQL (initially discovered with Open Report Analyzer).
227+
## 0-α5
228+
- Fixed an issue with undefined variables discovered with Issue #12.
229+
- Fixed an issue with mimecast improperly setting mime type outlined in Issue #12.
230230

231231
# Tested System Configurations
232232
| OS | Perl | SQL | Source |
@@ -244,9 +244,9 @@ Support will be provided as outlined in the following schedule. For more details
244244

245245
| Version | Support Level | Released | End of Support | End of Life |
246246
| ----------------------------------- | ---------------- | ---------------- | ---------------- | ---------------- |
247-
| Version 1 Alpha 4 | Full Support | 8 June 2023 | TBD | TBD |
248-
| Version 1 Alpha 3 | Critical Support | 25 May 2023 | 8 June 2023 | TBD |
249-
| Version 1 Alpha 2 | End of LIfe | 26 April 2023 | 25 May 2023 | 8 June 2023 |
247+
| Version 1 Alpha 5 | Full Support | 10 July 2023 | TBD | TBD |
248+
| Version 1 Alpha 4 | Critical Support | 8 June 2023 | 10 July 2023 | TBD |
249+
| Version 1 Alpha 3 | End of Life | 25 May 2023 | 8 June 2023 | 10 July 2023 |
250250

251251
# Contributing
252252

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0-α5
4+
- Fixed an issue with undefined variables discovered with Issue #12.
5+
- Fixed an issue with mimecast improperly setting mime type outlined in Issue #12.
6+
37
## 0-α4
48
- Fixed Issue #8 again - some errornous code was introduced at some point that skips DB checks if not using Oauth2.
59
- Updated documentation to fix minimum requirements regarding MariaDB vs MySQL (initially discovered with Open Report Analyzer).

docs/SECURITY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Open DMARC Analyzer Version Security Support
2020

2121
| Version | Supported | End of Life |
2222
| -------------------------- | --------- | ---------------- |
23+
| Version 0 Alpha 5 | YES | TBD |
2324
| Version 0 Alpha 4 | YES | TBD |
24-
| Version 0 Alpha 3 | YES | TBD |
25+
| Version 0 Alpha 3 | NO | 10 July 2023 |
2526
| Version 0 Alpha 2 | NO | 8 June 2023 |
2627
| Version 0 Alpha 1 | NO | 25 May 2023 |

docs/SUPPORT.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ Due to the limited time available to developrs to maintain support, dates must b
44

55
| Version | Support Level | Released | End of Support | End of Life |
66
| ----------------------------------- | ---------------- | ---------------- | ---------------- | ---------------- |
7-
| Version 1 Alpha 4 | Full Support | 8 June 2023 | TBD | TBD |
8-
| Version 1 Alpha 3 | Critical Support | 25 May 2023 | 8 June 2023 | TBD |
7+
| Version 1 Alpha 5 | Full Support | 10 July 2023 | TBD | TBD |
8+
| Version 1 Alpha 4 | Critical Support | 8 June 2023 | 10 July 2023 | TBD |
9+
| Version 1 Alpha 3 | End of Life | 25 May 2023 | 8 June 2023 | 10 July 2023 |
910
| Version 1 Alpha 2 | End of LIfe | 26 April 2023 | 25 May 2023 | 8 June 2023 |
1011
| Version 1 Alpha 1 | End of Life | 19 April 2023 | 26 April 2023 | 25 May 2023 |
1112

report-parser.pl

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,13 @@ sub show_usage {
144144
$reports_replace = 0;
145145
$imapauth = 'simple';
146146
$clear_token = 0;
147+
$processInfo = 0;
148+
$oauthuri = '';
149+
$oauthclientid = '';
147150

148151
# used in messages
149152
my $scriptname = 'Open Report Parser';
150-
my $version = 'Version 0 Alpha 4';
153+
my $version = 'Version 0 Alpha 5';
151154

152155
# allowed values for the DB columns, also used to build the enum() in the
153156
# CREATE TABLE statements in checkDatabase(), in order defined here
@@ -895,7 +898,31 @@ sub getXMLFromZip {
895898
my $unzip = "";
896899
if ($isgzip) {
897900
open(XML, "<:gzip", $filename)
898-
or $unzip = "ungzip";
901+
or $unzip = "gzip";
902+
903+
# check to see if the mimetype was incorrectly set to gzip *cough mimecast*
904+
if ($unzip eq "gzip") {
905+
printDebug("gzip failed, checking if incorrect mime type");
906+
# incorrect mimetype with incorrect file extension seems to manifest as a .dat
907+
# so let's check for that
908+
my $ext = '';
909+
if ($filename =~ /\.([^.]+)$/) {
910+
print "extension: $1" if $debug;
911+
$ext = $1;
912+
}
913+
else {
914+
warn "$scriptname: Could not find extension for (<$filename>)! \n";
915+
}
916+
917+
# if it's a dat file, then run this process again, but with $isgzip set to 0
918+
if ($ext eq "dat") {
919+
printDebug("Trying again using unzip");
920+
$xml = getXMLFromZip($filename,0);
921+
922+
# if it fails again, it'll warn, if not, it'll return the correct xml
923+
return $xml;
924+
}
925+
}
899926
}
900927
else {
901928
open(XML, "-|", "unzip", "-p", $filename)
@@ -967,18 +994,18 @@ sub storeXMLInDatabase {
967994
my $policy_aspf = undef;
968995
my $policy_p = undef;
969996
my $policy_sp = undef;
970-
my $policy_pct = undef;
997+
my $policy_pct = undef;
971998

972999
if (ref $xml->{'policy_published'} eq "HASH") {
973-
$domain = $xml->{'policy_published'}->{'domain'};
1000+
$domain = $xml->{'policy_published'}->{'domain'};
9741001
$policy_adkim = $xml->{'policy_published'}->{'adkim'};
9751002
$policy_aspf = $xml->{'policy_published'}->{'aspf'};
9761003
$policy_p = $xml->{'policy_published'}->{'p'};
9771004
$policy_sp = $xml->{'policy_published'}->{'sp'};
9781005
$policy_pct = $xml->{'policy_published'}->{'pct'};
9791006
}
9801007
else {
981-
$domain = $xml->{'policy_published'}[0]->{'domain'};
1008+
$domain = $xml->{'policy_published'}[0]->{'domain'};
9821009
$policy_adkim = $xml->{'policy_published'}[0]->{'adkim'};
9831010
$policy_aspf = $xml->{'policy_published'}[0]->{'aspf'};
9841011
$policy_p = $xml->{'policy_published'}[0]->{'p'};
@@ -1419,7 +1446,31 @@ sub getJSONFromZip {
14191446
my $unzip = "";
14201447
if ($isgzip) {
14211448
open(JSON, "<:gzip", $filename)
1422-
or $unzip = "ungzip";
1449+
or $unzip = "gzip";
1450+
1451+
# check to see if the mimetype was incorrectly set to gzip *cough mimecast*
1452+
if ($unzip eq "gzip") {
1453+
printDebug("gzip failed, checking if incorrect mime type");
1454+
# incorrect mimetype with incorrect file extension seems to manifest as a .dat
1455+
# so let's check for that
1456+
my $ext = '';
1457+
if ($filename =~ /\.([^.]+)$/) {
1458+
print "extension: $1" if $debug;
1459+
$ext = $1;
1460+
}
1461+
else {
1462+
warn "$scriptname: Could not find extension for (<$filename>)! \n";
1463+
}
1464+
1465+
# if it's a dat file, then run this process again, but with $isgzip set to 0
1466+
if ($ext eq "dat") {
1467+
printDebug("Trying again using unzip");
1468+
$json = getJSONFromZip($filename,0);
1469+
1470+
# if it fails again, it'll warn, if not, it'll return the correct xml
1471+
return $json;
1472+
}
1473+
}
14231474
}
14241475
else {
14251476
open(JSON, "-|", "unzip", "-p", $filename)

0 commit comments

Comments
 (0)