Hide Secret Messages in PNG Files

Поділитися
Вставка
  • Опубліковано 25 лип 2024
  • In this video, we learn how to hide secret messages inside of PNG files.
    ◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
    📚 Programming Books & Merch 📚
    🐍 The Python Bible Book: www.neuralnine.com/books/
    💻 The Algorithm Bible Book: www.neuralnine.com/books/
    👕 Programming Merch: www.neuralnine.com/shop
    🌐 Social Media & Contact 🌐
    📱 Website: www.neuralnine.com/
    📷 Instagram: / neuralnine
    🐦 Twitter: / neuralnine
    🤵 LinkedIn: / neuralnine
    📁 GitHub: github.com/NeuralNine
    🎙 Discord: / discord
    🎵 Outro Music From: www.bensound.com/
    Timestamps:
    (0:00) Intro
    (1:12) PNG File Structure
    (3:07) Hide Messages Simply
    (6:18) Hide Programs Simply
    (9:40) Professional Hiding (LSB)
    (27:41) Outro
  • Наука та технологія

КОМЕНТАРІ • 49

  • @user-ux8vk8pu2b
    @user-ux8vk8pu2b 2 роки тому +6

    Dude you're amazing.
    I've been trying to figure out how to do this for a while, thank god someone helped explain it clearly.

  • @prof.tahseen6104
    @prof.tahseen6104 2 роки тому +4

    13:50 You could actually write the length of the hidden message as the hidden message's first two bytes or so. Also after I saw this video, I literally smashed my mouse and opened up my IDE. I mean, this is an interesting topic. Great video, great channel, great biceps ;)

  • @Sinke_100
    @Sinke_100 2 роки тому +1

    During christmass i was acually doing just that, hiding "Mery Christmass" into picture of a christmass tree, perfect timing neural nine to teach me some better ways to aproach this, ty so much for amazing content 🙂

  • @chonkey
    @chonkey 7 місяців тому +1

    i love you. this is exactly what i was looking for. after 3 hours of researching, i found your vid. i just made 30 google accounts and liked and subscribed to your channel.

  • @higiniofuentes2551
    @higiniofuentes2551 Рік тому

    Thank you for this awesome and very useful video!

  • @AbdoAzmy2005
    @AbdoAzmy2005 2 роки тому +5

    can you please tell us about the quantum computing folder

  • @asphaltexplorer4390
    @asphaltexplorer4390 Рік тому

    Amazing , Thankyou for such a great content sir.

  • @gedtoon6451
    @gedtoon6451 2 роки тому

    Should the last three lines of the lsb encoder be tabbed in, as we do not want to save the encoded file if the the target file was not big enough?

  • @Synthetic_geth
    @Synthetic_geth 2 роки тому +2

    Brilliant!

  • @jesusdacoast872
    @jesusdacoast872 2 роки тому

    Good job dude 😎

  • @reputationhemp4011
    @reputationhemp4011 2 роки тому +1

    you are doing devil trickery? I literally just thought about doing this bro JUST NOW

  • @mgreek31
    @mgreek31 2 роки тому

    Thank for Great knowledge !!!

  • @pcgalvintoybonnie2827
    @pcgalvintoybonnie2827 Рік тому

    Real cool video! but a question... how can we execute the hidden .exe file in the image by opening it? i've seen some ppl making that i just don't know how, how to it?

  • @uday-xyz1523
    @uday-xyz1523 2 роки тому +2

    So for the second method we are limited to pixels... can we do the same with videos(since the are series of frames?)

    • @prof.tahseen6104
      @prof.tahseen6104 2 роки тому +2

      Yes you can.
      Just add 1 step to the start and to the end.
      extract frames
      ......
      ......
      ......
      re-assemble the video from injected frames

  • @ehsankalateh6785
    @ehsankalateh6785 Рік тому

    Amazing 🤩

  • @Sinke_100
    @Sinke_100 2 роки тому +4

    My aproach was:
    with open('image.png', 'rb') as f:
    data = f.read()
    text = data.split(b'\x82')[-1].decode()
    print(text)

    • @YoshiyaMakina
      @YoshiyaMakina 2 роки тому

      This also works in my case too

    • @gedtoon6451
      @gedtoon6451 2 роки тому

      I am intrigued, can you please explain what this does?

    • @Sinke_100
      @Sinke_100 2 роки тому

      @@gedtoon6451 if u hide text in picture with append method last byte is x82 of that png picture (bytes are represented in hex values from 00 till ff) then u split at that value and u get list where your text is now last item in that list, but it is in bytes mode still that is why u also have to decode

    • @gedtoon6451
      @gedtoon6451 2 роки тому

      @@Sinke_100 But is it not possible for x82 to appear somewhere in the image and then you would split too soon?

    • @Sinke_100
      @Sinke_100 2 роки тому

      @@gedtoon6451 not that i know of, but it's more convinient to pick last 4 or 5 common bytes for png, so split is more sure, like for example if u use character € in message then u would encounter problems since € sign has x82 in self, or the other solution is when u type message u put spliter already in like $$$.encode() between image and your message, then u split on that, maybe it's even better aproach, but both works fine

  • @andreaf6143
    @andreaf6143 2 роки тому +1

    great!

  • @tildesarecool7782
    @tildesarecool7782 7 місяців тому

    can't believe i made it through this whole thing. and understood almost parts of it.
    now all i have to do is hide 2600 roms inside of the box art thumbnail for the 2600 roms. that's fine, right? like one of those non-existent 8-bit machines, like pico-8 and friends that store programs in PNG files. surely I'm not the first one to think of applying this to 2600 roms. have to write a script that re-assembles the rom and throws it to stella. no problem, right? more efficient than the method 2600+ uses (grumble)

  • @UNAPPEAL
    @UNAPPEAL 2 роки тому +1

    could you hide code like a xml script inside of it aswell?

  •  2 роки тому

    how could you do this with xml code?

  • @computechtamil7218
    @computechtamil7218 2 роки тому

    How to extract meta data from Image

  • @guilherme5094
    @guilherme5094 2 роки тому +1

    👍!!

  • @Sinke_100
    @Sinke_100 2 роки тому +1

    I didn't try it yet, but i'm not sure if lsb method works outside ascii for example i would definetly need croatian letters 'šđč枊ĐČĆŽ' and each of them has ord bigger then 255, if doesn't work by default how u write it i would definetly need to find some workaround within the program, but first i would have to figure out how it acually works, which is slightly above my current knowledge, but i will give it a shot
    Solution:
    In encoder use byte_message = ''.join(f'{ord(c):09b}' for c in message) instead of 08b, then in extractor you should change secret_bits = [secret_bits[i:i+9] for i in range(0, len(secret_bits), 9)] instead of 8
    First i tryed with replace metdod, but this is better solution i think, even it takes a bit more space in picture

  • @unknown-society8037
    @unknown-society8037 Рік тому

    Uhm sir, how about executing the exe file while in the png

  • @philtoa334
    @philtoa334 2 роки тому

    Yes.Good.

  • @DiamondStumpy
    @DiamondStumpy 6 місяців тому

    i think this is really great, but im having a hard time understanding the process of the python logic your using.
    i wish it was explained what each little bit inside the code is doing.

  • @rmt3589
    @rmt3589 Рік тому +1

    Just watched the JPEG one before this. Looks awesome! Great tool for creating an ARG!
    My idea is to hide encryption data inside various png. I want to make a Unity Asset Pack with parts that can't be modified. For ARG-stuff. With a game hidden inside that needs to be played in Unity Editor. Plan is for the file structure to be set up, and so fragile that changing a texture, .txt, or script will break everything, but make it so the dev can use all the textures, models, shades, and scripts with no problem.
    Because a lot of the assets in this will be essentially white noise, hiding a lot of data is perfectly fine. Might even help!

    • @rons96
      @rons96 23 дні тому +1

      any success using JPEG with this code logic?

    • @rmt3589
      @rmt3589 23 дні тому +2

      @@rons96 I haven't tried yet. Still don't have a G to have AR with yet.

    • @rons96
      @rons96 23 дні тому +1

      @@rmt3589 i tried here and understood that JPEG do not store pixels, it's a weird compression that make each file somehow unique. Even if you modify the RGB channel values and save the image, when it loads there're totally new values. It is because JPEG have lossy compression in it's algorithm, so searching a bit i found at least 3 method to do it, but all are very complex. ChatGPT gave the hints but didn't was able to provide a working example. I found a PDF explaining but requires many math skills which i don't have.

  • @rons96
    @rons96 23 дні тому

    why it don't work with jpeg files?

  • @hello-my6ot
    @hello-my6ot 2 роки тому

    Genious

  • @kamilpadula7152
    @kamilpadula7152 2 роки тому +4

    I use this method in 97 xD

  • @thomasgoodwin2648
    @thomasgoodwin2648 2 роки тому +1

    Or you could hide an image 1/8th the size of the original.
    I'm kinda surprised this works given that png is a non lossless compressed format.

    • @sukritmanikandan3184
      @sukritmanikandan3184 2 роки тому

      It works because the PIL library neatly handles all of that for you

    • @sukritmanikandan3184
      @sukritmanikandan3184 2 роки тому

      Also I'm fairly certain png is lossless

    • @gedtoon6451
      @gedtoon6451 2 роки тому

      PNG offers various levels of compression, including none, but they are all lossless. You get get back exactly the same image. The steganography would not work with a lossy file format

  • @yusufutkan
    @yusufutkan 2 роки тому +1

    good tactic

  • @Technopawan-dx7fn
    @Technopawan-dx7fn Місяць тому

    In my view, if you would use this code, it would be faster.............. you don't need to wait for all the array to convert into bytes
    import numpy as np
    import PIL.Image
    img = PIL.Image.open("result.png", "r")
    img_arr = np.array(list(img.getdata()))
    channel = 4 if img.mode == 'RGBA' else 3
    pixels = img_arr.size
    stop_indicator = input("Enter Stop_indicator Code: ")
    stop_indicator_byte = ''.join(f"{(ord(byte)):08b}" for byte in stop_indicator)
    index = 0
    message_bits = ''
    for i in range(pixels-1):
    for j in range(channel):
    message_bits = message_bits + str(bin(img_arr[i][j])[-1])
    index += 1
    first_bit = index - len(stop_indicator_byte)
    if message_bits[first_bit:index] == stop_indicator_byte:
    break

    index = 0
    message_bytes = ''
    for i in range(int(len(message_bits)/8)):
    message_bytes = message_bytes + " "
    for j in range(8):
    message_bytes = message_bytes + message_bits[index]
    index += 1
    message_bytes = message_bytes[1:]
    to_ignore = -len(stop_indicator)
    message = "".join(chr(int(c, 2)) for c in message_bytes.split(" "))
    message = message[:to_ignore]
    print(message)

  • @psychoSherlock
    @psychoSherlock 2 роки тому +1

    First 🙂