-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Feature] Export section data as Pattern Data #1899
Comments
Each section has a hex editor window of its own separate from the main hex editor which is meant for the input file. |
Ah, I see! I knew about the section hex viewer, but didn't notice it exposed variables. But in that case, I'd like to change the feature request to allow exporting data from a section into either the 'context' it was created ( The reasoning is a bit more specific though. I tried to simplify it, but in my usecase, there's a flag indicating whether the data is zstd encoded or not, and my plan was to decode or not based on that flag. struct Packet {
u8 is_zstd;
u8 header_value;
if (is_zstd) {
u8 data_zstd[while(!std::mem::eof())] [[hidden]];
std::mem::Section data_sec = std::mem::create_section("data_sec");
hex::dec::zstd_decompress(data_zstd, data_sec);
InnerPacket data[] @ 0x00 in data_sec [[export]];
} else {
InnerPacket data[while(!std::mem::eof())];
}
}; As it stands, depending on the packet data will either end up under If there's a way to always expose |
Not sure if I should edit the issue description or create a new ticket. |
You have data that's part of the input file, the data can be zstd encoded or not but it is still part of the pattern that reads data from the input. The decoded version of the data is not like the data that's read but not encoded. The only way to have the two show in the same place would be to make a copy of the data that is not encoded and write it to the section without modifying it. I don't know the exact technical details, but afaik it is not possible to bring section data into the main hex editor without overwriting the input file. Global variables that are not placed are restricted in the ways they can be used. If you try to use them in a way thats illegal you'll get an error stating that you can't use data that is not placed. That means that you can't use section data to create global variables. Another way of saying this is that if global variables could hold section data then there would be no need for sections to exist at all. |
Well, if there was a way to override the file buffer (instead of the file itself) I'd be fine with that as well, but I couldn't find a way in the documentation. |
Maybe virtual files can be helpful here. they can be opened as views. i have trouble loading projects that had views open when saved though so be careful if you want to try using them. |
What feature would you like to see?
Maybe this is already possible, but I couldn't find a way to do it no matter how hard I tried.
I want to find a way to interpret the data under a
std::mem::Section
as another struct, and expose it under the 'Pattern Data' menu (or somewhere where I can inspect it's fields).How will this feature be useful to you and others?
The specific use case I'm thinking of is being able to inspect compressed data inside a packet, but I'm sure there are other uses as well.
Request Type
Additional context?
Here's an example: suppose I have a packet with a header and some content
zstd
encoded. Here's a python script to generate a sample value:Ideally, I'd want to see the values
0
and20
organized into structs on the pattern data menu. Here's the script that I think should be working:However, even with the
[[export]]
attribute set, the value still doesn't get exported to the pattern data menu:The text was updated successfully, but these errors were encountered: