OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: OT: Base64 encoding in obfuscated Perl

From: Andreas Meyer (anmeyeranup.de)
Date: Sun Aug 31 2003 - 16:11:04 CDT


Liviu Daia <Liviu.Daiaimar.ro> schrieb:

> Off topic, but still related: can some Perl-Fu master out there
> please explain (preferably in layman terms) why the following
> abomination works fine for encoding files as Base64:
>
> perl -MMIME::Base64 -e 'print encode_base64 $b while (read STDIN, $b, 57)' <file
>
> while this one only works for small files:
>
> perl -MMIME::Base64 -pne '$/=\57; $_=encode_base64 $_' <file

Both methods produce the same results in my tests:

delta:/var/log # ls -l mail
-rw-r--r-- 1 root root 94346956 Aug 31 22:42 mail

delta:/var/log # ls -l firewall
-rw-r--r-- 1 root root 249056 Aug 31 13:53 firewall

perl -MMIME::Base64 -e 'print encode_base64 $b while (read STDIN, $b, 57)' < firewall > /home/fi-big
perl -MMIME::Base64 -pne '$/=\57; $_=encode_base64 $_' < firewall > /home/fi-small

perl -MMIME::Base64 -e 'print encode_base64 $b while (read STDIN, $b, 57)' < mail > /home/mail-big
perl -MMIME::Base64 -pne '$/=\57; $_=encode_base64 $_' < mail > /home/mail-small

-rw-r--r-- 1 root root 336446 Aug 31 22:54 fi-big
-rw-r--r-- 1 root root 336447 Aug 31 22:55 fi-small
-rw-r--r-- 1 root root 127451154 Aug 31 23:01 mail-big
-rw-r--r-- 1 root root 127451155 Aug 31 22:58 mail-small

--
  Andreas Meyer | http://www.anup.de
                          | http://home.wtal.de/MeineHomepage

while zapfhahn [ traffic ]; do; zapfhahn (log traffic) | wirt | stift |
bierdeckel(trinker); done; bierdeckel > awk (sum log) > invoice.txt