Skip to content

Commit

Permalink
always use relative imports, fix status bar bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils committed Mar 10, 2014
1 parent e6349b5 commit c1fff51
Show file tree
Hide file tree
Showing 27 changed files with 54 additions and 30 deletions.
3 changes: 2 additions & 1 deletion libmproxy/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import
import flask
import os.path, os
import proxy
from . import proxy

mapp = flask.Flask(__name__)
mapp.debug = True
Expand Down
6 changes: 4 additions & 2 deletions libmproxy/cmdline.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from . import proxy
import re, filt
from __future__ import absolute_import
import re
import argparse
from argparse import ArgumentTypeError
from netlib import http
from . import proxy, filt


APP_HOST = "mitm.it"
APP_PORT = 80
Expand Down
10 changes: 6 additions & 4 deletions libmproxy/console/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import absolute_import
import mailcap, mimetypes, tempfile, os, subprocess, glob, time, shlex, stat
import os.path, sys, weakref, traceback
import urwid
from .. import controller, utils, flow, script
import flowlist, flowview, help, common, grideditor, palettes, contentview, flowdetailview
from .. import controller, utils, flow, script, proxy
from . import flowlist, flowview, help, common, grideditor, palettes, contentview, flowdetailview

EVENTLOG_SIZE = 500

Expand Down Expand Up @@ -168,8 +169,9 @@ def get_status(self):
if opts:
r.append("[%s]"%(":".join(opts)))

if self.master.server.config.upstream_server:
r.append("[dest:%s]"%utils.unparse_url(*self.master.server.config.upstream_server))
if self.master.server.config.get_upstream_server and \
isinstance(self.master.server.config.get_upstream_server, proxy.ConstUpstreamServerResolver):
r.append("[dest:%s]"%utils.unparse_url(*self.master.server.config.get_upstream_server.dst))
if self.master.scripts:
r.append("[scripts:%s]"%len(self.master.scripts))
if self.master.debug:
Expand Down
1 change: 1 addition & 0 deletions libmproxy/console/common.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import absolute_import
import urwid
import urwid.util
from .. import utils
Expand Down
9 changes: 3 additions & 6 deletions libmproxy/console/contentview.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import logging
import re, cStringIO, traceback, json
import urwid

from __future__ import absolute_import
import logging, subprocess, re, cStringIO, traceback, json, urwid
from PIL import Image
from PIL.ExifTags import TAGS

import lxml.html, lxml.etree
import netlib.utils
import common
from . import common
from .. import utils, encoding, flow
from ..contrib import jsbeautifier, html2text
import subprocess
try:
import pyamf
from pyamf import remoting, flex
Expand Down
3 changes: 2 additions & 1 deletion libmproxy/console/flowdetailview.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import absolute_import
import urwid
import common
from . import common
from .. import utils

