aboutsummaryrefslogtreecommitdiffstats
path: root/examples/tcp_message.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-07-05 16:02:37 -0700
committerGitHub <noreply@github.com>2016-07-05 16:02:37 -0700
commite84f5fcc7224d5cbbf3cf77eadfcd3aeb71fc7db (patch)
tree0caa50719bb854ea6ddfce3ee4089a4267861fb5 /examples/tcp_message.py
parent09d678272245dd12efe91ecadbe0b2731f4306b1 (diff)
parentd51cf543bb74755ed5dd17ed02859912ec557ef4 (diff)
downloadmitmproxy-e84f5fcc7224d5cbbf3cf77eadfcd3aeb71fc7db.tar.gz
mitmproxy-e84f5fcc7224d5cbbf3cf77eadfcd3aeb71fc7db.tar.bz2
mitmproxy-e84f5fcc7224d5cbbf3cf77eadfcd3aeb71fc7db.zip
Merge pull request #1315 from mitmproxy/better-unicode-handling
remove clean_bin, clarify unicode handling
Diffstat (limited to 'examples/tcp_message.py')
-rw-r--r--examples/tcp_message.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/tcp_message.py b/examples/tcp_message.py
index 78500c19..6eced0dc 100644
--- a/examples/tcp_message.py
+++ b/examples/tcp_message.py
@@ -17,9 +17,11 @@ def tcp_message(ctx, tcp_msg):
is_modified = False if modified_msg == tcp_msg.message else True
tcp_msg.message = modified_msg
- print("[tcp_message{}] from {} {} to {} {}:\r\n{}".format(
- " (modified)" if is_modified else "",
- "client" if tcp_msg.sender == tcp_msg.client_conn else "server",
- tcp_msg.sender.address,
- "server" if tcp_msg.receiver == tcp_msg.server_conn else "client",
- tcp_msg.receiver.address, strutils.clean_bin(tcp_msg.message)))
+ print(
+ "[tcp_message{}] from {} {} to {} {}:\r\n{}".format(
+ " (modified)" if is_modified else "",
+ "client" if tcp_msg.sender == tcp_msg.client_conn else "server",
+ tcp_msg.sender.address,
+ "server" if tcp_msg.receiver == tcp_msg.server_conn else "client",
+ tcp_msg.receiver.address, strutils.bytes_to_escaped_str(tcp_msg.message))
+ )