3

I have an image with a hidden message (Steganography), and my only clue of finding out what the hidden message is, a hint which said: "LSBit Steganography Over Triangular Series". My intuition thought that the message is hidden within the least significant bit on every pixel who's value is one of the triangle series (0,1,3,6,10,15...) but I guess I was wrong since I didn't have a readable message. I post my code for example of what I tried to do:

import numpy as np
from PIL import Image,ImageEnhance
import itertools

def messageToBinary(message):
    return format(message,"08b")

def triangle_series():
    k = 0
    for i in itertools.count(1):
        if k>=300:
            break
        yield k
        k += i
       
def getDataOfImage():
    im = Image.open('challenge.bmp')
    d = im.getdata()
    a = np.array(d, dtype=np.uint8)
#    a = a.reshape(d.size[::-1])
    return a

def getTriangleSeries():
    ts_lst = [k for k in triangle_series() ]
    return ts_lst

def dataToBits(pixels):
    bits = ''
    series_lst= getTriangleSeries()
    for pixel in pixels:
        if pixel in series_lst:
            bits+=messageToBinary(pixel)[-1]
    return bits

def bitsToBytes(bits):
    bytes = []
    for i in range(len(bits)//8):
        bytes.append(bits[i*8:(i+1)*8])
    return bytes

def bytesToChars(bytes):
    decoded_data = ""
    for byte in bytes:
        decoded_data += chr(int(byte , 2))
    return decoded_data

pixels = getDataOfImage()
bits = dataToBits(pixels)
bytes = bitsToBytes(bits)
decoded_data = bytesToChars(bytes)
print(decoded_data)

The grey scale image with the hidden message:

enter image description here

The original image in bmp can be found in this link: https://drive.google.com/file/d/1LCqyk0dRytNAEi-7ql_gBWRGkCYgfa1Z/view If someone solves it and willing to post the answer I'd be most grateful.

mashtock
  • 400
  • 4
  • 21
  • Maybe the image isn't *exactly* but *almost* in a grayscale, and you still have to process each channel separately, like in the tutorial you mentioned? – Ewelina Luczak Sep 06 '21 at 11:16
  • Not sure if it's a good idea but anyway: I repeated the line `binary_data += messageToBinary(pixel)[-1]` three times and then I could see 8 separate "words". They were still unreadable though. – Ewelina Luczak Sep 06 '21 at 11:19
  • I would have seen if it was 3 channels so I don't think so. – mashtock Sep 06 '21 at 11:19
  • The tutorial has nothing to do with the question, it just what I used to help me – mashtock Sep 06 '21 at 11:21
  • @anilewe I think it's more something like, I published my solution thinking that the triangle series works on pixels, but maybe I should take the lsb of a pixel who's value is in the triangle series. I tried it also and didn't get anything... Pretty sure I'm going to post a bounty on this question. – mashtock Sep 06 '21 at 11:51
  • 13
    This isn't really a programming question. Maybe should be on Puzzling stack exchange – qwr Sep 08 '21 at 15:05
  • @qwr Is there such a thing? XD Steganography is the subject of hidden messages in images and theres a tag for it here. I'll remove this question if required of me – mashtock Sep 08 '21 at 15:06
  • 1
    If the bits are hidden in the LSBs of pixels with values 0, 1, 3, ...., then you can extract said bits straight from the triangular series. To me it's more likely they meant the pixels with indices the triangular series. But do they mean from the first row (0), get the pixel at column 0, from the second row, get pixel 1, from the third row pixel 3, etc? Or maybe flatten the whole array and extract the bits from the triangular indices? Or do they mean do any of the above in reverse order? I tried all of these and I got no obvious result. – Reti43 Sep 08 '21 at 17:12
  • 3
    See, the problem is that SO requires a clear problem, i.e., "how do I do X in Y language", with X being a specific procedure. Your issue isn't in Y, but in X being vague. And this is why qwr suggested this is more appropriate for Puzzling SE, where you can try to interpret a clue in various ways and see what works. – Reti43 Sep 08 '21 at 17:15
  • @Reti43 You are absolutely right and I'm aware of the problems :). I gave all the instructions I had and if there wasn't a tag for steganography questions I wouldn't have asked the said question. – mashtock Sep 08 '21 at 17:47
  • @mashtock you might even have better luck on a site other than SO more dedicated to these kind of things, maybe consider posting places like [r/stegonagraphy](https://www.reddit.com/r/Steganography/) – 0x263A Sep 10 '21 at 17:09
  • It might help to compare it to the [original photo](https://en.wikipedia.org/wiki/Lenna) and look for differences. – RootTwo Sep 10 '21 at 22:53
  • @Uplus263A thanks for the tip, I'll do so :). And I have tried to compare it to the original lena ;) – mashtock Sep 11 '21 at 10:17
  • @mashtock it seems that you use .bmp in your code and uploaded .png for us (which might cut off the message during conversion). Can you also upload original bmp somewhere? – Grysik Sep 13 '21 at 08:11
  • @Grysik Here is a full link to the challenge:https://csa.checkpoint.com/challenges and I add a link to the bmp image only: https://drive.google.com/file/d/1LCqyk0dRytNAEi-7ql_gBWRGkCYgfa1Z/view?usp=sharing The challenge is called beat the map – mashtock Sep 13 '21 at 13:01
  • 3
    The link to the challenge requires someone to have an account. Why don't you edit the question here to quote the full wording of the challenge, as well as to include the actual image provided? – Reti43 Sep 15 '21 at 09:21
  • @Reti43 the full challenge includes more tasks which I manage to do them, and I have included a link to the bmp image. When I attach the image here in SO its immediately convert it, I doubt it really disrupts the bits though. I added all of the information I got from the question itself. – mashtock Sep 15 '21 at 12:30

0 Answers0