-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hikvision File System parser - DVR videos #1776
base: master
Are you sure you want to change the base?
Conversation
This needs to be disabled for now.
entroytest needs to be disabled for now.
This needs to be disabled for now.
Thanks @gfd2020 for this contribution. I'm changing this to draft until it is ready. |
3 years ago, I needed to research hikvision to try to recover images from a HD that had been formatted. There is no official documentation and the formatting is hikvision's own. I managed to find some software (paid) to recover the videos, but none of them have recovery of the Logs, which for an expert purpose is extremely important. paulo |
Hi Paulo. The implementation of this PR is based on the document below. The values of the logs are not being analyzed, but from what I've seen, it's ok to get the values of the log in the RATS fields. What you could help with is the interpretation of the RATS field descriptions. I looked at the HEX and I didn't understand the logic of the description. |
Hi @lfcnassif . Could you help me with the questions below so I can proceed with this PR?
|
Wouldn't it be more appropriate to implement this kind of FS as an DataSourceReader? |
Hi @gfd2020, sorry for my delay, currently I'm traveling on vacation...
|
This makes sense. But we would lost the ability to read this file system raw data from E01, Ex01, VMDK, VHD, VHDX and other image disk formats, and also to decode MBR and GPT partitions transparently, since TSK decoding would be skipped... As I said, the perfect approach would be to implement this into TSK, but I think it would need much more effort. |
Today, what does happen if a Vhd, an Ufdr or and Dd image is found inside
the original evidence passed to IPED? How their content are processed?
Em ter., 12 de set. de 2023 22:51, Luis Filipe Nassif <
***@***.***> escreveu:
… Wouldn't it be more appropriate to implement this kind of FS as an
DataSourceReader?
This makes sense. But we would lost the ability to read this file system
raw data from E01, Ex01, VMDK, VHD, VHDX and other image disk formats, and
also to decode MBR and GPT partitions transparently, since TSK decoding
would be skipped... As I said, the perfect approach would be to implement
this into TSK, but I think it would need much more effort.
—
Reply to this email directly, view it on GitHub
<#1776 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG247S7RMIP3GSESTHE2JCTX2ENUJANCNFSM6AAAAAA2NM6MV4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
They are passed to and decoded by SleuthkitReader through EmbeddedDiskProcessTask, except UFDR which is not processed recursively but as a common zip file. |
Couldn't these Hikvision partitions/disks be passed to be decoded by some HikvisionReader through the same EmbeddedDiskProcessTask? |
They could. But not sure if a HikVisionReader would be used directly in practice (like SleuthkitReader), since I think a DVR FS usually is into a partition (could you confirm @gfd2020?) that needs to be decoded first by TSK, so I think this would create another step for most cases. |
In the real cases I have, there is no disk initialization. The first sector of the disk is all zero (that is, without a partition system). The HikivisionFS starts in the second sector. Would this help with Patrick's suggestion? |
So, neither SleuthKit would show this as an item to be processed, and it seems that this "item" to be processed should first be carved from the unallocated space (as it would be identified by SleuthKit), right? |
Sleuthkit will complain that it does not recognize this item. So, Nassif gave me the tip to change a flag in the SleuthkitInputStreamFactory file to continue decoding the image bytes. From then on, as far as I remember, IPED fragmented everything and looked for carved files. IPED 4.1.4 log . Defaut config. Result: Decoding image C:\HVFS\test.E01
|
Yes, thanks!
I think so. Not sure, but I think @gfd2020 draft is reading data from the parent image. So it seems possible to create a HikVisionReader to decode DD images. For all others, like e(x)01, vmdk and vhd(x), they would need to pass through SleuthkitReader first. Honestly, I'm not sure which approach is better, creating a DatasourceReader or a Task, I think both would work, but the first would need an additional change in EmbeddedDiskProcessTask. |
I have some documentation of the format of this HD. |
Hi @paulobreim . I will make a change to the PR now for greater compatibility. Could you please try to improve log detection? |
After a little more work, I managed to get it working without changing any configuration parameters. In fact, you don't need to touch any of them. Basically I created a new constructor for the SleuthkitInputStreamFactory class to be able to use the decoded content of e01 (no external variable will be needed anymore). The main change that could impact the program in general is in the SleuthkitReader class. From what I tested, IPED worked normally on other types of images. However, we need to do regression tests. I'm finishing the changes and will commit. @lfcnassif , could you take a look when you get back from vacation? Thanks. |
parseUnknownFiles should preferably be disabled. If turned on, it may take longer to process
Hi @gfd2020. Since you said you would like to make changes for greater compatibility, I talked to @gbatmobile, a colleague from work who, together with one of his students, implemented DVR WFS file system support into a Sleuthkit fork, and also in python as a standalone tool. Here are the links he sent to me, perhaps they may help: I don't know anythink about DVR file systems (I have never had the need to decode one), so possibly they are complete different file systems. I'm also not sure if they share anything in common. If not, please ignore this post, maybe WFS support might be added in the future as a separate improvement... |
Hi @paulobreim , If your documentation has new information than below, yes please. I ran your code in my test case but there were no results. |
Hi @lfcnassif . Thanks. I think this could really help with integration. As for DVR FS's, from what I've seen, they don't have many features, basically a way to save videos and save metadata (channel, date and eventually logs). If I'm not mistaken, as you said before, there are two ways to do the integration. Modify the Sleuthkit or forward the content to handle the FS in IPED. Both have pros and cons. Modifying the Sleuthkit would be ideal as you wouldn't even need to change the IPED. However, this modification will not be simple and if the main Sleuthkit is updated, you have to check that the integrated module has not become incompatible. And this last step will have to be done for each new FS that is integrated. Personally (I could be completely wrong), I think it would be easier to integrate with IPED and minimally change Sleuthkit (since it is updated frequently). Anyway, I can try to integrate your colleague's code from WFS Sleuthkit into IPED, since it's ready (and it would be a proof of concept for hivision), but I believe it won't be easy or if I will be able to do this. |
Hi @gfd2020. The approach to integrate into Sleuthkit would need to be done into its official project, exactly to avoid we having to maintain a more complex fork than we have today and to apply patches on future TSK versions. But we have no clue if a PR to official TSK would be accepted or not. I have sent some simple ones to fix critical bugs that took many months to be accepted, after I complained a lot about 0 feedback... I agree this ideal path would be harder. Maybe we could ask/open an issue in TSK asking if they have interest in this feature, if you think this path is worth and if you still have the needed effort/time available, I leave the decision to you.
I think we are in 4.12, not sure. But there is no need to implement WFS support now, don't worry. I just sent the links because maybe they could help. Seems it's a different file system and supporting it, if desired, can be left as a future improvement. |
This document you sent is what I have and the program is exactly what is in item 2.2 System Logs. I'm going to try to find HDs, on Rua Santa Efigenica, in São Paulo, related to Hikvision to do tests because I don't know if they modify anything depending on the model. |
Hi @paulobreim . I think I couldn't explain it to you. I am able to read all the logs, types and created time. However, what is not clear is the text inside the log itself. The field that starts after the log type. Some random text and a bunch of hexadecimals appear, probably flags. See below, "Descryption for a system log" |
Honestly, I think it's unlikely that they will allow integration (having seen your report of minor bug fixes).
Thank you. I think it will be of great help for future integration |
Sure! Integrating directly into IPED is a reasonable option. Let me know when you finish, then I'll try to review after reviewing some older PRs after I return back. Thank you for contributing again! |
After the log type,there are the ip address, if the event is 3. I don´t remember in that time, to see other messages. |
I found the information we need. |
Hi @gfd2020! Is this ready for review or do you plan to do more changes? |
hi @lfcnassif . Yes, I need help transforming the log information into a new text file. |
Hi @gfd2020! Not sure if I understood, but I think you have 2 options:
|
Hi, @gfd2020? Nassif asked me to test/review this. Could you or @paulobreim share some sample hikvision images? |
Hi @patrickdalla . I think it will be a bit complicated, the image I have is 2TB compressed... |
Right, I will try to find some sample. Here at my department they use
Intelbras, which is based on Dahua if I am not wrong.
Il giorno ven 5 gen 2024 alle ore 08:03 gfd2020 ***@***.***>
ha scritto:
… Hi, @gfd2020 <https://github.com/gfd2020>? Nassif asked me to test/review
this. Could you or @paulobreim <https://github.com/paulobreim> share some
sample hikvision images?
Hi @patrickdalla <https://github.com/patrickdalla> . I think it will be a
bit complicated, the image I have is 2TB compressed...
Maybe @paulobreim <https://github.com/paulobreim> has a smaller one ...
—
Reply to this email directly, view it on GitHub
<#1776 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG247S3KCAFTUYBTOEVME3TYM7T25AVCNFSM6AAAAAA2NM6MV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZYGU3DCMZSGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@gfd2020, Your idea regarding HD Hikvision is to recover images and logs from a HD that has been formatted or HD that has not been formatted? |
It just shows the videos that are in the proprietary file system. It is not the objective of the PR to create recovery of deleted data, perhaps as future work. |
Allows you to index videos recorded on a DVR with the Hikvision file system.
This PR will need a lot of work. It turns off several flags to function and modifies the program's operation, causing malfunctions in the normal use of the IPED.