SQL Comes to Nmap: Power and Convenience
Listing 2. Results of a Single Scan
+---------------+------------+----------+--------+----------+--------+-------+ | target_ip | d | t | port | protocol | state | runid | +---------------+------------+----------+--------+----------+--------+-------+ | 192.168.10.0 | 2003-12-14 | 10:00:37 | 80 | tcp | open | 100 | | 192.168.10.1 | 2003-12-14 | 10:00:37 | 21 | tcp | open | 100 | | 192.168.10.1 | 2003-12-14 | 10:00:37 | 23 | tcp | open | 100 | | 192.168.10.1 | 2003-12-14 | 10:00:37 | 80 | tcp | open | 100 | | 192.168.10.44 | 2003-12-14 | 10:00:37 | 22 | tcp | open | 100 | | 192.168.10.44 | 2003-12-14 | 10:00:37 | 111 | tcp | open | 100 | | 192.168.10.44 | 2003-12-14 | 10:00:37 | 3306 | tcp | open | 100 | | 192.168.10.44 | 2003-12-14 | 10:00:37 | 6000 | tcp | open | 100 | | 192.168.10.64 | 2003-12-14 | 10:00:37 | 135 | tcp | open | 100 | | 192.168.10.64 | 2003-12-14 | 10:00:37 | 139 | tcp | open | 100 | | 192.168.10.64 | 2003-12-14 | 10:00:37 | 445 | tcp | open | 100 | | 192.168.10.64 | 2003-12-14 | 10:00:37 | 1024 | tcp | open | 100 | | 192.168.10.64 | 2003-12-14 | 10:00:37 | 1025 | tcp | open | 100 | | 192.168.10.64 | 2003-12-14 | 10:00:37 | 1031 | tcp | open | 100 | | 192.168.10.64 | 2003-12-14 | 10:00:37 | 5000 | tcp | open | 100 | | 192.168.10.64 | 2003-12-14 | 10:00:37 | 5101 | tcp | open | 100 | | 192.168.10.64 | 2003-12-14 | 10:00:37 | 6000 | tcp | open | 100 | | 192.168.10.65 | 2003-12-14 | 10:00:37 | 135 | tcp | open | 100 | | 192.168.10.65 | 2003-12-14 | 10:00:37 | 139 | tcp | open | 100 | | 192.168.10.65 | 2003-12-14 | 10:00:37 | 445 | tcp | open | 100 | | 192.168.10.65 | 2003-12-14 | 10:00:37 | 1025 | tcp | open | 100 | | 192.168.10.65 | 2003-12-14 | 10:00:37 | 5000 | tcp | open | 100 | +---------------+------------+----------+--------+----------+--------+-------+
We get Listing 3, showing the open ports information for target 192.168.10.44, when we use the following query:
mysql> select target_ip, d, t, port, protocol,
-> state, runid from portstat
-> where target_ip = '192.168.10.44'
-> order by d, t;
Listing 3. Scan Results for a Single Host
+---------------+------------+----------+--------+----------+--------+-------+ | target_ip | d | t | port | protocol | state | runid | +---------------+------------+----------+--------+----------+--------+-------+ | 192.168.10.44 | 2003-12-14 | 10:00:37 | 22 | tcp | open | 100 | | 192.168.10.44 | 2003-12-14 | 10:00:37 | 111 | tcp | open | 100 | | 192.168.10.44 | 2003-12-14 | 10:00:37 | 3306 | tcp | open | 100 | | 192.168.10.44 | 2003-12-14 | 10:00:37 | 6000 | tcp | open | 100 | +---------------+------------+----------+--------+----------+--------+-------+
If you match the four lines of output with the section for 192.168.10.44 in Listing 1, you can see the relationship immediately. As shown here, the portstat table alone can provide all the port scan information from Nmap. Of course, if you've done a number of scans, the above query shows all the results for 192.168.10.44 found in all the scans.
Let's say that two days, or a week or a month later, you scan your network again and want to compare the two results visually. A quick look through the runlist table shows that runid 102 corresponds to two days after the first scan. Armed with that information, you enter the query:
mysql> select target_ip, d,t,port, protocol,
-> state from portstat
-> where target_ip = '192.168.10.44'
-> and runid = 102 order by d,t,port;
You easily can compare the results of Listings 4 and 5 to pick out the differences. Obviously, a program could compare the two result sets and summarize the differences for you.
Listing 4. 192.168.10.44 Scanned Two Days Later
+---------------+------------+----------+--------+----------+--------+ | target_ip | d | t | port | protocol | state | +---------------+------------+----------+--------+----------+--------+ | 192.168.10.44 | 2003-12-16 | 00:47:16 | 22 | tcp | open | | 192.168.10.44 | 2003-12-16 | 00:47:16 | 111 | tcp | open | | 192.168.10.44 | 2003-12-16 | 00:47:16 | 3306 | tcp | open | | 192.168.10.44 | 2003-12-16 | 00:47:16 | 6000 | tcp | open | +---------------+------------+----------+--------+----------+--------+
Listing 5. Combined Results for a Host
+------------+----------+---------------+----------------------+-----------------------------+--------+----------+---------+--------+-------------------------------+ | d | t | ip | host | os_guessed | port | protocol | service | state | fullversion | +------------+----------+---------------+----------------------+-----------------------------+--------+----------+---------+--------+-------------------------------+ | 2003-12-14 | 10:00:37 | 192.168.10.44 | ophelia.hasnains.com | Linux Kernel 2.4.0 - 2.5.20 | 22 | tcp | ssh | open | OpenSSH 3.5p1(protocol 1.99) | | 2003-12-14 | 10:00:37 | 192.168.10.44 | ophelia.hasnains.com | Linux Kernel 2.4.0 - 2.5.20 | 111 | tcp | rpcbind | open | 2 (rpc #100000) | | 2003-12-14 | 10:00:37 | 192.168.10.44 | ophelia.hasnains.com | Linux Kernel 2.4.0 - 2.5.20 | 3306 | tcp | mysql | open | MySQL4.0.16-standard-log | | 2003-12-14 | 10:00:37 | 192.168.10.44 | ophelia.hasnains.com | Linux Kernel 2.4.0 - 2.5.20 | 6000 | tcp | X11 | open | (access denied) | +------------+----------+---------------+----------------------+-----------------------------+--------+----------+---------+--------+-------------------------------+
Going back to the poor man's port scan results, the hoststat table contains information for each live host. It keeps a simple count of open ports in the open_ports column. To find the open port information for our target host, we query:
mysql> select ip,d,t,open_ports, ports_scanned,
-> runid from hoststats where order by ip, d,t;
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |




3 hours 58 min ago
4 hours 15 min ago
6 hours 8 min ago
8 hours 2 min ago
14 hours 56 min ago
15 hours 12 min ago
17 hours 3 min ago
22 hours 55 min ago
1 day 3 hours ago
1 day 3 hours ago