From 66dcd1f9f8a8d4db81496acff4daf73c90855f58 Mon Sep 17 00:00:00 2001 From: Evan Fagerberg Date: Fri, 17 Jul 2015 10:20:14 -0400 Subject: [PATCH 1/6] master | documentation for windows users --- vagrant_setup.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 vagrant_setup.md diff --git a/vagrant_setup.md b/vagrant_setup.md new file mode 100644 index 0000000..9a329e1 --- /dev/null +++ b/vagrant_setup.md @@ -0,0 +1,36 @@ +How to Set Up Validate Email Using Vagrant on PC +------------------------------------------------- + +1. Download Vagrant & Virtual Box + * http://www.vagrantup.com/downloads + * http://www.virtualbox.org/ +2. Look at http://docs.vagrantup.com/v2/getting-started/ to make a linux virtual machine via vagrant + * tl;dr using bash (Can use regular Windows Terminal) + * Make a folder first, whenever you want to access the vm you will need to cd into that folder + * $ vagrant init hashicorp/precise32 + * $ vagrant up + * $ vagrant ssh + * This last command is used to go into your vm +3. Install pipin the vm + * http://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/ + * tl;dr + * $ sudo apt-get install python-pip +4. Install pyDNS + * This is a package dependency of validate email + * $ sudo pip install pydns +5. Install git + * sudo apt-get install git +6. Clone the validate_email repo to your vm + * (Since its a new machine you will need to clone using the https url) + * $ git clone git@github.com:efagerberg/validate_email.git + * If you want to use your ssh keys on your machine you will need to add this line to the vagrant file under the config + * Looks somthing like this: + Vagrant::Config.run do |config| + # stuff + config.ssh.forward_agent = true + end +7. cd into validate_email and run script + * $ cd validate_email + * $ python validate_email.py + + From 67b578f6c705d8681208358fb4279786f98686d5 Mon Sep 17 00:00:00 2001 From: Evan Fagerberg Date: Fri, 17 Jul 2015 12:02:45 -0400 Subject: [PATCH 2/6] Update vagrant_setup.md --- vagrant_setup.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/vagrant_setup.md b/vagrant_setup.md index 9a329e1..8cf19a4 100644 --- a/vagrant_setup.md +++ b/vagrant_setup.md @@ -7,19 +7,28 @@ How to Set Up Validate Email Using Vagrant on PC 2. Look at http://docs.vagrantup.com/v2/getting-started/ to make a linux virtual machine via vagrant * tl;dr using bash (Can use regular Windows Terminal) * Make a folder first, whenever you want to access the vm you will need to cd into that folder - * $ vagrant init hashicorp/precise32 - * $ vagrant up - * $ vagrant ssh - * This last command is used to go into your vm + ``` + $ vagrant init hashicorp/precise32 + + $ vagrant up + + $ vagrant ssh + ``` + * This last command is used to go into your vm 3. Install pipin the vm * http://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/ * tl;dr * $ sudo apt-get install python-pip 4. Install pyDNS - * This is a package dependency of validate email - * $ sudo pip install pydns + ``` + This is a package dependency of validate email + + $ sudo pip install pydns + ``` 5. Install git - * sudo apt-get install git + ``` + $ sudo apt-get install git + ``` 6. Clone the validate_email repo to your vm * (Since its a new machine you will need to clone using the https url) * $ git clone git@github.com:efagerberg/validate_email.git @@ -30,7 +39,10 @@ How to Set Up Validate Email Using Vagrant on PC config.ssh.forward_agent = true end 7. cd into validate_email and run script - * $ cd validate_email - * $ python validate_email.py + ``` + $ cd validate_email + + $ python validate_email.py + ``` From 6aae02f27c1e4b8a70a88b0908e378fd61afe125 Mon Sep 17 00:00:00 2001 From: Evan Fagerberg Date: Fri, 17 Jul 2015 12:03:21 -0400 Subject: [PATCH 3/6] Update vagrant_setup.md --- vagrant_setup.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vagrant_setup.md b/vagrant_setup.md index 8cf19a4..8845946 100644 --- a/vagrant_setup.md +++ b/vagrant_setup.md @@ -18,7 +18,9 @@ How to Set Up Validate Email Using Vagrant on PC 3. Install pipin the vm * http://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/ * tl;dr - * $ sudo apt-get install python-pip + ``` + $ sudo apt-get install python-pip + ``` 4. Install pyDNS ``` This is a package dependency of validate email From 59e8c648538f46dbca62429afb55b77bfa4d7dd3 Mon Sep 17 00:00:00 2001 From: Evan Fagerberg Date: Fri, 17 Jul 2015 12:04:24 -0400 Subject: [PATCH 4/6] Update vagrant_setup.md --- vagrant_setup.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vagrant_setup.md b/vagrant_setup.md index 8845946..e44ba31 100644 --- a/vagrant_setup.md +++ b/vagrant_setup.md @@ -20,6 +20,7 @@ How to Set Up Validate Email Using Vagrant on PC * tl;dr ``` $ sudo apt-get install python-pip + ``` 4. Install pyDNS ``` @@ -33,7 +34,7 @@ How to Set Up Validate Email Using Vagrant on PC ``` 6. Clone the validate_email repo to your vm * (Since its a new machine you will need to clone using the https url) - * $ git clone git@github.com:efagerberg/validate_email.git + * ```$ git clone git@github.com:efagerberg/validate_email.git``` * If you want to use your ssh keys on your machine you will need to add this line to the vagrant file under the config * Looks somthing like this: Vagrant::Config.run do |config| From 42b337cb288d7ed7c90eae236d57676cf05917eb Mon Sep 17 00:00:00 2001 From: Evan Fagerberg Date: Fri, 24 Jul 2015 16:18:16 +0000 Subject: [PATCH 5/6] whitespace throws regex failure and check for servfail --- validate_email.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validate_email.py b/validate_email.py index 3dc50e9..fd9168e 100644 --- a/validate_email.py +++ b/validate_email.py @@ -51,7 +51,7 @@ except (ImportError, AttributeError): # even when it's not strictly necessary. This way we don't forget # when it is necessary.) # -WSP = r'[ \t]' # see 2.2.2. Structured Header Field Bodies +WSP = r'[\s]' # see 2.2.2. Structured Header Field Bodies CRLF = r'(?:\r\n)' # see 2.2.3. Long Header Fields NO_WS_CTL = r'\x01-\x08\x0b\x0c\x0f-\x1f\x7f' # see 3.2.1. Primitive Tokens QUOTED_PAIR = r'(?:\\.)' # see 3.2.2. Quoted characters @@ -101,7 +101,7 @@ def get_mx_ip(hostname): try: MX_DNS_CACHE[hostname] = DNS.mxlookup(hostname) except ServerError as e: - if e.rcode == 3: # NXDOMAIN (Non-Existent Domain) + if e.rcode == 3 or e.rcode == 2: # NXDOMAIN (Non-Existent Domain) or SERVFAIL MX_DNS_CACHE[hostname] = None else: raise From ff2ad2bb623d93f5a52955277ec098918f838c6d Mon Sep 17 00:00:00 2001 From: Evan Fagerberg Date: Fri, 24 Jul 2015 12:27:30 -0400 Subject: [PATCH 6/6] Fix spacing --- validate_email.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validate_email.py b/validate_email.py index fd9168e..0f18e3e 100644 --- a/validate_email.py +++ b/validate_email.py @@ -101,7 +101,7 @@ def get_mx_ip(hostname): try: MX_DNS_CACHE[hostname] = DNS.mxlookup(hostname) except ServerError as e: - if e.rcode == 3 or e.rcode == 2: # NXDOMAIN (Non-Existent Domain) or SERVFAIL + if e.rcode == 3 or e.rcode == 2: # NXDOMAIN (Non-Existent Domain) or SERVFAIL MX_DNS_CACHE[hostname] = None else: raise