From 02e3e9af163f11c277f1a301ed69c304484a4251 Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Mon, 17 Aug 2015 14:52:26 -0500 Subject: [PATCH] Allow to compare ipv4 vs ipv6 hosts --- lib/rex/ui/text/table.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/rex/ui/text/table.rb b/lib/rex/ui/text/table.rb index 87b660d6c6..52da87c5f4 100644 --- a/lib/rex/ui/text/table.rb +++ b/lib/rex/ui/text/table.rb @@ -203,6 +203,10 @@ class Table cmp = Rex::Socket::addr_atoi(a[index]) <=> Rex::Socket::addr_atoi(b[index]) elsif a[index] =~ /^[0-9]+$/ and b[index] =~ /^[0-9]+$/ cmp = a[index].to_i <=> b[index].to_i + elsif a[index].kind_of?(IPAddr) && a[index].kind_of?(IPAddr) && a[index].ipv6? && b[index].ipv4? + cmp = 1 + elsif a[index].kind_of?(IPAddr) && b[index].kind_of?(IPAddr) && a[index].ipv4? && b[index].ipv6? + cmp = -1 else cmp = a[index] <=> b[index] # assumes otherwise comparable. end