BorderGame

Versione completa: PSERVER UDF
Al momento stai visualizzando i contenuti in una versione ridotta. Visualizza la versione completa e formattata.
Da Shadow992
Codice:
Func DecryptLoginPacket($str)
    Local $decrypted_string = "",$temp
    Local $splited = StringToASCIIArray($str,0,StringLen($str),1)
    For $i = 0 To UBound($splited) - 1
        $temp=BitXOR($splited[$i] - 0xF, 0xC3)
        If $temp<0 Then $temp+=256
        $decrypted_string &= Chr($temp)
    Next

    Return $decrypted_string
EndFunc   ;==>DecryptLoginPacket

Func EncryptLoginPacket($str)
    Local $decrypted_string = "",$temp
    Local $splited = StringToASCIIArray($str,0,StringLen($str),1)

    For $i = 0 To UBound($splited) - 1
        $temp=$splited[$i] + 0xF
        If $temp>256 Then $temp-=256
        $decrypted_string &= Chr($temp)
    Next

    Return $decrypted_string & Chr(0x19)
EndFunc   ;==>EncryptLoginPacket

Func GetPasswordString($str)

    Local $decrypted_string
    Local $count = 1
    Local $convert=""

    If Mod(StringLen($str), 2)=0 Then
        $str = StringTrimLeft($str, 3)
    Else
        $str = StringTrimLeft($str, 4)
    EndIf

    Local $splited = StringToASCIIArray($str,0,StringLen($str),1)

    for $i=0 To UBound($splited)-1 Step 2
        $convert &= chr($splited[$i])
        if Mod($count,2)=0 Then
            $convert &= ' '
        EndIf
        $count+=1
    Next

    $splited = StringToASCIIArray($convert,0,StringLen($convert),1)

    for $i=0 To UBound($splited)-1
        $decrypted_string&=hex($splited[$i])
    Next

    return $decrypted_string
EndFunc


Func DecryptSessionPacket($str)
    Local $encrypted_string = "", $firstbyte, $secondbyte

    Local $splited = StringToASCIIArray($str,0,StringLen($str),1)

    For $i = 1 To UBound($splited) - 1
        If ($splited[$i] == 0xE) Then Return $encrypted_string

        $firstbyte = $splited[$i] - 0xF;
        $secondbyte = $firstbyte
        $secondbyte = BitAND($secondbyte, 0xF0)
        $firstbyte = $firstbyte - $secondbyte
        $secondbyte = BitShift($secondbyte, 0x4)

        If $secondbyte = 0 Then
            $encrypted_string &= Chr(0)
        ElseIf $secondbyte = 1 Then
            $encrypted_string &= ' '
        ElseIf $secondbyte = 2 Then
            $encrypted_string &= '-'
        ElseIf $secondbyte = 3 Then
            $encrypted_string &= '.'
        Else
            $temp=0x2C +$secondbyte
            If $temp>256 Then $temp-=256
            $secondbyte = Chr($temp)
            $encrypted_string &= $secondbyte
        EndIf

        If $firstbyte = 0 Then
            $encrypted_string &= Chr(0)
        ElseIf $firstbyte = 1 Then
            $encrypted_string &= ' '
        ElseIf $firstbyte = 2 Then
            $encrypted_string &= '-'
        ElseIf $firstbyte = 3 Then
            $encrypted_string &= '.'
        Else
            $temp=0x2C +$firstbyte
            If $temp>256 Then $temp-=256
            $firstbyte = Chr($temp)
            $encrypted_string &= $firstbyte;
        EndIf
    Next

    Return $encrypted_string
EndFunc   ;==>DecryptSessionPacket


Func DecryptGamePacket($session_id, $str, $length)
    Local $encrypted_string = "", $firstbyte, $highbyte
    Local $session_key = BitAND($session_id, 0xFF)
    Local $session_number = BitShift($session_id, 6)
    $session_number = BitAND($session_number, 0xFF)
    $session_number = BitAND($session_number, 0x80000003)

    $splited = StringToASCIIArray($str,0,StringLen($str),1)

    If $session_number = 0 Then
        For $i = 0 To $length - 1
            $firstbyte = $session_key + 0x40
            $highbyte = $splited[$i] - $firstbyte
            If $highbyte>256 Then $highbyte-=256
            If $highbyte<0 Then $highbyte+=256
            $encrypted_string &= Chr($highbyte)
        Next
    ElseIf $session_number = 1 Then
        For $i = 0 To $length - 1
            $firstbyte = $session_key + 0x40
            $highbyte = $splited[$i] + $firstbyte
            If $highbyte>256 Then $highbyte-=256
            If $highbyte<0 Then $highbyte+=256
            $encrypted_string &= Chr($highbyte)
        Next
    ElseIf $session_number = 2 Then
        For $i = 0 To $length - 1
            $firstbyte = $session_key + 0x40
            $highbyte = BitXOR($splited[$i] - $firstbyte, 0xC3)
            If $highbyte>256 Then $highbyte-=256
            If $highbyte<0 Then $highbyte+=256
            $encrypted_string &= Chr($highbyte)
        Next
    ElseIf $session_number = 3 Then
        For $i = 0 To $length - 1
            $firstbyte = $session_key + 0x40
            $highbyte = $splited[$i] + $firstbyte
            If $highbyte>256 Then $highbyte-=256
            If $highbyte<0 Then $highbyte+=256
            $encrypted_string &= Chr($highbyte)
        Next
    Else
        $encrypted_string &= Chr(0xF)
    EndIf

    Local $temp = StringSplit($encrypted_string, Chr(0xFF), 3)
    Local $save = ""

    For $i = 0 To UBound($temp) - 1
        $save &= DecryptGamePacket2($temp[$i])
        $save &= Chr(0xFF)
    Next

    Return $save
