Translation please

S

Stan

Could someone please translate this into english please. This is part
of obfuscation script

thanks

perl -n -i.bak -e "if (/([0-9]+\t)([A-Z0-9]*)(.*)$/) { print $1 .
\"58\" x (length($2) / 2) . $3 . \"\n\"; } else { print; }"
TBL_BlobData.dat
 
T

Ted Zlatanov

Could someone please translate this into english please. This is part
of obfuscation script

perl -n -i.bak -e "if (/([0-9]+\t)([A-Z0-9]*)(.*)$/) { print $1 .
\"58\" x (length($2) / 2) . $3 . \"\n\"; } else { print; }"
TBL_BlobData.dat

You can't really translate that into English. Pseudo-code, maybe, but
English doesn't have a way to describe it in less than 3 pages of
dense text.

I'd recommend instead learning:

1) what does the -n switch do?

2) what does the -i.bak switch do?

3) what does the regular expression match? What is saved in $1, $2,
and $3? You should know this, having access to the TBL_BlobData.dat
file, unlike everyone else on this newsgroup.

4) What does this do, and could you use printf there?
print $1 . "58" x (length($2) / 2) . $3 . "\n";

It's really not all that complicated or obfuscated. It's presented
that way as a one-liner, but in 7-8 lines and with comments it's not
nearly as bad.

Ted
 
S

Stan

Jim said:
Stan said:
Could someone please translate this into english please. This is part
of obfuscation script

thanks

perl -n -i.bak -e "if (/([0-9]+\t)([A-Z0-9]*)(.*)$/) { print $1 .
\"58\" x (length($2) / 2) . $3 . \"\n\"; } else { print; }"
TBL_BlobData.dat

1. Start the Perl interpreter and execute a Perl program that does the
following:

2. Open a temporary file for writing.

3. Open the file TBL_BlobData.dat for reading.

4. Read each line in the input file and do the following:

5. If the line contains one or more decimal digits followed by a tab
character followed by zero or more decimal digits or upper-case English
alphabet characters, write the first set of digits followed by the
string "58" repeated one-half the number of times there are characters
in the second digit-upper-case-character string followed by the rest of
the original line and a newline to the output file. Otherwise, copy
the original line (with its original newline) to the output file.

6. When all of the input file has been read, close both files, rename
the original file to TBL_BlobData.dat.bak and rename the temporary file
to TBL_BlobData.dat.

7. Quit

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,662
Latest member
sxarexu

Latest Threads

Top