Skip to content

Instantly share code, notes, and snippets.

@AndyNovo
Last active September 29, 2023 11:52
Show Gist options
  • Save AndyNovo/e12854da8cb390fa3b31d17ccda30b4b to your computer and use it in GitHub Desktop.
Save AndyNovo/e12854da8cb390fa3b31d17ccda30b4b to your computer and use it in GitHub Desktop.
from PIL import Image
pal_im=Image.open("imgflag.png")
im = pal_im.convert('RGB')
w,h=im.size
pixels=[]
for i in range(w):
for j in range(h):
pixels.append(im.getpixel((i,j)))
f=file("loader.sql","w")
f.write("create table size (height int, width int);\n")
f.write("insert into size values (%d, %d);\n" % (w,h))
f.write("create table pixels (indx integer primary key autoincrement, red integer, green integer, blue integer);\n")
for triple in pixels:
f.write("insert into pixels (red, green, blue) values (%d, %d, %d);\n" % triple)
f.close()
import os
os.system("sqlite3 flag.db < loader.sql")
wget https://websec.prof.ninja/fall2022/sql/flag.db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment