Report ID in filename

Do you know of a feature that UVK should have? Post it here!
reggaemanu
Posts: 175
Joined: Wed Jun 10, 2015 9:07 pm
Location: France

Report ID in filename

Post by reggaemanu »

Hi Fred,

Could you add the report ID in the filename when sending/uploading report ?

Something like PCNAME_USERNAME_ID_DATE_HOURS.zip

I ask that because I would like to mod pcrt to automatically add the report to the work order (and auto import pc info) if there's a corresponding id, it would save a lot of time :)
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Report ID in filename

Post by Fred »

No problem, Manu. I can add that.
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
reggaemanu
Posts: 175
Joined: Wed Jun 10, 2015 9:07 pm
Location: France

Re: Report ID in filename

Post by reggaemanu »

Thanks Fred, I'm already done for the automatic attachment since I've posted the request :)
Just few more lines and it will add the specs
reggaemanu
Posts: 175
Joined: Wed Jun 10, 2015 9:07 pm
Location: France

Re: Report ID in filename

Post by reggaemanu »

The mod is ready and working, I'll post it on pcrt forum as soon as the feature is available :)
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Report ID in filename

Post by Fred »

Manu, because all non letter/digit characters in the report's file name are replaced with underscores, it is best to put the ID in the last segment of the name. I.E. PCNAME_USERNAME_DATE_TIME_ID.zip
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
reggaemanu
Posts: 175
Joined: Wed Jun 10, 2015 9:07 pm
Location: France

Re: Report ID in filename

Post by reggaemanu »

As you want Fred, It won't change the mod !
(the id on pcrt is just a number, and we will have to add "ID" before, that's all, the regex search for something between "ID" and a _ (I'll just change for a dot if you put it at the end) and check if there's a corresponding open work order or asset)

By the way, I don't see why you strip all the non letter/digit characters, it is to other softwares (pcrt or other) to be able to use utf-8. On pcrt it's a simple line change in validate filename procedure.

A lot of the computer I repair have "Propriétaire" as username so almost all my reports have "Propri_taire", that's ugly :D
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Report ID in filename

Post by Fred »

Manu, I strip all the non letter/digit characters because someone said I had to here in the forum. I'll try to find the post. So I need to put ID before the last report ID used? I'm getting a little confused here...
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
reggaemanu
Posts: 175
Joined: Wed Jun 10, 2015 9:07 pm
Location: France

Re: Report ID in filename

Post by reggaemanu »

Fred wrote:Manu, I strip all the non letter/digit characters because someone said I had to here in the forum. I'll try to find the post. So I need to put ID before the last report ID used? I'm getting a little confused here...
No, just the id (well as you want in fact), we will just had ID before the real pcrtid when typing it, that's all.
Just do it the way you want, I'll adapt the code if needed ;)

And yeah I know about this post but it wasn't to you to remove utf-8 support, it was more to luke to add it... and that's easy to add it. I can ask him to change that.
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Report ID in filename

Post by Fred »

OK, so I'll wait for you to tell whether I can stop replacing special chars with underscores.

By the way, here's the topic:

viewtopic.php?f=1&t=1270&p=5317&hilit=p ... name#p5317
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
reggaemanu
Posts: 175
Joined: Wed Jun 10, 2015 9:07 pm
Location: France

Re: Report ID in filename

Post by reggaemanu »

Ok i'll ask him. But there won't be any update before à while I think. He does an update every six month usually.

If you can add the id already it would be nice. And I'll tell you as soon as you can stop replacing chars.
(In fact you could almost already do it because uvk import is actually broken and those that want it to work correctly have to use my mod that does support utf-8 filename since the beginning)
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Report ID in filename

Post by Fred »

I was curious: what happens if someone uses non-numeric IDs?

Because I may no longer replace special chars in the near future, I'll put the ID in the end, like I said before, following and underscore. This is what it currently makes in my laptop:
DESKTOP-P4ED26I_Fred_20161015_203317_repid1.zip

This is very easy to parse. Something like:
$report_id = preg_replace ('_(.+?)\.zip$', '$1' , $zip_file);

Is that OK for you?
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
reggaemanu
Posts: 175
Joined: Wed Jun 10, 2015 9:07 pm
Location: France

Re: Report ID in filename

Post by reggaemanu »

Sure that's perfect ! :)
reggaemanu
Posts: 175
Joined: Wed Jun 10, 2015 9:07 pm
Location: France

Re: Report ID in filename

Post by reggaemanu »

Thanks for your reactivity Fred, just tested with 9.6.3.0 and it works great !
I've just posted the mod on pcrt forum, thanks again ! it will be a real time saver :)
reggaemanu
Posts: 175
Joined: Wed Jun 10, 2015 9:07 pm
Location: France

Re: Report ID in filename

Post by reggaemanu »

Hi Fred,

About utf8 ... I guess I got too much excited because it used to work before your started to replace with _ but it doesn't work anymore (I changed my server so maybe it's the cause).

I managed to have it working here but I can't be sure it will work for everybody (windows or linux server, php version, pcre or not, etc...) so I'll have to do testing on various server to be sure it's working for everyone.
Maybe it was too soon to remove the replacement. Sorry about that Fred, my bad !

Isn't there a c++ equivalent of php utf8_decode() or iconv() functions to replace specials chars by something pretty equivalent without replacing them by an underscore ? (eg. a "é" would be converted to a "e")
That could be an an intermediate solution...

As a side note, now that the ID is in the filename, could we have a way to set a report id via command line?

I'm working on one click or auto importation of the uvk logs to pcrt (well it's already done, I just have to make logs translatable in pcrt)
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Report ID in filename

Post by Fred »

Thanks, Manu.

I will convert the file name to ANSI using the OEM US code page so it doesn't have special characters in the name. I'll have it working for the next update.
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
Charger440
Posts: 1529
Joined: Sun May 25, 2014 7:44 am
Location: Missouri

Re: Report ID in filename

Post by Charger440 »

Manu

I was trying to see your script in PCRT work but I must be missing something. It sounds really cool but I can't tell that it worked at all. I'm sure that I am just missing something though.
Jim

It is not "Can it be done?" but rather, "How can we do it?"
reggaemanu
Posts: 175
Joined: Wed Jun 10, 2015 9:07 pm
Location: France

Re: Report ID in filename

Post by reggaemanu »

Hi Jim,

Did you applied correctly the mod AND add variables in your repair/deps.php file to configure/enable it ?
If you did good it should works fine (you just have to put the pcrt work order id or the pcrt pc id as reportid in uvk), but if there was special chars in file names it won't, and now that fred disabled it it won't work either as there is a lot more underscores. Which brings me to a question for Fred:

- Since the c++ version the file names are PCNAME_USERNAME_Y_M_D__HMS___REPORTID.zip (excepted when you enabled utf8 where they were like before : PCNAME_USERNAME_YMD_HMS_REPORTID.zip ) are all those underscores normal (if so I have to adapt the regex in my script) ?

Jim, I'm working on a new version of this script, you will be able to also (auto)import the logs as actions/installs/scans. It's almost ready :)
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Report ID in filename

Post by Fred »

No, Manu, those underscores are not normal. I'll check that out. Thanks for reporting.
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
Charger440
Posts: 1529
Joined: Sun May 25, 2014 7:44 am
Location: Missouri

Re: Report ID in filename

Post by Charger440 »

I would like to see the import thing work as it would make things so much easier for me. I know it works fine for that other software but never has worked right for UVK... Kinda sux cause UVK is so much better software...
Jim

It is not "Can it be done?" but rather, "How can we do it?"
reggaemanu
Posts: 175
Joined: Wed Jun 10, 2015 9:07 pm
Location: France

Re: Report ID in filename

Post by reggaemanu »

Charger440 wrote:I would like to see the import thing work as it would make things so much easier for me. I know it works fine for that other software but never has worked right for UVK... Kinda sux cause UVK is so much better software...
Well just apply the mod that is on pcrt forum and it will work (when Fred will have fixed the filenames underscores).
I will update it soon to import uvk logs (I'm just waiting for fred to fix the 3rd party logs bug so I can work on retrieving the removed items number for other 3rd apps (already done for mbam, uak, and adwcleaner)).
And as soon as I have something complete I'll contact Luke...

Below is a short video showing a work order in pcrt, NOTHING was filled pcrt side, I just uploaded report from uvk and all was done automatically (attach the zip to the work order, import system specs, and import scans, installs and actions from uvk logs). I'm so happy that I won't have to do it manually anymore, I should have asked a long time ago to add the report id in filename ! It's so painful to do that manually for each action/computer than most of the time I don't do it. :oops: :lol:

https://youtu.be/QpQgsFpYjJY
Post Reply