|
| | PNGPayload () |
| |
| | PNGPayload (const void *ptr, std::size_t size) |
| |
| | PNGPayload (const std::vector< std::uint8_t > &vec) |
| |
| | PNGPayload (const std::string &filename) |
| |
| | PNGPayload (const PNGPayload &other) |
| |
| png::Text & | add_text_payload (const std::string &keyword, const void *ptr, std::size_t size) |
| | Add a tEXt section payload to the PNG file.
|
| |
| png::Text & | add_text_payload (const std::string &keyword, const std::vector< std::uint8_t > &data) |
| | Add a tEXt section payload to the PNG file.
|
| |
| void | remove_text_payload (const png::Text &payload) |
| | Remove the given tEXt payload from the PNG image.
|
| |
| std::vector< png::Text > | get_text_payloads (const std::string &keyword) const |
| | Get all corresponding tEXt payloads that match the given keyword.
|
| |
| std::vector< std::vector< std::uint8_t > > | extract_text_payloads (const std::string &keyword) const |
| | Extract the binary data from the tEXt payloads corresponding to a given keyword.
|
| |
| png::ZText & | add_ztext_payload (const std::string &keyword, const void *ptr, std::size_t size) |
| | Add a zTXt section payload to the PNG file.
|
| |
| png::ZText & | add_ztext_payload (const std::string &keyword, const std::vector< std::uint8_t > &data) |
| | Add a zTXt section payload to the PNG file.
|
| |
| void | remove_ztext_payload (const png::ZText &payload) |
| | Remove the given tEXt payload from the PNG image.
|
| |
| std::vector< png::ZText > | get_ztext_payloads (const std::string &keyword) const |
| | Get all corresponding zTXt payloads that match the given keyword.
|
| |
| std::vector< std::vector< std::uint8_t > > | extract_ztext_payloads (const std::string &keyword) const |
| | Extract the binary data from the zTXt payloads corresponding to a given keyword.
|
| |
| std::vector< std::uint8_t > | read_stego_data (std::size_t bit_offset, std::size_t size) const |
| | Read steganographically-encoded data at an arbitrary bit offset in the image.
|
| |
| void | write_stego_data (const void *ptr, std::size_t size, std::size_t bit_offset) |
| | Write steganographically-encoded data at the given bit offset in the image.
|
| |
| void | write_stego_data (const std::vector< std::uint8_t > &data, std::size_t bit_offset) |
| | Write steganographically-encoded data at the given bit offset in the image.
|
| |
| bool | has_stego_payload () const |
| | Check if the image has a steganographically-encoded payload.
|
| |
| PNGPayload | create_stego_payload (const void *ptr, std::size_t size) const |
| | Create a copy of the payload with a steganographically-encoded payload within the image data.
|
| |
| PNGPayload | create_stego_payload (const std::vector< std::uint8_t > &data) const |
| | Create a copy of the payload with a steganographically-encoded payload within the image data.
|
| |
| std::vector< std::uint8_t > | extract_stego_payload () const |
| | Return the steganographically-encoded data from the image.
|
| |
| | Image () |
| |
| | Image (const void *ptr, std::size_t size, bool validate=true) |
| |
| | Image (const std::vector< std::uint8_t > &data, bool validate=true) |
| |
| | Image (const std::string &filename, bool validate=true) |
| |
| | Image (const Image &other) |
| |
| Image & | operator= (const Image &other) |
| | Syntatic sugar for assigning to an image object.
|
| |
| Scanline & | operator[] (std::size_t index) |
| | Syntactic sugar for getting a scanline from the loaded image.
|
| |
| const Scanline & | operator[] (std::size_t index) const |
| | Syntactic sugar for getting a const scanline from the loaded image.
|
| |
| bool | has_chunk (const std::string &tag) const |
| | Check for the presence of a given chunk tag.
|
| |
| std::vector< ChunkVec > | get_chunks (const std::string &tag) const |
| | Get the chunk data for the corresponding tag.
|
| |
| void | add_chunk (const ChunkVec &chunk) |
| | Add a given chunk to the underlying image.
|
| |
| bool | has_trailing_data () const |
| | Return whether or not this PNG image has trailing data.
|
| |
| std::vector< std::uint8_t > & | get_trailing_data () |
| | Get the trailing data in the image.
|
| |
| const std::vector< std::uint8_t > & | get_trailing_data () const |
| | Get the const trailing data in the image.
|
| |
| void | set_trailing_data (const std::vector< std::uint8_t > &data) |
| | Set the trailing data of the PNG image.
|
| |
| void | clear_trailing_data () |
| | Clear the trailing data in the PNG image.
|
| |
| void | parse (const void *ptr, std::size_t size, bool validate=true) |
| | Parse a given data buffer into its individual chunks for further processing.
|
| |
| void | parse (const std::vector< std::uint8_t > &data, bool validate=true) |
| | Parse a given data vector for a PNG image.
|
| |
| void | parse (const std::string &filename, bool validate=true) |
| | Read a file and parse it as a PNG file.
|
| |
| void | load () |
| | Load the image data from the IDAT chunks.
|
| |
| Scanline & | scanline (std::size_t index) |
| | Get the scanline at the given y index.
|
| |
| const Scanline & | scanline (std::size_t index) const |
| | Get the const scanline at the given y index.
|
| |
| bool | has_header () const |
| | Check if this PNG image has a header present.
|
| |
| Header & | header () |
| | Get the header present in the PNG image.
|
| |
| const Header & | header () const |
| | Get the const header present in the PNG image.
|
| |
| Header & | new_header () |
| | Create and return a new blank header in the PNG image.
|
| |
| std::size_t | width () const |
| | Get the width, in pixels, of this image.
|
| |
| std::size_t | height () const |
| | Get the height, in pixels, of this image.
|
| |
| bool | has_image_data () const |
| | Return if the image has any IDAT chunks present.
|
| |
| bool | is_loaded () const |
| | Check if the image data has been extracted from the IDAT chunks.
|
| |
| void | decompress () |
| | Decompress the IDAT chunks in the image.
|
| |
| void | compress (std::optional< std::size_t > chunk_size=8192, int level=-1) |
| | Compress the image data into IDAT chunks.
|
| |
| void | reconstruct () |
| | Reconstruct the filtered image data into their raw, unfiltered form.
|
| |
| void | filter () |
| | Filter the image data to prepare it for compression.
|
| |
| std::vector< std::uint8_t > | to_file () const |
| | Convert this object into an image buffer fit for saving to a .png file.
|
| |
| void | save (const std::string &filename) const |
| | Call facade::png::Image::to_file and save that file to disk.
|
| |
| bool | has_text () const |
| | Return whether or not the image contains a tEXt chunk.
|
| |
| Text & | add_text (const std::string &keyword, const std::string &text) |
| | Add a text chunk to the PNG image.
|
| |
| void | remove_text (const Text &text) |
| | Remove the given tEXt section from the image.
|
| |
| void | remove_text (const std::string &keyword, const std::string &text) |
| | Remove a tEXt section by keyword and text.
|
| |
| std::vector< Text > | get_text (const std::string &keyword) const |
| | Get the tEXt sections with the following keyword.
|
| |
| bool | has_ztext () const |
| | Return whether or not the image contains a zTXt chunk.
|
| |
| ZText & | add_ztext (const std::string &keyword, const std::string &text) |
| | Add a zTXt chunk to the PNG image.
|
| |
| void | remove_ztext (const ZText &ztext) |
| | Remove the given zTXt section from the image.
|
| |
| void | remove_ztext (const std::string &keyword, const std::string &text) |
| | Remove a zTXt section by keyword and text.
|
| |
| std::vector< ZText > | get_ztext (const std::string &keyword) const |
| | Get the zTXt sections with the following keyword.
|
| |
A PNG-based payload helper class.
There are four main ways to add payloads to images:
Here is an example of encoding payloads into a PNG image:
int main(int argc, char *argv[]) {
std::string payload_string("Just an arbitrary payload, nothing suspicious here!");
std::vector<std::uint8_t> payload_data(payload_string.begin(), payload_string.end());
image.set_trailing_data(payload_data);
image.add_text_payload("tEXt payload", payload_data);
image.add_ztext_payload("zTXt payload", payload_data);
auto final_payload = image.create_stego_payload(payload_data);
final_payload.save("art.payload.png");
return 0;
}
A PNG-based payload helper class.
Definition: payload.hpp:32
Definition: exception.hpp:14
And here is an example of extracting payloads from a PNG image:
#include <cassert>
int main(int argc, char *argv[]) {
std::string expected_string("Just an arbitrary payload, nothing suspicious here!");
std::vector<std::uint8_t> expected_data(expected_string.begin(), expected_string.end());
assert(image.get_trailing_data() == expected_data);
assert(image.extract_text_payloads("tEXt payload")[0] == expected_data);
assert(image.extract_ztext_payloads("zTXt payload")[0] == expected_data);
image.load();
assert(image.extract_stego_payload() == expected_data);
return 0;
}