News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
Steganography
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
Steganography

While watching Along Came a Spider last night on the telly, I noticed the school kids were playing with a "stego" program to embed and encrypt secret messages into image files. I'd done embedded zip files before, but thought this was a more interesting and secure alternative. After a bit of Google I found the commandline cross-platform program Steghide. So now here's a limited GUI for it.

The limitations are:
1) Embedding only (extraction will probably be added later)
2) JPEG container only (personal preference, unlikely to change)
3) No support for most options (will be improved later)
4) No way to change the image after it's loaded (will probably be fixed)

An image file can be supplied on the commandline (or, i assume, drag-and-drop onto the script's desktop icon). Otherwise a file chooser opens automatically.

I'm guessing this version will probably not work in Windows for now. Also obviously needs a lot of tweaks and fail-safe functions.

Code:
#!/usr/bin/env murgaLua

-- GUI for steghide <steghide.sourceforge.net>
-- function is limited to embedding data into jpg
-- 2010 mikshaw
-- version 0

if not arg[1] then img=fltk.fl_file_chooser("Choose a JPEG","*.jp{e,}g",nil,0) else img=arg[1] end
imgdata=fltk:Fl_JPEG_Image(img)
imgtest=imgdata:w() -- must be jpg
if imgtest==0 then os.exit() end

function write_file()
if passweird:value()=="" then
  fltk.fl_alert("No password specified!")
  return
end
local tmp=os.tmpname()..".txt"
if text:value()==1 then
  local out=io.open(tmp,"w")
  if out then
    out:write(textfield:value())
    out:close()
    embed=tmp
  end
else embed=filename:value()
end
local rtest=io.open(embed,"r")
if rtest then
  rtest:close()
else
  fltk.fl_alert("can't read file "..embed)
  return
end
if overw:value()==1 then ow=" -f " else ow="" end
os.execute("steghide embed -ef "..embed.." -cf "..img.." -sf "..outpoot:value().." -p "..passweird:value()..ow)
os.remove(tmp)
end

ww=500; wh=400; bh=30
w=fltk:Fl_Double_Window(ww,wh,"Steghide")

tabs=fltk:Fl_Tabs(0,0,ww,wh)

t1=fltk:Fl_Group(0,bh,ww,wh-bh,"image file")
t1:selection_color(46)
imgbox=fltk:Fl_Box(0,bh,ww,wh-bh)
imgbox:align(85)
imgbox:image(imgdata)
fltk:Fl_End() --t1

t2=fltk:Fl_Group(0,bh,ww,wh-bh,"hide data")
t2:selection_color(46)
file=fltk:Fl_Radio_Round_Button(10,bh*2,bh*3,bh,"file")
text=fltk:Fl_Radio_Round_Button(10,bh*3,bh*3,bh,"text")
filename=fltk:Fl_File_Input(10+bh*3,bh*2,ww-20-bh*4,bh)
choose=fltk:Fl_Button(ww-10-bh,bh*2,bh,bh,"@>")
choose:callback(function()
  newfile=fltk.fl_file_chooser("Embed a file","*.*",nil,0)
  if newfile then
    filename:value(newfile)
    file:value(1)
  end
end)
textfield=fltk:Fl_Multiline_Input(15,bh*4,ww-30,wh-bh*5)
fltk:Fl_End() --t2

t3=fltk:Fl_Group(0,bh,ww,wh-bh,"output")
t3:selection_color(46)
outpoot=fltk:Fl_File_Input(10+bh*2,bh*2,ww-20-bh*2,bh,"filename")
passweird=fltk:Fl_Secret_Input(10+bh*2,bh*4,ww-20-bh*2,bh,"password")
save=fltk:Fl_Button(10,bh*6,bh*3,bh,"save")
save:callback(write_file)
overw=fltk:Fl_Round_Button(bh*4,bh*6,bh*4,bh,"overwrite file")
slug=fltk:Fl_Box(ww-10,wh-10,10,10)
fltk:Fl_End() --t3
fltk:Fl_End() --tabs

file:value(1)
outname=string.gsub(img,"(.*)%..*","%1_stego.jpg")
outpoot:value(outname)

w:resizable(tabs)
tabs:resizable(t1)
tabs:resizable(t2)
tabs:resizable(t3)
t2:resizable(textfield)
t3:resizable(slug)
w:show()
Fl:run()

04-10-2010 08:26 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
Steganography - mikshaw - 04-10-2010 08:26 AM
RE: Steganography - mikshaw - 04-13-2010, 11:59 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: