kspviswa / local-packet-whisperer

A Fun project using Ollama, Streamlit & PyShark to chat with PCAP/PCAPNG files locally, privately!
MIT License
30 stars 11 forks source link

Windows usage #6

Closed taduo closed 2 weeks ago

taduo commented 3 weeks ago

Tying to use this on windows but getting an error.

When I attach the pcap I get this error.

image

RuntimeError: There is no current event loop in thread 'ScriptRunner.scriptThread'. Traceback: File "C:\Users\taduo\AppData\Local\Programs\Python\Python312\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 535, in _run_script exec(code, module.__dict__) File "C:\Users\taduo\Documents\gitprojects\local-packet-whisperer\bin\lpw_main.py", line 120, in <module> initLLM(pcap_data=getPcapData(input_file=f'{packetFile.name}', filter=filters, decode_info=decodes)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\taduo\Documents\gitprojects\local-packet-whisperer\bin\lpw_packet.py", line 17, in getPcapData cap : ps.FileCapture = ps.FileCapture(input_file=input_file, display_filter=filter) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\taduo\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyshark\capture\file_capture.py", line 38, in __init__ super(FileCapture, self).__init__(display_filter=display_filter, only_summaries=only_summaries, File "C:\Users\taduo\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyshark\capture\capture.py", line 88, in __init__ self._setup_eventloop() File "C:\Users\taduo\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyshark\capture\capture.py", line 170, in _setup_eventloop current_eventloop = asyncio.get_event_loop_policy().get_event_loop() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\taduo\AppData\Local\Programs\Python\Python312\Lib\asyncio\events.py", line 702, in get_event_loop raise RuntimeError('There is no current event loop in thread %r.'

Shannon0708 commented 2 weeks ago

Same here, don't know how to solve the problem on Windows. I just bulit this project on Ubuntu20.04, it works!

kspviswa commented 2 weeks ago

Thanks for trying this in windows. I haven't tested this in Windows so your issue helps.

Can you share the following info:

1) Windows version 2) Python version 3) Pip version 4) How did you install lpw? 5) do pip3 freeze > reqs.txt and attach it here

kspviswa commented 2 weeks ago
  • I was not able to run with lpw start but I have done the "pip install lpw"

@taduo what error you faced when you tried to install lpw in windows?

kspviswa commented 2 weeks ago

Fixed this issue. Update to LPW 0.1.3

pip install --upgrade lpw or pip install lpw==0.1.3

Shannon0708 commented 2 weeks ago

Hi, Nice to hear from you. I still face the same issue, the information is as follows:

  1. Windows version: windows 10 profesional
  2. Python version: 3.12.0
  3. Pip version: 24.0
  4. How did you install lpw? pip install lpw==0.1.3
  5. do pip3 freeze > reqs.txt and attach it here

altair==5.3.0 anyio==4.4.0 appdirs==1.4.4 attrs==23.2.0 blinker==1.8.2 cachetools==5.3.3 certifi==2024.6.2 charset-normalizer==3.3.2 click==8.1.7 colorama==0.4.6 gitdb==4.0.11 GitPython==3.1.43 h11==0.14.0 httpcore==1.0.5 httpx==0.25.2 idna==3.7 importlib_metadata==7.1.0 Jinja2==3.1.4 jsonschema==4.22.0 jsonschema-specifications==2023.12.1 lpw==0.1.3 lxml==5.2.2 markdown-it-py==3.0.0 MarkupSafe==2.1.5 mdurl==0.1.2 numpy==1.26.4 ollama==0.1.6 packaging==23.2 pandas==2.2.2 pillow==10.3.0 protobuf==4.25.3 pyarrow==16.1.0 pydeck==0.9.1 Pygments==2.18.0 pyshark==0.6 python-dateutil==2.9.0.post0 pytz==2024.1 referencing==0.35.1 requests==2.32.3 rich==13.7.1 rpds-py==0.18.1 scapy==2.5.0 setuptools==70.1.0 six==1.16.0 smmap==5.0.1 sniffio==1.3.1 streamlit==1.31.1 tenacity==8.4.1 termcolor==2.4.0 toml==0.10.2 toolz==0.12.1 tornado==6.4.1 typing_extensions==4.9.0 tzdata==2024.1 tzlocal==5.2 urllib3==2.2.2 validators==0.28.3 watchdog==4.0.1 zipp==3.19.2

Whole error msg RuntimeError: There is no current event loop in thread 'ScriptRunner.scriptThread'. Traceback: File "E:\PacketWhisperer\Python312\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 535, in _run_script exec(code, module.__dict__) File "E:\PacketWhisperer\local-packet-whisperer-main\local-packet-whisperer-main\bin\lpw_main.py", line 120, in <module> initLLM(pcap_data=getPcapData(input_file=f'{packetFile.name}', filter=filters, decode_info=decodes)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\PacketWhisperer\local-packet-whisperer-main\local-packet-whisperer-main\bin\lpw_packet.py", line 17, in getPcapData cap : ps.FileCapture = ps.FileCapture(input_file=input_file, display_filter=filter) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\PacketWhisperer\Python312\Lib\site-packages\pyshark\capture\file_capture.py", line 38, in __init__ super(FileCapture, self).__init__(display_filter=display_filter, only_summaries=only_summaries, File "E:\PacketWhisperer\Python312\Lib\site-packages\pyshark\capture\capture.py", line 88, in __init__ self._setup_eventloop() File "E:\PacketWhisperer\Python312\Lib\site-packages\pyshark\capture\capture.py", line 170, in _setup_eventloop current_eventloop = asyncio.get_event_loop_policy().get_event_loop() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\asyncio\events.py", line 698, in get_event_loop raise RuntimeError('There is no current event loop in thread %r.'

Thank you very much!

kspviswa commented 2 weeks ago

@Shannon0708 the error response shows old version. Line 17 in lpw_packet.py is different in 0.1.3 . I suggest removing the package and try again.

pip uninstall lpw pip install lpw

Or better follow https://github.com/kspviswa/local-packet-whisperer/tree/main?tab=readme-ov-file#local-development