Need help for spicy analyzer

Hi,
Recently, I’ve been trying to implement a PostgreSQL protocol parser using Spicy. I’ve looked at some official examples, but they seem to be different from what I’m trying to achieve. The communication format in PostgreSQL can be irregular, and I’m attempting to implement it using a state machine approach. However, I don’t know where to start, as the official examples don’t seem to use this approach. Of course, I might have missed something. I hope you could give me some relevant advice or point me to some reference examples. Thanks!

Hello @ret2c7 ,

thanks for your question.

However, I don’t know where to start, as the official examples don’t seem to use this approach. Of course, I might have missed something. I hope you could give me some relevant advice or point me to some reference examples

I had dabbled with a PostgreSQL analyzer, too and just now pushed my local WIP version to GitHub. Maybe it helps as a starting point: GitHub - awelzel/spicy-postgresql (not production tested).

I did run into synchronization hurdles, too, and it was suggested to use contexts and sinks for buffering of data. See for example, here:

This also spawned an idea to add a barrier type to synchronize client/server parsing states more easily. If you have any more thoughts or feedback here that would be much appreciated.

Is this roughly what you ran into? Maybe above code dump gives a starting point? Suggest to come by the Zeek Slack (Slack) and join the #spicy channel for further questions.

Hope this helps,
Arne