Skip to content

Commit 5f08591

Browse files
committed
Add Nagios XI exploit
1 parent fd07da3 commit 5f08591

File tree

6 files changed

+723
-0
lines changed

6 files changed

+723
-0
lines changed

data/exploits/nagios_xi/profile.zip

5.38 KB
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
02-19-2013 1.2
2+
------------
3+
- Added New functionality to download LOG files and latest snapshots in a zip for support. - SL
4+
- Added ps -aef to the log list - SL
5+
6+
7+
08-28-2012 1.1
8+
----------
9+
- Added XI Version -SW
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
3+
4+
echo "-------------------Fetching Information-------------------"
5+
6+
echo "Please wait......."
7+
8+
tail -100 /usr/local/nagios/var/nagios.log &> /usr/local/nagiosxi/var/components/profile/nagios.txt;
9+
10+
echo "Creating nagios.txt...";
11+
12+
tail -100 /usr/local/nagios/var/perfdata.log &> /usr/local/nagiosxi/var/components/profile/perfdata.txt;
13+
14+
echo "Creating perfdata.txt...";
15+
16+
tail -100 /usr/local/nagios/var/npcd.log &> /usr/local/nagiosxi/var/components/profile/npcd.txt;
17+
18+
echo "Creating npcd.txt...";
19+
20+
tail -100 /usr/local/nagiosxi/var/cmdsubsys.log > /usr/local/nagiosxi/var/components/profile/cmdsubsys.txt;
21+
22+
echo "Creating cmdsubsys.txt...";
23+
24+
tail -100 /usr/local/nagiosxi/var/eventman.log > /usr/local/nagiosxi/var/components/profile/eventman.txt;
25+
26+
echo "Creating eventman.txt...";
27+
28+
############ We'll need a sudoers rule for these, only root can read them
29+
30+
#tail -100 /var/log/messages > /usr/local/nagiosxi/var/components/profile/systemlog.txt;
31+
32+
#echo "Creating systemlog.txt...";
33+
34+
#tail -100 /var/log/httpd/error_log > /usr/local/nagiosxi/var/components/profile/apacheerrors.txt;
35+
36+
#echo "Creating apacheerrors.txt...";
37+
38+
#tail -100 /var/log/mysqld.log > /usr/local/nagiosxi/var/components/profile/mysqllog.txt;
39+
40+
#echo "Creating mysqllog.txt...";
41+
42+
df -h > /usr/local/nagiosxi/var/components/profile/filesystem.txt;
43+
44+
echo "Creating filesystem.txt...";
45+
46+
ps -aef > /usr/local/nagiosxi/var/components/profile/psaef.txt;
47+
48+
echo "Dumping PS - AEF to psaef.txt...";
49+
50+
top -b -n 1 > /usr/local/nagiosxi/var/components/profile/top.txt;
51+
52+
echo "Creating top log...";
53+
54+
FILE=$(ls /usr/local/nagiosxi/nom/checkpoints/nagioscore/ | sort -n -t _ -k 2 | grep .gz | tail -1); cp /usr/local/nagiosxi/nom/checkpoints/nagioscore/$FILE /usr/local/nagiosxi/var/components/profile/;
55+
56+
echo "Adding latest snapshot to: `pwd`"
57+
58+
## temporarily change to that directory, zip, then leave
59+
(
60+
cd /usr/local/nagiosxi/var/components/ && zip -r profile.zip profile
61+
)
62+
echo "Zipping logs directory...";
63+
64+
echo "Backup and Zip complete!";
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<?php
2+
// MASS ACKNOWLEDGE COMPONENT
3+
//
4+
// Copyright (c) 2010 Nagios Enterprises, LLC. All rights reserved.
5+
//
6+
// $Id: profile.inc.php 115 2010-08-16 16:15:26Z mguthrie $
7+
8+
//include the helper file
9+
require_once(dirname(__FILE__).'/../componenthelper.inc.php');
10+
11+
// respect the name
12+
$profile_component_name="profile";
13+
14+
// run the initialization function
15+
profile_component_init();
16+
17+
////////////////////////////////////////////////////////////////////////
18+
// COMPONENT INIT FUNCTIONS
19+
////////////////////////////////////////////////////////////////////////
20+
21+
function profile_component_init(){
22+
global $profile_component_name;
23+
24+
//boolean to check for latest version
25+
$versionok=profile_component_checkversion();
26+
27+
//component description
28+
$desc=gettext("This component creates a system profile menu in the Admin panel
29+
which can be used for troubleshooting purposes.");
30+
31+
if(!$versionok)
32+
$desc="<b>".gettext("Error: This component requires Nagios XI 20011R1.1 or later.")."</b>";
33+
34+
//all components require a few arguments to be initialized correctly.
35+
$args=array(
36+
37+
// need a name
38+
COMPONENT_NAME => $profile_component_name,
39+
COMPONENT_VERSION => '1.1',
40+
COMPONENT_DATE => '8/28/2012',
41+
42+
// informative information
43+
COMPONENT_AUTHOR => "Nagios Enterprises, LLC",
44+
COMPONENT_DESCRIPTION => $desc,
45+
COMPONENT_TITLE => "System Profile",
46+
47+
);
48+
49+
//register this component with XI
50+
register_component($profile_component_name,$args);
51+
52+
// register the addmenu function
53+
if($versionok)
54+
register_callback(CALLBACK_MENUS_INITIALIZED,'profile_component_addmenu');
55+
}
56+
57+
58+
59+
60+
///////////////////////////////////////////////////////////////////////////////////////////
61+
// MISC FUNCTIONS
62+
///////////////////////////////////////////////////////////////////////////////////////////
63+
64+
function profile_component_checkversion(){
65+
66+
if(!function_exists('get_product_release'))
67+
return false;
68+
//requires greater than 2011R1
69+
if(get_product_release()<201)
70+
return false;
71+
72+
return true;
73+
}
74+
75+
function profile_component_addmenu($arg=null){
76+
global $profile_component_name;
77+
//retrieve the URL for this component
78+
$urlbase=get_component_url_base($profile_component_name);
79+
//figure out where I'm going on the menu
80+
$mi=find_menu_item(MENU_ADMIN,"menu-admin-managesystemconfig","id");
81+
if($mi==null) //bail if I didn't find the above menu item
82+
return;
83+
84+
$order=grab_array_var($mi,"order",""); //extract this variable from the $mi array
85+
if($order=="")
86+
return;
87+
88+
$neworder=$order+0.1; //determine my menu order
89+
90+
//add this to the main home menu
91+
add_menu_item(MENU_ADMIN,array(
92+
"type" => "link",
93+
"title" => "System Profile",
94+
"id" => "menu-admin-profile",
95+
"order" => $neworder,
96+
"opts" => array(
97+
//this is the page the menu will actually point to.
98+
//all of my actual component workings will happen on this script
99+
"href" => $urlbase."/profile.php",
100+
)
101+
));
102+
103+
}
104+
105+
106+
?>

0 commit comments

Comments
 (0)