line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Python; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = 0.01; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
my $signed = "Hisssssssssssssssss"; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub encode { |
8
|
0
|
|
|
0
|
0
|
0
|
local $_ = unpack "b*", pop; |
9
|
0
|
0
|
|
|
|
0
|
$_ = join ' ', map{ (/1/?'H':'h').'is'.('s' x length); } m/(0+|1+)/g; |
|
0
|
|
|
|
|
0
|
|
10
|
0
|
|
|
|
|
0
|
s/(.{40,}?\s)/$1\n/g; |
11
|
0
|
|
|
|
|
0
|
"$signed\n$_" |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
sub decode { |
14
|
1
|
|
|
1
|
0
|
2
|
local $_ = pop; |
15
|
1
|
|
|
|
|
236
|
s/(^$signed|\s)//g; |
16
|
1
|
100
|
|
|
|
9
|
s/([hH])is(s+)/ ($1 eq 'H'?'1':'0')x(length $2); /ge; |
|
169
|
|
|
|
|
636
|
|
17
|
1
|
|
|
|
|
104
|
pack "b*", $_ |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
sub garbled { |
20
|
1
|
|
|
1
|
0
|
8
|
$_[0] =~ /\S/ |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
sub signed { |
23
|
1
|
|
|
1
|
0
|
26
|
$_[0] =~ /^$signed/ |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
open 0 or print "Can't execute '$0'\n" and exit; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
(my $program = join "", <0>) =~ s/.*^\s*use\s+Acme::Python\s*;\n//sm; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
local $SIG{__WARN__} = \&garbled; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
do { |
33
|
|
|
|
|
|
|
eval decode $program; |
34
|
|
|
|
|
|
|
exit |
35
|
|
|
|
|
|
|
} unless garbled $program && not signed $program; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
open 0, ">$0" or print "Can't python-ise '$0'\n" and exit; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
print {0} "use Acme::Python;\n", encode $program and exit; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |