Skip to content

Commit 2fbac9b

Browse files
committed
Add getproxy command
This command pulls out system proxy details on windows machines.
1 parent c8ceaa2 commit 2fbac9b

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

lib/rex/post/meterpreter/extensions/stdapi/net/config.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,24 @@ def remove_route(subnet, netmask, gateway)
231231
return true
232232
end
233233

234+
#
235+
# Get's the current proxy configuration
236+
#
237+
def get_proxy_config()
238+
request = Packet.create_request('stdapi_net_config_get_proxy')
239+
240+
response = client.send_request(request)
241+
242+
proxy_config = {
243+
:autodetect => response.get_tlv_value(TLV_TYPE_PROXY_CFG_AUTODETECT),
244+
:autoconfigurl => response.get_tlv_value(TLV_TYPE_PROXY_CFG_AUTOCONFIGURL),
245+
:proxy => response.get_tlv_value(TLV_TYPE_PROXY_CFG_PROXY),
246+
:proxybypass => response.get_tlv_value(TLV_TYPE_PROXY_CFG_PROXYBYPASS)
247+
}
248+
249+
return proxy_config
250+
end
251+
234252
protected
235253

236254
attr_accessor :client # :nodoc:

lib/rex/post/meterpreter/extensions/stdapi/tlv.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ module Stdapi
6969
# Resolve
7070
TLV_TYPE_ADDR_TYPE = TLV_META_TYPE_UINT | 1444
7171

72+
# Proxy configuration
73+
TLV_TYPE_PROXY_CFG_AUTODETECT = TLV_META_TYPE_BOOL | 1445
74+
TLV_TYPE_PROXY_CFG_AUTOCONFIGURL = TLV_META_TYPE_STRING | 1446
75+
TLV_TYPE_PROXY_CFG_PROXY = TLV_META_TYPE_STRING | 1447
76+
TLV_TYPE_PROXY_CFG_PROXYBYPASS = TLV_META_TYPE_STRING | 1448
77+
7278
# Socket
7379
TLV_TYPE_PEER_HOST = TLV_META_TYPE_STRING | 1500
7480
TLV_TYPE_PEER_PORT = TLV_META_TYPE_UINT | 1501

lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def commands
6262
"portfwd" => "Forward a local port to a remote service",
6363
"arp" => "Display the host ARP cache",
6464
"netstat" => "Display the network connections",
65+
"getproxy" => "Display the current proxy configuration",
6566
}
6667
reqs = {
6768
"ipconfig" => [ "stdapi_net_config_get_interfaces" ],
@@ -78,6 +79,7 @@ def commands
7879
"portfwd" => [ ],
7980
"arp" => [ "stdapi_net_config_get_arp_table" ],
8081
"netstat" => [ "stdapi_net_config_get_netstat" ],
82+
"getproxy" => [ "stdapi_net_config_get_proxy" ],
8183
}
8284

8385
all.delete_if do |cmd, desc|
@@ -414,6 +416,14 @@ def cmd_portfwd_help
414416
print @@portfwd_opts.usage
415417
end
416418

419+
def cmd_getproxy
420+
p = client.net.config.get_proxy_config()
421+
print_line( "Auto-detect : #{p[:autodetect] ? "Yes" : "No"}" )
422+
print_line( "Auto config URL : #{p[:autoconfigurl]}" )
423+
print_line( "Proxy URL : #{p[:proxy]}" )
424+
print_line( "Proxy Bypass : #{p[:proxybypass]}" )
425+
end
426+
417427
protected
418428

419429
#

0 commit comments

Comments
 (0)