xme / dockers

Miscelaneous Dockers
46 stars 36 forks source link

getaddrinfo() argument 2 must be integer or string #3

Closed vi-or-die closed 6 years ago

vi-or-die commented 6 years ago

Issue Description I am trying to use the imap2thehive to query a mailbox and am getting an error that I think might be related to the imap port but could be something that I am doing wrong. Multiple iterations of the error below (Gmail and O365 were used). I have removed my name, company, and password for privacy.

Environment Not using docker.

Desired Use I have a shared mailbox in Office365 that I want to route Phishing messages to.

Recreation steps

  1. Clone your docker repo https://github.com/xme/dockers.git
  2. Copy dockers/imap2thehive directory to /etc/imap2thehive sudo cp -r dockers/imap2thehive
  3. Modified configuration as noted below
  4. Ran script python imap2thehive.py -c imap2thehive.conf -v

imap2thehive.conf Gmail configuration

[imap]
host: imap.gmail.com
port: 993
user: first.last@gmail.com
password: Password
folder: incoming
expunge: true

Error when used with Gmail IMAP

[WARNING] Both case template and tasks are defined. Template (thehive_template) will be used.
[INFO] Processing first.last@gmail.com@imap.gmail.com:993/incoming
[ERROR] Cannot connect to IMAP server imap.gmail.com: getaddrinfo() argument 2 must be integer or string

imap2thehive.conf Office365 configuration

[imap]
host: outlook.office365.com
port: 993
user: first.last@company.com
password: Password
folder: incoming
expunge: true

Error when used with Office365 IMAP

[WARNING] Both case template and tasks are defined. Template (thehive_template) will be used.
[INFO] Processing first.last@company.com@outlook.office365.com:993/incoming
[ERROR] Cannot connect to IMAP server outlook.office365.com: getaddrinfo() argument 2 must be integer or string
vi-or-die commented 6 years ago

I also just took a look at firewall logs and am able to see outbound traffic to Google but not to Office365. So I feel like it isn't a firewall issue. Let me know if you need anymore information.

xme commented 6 years ago

I pushed a new version of the script which fixes a small bug (IMAP port must be integer not string). I think that the fact you used Python2 raised the bug. Can you test?

vi-or-die commented 6 years ago

The change seemed to get me further! I am indeed using Python 2.7.12.