From db88145294d214a1ab247ae283d72f2f06df172b Mon Sep 17 00:00:00 2001 From: James Lee Date: Tue, 28 Feb 2012 08:27:22 -0700 Subject: [PATCH] Keep the order of iface attributes the same accross rubies 1.8 doesn't maintain insertion order for Hash keys like 1.9 does so we end up with ~random order for the display with the previous technique. Switch to an Array instead of a Hash so it's always the same. --- .../extensions/stdapi/net/interface.rb | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/rex/post/meterpreter/extensions/stdapi/net/interface.rb b/lib/rex/post/meterpreter/extensions/stdapi/net/interface.rb index 0fbbb1df68..8b8adcb18b 100644 --- a/lib/rex/post/meterpreter/extensions/stdapi/net/interface.rb +++ b/lib/rex/post/meterpreter/extensions/stdapi/net/interface.rb @@ -47,19 +47,19 @@ class Interface mac_addr.each_byte { |o| macocts << o } macocts += [0] * (6 - macocts.size) if macocts.size < 6 - info = { - "Name" => mac_name, - "Hardware MAC" => sprintf("%02x:%02x:%02x:%02x:%02x:%02x", + info = [ + ["Name" , mac_name ], + ["Hardware MAC" , sprintf("%02x:%02x:%02x:%02x:%02x:%02x", macocts[0], macocts[1], macocts[2], - macocts[3], macocts[4], macocts[5]), - "MTU" => mtu, - "Flags" => flags, - "IPv4 Address" => ((ip and ip != "0.0.0.0") ? ip : nil), - "IPv4 Netmask" => netmask, - "IPv6 Address" => ((ip6 and ip6 != "::") ? ip6 : nil), - "IPv6 Netmask" => netmask6, - } - pad = info.keys.max_by{|k|k.length}.length + macocts[3], macocts[4], macocts[5])], + ["MTU" , mtu ], + ["Flags" , flags ], + ["IPv4 Address" , ((ip and ip != "0.0.0.0") ? ip : nil) ], + ["IPv4 Netmask" , netmask ], + ["IPv6 Address" , ((ip6 and ip6 != "::") ? ip6 : nil) ], + ["IPv6 Netmask" , ((netmask6 and netmask6 != "::") ? netmask6 : nil) ], + ] + pad = info.map{|i| i[0] }.max_by{|k|k.length}.length ret = sprintf( "Interface %2d\n" +