GithubHelp home page GithubHelp logo

spq / pkappa2 Goto Github PK

View Code? Open in Web Editor NEW
36.0 3.0 8.0 1.79 MB

Network traffic analysis tool for Attack & Defense CTF's

License: Apache License 2.0

Go 60.65% JavaScript 2.89% HTML 0.17% Vue 20.89% Python 10.69% Nearley 0.42% Dockerfile 0.22% TypeScript 4.09%
ctf-tools ctf attack-defense attack-defense-ctf capture-the-flag pcap pcap-analyzer packet-analyser

pkappa2's People

Contributors

dependabot[bot] avatar peace-maker avatar schmop avatar spq avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

pkappa2's Issues

Render http response in iframe with correct content type

Allow to preview HTML responses right in the browser. Make sure to sandbox it appropriately.

This might need a redesign of the streamdata view where every chunk gets their own buttons to change their appearance instead of changing the appearance of the whole stream at once.

Misleading error message if -base_dir cannot be listed

When missing the +x flag for the -base_dir folder, no files can be created and uploading a pcap sends a response of File already exists instead of some other more descriptive error message.

pkappa2 refuses to start if the -base_dir isn't readable, so checking this on start might be a good place.

Support PCAP groups during import

When importing a pcap file, allow to specify which group it belongs to. Challenges can be separated this way.
Groups have their own indexes & snapshots and may only be combined with packets in the same group.

This might improve import speed.

Assume `data:` prefix if query couldn't be parsed at all

Allow to search more intuitively by not requiring to learn the query language to do a quick regex search in the pcaps.
If parts of the query are valid syntax, the query should still fail to catch typos. But queries like GET /bla should silently be treated like data:"GET /bla".

Highlight query matches in stream data

When looking for "AAAA" highlight all occurences of "AAA" in the stream data view.
Maybe allow to skip/scroll to the next occurence would be useful too.

Converter output not updated after streams receive new packets

When a stream is converted, the output is cached. If the stream receives more packets in a new pcap, the longer stream is not converted again resulting in outdated converter output.

We need to invalidate the cache and rerun the converter when a stream is updated.

mgr.updatedStreamsDuringTaggingJob.Or(updatedStreams)
mgr.invalidateTags(updatedStreams, addedStreams)

Run program after importing a pcap

Add an option to run arbitrary programs after a new pcap was imported. The program could get the path to the imported .pcap file as an argument. This would be useful for external tools to analyze the pcap and add additional info to the streams, but only after pkappa2 knows about the streams itself.

We could add another pcap_postprocessor directory containing all the programs that should be run after the importPcapJob job.

Remember selected converter for a stream

When selecting a converter as a one-off view of a single stream, display that converter view again when navigating away and back to the same stream. Make sure to handle disappearing of the converter in the meantime.

fix formatting

with some changes to the project in the recent time, the (web) formatting settings were changed.
This results in auto formatting touching "every second line", which then results in not using autoformatting anymore.
We should either return to the formatting configuration from before the change or format every file according to the new settings.

Search history reverse search

I wish that when I press ctrl+r somewhere on the page, I could use it to search backwards in my previous search queries.
Just like in bash/zsh or other common shells and terminals.

  • ctrl+r opens the reverse search
  • In the reverse search, terms can be entered according to which the previous search queries are filtered live and the latest one is suggested
  • Ctrl+r again traverses backwards through the suggestions
  • Ctrl+shift+r moves forwards through the suggestions
  • ESC closes the reverse search and leaves the last suggestion in the search field
  • Ctrl+C closes the reverse search and clears the search field
  • Enter closes the reverse search and sends the search query immediately
  • Interaction with the UI should cancel the reverse search in the same way as ESC does
    • (This can be implemented using a modal with an invisible backdrop)

Add button to download raw data of a stream

Instead of downloading a pcap just download the raw binary blob of the traffic.

Selecting which side of the traffic client/server/both to export or even selecting per chunk seems useful.

"Search Selection" searches for one byte before the selection

When selecting bytes in the output and pressing Search Selection, the selection is one too large.

Selecting /bla in GET /bla HTTP/1.1 would cause the query to include the space beforehand cdata:"\x{20}\x{2F}bla".

Printable characters should be inserted plain without \x{XX} for readability too.

Improve and document graph UI

The graph view isn't intuitive to use.
grafik

Non aggregated graphs might give better insights of outliers in the history. Requires limiting the amount of data to display like in #62 when displaying every single stream.

Server not responsive on certain high-load queries

When executing certain queries the server (even when having very high specs at hand) becomes unresponsive and is overloaded.

Proposed Solution: Cap execution time and / or resource usage for each query and add a way to abort an query

Add tests

Add tests for the backend and maybe for the frontend.

We'd need to generate pcaps in CI or include some pcaps in the repo where we know which data to expect. Write queries selecting all kinds of streams and verify we find all the streams we expect.

filtering for streams not containing a particular string is broken

filtering for streams not containing a particular string is broken since converter support was merged.
a simple query like
id:123 -cdata:foo
will return the stream with id 123 even if it contains the string foo.

the reason is that a converter that has nothing to do with the given stream will not have already run on the stream.
Thus, an empty stream is used when searching, which matches the filter condition of not containing the string "foo".

There should be a distinction between an actual empty stream and a stream that has not (yet) been converted.
This will fix this and other issues.

This alone will however not fix the logic related to converters:
the current implementation works in a way that can be expressed like this:
id:123 AND ( -cdata.conv1:foo OR -cdata.conv2:foo OR -cdata.conv3:foo )
however the implementation should work in a way like this:
id:123 AND -( cdata.conv1:foo OR cdata.conv2:foo OR cdata.conv3:foo )

Separate manual and automatically added tag marks in UI

When tagging streams using e.g. Suricata the tags pollute the Marks list and manually created ones for interesting traffic get lost.
Maybe we can introduce yet another tag type for external tags which is folded/hidden by default in the left bar, but still show up in the results?

Cache tag matches for faster startup time

Currently only the tag query is saved and the query is ran again on startup to find all the matches which can take a long time. Since we ran the query before, we could store the matching stream ids somewhere and load them on startup instead of querying again.

Allow to abort running queries

When accidentally staring a dumb query which takes ages, don't waste resources but allow to abort the lookup before it's done.

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.