text
stringlengths 1
93.6k
|
|---|
sr = cv2.cvtColor(sr, cv2.COLOR_RGB2BGR)
|
if args.save:
|
cv2.imwrite(os.path.join(output_path, img_n.replace('.jpg', '.png')), sr)
|
# <FILESEP>
|
#!/usr/bin/python
|
from __future__ import print_function
|
"""SPF (Sender Policy Framework) implementation.
|
Copyright (c) 2003 Terence Way <terry@wayforward.net>
|
Portions Copyright(c) 2004,2005,2006,2007,2008,2011,2012 Stuart Gathman <stuart@bmsi.com>
|
Portions Copyright(c) 2005,2006,2007,2008,2011,2012,2013,2014 Scott Kitterman <scott@kitterman.com>
|
Portions Copyright(c) 2013,2014,2020 Stuart Gathman <stuart@gathman.org>
|
This module is free software, and you may redistribute it and/or modify
|
it under the same terms as Python itself, so long as this copyright message
|
and disclaimer are retained in their original form.
|
IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
|
THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
DAMAGE.
|
THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS,
|
AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
|
SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
For more information about SPF, a tool against email forgery, see
|
http://www.open-spf.org/
|
For news, bugfixes, etc. visit the home page for this implementation at
|
ERROR: type should be string, got " https://pypi.org/project/pyspf/\n"
|
ERROR: type should be string, got " https://github.com/sdgathman/pymilter/\n"
|
http://www.wayforward.net/spf/
|
"""
|
# CVS Commits since last release (2.0.12):
|
# $Log$
|
# Revision 1.108.2.152 2016/04/26 03:57:04 kitterma
|
# * Set version and update changelog for 2.0.13 development.
|
#
|
# Revision 1.108.2.151 2016/04/26 03:53:04 kitterma
|
# * Catch ValueError due to improper IP address in connect IP or in ip4/ip6
|
# mechanisms
|
#
|
# See pyspf_changelog.txt for earlier CVS commits.
|
__author__ = "Terence Way, Stuart Gathman, Scott Kitterman"
|
__email__ = "pyspf@pymilter.org"
|
__version__ = "2.1.0"
|
MODULE = 'spf'
|
USAGE = """To check an incoming mail request:
|
% python spf.py [-v] {ip} {sender} {helo}
|
% python spf.py 69.55.226.139 tway@optsw.com mx1.wayforward.net
|
To test an SPF record:
|
% python spf.py [-v] "v=spf1..." {ip} {sender} {helo}
|
% python spf.py "v=spf1 +mx +ip4:10.0.0.1 -all" 10.0.0.1 tway@foo.com a
|
To fetch an SPF record:
|
% python spf.py {domain}
|
% python spf.py wayforward.net
|
To test this script (and to output this usage message):
|
% python spf.py
|
"""
|
import re
|
import sys
|
import socket # for inet_ntoa() and inet_aton()
|
import struct # for pack() and unpack()
|
import time # for time()
|
try:
|
import urllib.parse as urllibparse # for quote()
|
except:
|
import urllib as urllibparse
|
import sys # for version_info()
|
from functools import reduce
|
try:
|
from email.message import Message
|
except ImportError:
|
from email.Message import Message
|
# Python standard library as of python3.3
|
import ipaddress
|
if bytes is str:
|
from ipaddress import Bytes
|
def DNSLookup_pydns(name, qtype, strict=True, timeout=20):
|
try:
|
req = DNS.DnsRequest(name, qtype=qtype, timeout=timeout)
|
resp = req.req()
|
#resp.show()
|
# key k: ('wayforward.net', 'A'), value v
|
# FIXME: pydns returns AAAA RR as 16 byte binary string, but
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.