Nmap Development mailing list archives

Re: implementing nmap in python


From: "Guilherme Polo" <ggpolo () gmail com>
Date: Tue, 28 Aug 2007 12:36:22 -0300

2007/8/28, Max <nmap () webwizarddesign com>:
I have been waiting to see if there was a need / desire for a library
like Nmap::Scanner in other languages, was thinking of ruby and python
as targets nearly two years ago, now that I am hearing there is some
interest in that I will port my library to python and ruby, your
choice of course whether you wish to use it or not :), seems the Umit
crowd has no love for Nmap::Scanner :p, which is fine and a choice I
am ok with of course.


It is not that we (can I say we?) from Umit don't love Nmap::Scanner,
but, first: it is perl =) Umit is python. Second, I took a look at
your lib right now and I saw it uses IPC::Open3, that is just like
using subprocess or you can update me since I haven't been using perl
lately. Umit already handles the nmap scans using subprocess, and it
also has a nmap xml parser and during this GSoC a new database schema
was created and it is possible to insert these xml scans into
database, but it is still missing somethings that I saw your lib have.

Of course I'm not telling you to not port your library to python and
ruby (argh ;)
Just pointing some reasons why it would be good to have a libnmap like
was suggested by Giorgio and why it is not used in Umit.

- Max

On 8/28/07, Guilherme Polo <ggpolo () gmail com> wrote:
2007/8/28, Giorgio Zoppi <giorgio.zoppi () gmail com>:
On Tue, 2007-08-28 at 11:15 -0300, Guilherme Polo wrote:
2007/8/28, Giorgio Zoppi <giorgio.zoppi () gmail com>:
On Sun, 2007-08-26 at 17:09 -0300, Guilherme Polo wrote:
2007/8/26, Julius Kuhn <julikr678 () gmail com>:
Hello!

I am currently working on a python program. I mean its basically a shell and
im trying to use nmap to portscan a host. I just wanted to know if there is
an easy way to implement it other then os.system etc.

Don't use os.system, use subprocess.

otherwise i would have
to write my own portscanner. Thanks ..


I don't believe this reason you are pointing is good enough to make a
new portscanner.
If you wish to do something like import nmap; nmap.scan(something) and
etc, you will need to create a set of nmap bindings for Python, and
that will be easier than creating a new portscanner that equals to
nmap.
In order to do something similar, it will be useful a libnmap written in
C,

Good proposal right there. It doesn't need to be in C, C++ would be
possible too.

Now, i'm doing my master thesis, so i've no time :).
so still your gui it will avoid to start on more process to scan
hosts.

I didn't understand this. Are you talking about performance ?

Yes. I suppose that your code does some fork+execv in order to start
scanning isn't it?  With a libnmap, your gui will need only to register
an event or a callback, in order to get scan results.


Using subprocess that will happen, yes. A callback would be much
better, but what is better is to not rely on OS spawning a new process
like that, so many things could go wrong...

But I believe that question wasn't to me, since I didn't start this thread.

Cheers,
Giorgio.





--
-- Guilherme H. Polo Goncalves

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


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



-- 
-- Guilherme H. Polo Goncalves

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


Current thread: