DiBobble
DiBobble

Reputation: 21

Can some decrypt this line of code before I go mucking my machine

Here is the line

sudo perl -pi -e 's/\x00\x85\xc0\x74\x7b\xe8/\x00\x85\xc0\xEB\x7b\xe8/g'

Just wondering what the string outputs to.

Upvotes: 0

Views: 174

Answers (1)

knittl
knittl

Reputation: 265131

s/…/…/g is the global substitute command. It replaces the matched text (the first part between /…/ with the replacement (the second /…/), i.e. s/pattern/replace/g. /g means it applies to all matches in a single line.

Therefore, s/\x00\x85\xc0\x74\x7b\xe8/\x00\x85\xc0\xEB\x7b\xe8/g will replace all occurrences of \x00\x85\xc0\x74\x7b\xe8 with \x00\x85\xc0\xEB\x7b\xe8 (in every line).

\xNN is the hexadecimal representation of a single byte. Most of the bytes in your question are non-printable ASCII characters:

\x00\x85\xc0\x74\x7b\xe8
              t   {      
\x00\x85\xc0\xEB\x7b\xe8
                  {

As you can see, only \x74 (t) and \x7b ({) are in the printable character range.

-p will apply your statement to every line in the input file. -i will edit the input file in-place. -e specifies the perl code to execute.

So for your invocation to be correct, you must actually pass a file:

perl -pi -e 's/\x00\x85\xc0\x74\x7b\xe8/\x00\x85\xc0\xEB\x7b\xe8/g' yourfilehere

Upvotes: 3

Related Questions