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>

November 29, 2009

Screws removed from my jaw

Filed under: Uncategorized — koen @ 20:10

About 6 months ago I had a rather unpleasant accident and broke my jaw.

Last Thursday I had surgery to remove the metal plates that held my jaw together. I went in around 9AM, had a good sleep between 1PM and 3PM and went back home around 6PM … with the things that were inside my cheek in a small plastic back.

The doctor told me I was rather fortunate, I managed to crack two of the screws. As a precaution doctors nowadays always use two plates to attach broken jaws. Thank you doctor! Otherwise it would have been forced to have that same surgery again. Not something I would have enjoyed. Out of eight screws that were used two were broken and the base part of the screws are still in my jaw. I’m already looking forward to my next airport security check.

Oh, and from the “outside” there’s nothing you can see (besides my grumpy face but the problems with my jaw aren’t the only source for my grumpiness …)

March 15, 2009

Install beta packages with PEAR

Filed under: Uncategorized — @ 15:00

If you want to install beta packages with dependencies in PEAR then use this command:

pear -d preferred_state=beta install –onlyreqdeps the_package_to_install

May 5, 2008

Huizenjacht in Antwerpen

Filed under: Uncategorized,antwerpen — @ 00:16

Op zoek naar een huis in Antwerpen.

Voorwaarden:

  • Een terras (of tuin)
  • Twee slaapkamers
  • Dicht bij een station (Berchem/Centraal)
  • Minder dan 500 euro per maand

Iemand een hint? lemmeknow.

March 11, 2008

DICOM foto’s linkerknie

Filed under: Uncategorized — @ 22:11

ASZ-Aalst 2008-Mar-06



3.jpg4.jpg5.jpg6.jpg

December 7, 2007

Auto te koop: Volvo V40 voor export

Filed under: Uncategorized — @ 01:21

Iemand interesse in een auto?
Volvo V40 diesel; ongeval-vrij; 219.000 km; handgeschakeld; centrale vergrendeling; auto/cd-speler Volvo; geen Johnny-opties.
Enkel bedoeld voor export. Interesse? Mail!

December 3, 2007

Spaargids.be

Filed under: Uncategorized — @ 10:36

Nuttige informatie over spaarrekeningen in België op spaargids.be.

November 24, 2007

ListAfterList

Filed under: Uncategorized — @ 02:12

Wel.
Ik ben onlangs op het fenomeen van microjobs gestoten. Via via was ik op Pajamanation terechtgekomen. Een vrij eenvoudige site die je in een oogopslag laat zien welke kleine jobs er nog allemaal beschikbaar zijn. Een beetje verder googlen en je komt automatisch terecht bij Amazon zijn Mechanical Turk. Eén van de opdrachten die ik er terugvond was om een review te schrivjen van ListAfterList. Nou ja … ik schrijf al genoeg rommel op deze blog … dus waarom niet? Listafterlist geeft, ja wat dacht je, een overzicht van lijstjes. Helemaal in web2.0 stijl. Lijstjes zijn blijkbaar ontzettend heet. Ze hoeven geen inhoud te hebben … enkel een lijst op zich is al voldoende. Nou ja. Via dezelfde website kan je ook eigen lijsten aanmaken, via de link van Create a List. Ik ben benieuwd.

April 28, 2007

Filmpje

Filed under: Uncategorized — @ 23:42

April 26, 2007

bio-food

Filed under: Uncategorized — @ 22:52

Reclame maken voor sites waar je zelf aan werkt is toch geen doodzonde? Edus:

Bio-food
Deze blog geeft u, de gebruiker, een venster om uw opinie, opmerkingen of tips weer te geven over alles wat van dicht of veraf verband heeft met biologisch en artisanaal eten.
Meer weten? Surf naar http://www.bio-food.be/.

Next Page »