def handshake_step_one(): http.build_empty_http_header() tcp.build_tcp_header(global_data.get_value("local_port"), 80, 0, 0, 5, 0, 1, 0, 0, 0) ip.build_ip_header() ethernet.build_ethernet_header_for_ip() data_transfer.send_packet_to_server()
def send_ack_to_server(seq_no): http.build_empty_http_header() tcp.build_tcp_header(global_data.get_value("local_port"), 80, 1 + global_data.get_value("http_request_length"), seq_no + 1, 5, 0, 0, 0, 0, 1) ip.build_ip_header() ethernet.build_ethernet_header_for_ip() send_packet_to_server()
def handshake_step_three(): http.build_empty_http_header() tcp.build_tcp_header(global_data.get_value("local_port"), 80, 1, global_data.get_value("sequence_number") + 1, 5, 0, 0, 0, 0, 1) ip.build_ip_header() ethernet.build_ethernet_header_for_ip() data_transfer.send_packet_to_server()
def send_fin_ack_to_server(): http.build_empty_http_header() tcp.build_tcp_header(global_data.get_value("local_port"), 80, global_data.get_value("acknowledge_number"), int(global_data.get_value("sequence_number")) + 1, 5, 1, 0, 0, 0, 1) ip.build_ip_header() ethernet.build_ethernet_header_for_ip() send_packet_to_server()
def send_data_to_server(): """ send http request to server """ http.build_http_header() tcp.build_tcp_header(global_data.get_value("local_port"), 80, 1, int(global_data.get_value("sequence_number")), 5, 0, 0, 0, 1, 1) ip.build_ip_header() ethernet.build_ethernet_header_for_ip() send_packet_to_server()