Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kajojify
Last active August 14, 2018 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kajojify/3c48bba38943f185538224bd15276e89 to your computer and use it in GitHub Desktop.
Save kajojify/3c48bba38943f185538224bd15276e89 to your computer and use it in GitHub Desktop.
Roman Samoilenko GSoC18 results

"Mitmproxy improvements" project results

Hello everyone! I have been working on the great GSoC project for Mitmproxy this summer. The task was to create the language with new syntax for working with mitmproxy commands in more comfortable way.

What is it about?

Mitmproxy has a modular core. All its functionality is implemented in completely self-contained addons (extensions in other words). Users interact with addons only through commands and options. An example of interaction using commands: cut.save @focus response.content ~/flows.

Here cut.save is a command name, which is pinned to Python function under the cover. @focus, response.content and ~/flows are its arguments: @focus - view flow selector, which is resolved into the list of flows under the cover, response.content represents the content of flow's response, ~/flows is a path to some file.

After typing this command in the Mitmproxy status bar and pressing Enter button, a user interacts with Cut addon and saves response content of the current HTTP flow to the ~/flows file. This was the only way of сommands appearance: command + args. It wasn't enough for Mitmproxy and we wanted more: nested commands, async commands, pipes like in Bash, array with square brackets and other awesome stuff. For example:

  • client.replay(view.select("~h google.com"))
  • view.select "~h google.com" | client.replay
console.command [
    @focus "|" export.file
    console.choose(Format export.formats())
]

and so on.

More about the language:

  1. The documentation I wrote at the very beginning of GSoC18 -> here.

  2. Two issues with the hottest discussion about the language I've ever seen. mitmproxy/mitmproxy#3074 mitmproxy/mitmproxy#3087

What work was done?

What code got merged? 5 PRs: https://github.com/mitmproxy/mitmproxy/pulls?q=is%3Apr+is%3Amerged+author%3Akajojify+label%3Agsoc

What code wasn't merged? 1 PR: https://github.com/mitmproxy/mitmproxy/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aunmerged+author%3Akajojify+label%3Agsoc+

What’s left to do? The area we went into is very deep, but as for now we need to fit our language to the documentation I wrote at the beginning of GSoC:

  • fix broken commands. There are 2-3 commands, which don't work after changes I made;
  • finish working on unmerged PR. This PR concerns syntax highlighting and autocompletion for the new language;
  • implement a few more features like sink and source commands, pointer and deferred commands etc. according to the docs.

It seems, this is everything I want to share with you. I hope to see your comments into Mitmproxy issues or PRs working hard on one of the coolest open source tools.

All the best, Roman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment