title: Reversing a byte string in Python
body: <p>I find out the following code in python:</p>
  
  <pre><code>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) &gt; 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
  </code></pre>
  
  <p>After I run this code in python3 it gives me the result of the objdump tools like the following:</p>
  
  <pre><code>"\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"+
  </code></pre>
  
  <p>But I want it shows the result in the big endian format. How can I change this represantion in python function. for example I want this code shows the result like the following:</p>
  
  <pre><code>"\x01\x60\x8f\xe2"+
  "\x16\xff\x2f\xe1"+
  "\x0c\x22"+
  "\x79\x46"+
  ...
  </code></pre>