nuke Pillow
This commit is contained in:
parent
bb2fa6dc7d
commit
8a6f8bd461
|
@ -85,7 +85,7 @@ libraries. This was tested on a fully patched installation of Ubuntu 16.04.
|
|||
|
||||
.. code:: bash
|
||||
|
||||
sudo apt-get install python3-pip python3-dev libffi-dev libssl-dev libtiff5-dev libjpeg8-dev zlib1g-dev libwebp-dev
|
||||
sudo apt-get install python3-pip python3-dev libffi-dev libssl-dev zlib1g-dev
|
||||
sudo pip3 install mitmproxy # or pip3 install --user mitmproxy
|
||||
|
||||
On older Ubuntu versions, e.g., **12.04** and **14.04**, you may need to install
|
||||
|
@ -104,7 +104,7 @@ libraries. This was tested on a fully patched installation of Fedora 24.
|
|||
|
||||
.. code:: bash
|
||||
|
||||
sudo dnf install make gcc redhat-rpm-config python3-pip python3-devel libffi-devel openssl-devel libtiff-devel libjpeg-devel zlib-devel libwebp-devel openjpeg2-devel
|
||||
sudo dnf install make gcc redhat-rpm-config python3-pip python3-devel libffi-devel openssl-devel zlib-devel
|
||||
sudo pip3 install mitmproxy # or pip3 install --user mitmproxy
|
||||
|
||||
Make sure to have an up-to-date version of pip by running ``pip3 install -U pip``.
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
import io
|
||||
import imghdr
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from mitmproxy.contentviews import base
|
||||
from mitmproxy.types import multidict
|
||||
from . import image_parser
|
||||
|
||||
from mitmproxy.contentviews import base
|
||||
|
||||
|
||||
class ViewImage(base.View):
|
||||
name = "Image"
|
||||
|
@ -16,8 +12,6 @@ class ViewImage(base.View):
|
|||
"image/png",
|
||||
"image/jpeg",
|
||||
"image/gif",
|
||||
"image/vnd.microsoft.icon",
|
||||
"image/x-icon",
|
||||
]
|
||||
|
||||
def __call__(self, data, **metadata):
|
||||
|
@ -37,19 +31,3 @@ class ViewImage(base.View):
|
|||
parts = image_parser.parse_jpeg(data)
|
||||
fmt = base.format_dict(multidict.MultiDict(parts))
|
||||
return "%s image" % f, fmt
|
||||
try:
|
||||
img = Image.open(io.BytesIO(data))
|
||||
except IOError:
|
||||
return None
|
||||
parts = [
|
||||
("Format", str(img.format_description)),
|
||||
("Size", "%s x %s px" % img.size),
|
||||
("Mode", str(img.mode)),
|
||||
]
|
||||
for i in sorted(img.info.keys()):
|
||||
if i != "exif":
|
||||
parts.append(
|
||||
(str(i), str(img.info[i]))
|
||||
)
|
||||
fmt = base.format_dict(multidict.MultiDict(parts))
|
||||
return "%s image" % img.format, fmt
|
||||
|
|
2
setup.py
2
setup.py
|
@ -71,7 +71,6 @@ setup(
|
|||
"hyperframe>=4.0.1, <5",
|
||||
"jsbeautifier>=1.6.3, <1.7",
|
||||
"kaitaistruct>=0.6, <0.7",
|
||||
"Pillow>=3.2, <4.1",
|
||||
"passlib>=1.6.5, <1.8",
|
||||
"pyasn1>=0.1.9, <0.3",
|
||||
"pyOpenSSL>=16.0, <17.0",
|
||||
|
@ -118,6 +117,7 @@ setup(
|
|||
'examples': [
|
||||
"beautifulsoup4>=4.4.1, <4.6",
|
||||
"pytz>=2015.07.0, <=2016.10",
|
||||
"Pillow>=3.2, <4.1",
|
||||
]
|
||||
}
|
||||
)
|
||||
|
|
|
@ -3,5 +3,4 @@ import logging
|
|||
logging.getLogger("hyper").setLevel(logging.WARNING)
|
||||
logging.getLogger("requests").setLevel(logging.WARNING)
|
||||
logging.getLogger("passlib").setLevel(logging.WARNING)
|
||||
logging.getLogger("PIL").setLevel(logging.WARNING)
|
||||
logging.getLogger("tornado").setLevel(logging.WARNING)
|
||||
|
|
|
@ -9,7 +9,6 @@ def test_view_image():
|
|||
"mitmproxy/data/image.png",
|
||||
"mitmproxy/data/image.gif",
|
||||
"mitmproxy/data/all.jpeg",
|
||||
"mitmproxy/data/image.ico"
|
||||
]:
|
||||
with open(tutils.test_data.path(img), "rb") as f:
|
||||
assert v(f.read())
|
||||
|
|
|
@ -23,8 +23,6 @@ logging.getLogger("hyper.packages.hpack.hpack").setLevel(logging.WARNING)
|
|||
logging.getLogger("requests.packages.urllib3.connectionpool").setLevel(logging.WARNING)
|
||||
logging.getLogger("passlib.utils.compat").setLevel(logging.WARNING)
|
||||
logging.getLogger("passlib.registry").setLevel(logging.WARNING)
|
||||
logging.getLogger("PIL.Image").setLevel(logging.WARNING)
|
||||
logging.getLogger("PIL.PngImagePlugin").setLevel(logging.WARNING)
|
||||
|
||||
|
||||
# inspect the log:
|
||||
|
|
Loading…
Reference in New Issue