Skip to content

Instantly share code, notes, and snippets.

@minhtt159
Created November 5, 2018 10:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minhtt159/78c63830bd0e2bf6ba25d70f43738bc5 to your computer and use it in GitHub Desktop.
Save minhtt159/78c63830bd0e2bf6ba25d70f43738bc5 to your computer and use it in GitHub Desktop.
LSB - SVATTT
from PIL import Image
def main():
img = Image.open("for1.png")
pixels = img.load()
h = img.size[0]
w = img.size[1]
out1 = ''
for row in range(h):
for col in range(w):
r,g,b,a = pixels[row,col]
if a < 255:
lsb = r & 0b00000001
print row, col, lsb
out1 += str(lsb)
print out1
flag = ''
for i in range(0, len(out1), 8):
binstr = out1[i:i+8]
flag += chr(int(binstr, 2))
print flag
pass
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment