Factorize code about offset.

Since in case where the ASLR is enabled is necessary to specify an offset I have factorized the code so to allow to generate a python script with the offset parameter configurable.

I admit I have not tested extensively, if you have any hint let me know.