<?php


/***********************************************************/
/* last update: 12.20.2002                                 */
/* --------------------------------------------------------*/
/*                    Inprotect                            */
/* --------------------------------------------------------*/
/* Copyright (C) 2002 Inprotect.com                        */
/*                                                         */
/* This program is free software; you can redistribute it  */
/* and/or modify it under the terms of version 2 of the    */
/* GNU General Public License as published by the Free     */
/* Software Foundation.                                    */
/* This program is distributed in the hope that it will be */
/* useful, but WITHOUT ANY WARRANTY; without even the      */
/* implied warranty of MERCHANTABILITY or FITNESS FOR A    */ 
/* PARTICULAR PURPOSE. See the GNU General Public License  */ 
/* for more details.                                       */
/*                                                         */
/* You should have received a copy of the GNU General      */ 
/* Public License along with this program; if not, write   */
/* to the Free Software Foundation, Inc., 59 Temple Place, */ 
/* Suite 330, Boston, MA 02111-1307 USA                    */
/*                                                         */
/* Contact Information:                                    */
/* Alex Zimin (alex@inprotect.com)                         */
/* http://www.inprotect.com                                */
/***********************************************************/
/* See the README.txt and/or help files for more           */ 
/* information on how to use & config.                     */
/* See the LICENSE.txt file for more information on the    */ 
/* License this software is distributed under.             */
/*                                                         */
/* This program is intended for use in an authorized       */ 
/* manner only, and the author can not be held liable for  */ 
/* anything done with this program, code, or items         */
/* discovered with this program's use.                     */
/***********************************************************/

include ('header.php');
//include ('config.php');


if(!is_numeric($id)) {die("Can not access this page");}



if ($op=="delnote" and $nid<>"") {

if(!is_numeric($nid)) {die("Can not access this page");}



	$query="delete from nessus_notes where id=$nid and username='$username'";
	$result=$dbconn->execute($query);


}


$result=$dbconn->Execute("select * from plugins where ID='$id'");
list($pid, $pname, $pfamily, $pcategory, $pcopyright, $psummary, $pdescription, $pversion, $pcve_id, $pbugtraq_id)= $result->fields;


$pdescription=htmlspecialchars($pdescription);

echo "<B>Nessus plugin details:</B><BR>
<B>ID:</B> $pid<BR><BR>
<B>Name:</B> $pname<BR><BR>
<B>Family:</B> $pfamily<BR><BR>
<B>Category:</B> $pcategory<BR><BR>
<B>Copyright:</B> $pcopyright<BR><BR>
<B>Summary:</B> $psummary<BR><BR>
<B>Description:</B> ".str_replace ( "\n", "<BR>", $pdescription)."<BR><BR>
<B>Version:</B> $pversion<BR><BR> 
<B>CVE IDs: </B>";
$CVEs = preg_split ("/[\s,]+/", $pcve_id);
foreach($CVEs as $CVE){
echo"<a href=\"http://cve.mitre.org/cgi-bin/cvename.cgi?name=$CVE\">$CVE</a> ";
}
$Bugtraqs = preg_split ("/[\s,]+/", $pbugtraq_id);
echo"<br/><B>Bugtraq IDs: </B>";
foreach($Bugtraqs as $Bugtraq){
echo"<a href=\"http://www.securityfocus.com/bid/$Bugtraq\">$Bugtraq</a>  ";
}


$result->Close;
echo "<BR/><B><a href=\"search.php?plugin=$pid&amp;showInfo=true&amp;submit=Submit\">Systems with this vulnerability</A></b>";
echo "<font color=\"red\"><BR><BR><B>Notes:</B><BR>";

$query = "select id, note from nessus_notes where username='$username' and pid=$id";
$result=$dbconn->execute($query);
while (!$result->EOF) {
	list($nid, $note)=$result->fields;
	echo "<hr><a href=\"lookup.php?op=delnote&amp;nid=$nid&amp;id=$id\">Delete Note</a> $note";


	$result->MoveNext();
}

echo "<BR><a href=\"notes.php?op=add&amp;pid=$id\">Add Note</a></font>";

include("footer.php");
?>
