in reply to Re^2: using Safe.pm
in thread using Safe.pm
eval ('perl -MO=Deparse obfu3.pl'); The top part works; the bottom doesn't. Looking for tips. Thank you.
What do you mean? Capture::Tiny? Look inside O and B::Deparse , and maybe Safe::Hole (or Safe::World), https://metacpan.org/source/RGARCIA/Safe-2.35/t/safeuniversal.t, ) then copy/paste stuff so you can reval somehow safely? There is no Safe::Deparse on cpan :)
perltidy then manual inspection is about the only safe way to figure stuff out step by step without BEGIN{} or `qx//ing` or s///eevaling stuff running, just decoding the strings
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: using Safe.pm ( Safe::Deparse )
by Aldebaran (Curate) on Jul 10, 2015 at 00:16 UTC | |
Thanks for your response, I chased down those cpan modules and gave them a read. It's been suggested that I might not have my 'puter at eye level, and the answers might be right there on the screen, but I'm missing them usually for lack of comprehension. This is new territory for me, and the learning curve is steep. I do best with the modules that have examples and have worked up a few examples to show what is working and what isn't. I wrote the simplest of toy programs: toy1.pl, that only substitutes a phrase. It's safe and short. Let me list the latest of many incarnations of this script:
The problem seems to be how to get deparse to work when the file to be deparsed is being selected after the program begins to run. Hence copying and pasting into a sub is not possible. I thought I was going to go with system() and Capture::Tiny until I ended up going with backticks in the 4th trial with good results. On the fifth trial I directed the backend of perl toward the obfu in the thread of the obfu decoder ring from the original post. It appears to be a bunch of junk under closer inspection:
Since there isn't any output, my guess is that perl is clever enough to look at this program and say, "why define a bunch of screwy-looking variables, assign a bunch of junk, and do nothing, if there is no output? Let's not play at all." But if there were output, would perl assign values to all the odd-looking $ variables like $= , $. , $~ , $___ ? What symbols would I look for if there were something pernicious happening? | [reply] [d/l] [select] |
by Anonymous Monk on Jul 10, 2015 at 02:12 UTC | |
... What symbols would I look for if there were something pernicious happening? You mean aside from the stuff I already mentioned? ppi_dumper can always help tell you which parts are which parts | [reply] |
by Anonymous Monk on Jul 11, 2015 at 02:52 UTC | |
... Danger :) I don't know that that obfu ever did anyting, but its fairly standard fare, try to hide when you're doing something tricy, transform nonsense into a message (or evil)
| [reply] [d/l] |