1

This is really a simple script written in python, which I can run it normally on Linux. But when I moved it to Windows, there is a strange error. I wish some helps.

Before running the code, I have made some preparation for the environment:
1. Install Microsoft Visual C++ Compiler for python 2.7
2. Install python 2.7.11
3. pip install pyinstaller
4. easy_install pyshark
Below is part of my code.

# -*- coding: utf-8 -*-
from __future__ import print_function
import pyshark
import lxml
import os

def analysis_method(file_name):
    cap = pyshark.FileCapture(input_file=file_name)
    for packet in cap:
        if hasattr(packet, "http"):
            http_layer = packet["http"]

Below is the error information:
Traceback (most recent call last):
File "packet_offline_analysis.py", line 36, in analysis_method
for packet in cap:
File "C:\Python27\lib\site-packages\pyshark-0.3.6.1-py2.7.egg\pyshark\capture\capture.py", line 173, in _packets_from_tshark_sync
self._get_packet_from_stream(tshark_process.stdout, data, psml_structure=psml_structure))
File "C:\Python27\lib\site-packages\trollius-1.0.4-py2.7-win32.egg\trollius\base_events.py", line 300, in run_until_complete
return future.result()
File "C:\Python27\lib\site-packages\trollius-1.0.4-py2.7-win32.egg\trollius\futures.py", line 287, in result
raise self._exception
lxml.etree.XMLSyntaxError: Input is not proper UTF-8, indicate encoding !
Bytes: 0xD6 0xD0 0xB9 0xFA, line 6, column 58

mortimer
  • 11
  • 4

1 Answers1

0

Uninstall your Chinese version of Wireshark, and install a english version of Wireshark instead. Then the problem is solved.

warlock
  • 31
  • 3