Openkore.com

OpenKore Forums
It is currently 30 Apr 2017, 16:29

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How do we hide the work of ench.pl?
PostPosted: 17 Apr 2017, 06:34 
Offline
Noob
Noob

Joined: 09 Apr 2017, 07:23
Posts: 12
How do we hide the work of ench.pl?


Image

Code:
package xorHeader;

use Network::Send;
use Log qw (warning message debug error);
use Globals qw(%config $encryptVal $bytesSent $conState %packetDescriptions $enc_val1 $enc_val2 $char $masterServer $syncSync $accountID %timeout %talk);
Plugins::register("Encryption private", "Encrypt header", \&unencryptedMessageID2);

sub unencryptedMessageID2 {warning "UnencryptedMessageID2ing\n";}

sub loadKeys2 {
my ($self, $input, $tmp1, @keys);
my $self = shift;
$tmp1 = 0;   #initialize
open $input, "<plugins/xh.txt" or warnuser();
   while (<$input>) {
      if ($_ =~ /(1|2|3) = 0x(.{8})/ig) {
      $tmp += 1;
         $self->{encryption}->{crypt_key_1} = sprintf("08d", $2) if ($tmp eq 1);
         $self->{encryption}->{crypt_key_3} = sprintf("08d", $2) if ($tmp eq 2);
         $self->{encryption}->{crypt_key_2} = sprintf("08d", $2) if ($tmp eq 3);
      }
      next;
   }
close ($input);
$self->cryptKeys(@keys) if (exists $self->{encryption}->{crypt_key_3});
warning "Ench plugin requires keys to work..." if (exists $self->{encryption}->{crypt_key_3});
}

sub warnuser {
system("cls");
warning ("******Hello*******\n");
warning ("You need to create a file called \'xh.txt\' inside your plugins folder\n");
warning ("Please, insert the keys as the PEEK shown for you :\n");
warning ("[Packet Keys]\n");
warning ("1 = 0x11111111\n");
warning ("2 = 0x11111111\n");
warning ("3 = 0x11111111\n");
warning ("Then, create the file containing this last 3 lines above.\n");
warning ("Please Any question ask in openkore forum !\n");
error("Bye\n")
}

sub encryptedMessageID2 {
my ($self, $r_message) = @_;
loadKeys2($self);
if ($scenario eq "s1"|| $self eq "s1") {
   my $messageID = unpack("v", $$r_message);
      if ($self->{encryption}->{crypt_key_3}) {
        if (sprintf("%04X",$messageID) eq $self->{packet_lut}{map_login}) {
          $self->{encryption}->{crypt_key} = $self->{encryption}->{crypt_key_1};
        } elsif ($self->{net}->getState() != Network::IN_GAME) {
          # Turn off keys
          $self->{encryption}->{crypt_key} = 0; return;
        }
         
        # Checking if Encryption is Activated
        if ($self->{encryption}->{crypt_key} > 0) {
          # Saving Last Informations for Debug Log
          my $oldMID = $messageID;
          my $oldKey = ($self->{encryption}->{crypt_key} >> 16) & 0x7FFF;
         
          # Calculating the Encryption Key
          $self->{encryption}->{crypt_key} = ($self->{encryption}->{crypt_key} * $self->{encryption}->{crypt_key_3} + $self->{encryption}->{crypt_key_2}) & 0xFFFFFFFF;
       
          # Xoring the Message ID
          $messageID = ($messageID ^ (($self->{encryption}->{crypt_key} >> 16) & 0x7FFF)) & 0xFFFF;
          $$r_message = pack("v", $messageID) . substr($$r_message, 2);

          # Debug Log   
          debug (sprintf("Encrypted MID : [%04X]->[%04X] / KEY : [0x%04X]->[0x%04X]\n", $oldMID, $messageID, $oldKey, ($self->{encryption}->{crypt_key} >> 16) & 0x7FFF), "sendPacket", 0) if $config{debugPacket_sent};
        }
      } else {
        use bytes;
        if ($self->{net}->getState() != Network::IN_GAME) {
          $enc_val1 = 0;
          $enc_val2 = 0;
          return;
        }

        my $messageID = unpack("v", $$r_message);
        if ($enc_val1 != 0 && $enc_val2 != 0) {
          # Prepare encryption
          $enc_val1 = ((0x000343FD * $enc_val1) + $enc_val2)& 0xFFFFFFFF;
          debug (sprintf("enc_val1 = %x", $enc_val1) . "\n", "sendPacket", 2);
          # Encrypt message ID
          $messageID = ($messageID ^ (($enc_val1 >> 16) & 0x7FFF)) & 0xFFFF;
          $$r_message = pack("v", $messageID) . substr($$r_message, 2);
         }
      }
   }
}

*Network::Send::encryptMessageID = *encryptedMessageID2;
1;


Top
 Profile  
 
 Post subject: Re: How do we hide the work of ench.pl?
PostPosted: 17 Apr 2017, 22:53 
Offline
Moderators
Moderators
User avatar

Joined: 16 Dec 2011, 02:53
Posts: 1052
Location: Brazil - DF
Redownload my plugin again.
Return with feedbacks !

_________________
"'There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.'" :P

Click here and travel to a new world -> Newbies
Read before asking something.
How to connect to private servers


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group