Ce script permet de generer un shellcode formate pour du JIT Spraying. Il convertit une commande Bash en une suite de nombres flottants (double precision).
Le script genere des instructions assembleur x64 correspondant a la commande. Chaque instruction est pad a 6 octets, suivie d'un saut court (jmp) de 2 octets. Cela permet de cacher le shellcode dans les constantes immediates des instructions movabs generees par le compilateur JIT.
Pour calculer la valeur de l'argument --jump, il faut analyser la memoire JIT.
Comme montre dans la capture d'ecran ci-dessous :
- Reperez l'adresse du
movabscontenant votre premier bloc (ex:0xceb90903cec8348). - Reperez l'adresse du
movabssuivant (ex:0xceb909090c03148). - La distance de saut doit permettre d'atterrir exactement, depuis la fin de votre bloc (offset +8), au debut du bloc suivant (offset +2 dans le movabs suivant).
Formule :
Jump = (Adresse Movabs Suivant) - (Adresse Movabs Actuel) - 8
python jit2shellcode.py "commande" --jump <DISTANCE>This script generates formatted shellcode for JIT Spraying. It converts a Bash command into a sequence of double-precision floating-point numbers.
The script generates x64 assembly instructions for the command. Each instruction is padded to 6 bytes, followed by a 2-byte short jump. This hides the shellcode within the immediate constants of movabs instructions generated by the JIT compiler.
To calculate the --jump argument, you must analyze the JIT memory.
As shown in the screenshot below:

- Locate the address of the
movabscontaining your first block (e.g.,0xceb90903cec8348). - Locate the address of the next
movabs(e.g.,0xceb909090c03148). - The jump distance must land exactly from the end of your block (offset +8) to the start of the next block (offset +2 in the next movabs).
Formula:
Jump = (Next Movabs Address) - (Current Movabs Address) - 8
python jit2shellcode.py "command" --jump <DISTANCE>