mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-12-04 12:40:06 +00:00
peer_address -> ip_address
This commit is contained in:
parent
14e9b0a0ac
commit
70e35b7017
@ -23,7 +23,7 @@ def flowdetails(state, flow):
|
|||||||
text.append(urwid.Text([("head", "Server Connection:")]))
|
text.append(urwid.Text([("head", "Server Connection:")]))
|
||||||
parts = [
|
parts = [
|
||||||
["Address", repr(sc.address)],
|
["Address", repr(sc.address)],
|
||||||
["Peer Address", repr(sc.peer_address)],
|
["Resolved Address", repr(sc.ip_address)],
|
||||||
]
|
]
|
||||||
|
|
||||||
text.extend(
|
text.extend(
|
||||||
|
@ -842,21 +842,15 @@ class FlowMaster(controller.Master):
|
|||||||
"""
|
"""
|
||||||
this method creates a new artificial and minimalist request also adds it to flowlist
|
this method creates a new artificial and minimalist request also adds it to flowlist
|
||||||
"""
|
"""
|
||||||
c = ClientConnection.from_state(dict(
|
c = ClientConnection.make_dummy(("", 0))
|
||||||
address=dict(address=(host, port), use_ipv6=False),
|
s = ServerConnection.make_dummy((host, port))
|
||||||
clientcert=None,
|
|
||||||
ssl_established=False,
|
|
||||||
timestamp_start=None,
|
|
||||||
timestamp_end=None,
|
|
||||||
timestamp_ssl_setup=None
|
|
||||||
))
|
|
||||||
|
|
||||||
s = ServerConnection.from_state(dict(
|
s = ServerConnection.from_state(dict(
|
||||||
address=dict(address=(host, port), use_ipv6=False),
|
address=dict(address=(host, port), use_ipv6=False),
|
||||||
peer_address=None,
|
ip_address=None,
|
||||||
cert=None,
|
cert=None,
|
||||||
sni=host,
|
sni=host,
|
||||||
source_address=dict(address=('', 0), use_ipv6=False),
|
source_address=dict(address=("", 0), use_ipv6=False),
|
||||||
ssl_established=True,
|
ssl_established=True,
|
||||||
timestamp_start=None,
|
timestamp_start=None,
|
||||||
timestamp_tcp_setup=None,
|
timestamp_tcp_setup=None,
|
||||||
|
@ -41,6 +41,7 @@ def convert_016_017(data):
|
|||||||
|
|
||||||
|
|
||||||
def convert_017_018(data):
|
def convert_017_018(data):
|
||||||
|
data["server_conn"]["ip_address"] = data["server_conn"].pop("peer_address")
|
||||||
data["version"] = (0, 18)
|
data["version"] = (0, 18)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
from __future__ import (absolute_import, print_function, division)
|
from __future__ import (absolute_import, print_function, division)
|
||||||
|
|
||||||
from .http import (
|
from .http import (
|
||||||
HTTPFlow, HTTPRequest, HTTPResponse, Headers, decoded,
|
HTTPFlow, HTTPRequest, HTTPResponse, Headers,
|
||||||
make_error_response, make_connect_request, make_connect_response, expect_continue_response
|
make_error_response, make_connect_request, make_connect_response, expect_continue_response
|
||||||
)
|
)
|
||||||
|
from netlib.http import decoded
|
||||||
from .connections import ClientConnection, ServerConnection
|
from .connections import ClientConnection, ServerConnection
|
||||||
from .flow import Flow, Error
|
from .flow import Flow, Error
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
|
|||||||
|
|
||||||
_stateobject_attributes = dict(
|
_stateobject_attributes = dict(
|
||||||
address=tcp.Address,
|
address=tcp.Address,
|
||||||
peer_address=tcp.Address,
|
ip_address=tcp.Address,
|
||||||
source_address=tcp.Address,
|
source_address=tcp.Address,
|
||||||
ssl_established=bool,
|
ssl_established=bool,
|
||||||
cert=certutils.SSLCert,
|
cert=certutils.SSLCert,
|
||||||
@ -172,6 +172,7 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
|
|||||||
def make_dummy(cls, address):
|
def make_dummy(cls, address):
|
||||||
return cls.from_state(dict(
|
return cls.from_state(dict(
|
||||||
address=dict(address=address, use_ipv6=False),
|
address=dict(address=address, use_ipv6=False),
|
||||||
|
ip_address=dict(address=address, use_ipv6=False),
|
||||||
cert=None,
|
cert=None,
|
||||||
sni=None,
|
sni=None,
|
||||||
source_address=dict(address=('', 0), use_ipv6=False),
|
source_address=dict(address=('', 0), use_ipv6=False),
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
from __future__ import (absolute_import, print_function, division)
|
from __future__ import (absolute_import, print_function, division)
|
||||||
import cgi
|
import cgi
|
||||||
import copy
|
|
||||||
import warnings
|
|
||||||
from email.utils import parsedate_tz, formatdate, mktime_tz
|
|
||||||
import time
|
|
||||||
|
|
||||||
from netlib import encoding
|
from netlib import encoding
|
||||||
from netlib.http import status_codes, Headers, Request, Response, decoded
|
from netlib.http import status_codes, Headers, Request, Response
|
||||||
from netlib.tcp import Address
|
from netlib.tcp import Address
|
||||||
from .. import utils
|
|
||||||
from .. import version
|
from .. import version
|
||||||
from .flow import Flow
|
from .flow import Flow
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ from .message import Message, _native, _always_bytes, MessageData
|
|||||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=45891
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=45891
|
||||||
host_header_re = re.compile(r"^(?P<host>[^:]+|\[.+\])(?::(?P<port>\d+))?$")
|
host_header_re = re.compile(r"^(?P<host>[^:]+|\[.+\])(?::(?P<port>\d+))?$")
|
||||||
|
|
||||||
|
|
||||||
class RequestData(MessageData):
|
class RequestData(MessageData):
|
||||||
def __init__(self, first_line_format, method, scheme, host, port, path, http_version, headers=None, content=None,
|
def __init__(self, first_line_format, method, scheme, host, port, path, http_version, headers=None, content=None,
|
||||||
timestamp_start=None, timestamp_end=None):
|
timestamp_start=None, timestamp_end=None):
|
||||||
|
@ -458,11 +458,11 @@ class _Connection(object):
|
|||||||
def __init__(self, connection):
|
def __init__(self, connection):
|
||||||
if connection:
|
if connection:
|
||||||
self.connection = connection
|
self.connection = connection
|
||||||
self.peer_address = Address(connection.getpeername())
|
self.ip_address = Address(connection.getpeername())
|
||||||
self._makefile()
|
self._makefile()
|
||||||
else:
|
else:
|
||||||
self.connection = None
|
self.connection = None
|
||||||
self.peer_address = None
|
self.ip_address = None
|
||||||
self.rfile = None
|
self.rfile = None
|
||||||
self.wfile = None
|
self.wfile = None
|
||||||
|
|
||||||
@ -708,7 +708,7 @@ class TCPClient(_Connection):
|
|||||||
'Error connecting to "%s": %s' %
|
'Error connecting to "%s": %s' %
|
||||||
(self.address.host, err))
|
(self.address.host, err))
|
||||||
self.connection = connection
|
self.connection = connection
|
||||||
self.peer_address = Address(connection.getpeername())
|
self.ip_address = Address(connection.getpeername())
|
||||||
self._makefile()
|
self._makefile()
|
||||||
|
|
||||||
def settimeout(self, n):
|
def settimeout(self, n):
|
||||||
|
@ -100,7 +100,7 @@ def tserver_conn():
|
|||||||
c = ServerConnection.from_state(dict(
|
c = ServerConnection.from_state(dict(
|
||||||
address=dict(address=("address", 22), use_ipv6=True),
|
address=dict(address=("address", 22), use_ipv6=True),
|
||||||
source_address=dict(address=("address", 22), use_ipv6=True),
|
source_address=dict(address=("address", 22), use_ipv6=True),
|
||||||
peer_address=None,
|
ip_address=None,
|
||||||
cert=None,
|
cert=None,
|
||||||
timestamp_start=1,
|
timestamp_start=1,
|
||||||
timestamp_tcp_setup=2,
|
timestamp_tcp_setup=2,
|
||||||
|
Loading…
Reference in New Issue
Block a user