Too hard to drive Advanced Format

I’ve been struggling for quiet a long time about a problem with a Western Digital 3TB hard drive. I let it aside as, back in time, I found a quick workaround which is not efficient on the long term: using windows to partition the disk, and use windows to read/write on it.

I’ve finally decided to tackle this inconsistency and looked desperately for a satisfying solution. As I’ve been looking for the solution for more than few dozen minutes, this page might help other people 🙂

Problem is: When plugged through USB enclosure, the kernel sees 1565565872 sectors of 512 bytes, where in fact there are 1565565872 sectors of 4096 bytes in my hard drive. I’m still a bit confused with the responsabilities. Apparently, Western Digital firmware doesn’t respond well to some commands, reporting wrong values. But the kernel is not able to circumvent these wrong values despite accessible workaround to retrieve the valid values.

In the following, we compare what you can encounter when plugging-in your hard drive through USB enclosure, or through SATA enclosure. I take advantage of the following to also present few debugging tips for SCSI or ATA commands. Continuer la lecture de « Too hard to drive Advanced Format »

JQuery ajax example

A small post to present the complete JQuery.ajax syntax (http://api.jquery.com/jQuery.ajax/). I’ve also added a simple timer.

You can start from this example to observe the diferent status 😉

{codecitation class= »brush: javascript; »}

function log(msg) {
if (window.console) // IE8+ compliant 😉
console.log(msg);
}

function callServer(url, data, callbackSuccess, callbackError) {
log(« begin » + url);
try {
var t = new Date().getTime();
var object = $.ajax(url, {
complete : function(query, status) {
log(« complete »);
},
// contentType : »application/json »,
// dataType: »jsonp »,
// jsonp:’onJSONPLoad’,
data : {
« data » : data
},
error : function(d, s, q) {
callbackError(d, s, q, t);
},
success : function(d, s, q) {
callbackSuccess(d, s, q, t);
},
error : function(query, status, error) {
log(« error » + status);
},
success : function(data, status, query) {
log(« success » + status);
},
type : ‘POST’,
});

object.done(function(data, textStatus, jqXHR) {
log(« done » + textStatus);
});
object.fail(function(query, textStatus, error) {
log(« fail » + textStatus);
});
object.always(function(query, textStatus, error) {
log(« always » + textStatus);
});

log(« ajax fired »);
} catch (e) {
log(« exception » + e);
}
log(« end » + url);
}

{/codecitation}

{jcomments on}

 

2d-doc, verify on your own the signature

Following the last article where I present 2d-doc, I present here a script I wrote to verify the signature on my own. There is a set of examples on the official web-site (http://www.2d-doc.com/spip.php?page=article&id_article=15), that you can reuse if you don’t have existing 2d-doc pictures and public key.

You can find the demo material on github: https://github.com/eirmag/2ddoc.

The facture picture contains several information, that you can again extract with ‘dmtxread’. Continuer la lecture de « 2d-doc, verify on your own the signature »

2d-doc, using digital signature to protect physical documents

Today, I’m going to discuss a bit about a technology found few weeks ago, in order to present it to non-french people. It represents a technique that will be intensively used to assess the authenticity of physical documents produced by different service providers, and thus protect from fake documents. There is an hight interest on the enterprise processes and administrative systems, where different institutions request papers from other entities to evaluate eligibility to social aid, where private companies needs proof of identity and residence, etc.

The solution proposes to apply existing digital signature, based on a public key infrastructure, to calculate signatures on physical documents. The originality is to carry the digital information in a physical support through two dimensional barcode (following datamatrix specifications). As of today, the official web-site proposes several examples to understand how one can retrieve information. But for sake of example, I’ve taken an existing qrcode from one of my SFR (internet provider) invoice and extract the content hereafter.

 

2d-doc for serme invoice

Continuer la lecture de « 2d-doc, using digital signature to protect physical documents »

Reveal hidden visitors on Viadeo.com

Viadeo has a feature to reveal who visited your profile…. but you first have to pay to become a premium user.

But the way viadeo presents us the different profiles « anonymized » (cf picture1) contains a token which identify a profile. To illustrate this tiny breach in their business, I’ve created a small script you can launch when browsing the viadeo « profile visits view ».

Basically it replaces all links on profile cards by the user profile link whereas normally they point to the subscription page. The script also browses for you the different profiles and replace the labels by the real name and job position from your visitor (cf picture 2). Be careful that this latest option creates automated activity for your account and indicates to the profiles being revealed that you have visited them.

 

Before :

Anonymized profile card for your account's visitors on viadeo.com
Anonymized profile card for your account’s visitors on viadeo.com

After: Continuer la lecture de « Reveal hidden visitors on Viadeo.com »

RAW_SOCKET to forge UDP packets

Recently, I had to forge UDP packets in order to resolve a challenge, but unfortunately, I faced a lack of documentation on RAW_SOCKET with the usage of UDP. So there is my feedback on how to forge correct UDP packets, with links to documentation I used.

To begin with, let me introduce what is a RAW_SOCKET, and what we can do with it. A RAW_SOCKET is a type of socket that allows you to bypass the operating system encapsulation. You are responsible to fill all headers of the different protocols used during the communication. Thus, you have to fill IP Header, and UDP header on our example. Furthermore, you have to comply with the different RFCs by computing yourself all checksums to keep packet’s integrity while transmitting data in the wild.

A RAW_SOCKET requires root credentials, as forging a packet is really sensitive and allows one to do IP Spoofing on local network (ISP’s protection are pretty efficient :)). You can also use them to do application spoofing in order to send application-specific data, or whatever you want.

Create the socket Continuer la lecture de « RAW_SOCKET to forge UDP packets »

Chiffrer un fichier avec Openssl

C’est dans un élan de paranoïa aigüe que je me suis penché sur la question du cryptage de fichier.

Après quelques rapides recherches j’ai appris que l’on ne dit pas  » crypter  » mais  » chiffrer » ( http://fr.wikipedia.org/wiki/Chiffrement ) et surtout on trouve une multitude soft qui peuvent résoudre notre problème.

EasyCrypt et encfs marche très bien, mais j’ai une petit préférence pour OpenSSL.

Le cryptage/décryptage ce fait en ligne de commande avec une syntaxe très simple. De plus c’est rapide et multiplateforme.
Une multitude de solutions sont possibles, une des plus simples est la suivante:

chiffrer un fichier:

openssl  aes-256-ecb -in ficher_a_crypter -out fichier_crypte 

déchiffrer un fichier:

openssl  aes-256-ecb -d -in fichier_crypte -out fichier_decrypte 

Les plus curieux d’entre vous peuvent se pencher sur le TP de l’Université Paris Descartes pour découvrir plus de fonctionnalité de OpenSSL. www.mi.parisdescartes.fr/~osalem/enseignement/SSIC/TPopenssl1.pdf

Et voila, amusez vous bien,….{jcomments on}

How to use Jabref behind a proxy

Jabref, a powerful tool to manage bibliography, has a special feature that let the user search bibtex entries online, and import them within your bibliography.

A problem occurs when you run JabRef behind a proxy (corporate or not), because no options is available to configure it.

Hopefully, JabRef is provided as a jar so we have the ability to modify proxy properties used by java.

Just run the following command :

 java -Dhttp.proxyHost="proxy" -Dhttp.proxyPort="8080" -jar "/where/is/the/jar/JabRef-2.6b2.jar"

 

JabRef online search

 

 That’s it, you can search for whatever you want on ACM portal, IEEE, etc. in few clicks. 

 For information,

  • java properties for proxy (https, ftp, sock, etc.) : http://java.sun.com/javase/6/docs/technotes/guides/net/proxies.html
  • Sorry for screenshot with vista skin, but as my corporate’s laptop is using it, I need to work with it 😀 But this tip is cross platform.

{jcomments on}

Setting up PluXML with Nginx

Hi, today, we are going to see powerfull web servers – nginx – and portable cms – PluXML written in Php.

 The goal is to set up the all solution under fedora 12 and make it works in local. 

 Let’s start with most important steps and resources that allowed me to set up everything in quiet short time :

  • PluXML : Download the latest archive and extract it wherever you want on your drive
  • NGinx : Downlad and build-it up, or install it through your favorite package-manager (i.e yum install nginx)
  • Install Php and FastCGI in your system,for example under fedora : yum install lighttpd-fastcgi php php-gd

Continuer la lecture de « Setting up PluXML with Nginx »

Vim substitution

Just a note to remember substitution :

:%s/\ {http\(.*\)},/\ {\\url{http\1}},/

Goal was, in a bibtex file, to make an anchor with each url, using \url{} command.

For example, 

 @MISC{ademe,
  title = {http://www.ademe.fr},
  note = {L'Agence de l'environnement et de la ma\^itrise de l'\'energie},
}

became

 @MISC{ademe,
  title = {\url{http://www.ademe.fr}},
  note = {L'Agence de l'environnement et de la ma\^itrise de l'\'energie},
}{jcomments on}