techsneeze / dmarcts-report-parser

A Perl based tool to parse DMARC reports from an IMAP mailbox or from the filesystem, and insert the information into a database. ( Formerly known as imap-dmarcts )
http://www.techsneeze.com/how-parse-dmarc-reports-imap/
GNU General Public License v3.0
222 stars 61 forks source link

parse_data: No data passed at ./dmarcts-report-parser.pl line 439. #40

Closed SamosHaven closed 6 years ago

SamosHaven commented 6 years ago

I have followed the instructions in the guide on how to set up the report parser and I'm getting this error.

parse_data: No data passed at ./dmarcts-report-parser.pl line 439.

Looks as though the pearl program has trouble recognizing the XML files that are stored in a ZIP file in my IMAP server email inbox.

Anyone know of / can think of a fix for this problem.

Much appreciated.

lwt-pressy commented 6 years ago

@SamosHaven - could you please comment how your call dmarcte-report-parser.pl and give us an output with -d (debug) set.

SamosHaven commented 6 years ago

@lwt-pressy - Hi, thanks for the reply. I call the dmarcts-report-parser.pl by using the ./dmarcts-report-parser.pl command while in the dmarcts-report-parser directory.

Here is the debug report:

*root@dmarc-VirtualBox:~/dmarcts-report-parser# ./dmarcts-report-parser.pl -i -d use tls with verify servercert. Started at Thu Sep 21 09:05:33 2017 Using Mail::IMAPClient version 3.39 on perl 5.022001 Connecting with IO::Socket::INET PeerAddr imap-mail.outlook.com:143 PeerPort 143 Proto tcp Timeout 600 Debug 1 Connected to imap-mail.outlook.com:143 Read: OK The Microsoft Exchange IMAP4 service is ready. [VgBJADEAUABSADAANAAwADEAQwBBADAAMAAwADUALgBlAHUAcgBwAHIAZAAwADQALgBwAHIAbwBkAC4AbwB1AHQAbABvAG8AawAuAGMAbwBtAA==] Sending: 1 STARTTLS Sent 12 bytes Read: 1 OK Begin TLS negotiation now. Sending: 2 LOGIN dmarc-report-tester@outlook.com [Redact: Count=2 Showcredentials=OFF] Sent 53 bytes Read: 2 OK LOGIN completed. Sending: 3 STATUS Inbox (MESSAGES) Sent 27 bytes Read: STATUS Inbox (MESSAGES 6) 3 OK STATUS completed. Processing 6 messages in folder . Sending: 4 STATUS Inbox (MESSAGES) Sent 27 bytes Read: STATUS Inbox (MESSAGES 6) 4 OK STATUS completed. Sending: 5 SELECT Inbox Sent 16 bytes Read: * 6 EXISTS


Processing IMAP message with UID #34

parse_data: No data passed at ./dmarcts-report-parser.pl line 439.**

Update: I have had to edit and remove the personal information for security reasons, hope this does not effect your analysis. Cheers

lwt-pressy commented 6 years ago

@SamosHaven

starting from line 230:

    my $imap = Mail::IMAPClient->new( Server => $imapserver,
        Ssl => $imapssl,
        Starttls => $imapopt,
        User => $imapuser,
        Password => $imappass,
        Debug=> $debug
  )

please change it to:

    my $imap = Mail::IMAPClient->new( Server => $imapserver,
        Ssl => $imapssl,
        Starttls => $imapopt,
        User => $imapuser,
        Password => $imappass,
        Ignoresizeerrors => 1,
        Debug=> $debug
  )

by adding line:

        Ignoresizeerrors => 1,

Don't forget the coma at the end. If this work, I'll add an Option for it to activate. Before I'll like to know if its work. The Reason I guess is a know bug in Microsoft.

SamosHaven commented 6 years ago

Yep that fixed it thank you. Wonder if you can help me with my next issue?

I'm trying to run dmarcts-report-viewer on my local host set up using apache2. I have moved the dmarcts report-parser folder along with all the other files into the /var/www/html directory. My issue is that when I direct the browser to 127.0.0.1/dmarcts-report-parser/dmarcts-report-viewer/dmarcts-report-viewer.php, it shows a blank white web page.

I know the directory is correctly linked to the php file as I removed the <?php tag and the same web page displayed all the code in the file, but it wont display the SQL database.

I have also checked my SQL database on my localhost and it is populated using dmarcts-report-parser.

Cheers

lwt-pressy commented 6 years ago

@SamosHaven, thx for the feedback. I will prepare a new commit soon, where this can be set in the config file.

As for the Error, would you please me a new issue in dmarcts-report-viewer. So we can handle this seperately. In your case it would help if you include an error log of your apache server where normally an error is seen. It probaly in /var/log/apache or /var/log/http{d}, depending on your distro or your config file.

lwt-pressy commented 6 years ago

@SamosHaven - today everythings goes fast. The new version is merge. Please update your package and use the new config sample, especially the new option "$imapignoreerror = 1;" (you need 1 here).

If it fixes it give us feedback so this issue can be closed.