-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement TCP server Automaton #3690
Conversation
As a child class of TCP_client, server automatically completes a TCP handshake when a client connects and is integrated with supersocket. Anything that could be removed due to parent class was removed. States were required to stay due to Automaton design.
Codecov Report
@@ Coverage Diff @@
## master #3690 +/- ##
==========================================
- Coverage 86.23% 86.16% -0.07%
==========================================
Files 296 296
Lines 66907 66987 +80
==========================================
+ Hits 57698 57722 +24
- Misses 9209 9265 +56
|
Thanks for your PR. Looks good, so far. Could you please provide some unit-tests? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the PR & your interest in Scapy !
This is an interesting topic and it's really nice to see what you did.
Unfortunately though, I believe it would need a bit of refactoring: we want to support multiple clients, so you probably would need to implement TCBs of some sort. There is a bit of refactoring to do :p
|
||
@ATMT.action(incoming_data_received) | ||
def receive_data(self, pkt): | ||
super().receive_data(pkt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work on Python 2 (super(TCP_server, self)
). Did you test it? same elsewhere
(sorry this should be the last release to support it :p)
self.l4 = IP(src=ip) / TCP(sport=self.sport, flags=0, | ||
seq=random.randrange(0, 2**32)) | ||
self.src = self.l4.src | ||
self.sack = self.l4[TCP].ack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit cheap: you handled only a single client at the time. I must say I envisioned something a bit more useful, handling multiple streams.
Did you have a look at Transmission Control Block?
I will continue this soon, been out of town for a bit so please don't close |
Still working on this @jabbate19 ? |
Closing for inactivity. |
As a child class of TCP_client, new TCP_server automatically completes a TCP handshake when a client connects and is integrated with supersocket. Inspiration was taken from #2409
Anything that could be removed due to parent class was removed. States were required to stay due to Automaton design.
While working on this, I found/fixed a bug within TCP_client that would cause the ACK number of a response from data to be wrong when a small amount of data was sent. Padding was being considered in the length for the ack number when it is not in the protocol.
Part of #399