From 72a901347d39ddfe5861330c04cad8675b222abb Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Fri, 29 Oct 2010 10:06:28 +0000 Subject: [PATCH] Adjustments --- extra/icmpsh/icmpsh_m.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/extra/icmpsh/icmpsh_m.py b/extra/icmpsh/icmpsh_m.py index bfccf1e3b..b1d8c3e38 100755 --- a/extra/icmpsh/icmpsh_m.py +++ b/extra/icmpsh/icmpsh_m.py @@ -25,7 +25,7 @@ import socket import subprocess import sys -def checkImpacketLibs(): +def checkLibs(): try: from impacket import ImpactDecoder from impacket import ImpactPacket @@ -46,10 +46,10 @@ def setNonBlocking(fd): def main(src, dst): if subprocess.mswindows: - sys.stderr.write('ERROR: icmpsh master can only be run on Posix systems\n') + sys.stderr.write('icmpsh master can only run on Posix systems\n') sys.exit(255) - checkImpacketLibs() + checkLibs() # Make standard input a non-blocking file stdin_fd = sys.stdin.fileno() @@ -61,7 +61,7 @@ def main(src, dst): try: sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP) except socket.error, e: - print 'You need to run icmpsh master with administrator privileges' + sys.stderr.write('You need to run icmpsh master with administrator privileges\n') sys.exit(1) sock.setblocking(0) @@ -132,13 +132,10 @@ def main(src, dst): sock.sendto(ip.get_packet(), (dst, 0)) if __name__ == '__main__': - if subprocess.mswindows: - print 'ERROR: this icmpsh master can only be run on Posix systems' - sys.exit(1) - if len(sys.argv) < 3: - print 'ERROR: missing mandatory options. Execute as root:' - print './icmpsh-m.py ' + msg = 'missing mandatory options. Execute as root:\n' + msg += './icmpsh-m.py \n' + sys.stderr.write(msg) sys.exit(1) main(sys.argv[1], sys.argv[2])