MCPcopy Index your code
hub / github.com/secdev/scapy / add_ClientData

Method add_ClientData

scapy/layers/tls/automaton_cli.py:620–655  ·  view source on GitHub ↗

r""" The user may type in: GET / HTTP/1.1\r\nHost: testserver.com\r\n\r\n Special characters are handled so that it becomes a valid HTTP request.

(self)

Source from the content-addressed store, hash-verified

618
619 @ATMT.condition(WAIT_CLIENTDATA, prio=1)
620 def add_ClientData(self):
621 r"""
622 The user may type in:
623 GET / HTTP/1.1\r\nHost: testserver.com\r\n\r\n
624 Special characters are handled so that it becomes a valid HTTP request.
625 """
626 if not self.data_to_send:
627 if self.is_atmt_socket:
628 # Socket mode
629 fd = select_objects([self.ioin["tls"]], 0)
630 if fd:
631 self.add_record()
632 self.add_msg(TLSApplicationData(data=fd[0].recv()))
633 raise self.ADDED_CLIENTDATA()
634 raise self.WAITING_SERVERDATA()
635 else:
636 data = input().replace('\\r', '\r').replace('\\n', '\n').encode()
637 else:
638 data = self.data_to_send.pop()
639 if data == b"quit":
640 return
641 # Command to skip sending
642 elif data == b"wait":
643 raise self.WAITING_SERVERDATA()
644 # Command to perform a key_update (for a TLS 1.3 session)
645 elif data == b"key_update":
646 if self.cur_session.tls_version >= 0x0304:
647 self.add_record()
648 self.add_msg(TLS13KeyUpdate(request_update="update_requested"))
649 raise self.ADDED_CLIENTDATA()
650
651 if self.linebreak:
652 data += b"\n"
653 self.add_record()
654 self.add_msg(TLSApplicationData(data=data))
655 raise self.ADDED_CLIENTDATA()
656
657 @ATMT.condition(WAIT_CLIENTDATA, prio=2)
658 def no_more_ClientData(self):

Callers

nothing calls this directly

Calls 11

ADDED_CLIENTDATAMethod · 0.95
WAITING_SERVERDATAMethod · 0.95
select_objectsFunction · 0.90
TLSApplicationDataClass · 0.90
TLS13KeyUpdateClass · 0.90
add_recordMethod · 0.80
add_msgMethod · 0.80
encodeMethod · 0.80
replaceMethod · 0.80
popMethod · 0.80
recvMethod · 0.45

Tested by

no test coverage detected