From d0a534dee59df323879c0bb4eea50b986a5e58dc Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Sat, 23 Apr 2011 21:57:07 +0000 Subject: [PATCH] Do not even prompt for ICMP tunnel if the target OS is not Windows --- plugins/generic/takeover.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/generic/takeover.py b/plugins/generic/takeover.py index 32e55b7bd..72a36b7e3 100644 --- a/plugins/generic/takeover.py +++ b/plugins/generic/takeover.py @@ -93,18 +93,26 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous): msg = "how do you want to establish the tunnel?" msg += "\n[1] TCP: Metasploit Framework (default)" - msg += "\n[2] ICMP: icmpsh - ICMP tunneling" + + if Backend.isOs(OS.WINDOWS): + msg += "\n[2] ICMP: icmpsh - ICMP tunneling" + valids = ( 1, 2 ) + else: + valids = ( 1, ) while True: tunnel = readInput(msg, default=1) - if isinstance(tunnel, basestring) and tunnel.isdigit() and int(tunnel) in ( 1, 2 ): + if isinstance(tunnel, basestring) and tunnel.isdigit() and int(tunnel) in valids: tunnel = int(tunnel) break - elif isinstance(tunnel, int) and tunnel in ( 1, 2 ): + elif isinstance(tunnel, int) and tunnel in valids: break + elif len(valids) == 1: + warnMsg = "invalid value, valid value is 1" + logger.warn(warnMsg) else: warnMsg = "invalid value, valid values are 1 and 2" logger.warn(warnMsg)