Giter Club home page Giter Club logo

local-packet-whisperer's Introduction

Local Packet Whisperer (LPW)

A Fun project using Ollama, Streamlit & PyShark to chat with PCAP/PCAG NG files locally, privately!

Features & Background

  1. 100% local, private PCAP assistant powered by range of local LLMs at your control, powered by Ollama
  2. Purely based on promp engg without any fancy libraries & dependencies. 100% vanilla
  3. Uses streamlit for the FE and pyshark for the pcap parsing needs
  4. Available as a pip installable package. So just pip it away! ๐Ÿ˜Ž

Refer Release History for more details info on what each release contains.

Requirements

  1. Download & Install Ollama by referring to instructions according to your OS here

  2. Pull any Chat based LLM models to use with LPW.

ollama pull dolphin-mistral:latest
  1. If not running the desktop application, Start Ollama Server (refer here)

Usage

  1. Install LPW using pip
pip install lpw
  1. This will install lpw CLI in your machine. Now simply Start or Stop LPW as follows:
lpw {start or stop}
lpw -h #for help
  1. LPW will automatically fetch the local models from Ollama local repo and populate the dropdown. Select a model to start your test. You can play with more than 1 model to compare the results ๐Ÿ˜Ž

  1. Now upload a PCAP/PCAPNG file.

  1. You can now start to chat with LPW and ask questions about the packet. Please Note: The performance of LPW depends on the underlying model. So feel free to download as many local LLMs from Ollama and try it. It is fun to see different response ๐Ÿคฉ๐Ÿคฉ๐Ÿคฉ.

(This is a long gif. You will find LLM response at the end of the gif)

  1. By default PyShark parse the pcap till transport layer. If you want, you can help the LLM to parse application layer by selecting protocol filter in the analysis (just like how we would do in wireshark) .

Local Development

  1. Clone this repo and install requirements
git clone https://github.com/kspviswa/local-packet-whisperer.git
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
  1. Run streamlit app & point to http://localhost:8501
streamlit run bin/lpw_main.py

or simply

<lpw dir>/bin/lpw {start or stop}

Contributions

I just created this project based on inspiration from similar project called Packet Buddy which used open AI. But if you find this useful and wanna contribute bug fixes, additional features feel free to do so by raising a PR or open issues for me to fix. I intend to work on this as a hobby unless there is some interest in the community.

local-packet-whisperer's People

Contributors

kspviswa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

local-packet-whisperer's Issues

Support pcapng files

Thanks for this!
I was excited to try this out on some captures I have.
Installed everything and uploaded a file and it says pcapng is not supported.
image

I will look into any simple way to convert pcapng to pcap, but it would be nice if LPW directly supported pcapng files.

Again, thanks!

Analysis folder missing

Hi we are trying local packet whisperer and when we upload the file we get this error:

[Errno 2] No such file or directory: 'analysis/test1.pcap'
Traceback:
File "/Users/dzacks/local-packet-whisperer/.venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
exec(code, module.dict)
File "/Users/dzacks/local-packet-whisperer/main.py", line 105, in
with open(f'analysis/{packetFile.name}', 'wb') as f

we are trying this from scratch on a mac; when we upload the file we get this error

where is the analysis folder coming from? are you sure you are making this folder and saving the upload into this folder?

John

Need help in testing LPW in WINDOWS machine

Although I took care to ensure that LPW is cross platform, I couldn't be sure since I don't own a windows machine to test LPW.
I'm looking for some community support to test and validate lpw in windows and open issue if you find any gaps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.