EndFunc   ;==>DecryptGamePacket

Func DecryptGamePacket2($str)
    Local $decrypted_string = "", $len, $i = 0, $highbyte, $lowbyte
    Local $table[13] = [' ', '-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', @LF]
    Local $count = 0

    $splited = StringToASCIIArray($str,0,StringLen($str),1)

    While $count < UBound($splited)
        If ($splited[$count] <= 0x7A) Then
            $len = $splited[$count]

            For $i2 = 0 To $len - 1
                $count += 1
                $decrypted_string &= Chr(BitXOR($splited[$count], 0xFF))
            Next
            $count += 1
        Else
            $len = $splited[$count]
            $len = BitAND($len, 0x7F)

            While $i < $len
                $count += 1

                $highbyte = $splited[$count]
                $highbyte = BitAND($highbyte, 0xF0)
                $highbyte = BitShift($highbyte, 0x4)

                $lowbyte = $splited[$count]
                $lowbyte = BitAND($lowbyte, 0x0F)

                If ($highbyte >0 0x0 And $highbyte < 14) Then
                    $decrypted_string &= $table[$highbyte - 1]
                    $i += 1
                EndIf

                If ($lowbyte >0 And $lowbyte < 14) Then
                    $decrypted_string &= $table[$lowbyte - 1]
                    $i += 1
                EndIf
            WEnd
            $count += 1
        EndIf
    WEnd

    Return $decrypted_string
EndFunc   ;==>DecryptGamePacket2

Func EncryptGamePacket($str)
    Local $encrypted_string = "",$temp
    Local $buffer, $size
    Local $splited = StringToASCIIArray($str,0,StringLen($str),1)

    $buffer = StringSplit($str, ' ', 3)
    If IsArray($buffer) Then
        $temp=StringLen($buffer[0])
        If $temp>256 Then $temp-=256
        If $temp<0 Then $temp+=256
        $encrypted_string &= Chr($temp))
        For $i = 0 To UBound($splited) - 1
            If ($i = StringLen($buffer[0])) Then
                $size = StringLen($str[0]) - StringLen($buffer[0])
                If $size>256 Then $size-=256
                If $size<0 Then $size+=256
                $encrypted_string &= Chr($size)
            EndIf

            $encrypted_string &= BitXOR($splited[$i], 0xFF)
        Next
        Return $encrypted_string & Chr(0xFF)
    Else
        Return 0
    EndIf
EndFunc   ;==>EncryptGamePacket
Cos'è sta roba? O.o
Encrypt e decrypt dei pacchetti in autoit, è fondamentale per sviluppare un packetlogger o un game/login server.
(19-09-2012 05:04 PM)Ð3V!L Ha scritto: [ -> ]Cos'è sta roba? O.o

Il creatore di NosAngel dovrebbe saperlo >.<
Comunque credo che sia un decript di un codice ascii ma non so, forse è c++
(19-09-2012 05:07 PM)Lord Freud Ha scritto: [ -> ]
(19-09-2012 05:04 PM)Ð3V!L Ha scritto: [ -> ]Cos'è sta roba? O.o

Il creatore di NosAngel dovrebbe saperlo >.<
Comunque credo che sia un decript di un codice ascii ma non so, forse è c++

E' autoit, i codici in duoble word servono per l'algoritmo di encrypt e decrypt.
è AutoIT e io non me ne intendo ecco xk gliel'ho chiesto :|
Epic fail
(23-09-2012 12:21 PM)oskyrulez Ha scritto: [ -> ]Epic fail
Avvertimento per spam
Ma e un server che si sta costruendo oppure un source?
E' una libreria contenente le funzioni per decriptare/criptare i pacchetti.

Trollface-

Its a library wich translated Shadow992 from my C++ to AutoIT code for AutoIT Users.
You can't create with these a Packetlogger because this Encryptions/Decryptions are released from me for Private Servers especially.
But the other problem is that AutoIT is to slow for PServers so its maybe not the greates idea. Wink
URL di riferimento