aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/flashing
Commit message (Expand)AuthorAgeFilesLines
* scripts: fix wrong usage of '==' operatorJohn Crispin2014-10-141-3/+3
* make flashing scripts executableFlorian Fainelli2010-06-264-0/+0
* Add check for IXP42x A0 stepping.Jose Vasconcellos2009-03-241-2/+13
* adam2flash: fix 'Interrupted system call' error when flashing (closes: #4490,...Nicolas Thill2009-02-011-0/+2
* Added support WRV54G.Jose Vasconcellos2009-01-251-9/+15
* Fix to wait for internal http server to complete transfer. Rework and simplif...Jose Vasconcellos2009-01-181-46/+54
* Fix parsing of password option; set timeout for writing.Jose Vasconcellos2009-01-151-15/+15
* Also move jungo-image.py to scripts/flashingFlorian Fainelli2008-12-171-0/+258
* Move flashing scripts to scripts/flashing/Florian Fainelli2008-12-175-0/+959
d } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
'''
tcp_message Inline Script Hook API Demonstration
------------------------------------------------

* modifies packets containing "foo" to "bar"
* prints various details for each packet.

example cmdline invocation:
mitmdump -T --host --tcp ".*" -q -s examples/tcp_message.py
'''
from netlib.utils import clean_bin

def tcp_message(ctx, tcp_msg):
    modified_msg = tcp_msg.message.replace("foo", "bar")

    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, clean_bin(tcp_msg.message)))