Tails 3.0 does not download stampnik labels properly

January 19, 2018 at 7:10 am | Posted in Uncategorized | Leave a comment

I do consulting time to time and I’ve encountered two clients with this very same problem. Basically, it seems that tails 3.0 can’t download stampnik labels properly. It downloads a HTML file instead.

Ok, I looked into the problem further, and I see what’s happening. Basically, when stampnik “shows” a label that’s a .png file, it’s not “really” a PNG file, it’s an actually html file with a .PNG extension that, when executed, DISPLAYS a PNG image. Anyway, tails just downloads the straight html file and doesn’t actually execute it, I assume for security reasons. I don’t know of a way to force tails to actually execute the HTML so I found a workaround.

Basically, you have to right click the label image and select “copy image”. The actual image is then stored in the computer’s memory. And then execute this script and it will write label to a file:

import glob
import gtk
import os
import Tkinter
import tkMessageBox

# Find the name of the label
def def_file():
Return default file name
files = glob.glob("/home/amnesia/Tor Browser/lbl_???.png")
if len(files) < 1:
return 'lbl_001.png'
maxf = 0
for f in files:
n = int(f[30:33])
maxf = max(n, maxf)
except ValueError:
return 'lbl_{:03d}.png'.format(maxf+1)

# Save the label
fname = def_file()
clipboard = gtk.clipboard_get()
image = clipboard.wait_for_image()
if image is not None:
image.save("/home/amnesia/Tor Browser/" + fname, "png")
message = "Postage label saved to file: " + fname
message = "No image in clipboard found"

# Inform user
tkMessageBox.showinfo("Message", message)

If you use this script a lot, you might want to save this “save_stampnik.desktop” file so you can actually double click an icon:

[Desktop Entry]
Name=Save label
Comment=Save label

Just putting this out there so other people can benefit. If there are improvements to the code or if anyone else has tips to make the user experience better, comment on my blog and I will update this post.

Leave a Comment »

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: