Files
perl-B-Deobfuscate/perl-B-Deobfuscate.spec
2025-08-12 18:11:55 +02:00

116 lines
3.9 KiB
RPMSpec

#
# spec file for package perl-B-Deobfuscate
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define cpan_name B-Deobfuscate
Name: perl-B-Deobfuscate
Version: 0.200.0
Release: 0
# 0.20 -> normalize -> 0.200.0
%define cpan_version 0.20
License: CHECK(Artistic-1.0 or GPL-1.0-or-later)
Summary: Deobfuscate source code
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/J/JJ/JJORE/%{cpan_name}-%{cpan_version}.tar.gz
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(B::Keywords) >= 1.04
BuildRequires: perl(YAML)
Requires: perl(B::Keywords) >= 1.04
Requires: perl(YAML)
Provides: perl(B::Deobfuscate) = %{version}
Provides: perl(B::Deobfuscate::Dict::Flowers)
Provides: perl(B::Deobfuscate::Dict::PGPHashWords)
%undefine __perllib_provides
%{perl_requires}
%description
B::Deobfuscate is a backend module for the Perl compiler that generates
perl source code, based on the internal compiled structure that perl itself
creates after parsing a program. It adds symbol renaming functions to the
B::Deparse module. An obfuscated program is already parsed and interpreted
correctly by the B::Deparse program. Unfortunately, if the obfuscation
involved variable renaming then the resulting program also has obfuscated
symbols.
This module takes the last step and fixes names like $z5223ed336 to be a
word from a dictionary. While the name still isn't meaningful it is at
least easier to distinguish and read. Here are two examples - one from
B::Deparse and one from B::Deobfuscate.
Initial input
if(@z6a703c020a){(my($z5a5fa8125d,$zcc158ad3e0)=File::Temp::tempfile(
'UNLINK',1));print($z5a5fa8125d "=over 8\n\n");(print($z5a5fa8125d
@z6a703c020a)or die(((("Can't print $zcc158ad3e0: $!"))); print($z5a5fa8125d
"=back\n");(close(*$z5a5fa8125d)or die(((("Can't close ".*$za5fa8125d.": $!")
));(@z8374cc586e=$zcc158ad3e0);($z9e5935eea4=1);}
After B::Deparse:
if (@z6a703c020a) {
(my($z5a5fa8125d, $zcc158ad3e0) = File::Temp::tempfile('UNLINK', 1));
print($z5a5fa8125d "=over 8\n\n");
(print($z5a5fa8125d @z6a703c020a)
or die((((q[Can't print ] . $zcc158ad3e0) . ': ') . $!)));
print($z5a5fa8125d "=back\n");
(close(*$z5a5fa8125d)
or die((((q[Can't close ] . *$za5fa8125d) . ': ' . $!)));
(@z8374cc586e = $zcc158ad3e0);
($z9e5935eea4 = 1);
}
After B::Deobfuscate:
if (@parenthesises) {
(my($scrupulousity, $postprocesser) = File::Temp::tempfile('UNLINK', 1));
print($scrupulousity "=over 8\n\n");
(print($scrupulousity @parenthesises)
or die((((q[Can't print ] . $postprocesser) . ': ') . $!)));
print($scrupulousity "=back\n");
(close(*$scrupulousity)
or die((((q[Can't close ] . *$postprocesser) . ': ') . $!)));
(@interruptable = $postprocesser);
($propagandaist = 1);
}
You'll note that the only real difference is that instead of variable names
like $z9e5935eea4 you get $propagandist.
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
%build
perl Makefile.PL INSTALLDIRS=vendor
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README
%license LICENSE
%changelog