ich den folgenden Code in Python finden Sie heraus:Umkehren einer Byte-String in Python
"\xe2\x8f\x60\x01"+
"\xe1\x2f\xff\x16"+
"\x22\x0c"+
"\x46\x79"+
"\x31\x0e"+
"\x20\x01"+
"\x27\x04"+
"\xdf\x01"+
"\x1b\x24"+
"\x1c\x20"+
"\x27\x01"+
"\xdf\x01"+
"\x6c\x6c\x65\x48"+
"\x6f\x57\x20\x6f"+
"\x0a\x64\x6c\x72"+
:
def ExtractShellcodeArm(_arg_name):
ObjDumpOutput(_arg_name)
print("\033[101m\033[1mExtracted Shellcode:\033[0m\n")
proc = subprocess.Popen(['objdump','-d',_arg_name], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
while True:
line = proc.stdout.readline()
if line != b'':
array = line.decode().rstrip().split(':')
if len(array) > 1:
if array[1]:
array2 = array[1].split(' ')
array2 = array2[0].lstrip().rstrip()
if array2:
sc_part = '\t"'
sc_part += '\\x'
sc_part += '\\x'.join(a+b for a,b in zip(array2[::2], array2[1::2]))
sc_part += '"+'
print(sc_part)
else:
break
Nachdem ich diesen Code in python3 führen Sie es mir das Ergebnis der objdump Tools wie folgt gibt
Aber ich will es zeigt das Ergebnis im Big Endian-Format. Wie kann ich diese Darstellung in der Python-Funktion ändern? zum Beispiel möchte ich diesen Code, um das Ergebnis wie folgt zeigt:
"\x01\x60\x8f\xe2"+
"\x16\xff\x2f\xe1"+
"\x0c\x22"+
"\x79\x46"+
...
Versuchen Sie: 'print (sc_part [:: - 1])' –
Dieser Befehl hat die ganze Zeichenfolge umgekehrt. Aber ich möchte die Zeichenfolge veraltet 2 Byte 2byte. –
Ich möchte String "\ xe2 \ x8f \ x60 \ x01" wird "\ x01 \ x60 \ x8f \ xe2". –