Add `getproxy` command

This command pulls out system proxy details on windows machines.
bug/bundler_fix
OJ 2013-10-30 18:40:51 +10:00
parent c8ceaa25c6
commit 2fbac9b129
3 changed files with 34 additions and 0 deletions

View File

@ -231,6 +231,24 @@ class Config
return true
end
#
# Get's the current proxy configuration
#
def get_proxy_config()
request = Packet.create_request('stdapi_net_config_get_proxy')
response = client.send_request(request)
proxy_config = {
:autodetect => response.get_tlv_value(TLV_TYPE_PROXY_CFG_AUTODETECT),
:autoconfigurl => response.get_tlv_value(TLV_TYPE_PROXY_CFG_AUTOCONFIGURL),
:proxy => response.get_tlv_value(TLV_TYPE_PROXY_CFG_PROXY),
:proxybypass => response.get_tlv_value(TLV_TYPE_PROXY_CFG_PROXYBYPASS)
}
return proxy_config
end
protected
attr_accessor :client # :nodoc:

View File

@ -69,6 +69,12 @@ TLV_TYPE_ROUTE_METRIC = TLV_META_TYPE_UINT | 1443
# Resolve
TLV_TYPE_ADDR_TYPE = TLV_META_TYPE_UINT | 1444
# Proxy configuration
TLV_TYPE_PROXY_CFG_AUTODETECT = TLV_META_TYPE_BOOL | 1445
TLV_TYPE_PROXY_CFG_AUTOCONFIGURL = TLV_META_TYPE_STRING | 1446
TLV_TYPE_PROXY_CFG_PROXY = TLV_META_TYPE_STRING | 1447
TLV_TYPE_PROXY_CFG_PROXYBYPASS = TLV_META_TYPE_STRING | 1448
# Socket
TLV_TYPE_PEER_HOST = TLV_META_TYPE_STRING | 1500
TLV_TYPE_PEER_PORT = TLV_META_TYPE_UINT | 1501

View File

@ -62,6 +62,7 @@ class Console::CommandDispatcher::Stdapi::Net
"portfwd" => "Forward a local port to a remote service",
"arp" => "Display the host ARP cache",
"netstat" => "Display the network connections",
"getproxy" => "Display the current proxy configuration",
}
reqs = {
"ipconfig" => [ "stdapi_net_config_get_interfaces" ],
@ -78,6 +79,7 @@ class Console::CommandDispatcher::Stdapi::Net
"portfwd" => [ ],
"arp" => [ "stdapi_net_config_get_arp_table" ],
"netstat" => [ "stdapi_net_config_get_netstat" ],
"getproxy" => [ "stdapi_net_config_get_proxy" ],
}
all.delete_if do |cmd, desc|
@ -414,6 +416,14 @@ class Console::CommandDispatcher::Stdapi::Net
print @@portfwd_opts.usage
end
def cmd_getproxy
p = client.net.config.get_proxy_config()
print_line( "Auto-detect : #{p[:autodetect] ? "Yes" : "No"}" )
print_line( "Auto config URL : #{p[:autoconfigurl]}" )
print_line( "Proxy URL : #{p[:proxy]}" )
print_line( "Proxy Bypass : #{p[:proxybypass]}" )
end
protected
#