in reply to Obfuscating method calls
One method that springs to mind would be to add the obfu method names to the UNIVERSAL package and have them redirect to the actual methods.
This would allow you to obfuscate core/standard module calls without having to munge their source.
Another evil thing to do is to create constant subroutines to return the class names, and swap them around so the Foo subroutine returns the Bar package name. Can be most confusing.
For example:
#! /usr/bin/perl; use strict; use warnings; package Foo; sub new { bless {}, shift }; sub foo { my $self = shift; @_ ? $self->{foo} = shift : $self->{foo}; }; sub show { print "foo is ", shift->foo, "\n" }; package Bar; sub new { bless {}, shift }; sub bar { my $self = shift; @_ ? $self->{bar} = shift : $self->{bar}; }; sub show { print "bar is ", shift->bar, "\n" }; package main; use constant Bar => 'Foo'; use constant Foo => 'Bar'; { package UNIVERSAL; no warnings; *kwenve = sub { my $self = shift; $self->new(@_) }; *kwjehd = sub { my $self = shift; $self->foo(@_) }; *kjwehd = sub { my $self = shift; $self->bar(@_) }; *kfdlfe = sub { my $self = shift; $self->new(@_) }; *kedfgf = sub { my $self = shift; $self->show(@_) }; }; my ($kivbe, $kfovg) = (Bar->kwenve, Foo->kfdlfe); # my ($foo, $bar) = (Foo->new, Bar->new); $kivbe->kwjehd(12); # $foo->foo(12); $kfovg->kjwehd(42); # $bar->bar(42); $kivbe->kedfgf; # $foo->show; $kfovg->kedfgf; # $bar->show;
|
|---|