how to implement stp, rstp , mstp protocol using scapy? - scapy

I am trying to implement the SPANNING TREE PROTOCOL, rapid spanning tree protocol and multiple spanning tree protocol using SCAPY. Can someone post the code to implement the same .

It’s not currently implemented, meaning that you must implement it yourself.
You can have a look on internet if someone has already done it and lookup through scapy source code
Also, see
Adding new protocols from scapy’s documentation

Related

Connecting to the logical replication/streaming from node or go?

Is there a way to connect/subscribe to Postgres logical replication/streaming replication using node or go? I know its a TCP/IP connection but not exactly where to start. I also know there is a package for this, was wondering for more of a vanilla/understanding solution.
I'm not certain what you want, but maybe you are looking for “logical decoding”.
If you want to directly speak the replication protocol with the server, you'll have to implement it in your code, but that information is pretty useless, as it only contains the physical changes to the data files.
If you want logical decoding, there is the test_decoding module provided by PostgreSQL, and here are some examples how it can be used.
Mind that test_decoding is for testing. For real-world use cases, you will want to use a logical decoding plugin that fits your needs, for example wal2json.
If that's what you want to consume, you'll have to look up the documentation for the logical decoding plugin you want to use to learn the format in which it provides the information.

Is it possible to implement RTP-based protocol using Google's FlatBuffers library?

I'm especially interested in implementation of RTP-MIDI protocol. The major difficulties could be faced in implementation of bit-fields and non-ordinary MIDI-like timestamps, as I can expect. And maybe if somebody knows already existed open source c++ implementations, please give me a reference to it.
I don't think so. As far as I can tell, RTP-MIDI is a very specific encoding. FlatBuffers is not able to emulate existing binary encoding/layout, it has its own encoding which typically does not match other binary encodings, even if the same information is stored.
FlatBuffers can generally be used with any protocol that can transport an opaque payload of bytes. RTP itself (not RTP-MIDI) could potentially be used with FlatBuffer data (after the RTP header).

Induction by assume-guarantee with nuSMV

I have an asynchronous symmetric ring-shaped protocol with 5 processes that satisfies a given property. I want to prove (or get counterexample) that the property is true for protocols with 6 number of processes and more; that is
∀n.φ(n)
I decided to use assume-guarantee and I’m using nuSMV for model-checking.
I know that former versions of SMV like Cadence could support this feature but is there any way to implement assume-guarantee in nuSMV?
If there is not, could I use other model checkers like SPIN instead?
Thank you.

What does the python selector module do and how does it work?(python3)

I would like to know how the selector module works and how can I use it in socket programming. What does the selector.register() do? I've searched a lot but couldn't find anything, so I couldn't wrap my head around it.
The selector module is a higher level interface around the good old select function. That select function was invented in the 80's for the Unix BSD 4.2 OS, along with the other parts of the Berkeley sockets interface. And as the rest of the socket interface it is still in use nowadays to allow a single execution thread to handle a number of incoming and outgoing connections => it is the best way I know to handle large network throughput using limited resources.
The underlying engine of select is to present the readiness state (both for reading and writing) of a list of interfaces. From that on, it is the responsability of the application (and of the application programmer) to use that information to only read or write to a socket when the operation cannot block. Not that hard, but the threading model (one execution thread per connection) if far more natural for a human being (what most programmers are except for gods).
The Python selector module presents an event driven interface above select:
the programmer register a number of interfaces and can dynamically add or remove sockets
for each socket, the programmer declare what should be done when it is ready for reading or writing
Functionaly it is exactly the same of the good old select module. But it is much more programmer friendly with all the OOP goodies and the event driven pattern. Old dinausors, that were used to programming select in C language may find that it is not really worth learning a new interface. But IMHO, the fact is that it allows to write code easier to read and test.
Basically the selector module gives us the ability to keep track of sockets. We can use it to register a socket and unregister it.
An analogy for this would be, a selector object is like a notebook. Every time we create a new socket, we jot it down in the notebook for later use. When we are done with it, we remove it from the notebook. This is not how it works in reality(i'm not sure if it actually works this way) but this analogy helped me to understand it a bit more easily.
Now, you might think what happens when a sock is registered?
An object is created with a few attributes like sock no,a callback and It's added to some kind of list.
I'd appreciate if some on corrected my explanation.

implement imap search on server

I'm currently working on implementing IMAP protocol on our mail server. This is my first time implementing such a big project and I've so far coded a majority of IMAP commands in the RFC, except the Search command.
I've been searching on the internet and studied postfix algorithm for weeks to see how to write the search command correctly.
It seems Postfix would work until I encountered something like OR OR A B C D ==> (OR (OR A B) C) D
Could anyone point me a direction on how to implement the Search command when there are multiple ORs?
Thank you very much for any help you could provide.
This is not going to be an answer you are going to like, but I'll recommend this anyway -- don't do this. IMAP is an extremely complex protocol with a ton of non-obvious corner cases. The baseline version (RFC3501) also leaves many advanced features missing; in order to get reasonable performance, especially with mobile clients, you need to implement quite a few extensions.
If I were you, I would recommend integrating with an existing open-source IMAP server implementation. If you have a fancy storage backend, perhaps you can write a plugin for Dovecot or Cyrus.
If you decide to really reimplement this yourself and this is your first complex project, you will very likely end up with a product which is subtly broken in numerous ways. If your goal is to be able to add a "speaks IMAP" phrase to the sales brochure, well, it will work, but in practice, you will be solving interoperability problems in the next five years at least.

Resources