Nmap Development mailing list archives

Re: Zenmap couldn't termate nmap.exe process when exiting


From: David Fifield <david () bamsoftware com>
Date: Thu, 23 Jun 2011 14:11:16 -0700

On Wed, Jun 22, 2011 at 08:03:45PM +0300, Shinnok wrote:
On 6/22/2011 6:47 PM, David Fifield wrote:
This doesn't work for me; Python installed according to the instructions
in docs/win32-installer-zenmap-buildguide.txt doesn't have the win32api
module. If I remove the try...pass I get an exception when trying to
kill a scan.

Can you back out this change until we've had time to discuss it and
possible alternatives?

David Fifield
Reverted.

The problem was that win32api module is part of pywin32 which was available
in Active Python but not Python from Python.org, which figures as to
be used in
win32-installer-zenmap-buildguide.txt.

However, I've since reverted to an exact environment as in the
zenmap build guide and
I have the following two alternative approaches that work just fine:

#Use ctypes instead pywin32 which is a standard library in
Python.org distribution
import ctypes
ctypes.windll.kernel32.TerminateProcess(int(self.command_process._handle),
-1)

-or-

# :-P
os.popen('TASKKILL /PID '+str(self.command_process.pid)+' /F')

The ctypes method looks good to me. Please check that it works back to
Windows XP, and then you can commit it.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: