Code: Select all
new COM('WbemScripting.SWebLocator');
Code: Select all
new COM("ADODB.Connection");
Moderators: Developers, Moderators
Code: Select all
new COM('WbemScripting.SWebLocator');
Code: Select all
new COM("ADODB.Connection");
now it showsTheWitness wrote: ↑Tue Jan 03, 2023 1:29 pm Goto line 600 in the tools and try changing the following:
toCode: Select all
new COM('WbemScripting.SWebLocator');
If that works, it might have to be repeated in another location too.Code: Select all
new COM("ADODB.Connection");
Code: Select all
$conn->Open("Provider=SQLOLEDB; Data Source=localhost;
Initial Catalog=database; User ID=user; Password=password");
Code: Select all
$wmic = $wmi->Open("Provider=SQLOLEDB; Data Source=$host;
Initial Catalog=database; User ID=$username; Password=$passowrd");
My introduction to cacti and the first program .PHPTheWitness wrote: ↑Tue Jan 03, 2023 1:22 pm Okay, I never tested from a Windows server to a Windows server. So, I'm not surprised this is not working. Should work from Linux to Windows though.
If you know anything about PHP you might be able to do some debugging to fix this. If you do, a Pull request would be appreciated at the GitHub location.
It's likely an escaping issue associated the the darn backslashes.
Code: Select all
{
// Windows version
$KodeWin = 'windows-1251'; //!!!!!!!!!!!!!!!!!!!!!!!!
$namespace = preg_replace('~\\\+~', '\\', $namespace);
$username = iconv('utf-8', $KodeWin, preg_replace('~\\\+~', '\\', $username));
$password = iconv('utf-8', $KodeWin, $password);
$wmi = new COM('WbemScripting.SWbemLocator');
if (($wmic = $wmi->ConnectServer($host, $namespace, $username, $password)) !== false) {;
$wmic->Security_->ImpersonationLevel = 3;
$wmicdata = $wmic->ExecQuery($command);
print "<table style='width:100%'><tr><td class='even'>";
$indexes = array();
preg_match('~SELECT (.*?) FROM (.*?)(?: WITHIN| WHERE|\z)~si', $command, $match_class);
$class = trim($match_class[2]);
if($match_class[1] == '*'){
$wmiClass = new COM('winmgmts:'.$namespace.':'.$class);
foreach ($wmiClass->Properties_ as $var)
array_push($indexes, $var->Name);
}
else //{
foreach(explode(',', $match_class[1]) as $k=>$v)
array_push($indexes, trim($v));
//}
// print "<h4>" . __('WMI Query Results for Device: %s, Class: %s, Columns: %s, Rows: %s', $host, $class, sizeof($indexes), sizeof($data), 'wmi') . "</h4>";
print "<h4>" . __('WMI Query Results for Device: %s, Class: %s, Columns: %s, Rows: %s', $host, $class, sizeof($indexes), $wmicdata->Count, 'wmi') . "</h4>";
print "<p>" . __('Showing columns and first one or two rows of data.', 'wmi') . "</p>";
print "</table>";
print "<table style='width:100%'>";
$i = 1;
foreach ($wmicdata as $index ) {
foreach ($indexes as $var) {
$peremennaia = $var;
form_alternate_row('line' . $peremennaia, true);
if(is_int($index->$peremennaia))
$index_data = $index->$peremennaia;
elseif(is_bool($index->$peremennaia)) //{
if(($index->$peremennaia) == '')
$index_data = 0;
else
$index_data = $index->$peremennaia;
//}
elseif(is_string($index->$peremennaia))
$index_data = iconv($KodeWin,'utf-8',$index->$peremennaia);
else
$index_data = 'Array Or Null';
print "<td style='font-weight:bold;'>" . $peremennaia . "</td><td>" . $index_data . "</td>";
}
form_end_row();
if (($i += 1) > 2 )
break;
}
print "</table>";
} else
print $wmi->error;
}
Users browsing this forum: No registered users and 0 guests