March 3, 2010

nmap XML to HTML parser

Filed under: Security, Uncategorized, internet — admin @ 23:57

I was recently in need for a parser that would convert Nmap XML output to a HTML file. As far as I could see there was no tool available so I wrote my own. Feel free to use or adjust it.

<!--
Parse nmap XML output
	Koen Van Impe		cudeso.be
	20100303
-->
<html>
<head><title>nmap xml file to html</title></head>
<body>
	<form method="POST" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
		XML file: <input type="file" name="xmlfile"	<br />
		<input type="checkbox" checked name="open"> Open <br />
		<input type="checkbox"  name="closed"> Closed <br />
		<input type="checkbox"  name="filtered"> Filtered <br />
		<input type="submit" value="Press"> to upload the file!
	</form>
<?php

if(isset($_FILES['xmlfile'])) {

	// init
	if (trim($_POST["open"]) == "on") 	$printOpen = true;
	else   								$printOpen = false;
	if (trim($_POST["closed"]) == "on") 	$printClosed = true;
	else   								$printClosed = false;
	if (trim($_POST["filtered"]) == "on") 	$printFiltered = true;
	else   								$printFiltered = false;
	$xmlObject = simplexml_load_file($_FILES['xmlfile']['tmp_name']);

	// output the header
	echo "<h1>".(string)$xmlObject["args"]."</h1>";
	echo "<h2>Hosts up: ".(string) $xmlObject->runstats->hosts["up"]." / Hosts down: ".
			(string) $xmlObject->runstats->hosts["down"]. " / Hosts total: ".(string) $xmlObject->runstats->hosts["total"]."</h2>";

	// run through the xml and print hostinfo
	foreach($xmlObject as $host => $value) {

		// Only grab the data if it's host related info
		if ((string) $host == "host") {

			// declare portsarray
			$nmap["ports"] = array();

			// get the hostinfo
			echo "<h2>".(string) $value->hostnames->hostname["name"].
						" (".(string) $value->address["addr"]." / ".(string) $value->address["addrtype"].")</h2>";
			echo "<table>";

			// put the discovered ports in an array
			foreach ($value->ports->port as $port) {

				if (  ( ((string) $port->state["state"] == "filtered")	and	($printFiltered)) or
					  ( ((string) $port->state["state"] == "closed")	and	($printClosed)) or
					  ( ((string) $port->state["state"] == "open")	and	($printOpen))
					) {
					echo "<tr><td>".(string)$port["portid"]."/".(string)$port["protocol"]."</td><td>".
							(string)$port->state["state"]."(".(string)$port->state["reason"].")</td>
							<td>".$port->service["name"]."(".(string)$port->service["product"].")
								</tr>";
				}
			}
			echo "</table>";
		}
	}

}
?>
</body>
</html>

June 18, 2009

Tweets from Pidgin

Filed under: geek, internet, ubuntu — @ 23:26

I use Pidgin as my primary chat client. Up until now I was forced to update my Twitter feed through SMS or a Firefox plugin.

A new plugin for Pidgin, microblog-pidgin, allows you to update your Twitter feed within Pidgin. Installation is straightforward.

sudo echo “deb http://ppa.launchpad.net/sugree/ppa/ubuntu jaunty main” >> /etc/apt/sources.list
sudo echo “deb-src http://ppa.launchpad.net/sugree/ppa/ubuntu jaunty main” >> /etc/apt/sources.list
sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com 0CF459B8DF37ED8B
sudo apt-get update
sudo apt-get install pidgin-microblog

Now start Pidgin, enable the plugin and add a Twitgin account.

April 29, 2009

Google Earth with Ubuntu 9

Filed under: internet, linux, ubuntu — @ 22:43

My upgrade to Ubuntu 9 resulted in quite some frustration (ipv6, cryptodisk, …) but there’s one nice though … installing Google Earth is very easy.

sudo apt-get install googleearth-package
make-googleearth-package –force

Then double click on the .deb file that’s the result of the above.

Found on http://ubuntuguide.org/wiki/Ubuntu:Jaunty#Google_Earth

April 2, 2009

Snort 3.0 Beta 3 Released

Filed under: Open Source, Security, honeypot, internet — @ 22:54

An interesting post by Martin Roesch on the new architecture in the beta release of Snort.

March 24, 2009

Top 10 Most Annoying Tweets

Filed under: geek, internet — @ 23:23

A funny post on Niallh.com

March 10, 2009

Sad day for IT Security

Filed under: Security, dns, internet — @ 21:54

It’s a sad day for IT security when even D. J. Bernstein has to admit that there’s a flaw in DJBDNS. Luckily the patch that needs to be applied is straightforward and has no known side-effects (at least, not on the DJBDNS servers that I patched).

January 28, 2009

TF-CSIRT 26 – Riga: Quantitative Cross Comparative Analysis of Tools for Anomaly Detection

Filed under: Security, conferences, internet — @ 22:06

I attended the last joint TF-CSIRT / FIRST meeting in Riga. One of the most interesting talks was by Wayne Routly from Dante. He talked on Quantitative Cross Comparative Analysis of Tools for Anomaly Detection. He gave some very good information on StealthWatch and Netreflex. If you’re moving Gbs of data then the set of tools you can use to analyze traffic are limited. According to the presentation both tools did quite well though.

January 5, 2009

SSL Blacklist 4.0

Filed under: Security, firefox, internet — @ 23:24

SSL Blacklist is a nice addon for Firefox that has the ability to detect MD5 signed certificates and block access. If you don’t know what’s the problem with MD5 signed certificates then enjoy reading this.

December 14, 2008

Google Sites

Filed under: internet, webdevelopment — @ 11:54

I’ve stumbled on a new Google App, Google Sites. The Google Sites engine is the old JotSpot enhanced with the “Google Experience”. If you need to set up a site quickly with a wysiwyg editor then Google Sites might be a good tool for this …

November 15, 2008

Microsoft doesn’t like Linux users on Hotmail

Filed under: firefox, internet, linux, mail, microsoft — @ 00:12

A recent upgrade of Hotmail prevented me from sending new mails with Firefox 3 on Ubuntu. I could hit “reply” but it was impossible to edit the body of the e-mail. The editor just remained disabled.

The solution to this is fairly simple. Open Firefox, type in “about:config” in the addressbar and look for the setting “general.useragent.vendor“. On my Ubuntu machine this was set to “Ubuntu”. If you change this to “Firefox”, quit Firefox and restart it then you should be able to compose new e-mails in Hotmail.

On the other hand you might also consider using a reliable free mail provider.

Next Page »