mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-04-25 17:25:17 +02:00
Merge remote-tracking branch 'origin/GP-6716_Dan_useLocalhost' into Ghidra_12.1
This commit is contained in:
@@ -185,20 +185,20 @@ def ghidra_trace_connect(address: Optional[str] = None) -> None:
|
||||
raise RuntimeError("port must be numeric")
|
||||
|
||||
|
||||
def ghidra_trace_listen(address: str = '0.0.0.0:0') -> None:
|
||||
def ghidra_trace_listen(address: str = '127.0.0.1:0') -> None:
|
||||
"""Listen for Ghidra to connect for tracing.
|
||||
|
||||
Takes an optional address for the host and port on which to listen.
|
||||
Either the form 'host:port' or just 'port'. If omitted, it will bind
|
||||
to an ephemeral port on all interfaces. If only the port is given,
|
||||
it will bind to that port on all interfaces. This command will block
|
||||
until the connection is established.
|
||||
to an ephemeral port on localhost. If only the port is given, it will
|
||||
bind to that port on localhost. This command will block until the
|
||||
connection is established.
|
||||
"""
|
||||
|
||||
STATE.require_no_client()
|
||||
parts = address.split(':')
|
||||
if len(parts) == 1:
|
||||
host, port = '0.0.0.0', parts[0]
|
||||
host, port = '127.0.0.1', parts[0]
|
||||
elif len(parts) == 2:
|
||||
host, port = parts
|
||||
else:
|
||||
@@ -1526,8 +1526,8 @@ def put_exceptions() -> None:
|
||||
|
||||
|
||||
@util.dbg.eng_thread
|
||||
def put_single_exception(obj: TraceObject, objpath: str,
|
||||
p: DbgEng._DEBUG_EXCEPTION_FILTER_PARAMETERS,
|
||||
def put_single_exception(obj: TraceObject, objpath: str,
|
||||
p: DbgEng._DEBUG_EXCEPTION_FILTER_PARAMETERS,
|
||||
offset: int, index: int, specific: bool) -> None:
|
||||
exc_name = "None"
|
||||
if specific is True:
|
||||
|
||||
@@ -170,21 +170,21 @@ def ghidra_trace_connect(address: Optional[str] = None) -> None:
|
||||
raise RuntimeError("port must be numeric")
|
||||
|
||||
|
||||
def ghidra_trace_listen(address: str = '0.0.0.0:0') -> None:
|
||||
def ghidra_trace_listen(address: str = '127.0.0.1:0') -> None:
|
||||
"""
|
||||
Listen for Ghidra to connect for tracing
|
||||
|
||||
Takes an optional address for the host and port on which to listen. Either
|
||||
the form 'host:port' or just 'port'. If omitted, it will bind to an
|
||||
ephemeral port on all interfaces. If only the port is given, it will bind to
|
||||
that port on all interfaces. This command will block until the connection is
|
||||
established.
|
||||
Takes an optional address for the host and port on which to listen.
|
||||
Either the form 'host:port' or just 'port'. If omitted, it will bind
|
||||
to an ephemeral port on localhost. If only the port is given, it will
|
||||
bind to that port on localhost. This command will block until the
|
||||
connection is established.
|
||||
"""
|
||||
|
||||
STATE.require_no_client()
|
||||
parts = address.split(':')
|
||||
if len(parts) == 1:
|
||||
host, port = '0.0.0.0', parts[0]
|
||||
host, port = '127.0.0.1', parts[0]
|
||||
elif len(parts) == 2:
|
||||
host, port = parts
|
||||
else:
|
||||
@@ -199,7 +199,7 @@ def ghidra_trace_listen(address: str = '0.0.0.0:0') -> None:
|
||||
c, (chost, cport) = s.accept()
|
||||
s.close()
|
||||
print("Connection from {}:{}".format(chost, cport))
|
||||
STATE.client = Client(c, "dbgeng.dll", methods.REGISTRY)
|
||||
STATE.client = Client(c, "drgn", methods.REGISTRY)
|
||||
except ValueError:
|
||||
raise RuntimeError("port must be numeric")
|
||||
|
||||
@@ -786,7 +786,7 @@ def ghidra_trace_set_value(path: str, key: str, value: Any,
|
||||
Set a value (attribute or element) in the Ghidra trace's object tree.
|
||||
|
||||
A void value implies removal.
|
||||
NOTE: The type of an expression may be subject to the dbgeng's current
|
||||
NOTE: The type of an expression may be subject to drgn's current
|
||||
language. which current defaults to DEBUG_EXPR_CPLUSPLUS (vs DEBUG_EXPR_MASM).
|
||||
For most non-primitive cases, we are punting to the Python API.
|
||||
"""
|
||||
|
||||
@@ -236,9 +236,9 @@ def ghidra_trace_listen(address: Optional[str] = None, *, is_mi: bool,
|
||||
|
||||
Takes an optional address for the host and port on which to listen.
|
||||
Either the form 'host:port' or just 'port'. If omitted, it will bind
|
||||
to an ephemeral port on all interfaces. If only the port is given,
|
||||
it will bind to that port on all interfaces. This command will block
|
||||
until the connection is established.
|
||||
to an ephemeral port on localhost. If only the port is given, it will
|
||||
bind to that port on localhost. This command will block until the
|
||||
connection is established.
|
||||
"""
|
||||
|
||||
STATE.require_no_client()
|
||||
@@ -247,13 +247,13 @@ def ghidra_trace_listen(address: Optional[str] = None, *, is_mi: bool,
|
||||
if address is not None:
|
||||
parts = address.split(':')
|
||||
if len(parts) == 1:
|
||||
host, port = '0.0.0.0', parts[0]
|
||||
host, port = '127.0.0.1', parts[0]
|
||||
elif len(parts) == 2:
|
||||
host, port = parts
|
||||
else:
|
||||
raise gdb.GdbError("address must be 'port' or 'host:port'")
|
||||
else:
|
||||
host, port = '0.0.0.0', 0
|
||||
host, port = '127.0.0.1', 0
|
||||
try:
|
||||
s = socket.socket()
|
||||
s.bind((host, int(port)))
|
||||
|
||||
@@ -302,23 +302,23 @@ def ghidra_trace_listen(debugger: lldb.SBDebugger, command: str,
|
||||
Usage: ghidra trace listen [ADDRESS]
|
||||
ADDRESS must be PORT or HOST:PORT
|
||||
|
||||
Takes an optional address for the host and port on which to listen. Either
|
||||
the form 'host:port' or just 'port'. If omitted, it will bind to an
|
||||
ephemeral port on all interfaces. If only the port is given, it will bind to
|
||||
that port on all interfaces. This command will block until the connection is
|
||||
established.
|
||||
Takes an optional address for the host and port on which to listen.
|
||||
Either the form 'host:port' or just 'port'. If omitted, it will bind
|
||||
to an ephemeral port on localhost. If only the port is given, it will
|
||||
bind to that port on localhost. This command will block until the
|
||||
connection is established.
|
||||
"""
|
||||
|
||||
args = shlex.split(command)
|
||||
host: str
|
||||
port: Union[str, int]
|
||||
if len(args) == 0:
|
||||
host, port = '0.0.0.0', 0
|
||||
host, port = '127.0.0.1', 0
|
||||
elif len(args) == 1:
|
||||
address = args[0]
|
||||
parts = address.split(':')
|
||||
if len(parts) == 1:
|
||||
host, port = '0.0.0.0', parts[0]
|
||||
host, port = '127.0.0.1', parts[0]
|
||||
elif len(parts) == 2:
|
||||
host, port = parts
|
||||
else:
|
||||
|
||||
@@ -182,20 +182,20 @@ def ghidra_trace_connect(address: Optional[str] = None) -> None:
|
||||
raise RuntimeError("port must be numeric")
|
||||
|
||||
|
||||
def ghidra_trace_listen(address: str = '0.0.0.0:0') -> None:
|
||||
def ghidra_trace_listen(address: str = '127.0.0.1:0') -> None:
|
||||
"""Listen for Ghidra to connect for tracing.
|
||||
|
||||
Takes an optional address for the host and port on which to listen.
|
||||
Either the form 'host:port' or just 'port'. If omitted, it will bind
|
||||
to an ephemeral port on all interfaces. If only the port is given,
|
||||
it will bind to that port on all interfaces. This command will block
|
||||
until the connection is established.
|
||||
to an ephemeral port on localhost. If only the port is given, it will
|
||||
bind to that port on localhost. This command will block until the
|
||||
connection is established.
|
||||
"""
|
||||
|
||||
STATE.require_no_client()
|
||||
parts = address.split(':')
|
||||
if len(parts) == 1:
|
||||
host, port = '0.0.0.0', parts[0]
|
||||
host, port = '127.0.0.1', parts[0]
|
||||
elif len(parts) == 2:
|
||||
host, port = parts
|
||||
else:
|
||||
|
||||
@@ -156,7 +156,7 @@ public class JdiCommands {
|
||||
public void ghidraTraceListen(String address) {
|
||||
// TODO: UNTESTED
|
||||
state.requireNoClient();
|
||||
String host = "0.0.0.0";
|
||||
String host = "127.0.0.1";
|
||||
int port = 0;
|
||||
if (address != null) {
|
||||
String[] parts = address.split(":");
|
||||
|
||||
@@ -79,7 +79,7 @@ public class TraceRmiPlugin extends Plugin implements InternalTraceRmiService {
|
||||
@SuppressWarnings("unused")
|
||||
private final Wiring autoServiceWiring;
|
||||
|
||||
private SocketAddress serverAddress = new InetSocketAddress("0.0.0.0", DEFAULT_PORT);
|
||||
private SocketAddress serverAddress = new InetSocketAddress("127.0.0.1", DEFAULT_PORT);
|
||||
private TraceRmiServer server;
|
||||
|
||||
private final Set<TraceRmiHandler> handlers = new LinkedHashSet<>();
|
||||
|
||||
Reference in New Issue
Block a user