| Functions | |
| def | print_hexa_raw | 
| Prints hexadecimal string to a file. | |
| def | hexa_byteswapper | 
| Swaps bytes in the source hexadecimal string. | |
| def | get_hexa_unixtime | 
| Returns actual time in the unix timeformat recalculated to hexadecimal, without leading 0x. | |
| def | get_bytelength | 
| Computes length of the hexadecimal string(in bytes). | |
| def | hexa_padd8x | 
| Removes leading 0x and adds leading zeros to padd hex number to format XXXXXXXX. | |
| def | hexa_padd4x | 
| Removes leading 0x and adds leading zeros to padd hex number to format XXXX. | |
| def | checksum | 
| Computes a one's complement checksum for the IP packet header. | |
| def | create_pcap_global_hdr | 
| Creates a pcap global header in form of a packed python struct. | |
| def | create_pcap_pckt_hdr | 
| Creates a pcap packet header in form of a packed python struct. | |
| def | create_eth_hdr | 
| Creates an ethernet header in form of a packed python struct. | |
| def | pack_ip | 
| Transforms IP address from a string to the packed python struct. | |
| def | create_ip_hdr | 
| Creates an IP header in a form of a packed python struct. | |
| def | create_udp_hdr | 
| Creates a UDP header in a form of a packed python struct. | |
| def | create_tcp_hdr | 
| Creates a TCP header in a form of a packed python struct. | |
| def | init_pcap_file | 
| Writes a pcap global header to a file. | |
| def | convert_data_to_pcap | 
| Creates all necessary fake headers and wraps up the raw data with it. | |
| def | merge_headers_and_data | 
| Creates all necessary fake headers and wraps up the raw data with it. | |
| def | remove_global_header | 
| Removes the pcap global header from the fake packet. | |
| def | save_pcap_packet_to_pcap_file | 
| Saves the fake packet to a pcap file. | |
| def | update_tcp_control_length | 
| Updates the TCP sequence number. | |
| Variables | |
| int | eth_hdr_size = 14 | 
| size of ethernet header in bytes | |
| int | ip_hdr_size = 20 | 
| size of IP header in bytes | |
| int | tcp_hdr_size = 20 | 
| size of TCP header in bytes | |
| int | udp_hdr_size = 8 | 
| size of UDP header in bytes | |
| int | pcap_glob_hdr_size = 24 | 
| size of pcap global header in bytes | |
| int | pcap_pckt_hdr_size = 16 | 
| size of pcap local header in bytes | |
| tuple | ip_pack_proto_udp = int('11',16) | 
| Reusable field used in a few different headers. | |
| tuple | ip_pack_proto_tcp = int('06',16) | 
| Reusable field used in a few different headers. | |
| def Shark_libs::data2pcap::checksum | ( | header | ) | 
Computes a one's complement checksum for the IP packet header.
| header | Source IP packet header with zero checksum. | 
| def Shark_libs::data2pcap::convert_data_to_pcap | ( | data, | ||
| pcap_file, | ||||
| mode, | ||||
| src_ip, | ||||
| src_port, | ||||
| dst_ip, | ||||
| dst_port, | ||||
| seq, | ||||
| ack | ||||
| ) | 
Creates all necessary fake headers and wraps up the raw data with it.
Resulting fake packet is written to a pcap file.
| data | Raw data which will be wrapped up into the fake packet. | |
| pcap_file | File handle of the opened file to which we write to. | |
| mode | Type of the fake packet. Now supported UDP/TCP only. | |
| src_ip | IP address that will be used as source IP in the fake packet. | |
| src_port | Number that will be used as a source port in the fake packet. | |
| dst_ip | IP address that will be used as dest IP in the fake packet. | |
| dst_port | Number that will be used as a dest port in the fake packet. | |
| seq | Number that will be used as a TCP sequence number in the fake packet. | |
| ack | Number that will be used as a TCP acknowledgement number in the fake packet. | 
| def Shark_libs::data2pcap::create_eth_hdr | ( | ) | 
Creates an ethernet header in form of a packed python struct.
| def Shark_libs::data2pcap::create_ip_hdr | ( | raw_data, | ||
| src_ip, | ||||
| dst_ip, | ||||
| mode | ||||
| ) | 
Creates an IP header in a form of a packed python struct.
| raw_data | Raw data which will be wrapped up into the fake packet. | |
| src_ip | IP address that will be used as source IP in the fake packet. | |
| dst_ip | IP address that will be used as dest IP in the fake packet. | |
| mode | Type of the fake packet. Now supported UDP/TCP only. | 
| def Shark_libs::data2pcap::create_pcap_global_hdr | ( | ) | 
Creates a pcap global header in form of a packed python struct.
| def Shark_libs::data2pcap::create_pcap_pckt_hdr | ( | raw_data, | ||
| mode | ||||
| ) | 
Creates a pcap packet header in form of a packed python struct.
| def Shark_libs::data2pcap::create_tcp_hdr | ( | raw_data, | ||
| src_ip, | ||||
| sport, | ||||
| dst_ip, | ||||
| dport, | ||||
| seq, | ||||
| ack | ||||
| ) | 
Creates a TCP header in a form of a packed python struct.
| raw_data | Raw data which will be wrapped up into the fake packet. | |
| src_ip | IP address that will be used as source IP in the fake packet. | |
| sport | Number that will be used as a source port in the fake packet. | |
| dst_ip | IP address that will be used as dest IP in the fake packet. | |
| dport | Number that will be used as a dest port in the fake packet. | |
| seq | Number that will be used as a TCP sequence number in the fake packet. | |
| ack | Number that will be used as a TCP acknowledgement number in the fake packet. | 
| def Shark_libs::data2pcap::create_udp_hdr | ( | raw_data, | ||
| src_ip, | ||||
| sport, | ||||
| dst_ip, | ||||
| dport | ||||
| ) | 
Creates a UDP header in a form of a packed python struct.
| raw_data | Raw data which will be wrapped up into the fake packet. | |
| src_ip | IP address that will be used as source IP in the fake packet. | |
| sport | Number that will be used as a source port in the fake packet. | |
| dst_ip | IP address that will be used as dest IP in the fake packet. | |
| dport | Number that will be used as a dest port in the fake packet. | 
| def Shark_libs::data2pcap::get_bytelength | ( | in_str | ) | 
Computes length of the hexadecimal string(in bytes).
| in_str | Source string. | 
| def Shark_libs::data2pcap::get_hexa_unixtime | ( | ) | 
Returns actual time in the unix timeformat recalculated to hexadecimal, without leading 0x.
| def Shark_libs::data2pcap::hexa_byteswapper | ( | in_str | ) | 
Swaps bytes in the source hexadecimal string.
| in_str | Source hexadecimal string. | 
| def Shark_libs::data2pcap::hexa_padd4x | ( | original | ) | 
Removes leading 0x and adds leading zeros to padd hex number to format XXXX.
| original | Source number in hex format. | 
| def Shark_libs::data2pcap::hexa_padd8x | ( | original | ) | 
Removes leading 0x and adds leading zeros to padd hex number to format XXXXXXXX.
| original | Source number in hex format. | 
| def Shark_libs::data2pcap::init_pcap_file | ( | filehandle | ) | 
Writes a pcap global header to a file.
| filehandle | File handle of the opened file to which we write to. | 
| def Shark_libs::data2pcap::merge_headers_and_data | ( | raw_data, | ||
| protocol, | ||||
| src_ip, | ||||
| src_port, | ||||
| dst_ip, | ||||
| dst_port, | ||||
| seq = 1000, | ||||
| ack = 100 | ||||
| ) | 
Creates all necessary fake headers and wraps up the raw data with it.
| raw_data | Raw data which will be wrapped up into the fake packet. | |
| protocol | Type of the fake packet. Now supported UDP/TCP only. | |
| src_ip | IP address that will be used as source IP in the fake packet. | |
| src_port | Number that will be used as a source port in the fake packet. | |
| dst_ip | IP address that will be used as dest IP in the fake packet. | |
| dst_port | Number that will be used as a dest port in the fake packet. | |
| seq | Number that will be used as a TCP sequence number in the fake packet. | |
| ack | Number that will be used as a TCP acknowledgement number in the fake packet. | 
| def Shark_libs::data2pcap::pack_ip | ( | ip_address | ) | 
Transforms IP address from a string to the packed python struct.
| ip_address | Source IP addres in a string format. | 
| def Shark_libs::data2pcap::print_hexa_raw | ( | to_print, | ||
| mfile | ||||
| ) | 
Prints hexadecimal string to a file.
| to_print | String that will be written to a file. | |
| mfile | File handle of the opened file to which we write to. | 
| def Shark_libs::data2pcap::remove_global_header | ( | data | ) | 
Removes the pcap global header from the fake packet.
| data | Wrapped data which will be stripped. | 
| def Shark_libs::data2pcap::save_pcap_packet_to_pcap_file | ( | data, | ||
| pcap_file | ||||
| ) | 
Saves the fake packet to a pcap file.
| data | Wrapped data which will be written to a file. | |
| pcap_file | File handle of the opened file to which we write to. | 
| def Shark_libs::data2pcap::update_tcp_control_length | ( | mlen, | ||
| old_tcp_ctrl | ||||
| ) | 
Updates the TCP sequence number.
| mlen | Length of the new data e.g. number we add to seq. | |
| old_tcp_ctrl | Previous sequence number that will be updated. | 
| int Shark_libs::data2pcap::eth_hdr_size = 14 | 
size of ethernet header in bytes
| int Shark_libs::data2pcap::ip_hdr_size = 20 | 
size of IP header in bytes
| tuple Shark_libs::data2pcap::ip_pack_proto_tcp = int('06',16) | 
Reusable field used in a few different headers.
| tuple Shark_libs::data2pcap::ip_pack_proto_udp = int('11',16) | 
Reusable field used in a few different headers.
size of pcap global header in bytes
size of pcap local header in bytes
| int Shark_libs::data2pcap::tcp_hdr_size = 20 | 
size of TCP header in bytes
size of UDP header in bytes
 1.5.8
 1.5.8