jueves, 20 de diciembre de 2018

PyTweet2Img: a tweet to image conversion tool


Sometimes we need to quote to tweet but we do not want to retweet it. A easy way is to make a screenshot but it's necessary to crop it to a proper size.

This online tool can generate an image (a .PNG) from the tweet's URL.


A title can be added as a header ("Tweet Captured")
Emojis are supported. Mentions and hashtags are properply coloured.
Example of a generated Image

Technical Details 

-Python 3.x
-Requests to retrieve the tweet content, the author image and the emojis
-It isn't a "screenshot", the image is rendered from the tweet information.



lunes, 27 de agosto de 2018

Graphical Shutdown/Reboot in OpenBox: pyshutdown


A graphical interface to Shutdown/reboot. Useful if your favourite WM hasn't that functionality. (i.e. OpenBox). A very good guide to install/configure OpenBox: https://www.emezeta.com/articulos/openbox-personalizar-escritorio-linux

PyShutdown Git Repository

This project starts like a personal needed due I use OpenBox everyday. I had a little bash script to automatize shutdown/reboot but it was ugly and It can't be cancelled.

It uses Tk-inter to the graphical interface. The language is autodetected (only english (default), spanish and german) and it's easy add new translations due to the .po/.mo translations files.




Due to debugging needs there is a command line parameter (-l) to write a log in /var/tmp


#apt-get install python-tk

User grants

User need to be enough privilegies to shutdown/reboot the machine:
Create a new group:
sudo groupadd power
Adding your user to the group power:
sudo usermod -a -G power yourusername
Allow members of group power to shutdown without a password:
sudo visudo

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
# Allow members of group power to shutdown (or reboot) system
%power  ALL = NOPASSWD: /sbin/shutdown
It is necessary re-login to the changes take effect.

sábado, 24 de marzo de 2018

martes, 6 de junio de 2017

mstsc.exe not responding

Last week I experienced an annoying delay in the startup time of mstsc.exe (terminal server client) of about 10-15 minutes. I 'googled' a lot and I found a bunch links discussing about security certificates, corrupted system files and other logical causes.

A server related problem was discarted because there wasn't any problem connecting to the same server from other client.

Obviously anything I found doesn't work ... My last chance was a open-source terminal server client for windows... (FreeRDP) and it last the same time to startup.... interesting... (and frustrating!).

After a lot of test, I analized my system event viewer:

Any terminal server client can share resources between server and client, so it looks obvious it "wait" until all resources are ready. My cdrom drive was dead, so it was delaying all the startup process of mstsc.exe. After disabling the unit, all worked perfectly.

I'm not saying this is THE SOLUTION, of all problems related to mstsc.exe, it was my solution.

martes, 30 de mayo de 2017

How to find out which hdd is \Device\Harddisk#\DR#

Sometimes we obtain a weird Disk Error (Event 11) on Windows Event Viewer pointing to a "Disk" called something like \Device\Harddisk#\DR#

And the question is: which one is that failling disk? is "C:" unit? Is it my system disk?

In my case that was my error (just before a system's hang):

To translate that obscure representation of a disk we can use WinObj.

WinObj is a must-have tool if you are a system administrator concerned about security, a developer tracking down object-related problems, or just curious about the Object Manager namespace.

  • Download WinObj from Sysinternals
  • Run it as administrator
  • Go to \Device\HarddiskX

  • You will see individual PartitionY symbolic links (to \Device\HarddiskVolumeZ), note these down
  • Go to \GLOBAL??, sort by the 3rd column "SymLink"
  • Find the \Device\HarddiskVolumeZ value you noted down in the 3rd column
  • You will see various names of that volume in the first column, including HarddiskXPartitionY, Volume{GUID} and (what's probably most useful for most people) the DOS-style letter like C:

Finally I can realise that the faulting drive was a external usb-stick and not my system disk.

Found at Microsoft Forums, pictures are my own.

martes, 18 de abril de 2017

How to prevent Punycode Phishing Attacks

What is Punycode Phishing Attacks?

It's a intentionally malformed url to "appears to" a well known url, using special characters that looks like "normal" one but aren't the same.

For example:

The second one points to a different domain that it isn't under control of apple, so if we use our user&password to try login we are revealing it to the attacker.

Imagine the same situation with the url of your bank.

The solution

 Use Punycode Alert a Chrome Extension that shows a Warning when you visit a malformed url

Chrome will release a new version of his browser this month

jueves, 16 de marzo de 2017

How to copy a file with I/O errors?

Sometimes we need (yes, really NEEEEEED) access a file from a damaged hard disk without recent backup.

If we try do it manually we can obtain errors and the operation can be aborted. In other cases the damaged disk can block the entire system. This is because the operating system want to give us the entire original file, without errors. If the disk responses with a error in a certain block (1Kb) inside a large file (1 Gb) the operating system won't give us the file. But we want the 99% of the file that is ok. (i.e., If the file requested file is a video, we don't care lose 1 seg.)

Short Answer:

$ dd if=/media/_MYDISK_/file.mp4 of=file.mp4 conv=noerror,sync

if= path to the original file, in the damaged filesystem
of = path to the destination file, in a safe filesystem
conv = noerrors, sync Ignore all errors and continue!!!!!!

That doesn't mean the copied file haven't any errors. After copy it, we will need specific tools to repair it. Sometimes the file format is "fault tolerant" and when we'll open it with his software (i.e. Word, Zip...) it'll be auto-repaired. In other cases we'll loose part of our data, but not all.

Long Answer: Blog of Aeroquartet