Parsable system info available in 7.6.5
Forum rules
We have no special rules for UVK forums. Just try to be polite and clear in your posts.
Please don't post spam in this forum. Spammers will be banned by IP, e-mail and username.
We reserve the right to delete all posts and ban all users we consider not having respected these rules without warning.
We have no special rules for UVK forums. Just try to be polite and clear in your posts.
Please don't post spam in this forum. Spammers will be banned by IP, e-mail and username.
We reserve the right to delete all posts and ban all users we consider not having respected these rules without warning.
Parsable system info available in 7.6.5
I'm pleased to announce that version 7.6.5, currently in beta state now generates a SystemInfo INI file each time the system information is exported to an HTML file from the System info section. This INI file is automatically added to the Reporting zip file. This feature has been requested in the following topic:
viewtopic.php?f=9&t=1230
I have chosen the INI file format because it is natively supported by windows, PHP and most programing languages, and it is easily parsable. It is mainly intended to be used by PCRT, CRS and other applications of the same kind. So if you are a licensed user of one of those apps, please contact their support team asking them to integrate the file.
Thanks.
viewtopic.php?f=9&t=1230
I have chosen the INI file format because it is natively supported by windows, PHP and most programing languages, and it is easily parsable. It is mainly intended to be used by PCRT, CRS and other applications of the same kind. So if you are a licensed user of one of those apps, please contact their support team asking them to integrate the file.
Thanks.
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.
Fred
Fred
-
- Posts: 175
- Joined: Wed Jun 10, 2015 9:07 pm
- Location: France
Re: Parsable system info available in 7.6.5
Just for information:
Luke from pcrt just released the v3 that finally include import specs infos from uvk (using the ini file)
Luke from pcrt just released the v3 that finally include import specs infos from uvk (using the ini file)
Re: Parsable system info available in 7.6.5
Thanks for the information, Manu.
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.
Fred
Fred
-
- Posts: 1529
- Joined: Sun May 25, 2014 7:44 am
- Location: Missouri
Re: Parsable system info available in 7.6.5
Reggae
Did someone post a working version of Lukes UVK system.ini parser? Kinda seemed like they did but I cant find it. All the did was copy the d7 ini parsing stuff and most of it does not work with UVK. So either I need to find a corrected script or I gotta fix it myself..... really don't wanna if someone else already has.
Did someone post a working version of Lukes UVK system.ini parser? Kinda seemed like they did but I cant find it. All the did was copy the d7 ini parsing stuff and most of it does not work with UVK. So either I need to find a corrected script or I gotta fix it myself..... really don't wanna if someone else already has.
Jim
It is not "Can it be done?" but rather, "How can we do it?"
It is not "Can it be done?" but rather, "How can we do it?"
-
- Posts: 175
- Joined: Wed Jun 10, 2015 9:07 pm
- Location: France
Re: Parsable system info available in 7.6.5
Hi Jim,
No, was just talking about the official integration in the v3, but after testing it doesn't really work.
I'll be back to work tomorrow (end of holidays
) and I need a working import so I guess I'll have to use my old mod for now while trying to make the new version work correctly
[EDIT] Just took some times to update it but I've no result with parse_ini_string() function for now, it keep returning an empty array.
@fred> that's on the parse_ini_string function manual :
Anyway, this file format is not easy to parse as for applications like pcrt we need keywords.
For example for hard disks, there's no "partition=", the key itself is the name of the partition so it changes all the time.
Would be more effective to have something like a plain :
We don't need sections or full detailed infos (there's already system info.htm for that), we just need basic/easy import via keywords
No, was just talking about the official integration in the v3, but after testing it doesn't really work.
I'll be back to work tomorrow (end of holidays

[EDIT] Just took some times to update it but I've no result with parse_ini_string() function for now, it keep returning an empty array.
@fred> that's on the parse_ini_string function manual :
I thought that was the problem but even if I strip all that chars from the keys that still doesn't work.Les caractères ?{}|&~
Anyway, that would be nice to have a more natural way to parse it like said above but don't hurry Fred, that will work for now
You probably have better to do...
For those interested you have to change the regex line from my last mod by this one (I'll update the mod on pcrt forum):

Anyway, that would be nice to have a more natural way to parse it like said above but don't hurry Fred, that will work for now

You probably have better to do...
For those interested you have to change the regex line from my last mod by this one (I'll update the mod on pcrt forum):
Code: Select all
$pattern = "/$val<\/td>(<\/tr><tr>|)<td[^>]*(> <a[^>]*|)>([^<]*)/ui";
Re: Parsable system info available in 7.6.5
Thanks, Manu. I also felt I had to do something about this, since many of you asked for it.
So I made this page, which takes a SystemInfo.ini file, and outputs a table similar to the System info HTML file. Feel free to test it out.
As Manu said, the parse_ini_string() function didn't work, actually because of PHP's lack of UNICODE support (SystemInfo.ini is UNICODE encoded to support any language).
So I used parse_ini_string_m(), which I copied from this PHP help page. That function parses the INI file just fine, but you still have to strip the first two bytes from the INI string, which are the UNICODE BOM (BYTE order mark).
So, here's an example. Feel free to post it in PCRT's forum.
So I made this page, which takes a SystemInfo.ini file, and outputs a table similar to the System info HTML file. Feel free to test it out.
As Manu said, the parse_ini_string() function didn't work, actually because of PHP's lack of UNICODE support (SystemInfo.ini is UNICODE encoded to support any language).
So I used parse_ini_string_m(), which I copied from this PHP help page. That function parses the INI file just fine, but you still have to strip the first two bytes from the INI string, which are the UNICODE BOM (BYTE order mark).
So, here's an example. Feel free to post it in PCRT's forum.
Code: Select all
<?php
//First, we declare our function
function parse_ini_string_m($str) {
if(empty($str)) return false;
$lines = explode("\n", $str);
$ret = Array();
$inside_section = false;
foreach($lines as $line) {
$line = trim($line);
if(!$line || $line[0] == "#" || $line[0] == ";") continue;
if($line[0] == "[" && $endIdx = strpos($line, "]")){
$inside_section = substr($line, 1, $endIdx-1);
continue;
}
if(!strpos($line, '=')) continue;
$tmp = explode("=", $line, 2);
if($inside_section) {
$key = rtrim($tmp[0]);
$value = ltrim($tmp[1]);
if(preg_match("/^\".*\"$/", $value) || preg_match("/^'.*'$/", $value)) {
$value = mb_substr($value, 1, mb_strlen($value) - 2);
}
$t = preg_match("^\[(.*?)\]^", $key, $matches);
if(!empty($matches) && isset($matches[0])) {
$arr_name = preg_replace('#\[(.*?)\]#is', '', $key);
if(!isset($ret[$inside_section][$arr_name]) || !is_array($ret[$inside_section][$arr_name])) {
$ret[$inside_section][$arr_name] = array();
}
if(isset($matches[1]) && !empty($matches[1])) {
$ret[$inside_section][$arr_name][$matches[1]] = $value;
} else {
$ret[$inside_section][$arr_name][] = $value;
}
} else {
$ret[$inside_section][trim($tmp[0])] = $value;
}
} else {
$ret[trim($tmp[0])] = ltrim($tmp[1]);
}
}
return $ret;
}
//...
//Get the text of SystemInfo.ini directly from the report zip file
$initext = zip_entry_read($zipentry, zip_entry_filesize($zipentry));
//...
$initext = substr($initext, 2);
$inidata = parse_ini_string_m($initext, true);
if (FALSE === $inidata) :
echo '<p><b>Could not parse the INI string</b></p>';
else :
// The ini file was successfully parsed, output it
foreach ($inidata as $sectionname => $sectionarray )
{
// Output or do whatever you need with $sectionname
foreach ($sectionarray as $key => $val)
{
// Output or do whatever you need with $key ad $val
}
}
endif;
?>
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.
Fred
Fred
-
- Posts: 175
- Joined: Wed Jun 10, 2015 9:07 pm
- Location: France
Re: Parsable system info available in 7.6.5
Thanks Fred, I'll try to do some testing with that this weekend to come up with a mod that works fine with ini and submit it to luke