Added initial protobuf definitions

This commit is contained in:
madt1m 2018-06-22 22:43:05 +02:00
parent 3cd3765270
commit ba144b15bc
4 changed files with 100 additions and 0 deletions

0
mitmproxy/io/db.py Normal file
View File

View File

@ -0,0 +1,38 @@
syntax='proto2';
message Address {
optional string host = 1;
optional int32 port = 2;
}
message ClientConnection {
optional string id = 1;
optional Address address = 2;
optional bool tls_established = 3;
optional string clientcert = 4;
optional string mitmcert = 5;
optional float timestamp_start = 6;
optional float timestamp_tls_setup = 7;
optional float timestamp_end = 8;
optional string sni = 9;
optional string cipher_name = 10;
optional bytes alpn_proto_negotiated = 11;
optional string tls_version = 12;
}
message ServerConnection {
optional string id = 1;
optional Address address = 2;
optional Address ip_address = 3;
optional Address source_address = 4;
optional bool tls_established = 5;
optional string cert = 6;
optional string sni = 7;
optional bytes alpn_proto_negotiated = 8;
optional string tls_version = 9;
optional float timestamp_start = 10;
optional float timestamp_tcp_setup = 11;
optional float timestamp_tls_setup = 12;
optional float timestamp_end = 13;
}

View File

@ -0,0 +1,51 @@
syntax='proto2';
import "connection.proto";
message HTTPFlow {
optional HTTPRequest request = 1;
optional HTTPResponse response = 2;
optional HTTPError error = 3;
optional ClientConnection client_conn = 4;
optional ServerConnection server_conn = 5;
optional bool intercepted = 6;
optional bool marked = 7;
optional string mode = 8;
optional string id = 9;
optional int32 version = 10;
}
message HTTPRequest {
optional string first_line_format = 1;
optional bytes method = 2;
optional bytes scheme = 3;
optional bytes host = 4;
optional int32 port = 5;
optional bytes path = 6;
optional bytes http_version = 7;
repeated HTTPHeader headers = 8;
optional bytes content = 9;
optional int64 timestamp_start = 10;
optional int64 timestamp_end = 11;
optional bool is_replay = 12;
}
message HTTPResponse {
optional bytes http_version = 1;
optional int32 status_code = 2;
optional bytes reason = 3;
repeated HTTPHeader headers = 4;
optional bytes content = 5;
optional int64 timestamp_start = 6;
optional int64 timestamp_end = 7;
optional bool is_replay = 8;
}
message HTTPError {
optional string msg = 1;
optional int64 timestamp = 2;
}
message HTTPHeader {
optional bytes name = 1;
optional bytes value = 2;
}

11
mitmproxy/io/protobuf.py Normal file
View File

@ -0,0 +1,11 @@
"Just define dumps and loads. Files will be handled later. Or maybe...do it, and DONT use it."
import typing
def dumps(value) -> bytes:
pass
def dump(value, file_handle: typing.BinaryIO) -> None:
pass