Port scanning using pbnj!

Recently i installed Kali Linux on Vmware workstation. There was a tool called pbnj which can scan port and store results in mysql database. Sometime it is useful storing vulnerable assessment into database.But in Kali linux it is not installed as default. pbnj use nmap(with “-a [options] to scan network , I only use it store the result in database!

Let’s  see how to install and use it to scan port and store to database

Start mysql services on Kali Linux:

Let’s find all file related of pbnj :

I am going to use mysql so i am only interested in “/usr/share/doc/pbnj/examples/mysql.yaml” . So we need to edit this file to use correct username, password and database :

In Kali mysql password is blank and username “root”. You should really change the username and password. But i am doing it without changing anything. Set let’s configure mysql:

We are ready to go now:

Now Let’s scan port:

Above the command option “-a” for nmap argument is “-sS”. Scan finished and hopefully result written to database. Let’s check:

There is another tool installed called outputpbnj which can be used to dump the result without manually logging to MySQL.

Okay, Let’s dump the latest result:


It is not working for as expected, No problem i am going to edit the “outputpbnj”(perl script). I have to remove “|” from “test” and “debug”. Kali linux use LeafPad text editor so “leafpad /usr/bin/outputpbnj” or you can use gedit or kate/kwrite(KDE) . Then searching for “test|=s”:

Just remove the pipe “|” from “test” and “debug”, It should be :‘test=s’,    ‘debug=s’  Now save and run :

It is possible save the output in different format. For example:

Another curiosity that i can use only one query(“-q”) or there are more…. no, I can use many command:

All the query command is available in outputpbnj script(With Description)!

These kind of tool really useful for vulnerability assessment. pbnj is really a nice tool.