mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-01-30 23:09:44 +00:00
Added initial protobuf definitions
This commit is contained in:
parent
3cd3765270
commit
ba144b15bc
0
mitmproxy/io/db.py
Normal file
0
mitmproxy/io/db.py
Normal file
38
mitmproxy/io/proto/connection.proto
Normal file
38
mitmproxy/io/proto/connection.proto
Normal 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;
|
||||
}
|
||||
|
51
mitmproxy/io/proto/http.proto
Normal file
51
mitmproxy/io/proto/http.proto
Normal 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
11
mitmproxy/io/protobuf.py
Normal 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
|
Loading…
Reference in New Issue
Block a user