footer = [
Expand Down
3 changes: 2 additions & 1 deletion libmproxy/console/flowlist.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import absolute_import
import urwid
import common
from . import common

def _mkhelp():
text = []
Expand Down
3 changes: 2 additions & 1 deletion libmproxy/console/flowview.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import
import os, sys, copy
import urwid
import common, grideditor, contentview
from . import common, grideditor, contentview
from .. import utils, flow, controller
from ..protocol.http import HTTPResponse, CONTENT_MISSING

Expand Down
3 changes: 2 additions & 1 deletion libmproxy/console/grideditor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import
import copy, re, os
import urwid
import common
from . import common
from .. import utils, filt, script
from netlib import http_uastrings

Expand Down
3 changes: 2 additions & 1 deletion libmproxy/console/help.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import absolute_import
import urwid
import common
from . import common
from .. import filt, version

footer = [
Expand Down
2 changes: 1 addition & 1 deletion libmproxy/contrib/jsbeautifier/unpackers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pkgutil
import re
from jsbeautifier.unpackers import evalbased
from . import evalbased

# NOTE: AT THE MOMENT, IT IS DEACTIVATED FOR YOUR SECURITY: it runs js!
BLACKLIST = ['jsbeautifier.unpackers.evalbased']
Expand Down
1 change: 1 addition & 0 deletions libmproxy/controller.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import absolute_import
import Queue, threading

should_exit = False
Expand Down
3 changes: 2 additions & 1 deletion libmproxy/dump.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import
import sys, os
import netlib.utils
import flow, filt, utils
from . import flow, filt, utils

class DumpError(Exception): pass

Expand Down
1 change: 1 addition & 0 deletions libmproxy/encoding.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Utility functions for decoding response bodies.
"""
from __future__ import absolute_import
import cStringIO
import gzip, zlib

Expand Down
3 changes: 2 additions & 1 deletion libmproxy/filt.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
~c CODE Response code.
rex Equivalent to ~u rex
"""
from __future__ import absolute_import
import re, sys
import contrib.pyparsing as pp
from .contrib import pyparsing as pp


class _Token:
Expand Down
10 changes: 4 additions & 6 deletions libmproxy/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
This module provides more sophisticated flow tracking. These match requests
with their responses, and provide filtering and interception facilities.
"""
from __future__ import absolute_import
import base64
import hashlib, Cookie, cookielib, re, threading
import os
import flask
import requests
from . import controller, protocol
from netlib import odict, wsgi, tcp
import netlib.http
from . import controller, protocol, tnetstring, filt, script, version, app
from .protocol import http
from .proxy.connection import ServerConnection
from .proxy.primitives import ProxyError
import tnetstring, filt, script
from netlib import odict, wsgi, tcp
import netlib.http
import version
import app

ODict = odict.ODict
ODictCaseless = odict.ODictCaseless
Expand Down
1 change: 1 addition & 0 deletions libmproxy/protocol/handle.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import absolute_import
from . import http, tcp

protocols = {
Expand Down
3 changes: 2 additions & 1 deletion libmproxy/protocol/http.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import absolute_import
import Cookie, urllib, urlparse, time, copy
from email.utils import parsedate_tz, formatdate, mktime_tz
import netlib.utils
from netlib import http, tcp, http_status
import netlib.utils
from netlib.odict import ODict, ODictCaseless
from .primitives import KILL, ProtocolHandler, TemporaryServerChangeMixin, Flow, Error
from ..proxy.connection import ServerConnection
Expand Down
1 change: 1 addition & 0 deletions libmproxy/protocol/primitives.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import absolute_import
from .. import stateobject, utils, version
from ..proxy.primitives import AddressPriority
from ..proxy.connection import ClientConnection, ServerConnection
Expand Down
1 change: 1 addition & 0 deletions libmproxy/protocol/tcp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import absolute_import
import select, socket
from cStringIO import StringIO
from .primitives import ProtocolHandler
Expand Down
1 change: 1 addition & 0 deletions libmproxy/proxy/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import absolute_import
import os
from .. import utils, platform
from netlib import http_auth, certutils
Expand Down
3 changes: 2 additions & 1 deletion libmproxy/proxy/connection.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import absolute_import
import copy
import os
from netlib import tcp, certutils
from .. import stateobject, utils
from .primitives import ProxyError
from netlib import tcp, certutils


class ClientConnection(tcp.BaseHandler, stateobject.SimpleStateObject):
Expand Down
2 changes: 2 additions & 0 deletions libmproxy/proxy/primitives.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

class ProxyError(Exception):
def __init__(self, code, msg, headers=None):
self.code, self.msg, self.headers = code, msg, headers
Expand Down
2 changes: 2 additions & 0 deletions libmproxy/proxy/server.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

import socket
from OpenSSL import SSL
from netlib import tcp
Expand Down
3 changes: 2 additions & 1 deletion libmproxy/script.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import absolute_import
import os, traceback, threading, shlex
import controller
from . import controller

class ScriptError(Exception):
pass
Expand Down
2 changes: 2 additions & 0 deletions libmproxy/stateobject.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

class StateObject(object):
def _get_state(self):
raise NotImplementedError # pragma: nocover
Expand Down
1 change: 1 addition & 0 deletions libmproxy/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import absolute_import
import os, datetime, urllib, re
import time, functools, cgi
import json
Expand Down

0 comments on commit c1fff51

Please sign in to comment.