aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy
diff options
context:
space:
mode:
authormadt1m <blackjuniper@protonmail.com>2018-06-22 22:43:05 +0200
committermadt1m <blackjuniper@protonmail.com>2018-06-22 22:43:05 +0200
commitba144b15bc1a33f71200e54eb4a25894a11d6a53 (patch)
tree93b0b84f7d7cf64df07397af63e1cbe2e5feb54d /mitmproxy
parent3cd37652709292cffa1bc733134cef5483489341 (diff)
downloadmitmproxy-ba144b15bc1a33f71200e54eb4a25894a11d6a53.tar.gz
mitmproxy-ba144b15bc1a33f71200e54eb4a25894a11d6a53.tar.bz2
mitmproxy-ba144b15bc1a33f71200e54eb4a25894a11d6a53.zip
Added initial protobuf definitions
Diffstat (limited to 'mitmproxy')
-rw-r--r--mitmproxy/io/db.py0
-rw-r--r--mitmproxy/io/proto/connection.proto38
-rw-r--r--mitmproxy/io/proto/http.proto51
-rw-r--r--mitmproxy/io/protobuf.py11
4 files changed, 100 insertions, 0 deletions
diff --git a/mitmproxy/io/db.py b/mitmproxy/io/db.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/mitmproxy/io/db.py
diff --git a/mitmproxy/io/proto/connection.proto b/mitmproxy/io/proto/connection.proto
new file mode 100644
index 00000000..fdcb0d13
--- /dev/null
+++ b/mitmproxy/io/proto/connection.proto
@@ -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;
+}
+
diff --git a/mitmproxy/io/proto/http.proto b/mitmproxy/io/proto/http.proto
new file mode 100644
index 00000000..f1b90f78
--- /dev/null
+++ b/mitmproxy/io/proto/http.proto
@@ -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;
+} \ No newline at end of file
diff --git a/mitmproxy/io/protobuf.py b/mitmproxy/io/protobuf.py
new file mode 100644
index 00000000..2dd0f1e7
--- /dev/null
+++ b/mitmproxy/io/protobuf.py
@@ -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