Results 1 to 1 of 1
  1. #1
    spike21478's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    Netherlands
    Posts
    3
    Reputation
    10
    Thanks
    0

    Toxicdata's WarRock decoder class

    Found this on my computer.
    This is to decode script files.
    One of the imports is commented out as ****.
    This is because MPGH does it. Fix it yourself!

    C#:
    Code:
    using Microsoft.VisualBasic;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Data;
    using System.Diagnostics;
    using System.Text;
    using System****;
    
    public class Crypt
    {
    	public string Decode(string sText)
    	{
    		byte[] bytes = Encoding.ASCII.GetBytes(sText);
    		this.HexToString(ref bytes);
    		this.XorCrypt(ref bytes);
    		return Encoding.ASCII.GetString(bytes);
    	}
    
    	public bool DecodeFile(string sOpen, string sSafe)
    	{
    		try {
    			byte[] sData = this.loadFile(sOpen);
    			this.HexToString(ref sData);
    			this.XorCrypt(ref sData);
    			this.saveFile(sSafe, sData);
    			return true;
    		} catch (Exception obj1) {
    			return false;
    		}
    	}
    
    	public string Encode(string sText)
    	{
    		byte[] bytes = Encoding.ASCII.GetBytes(sText);
    		this.XorCrypt(ref bytes);
    		this.StringToHex(ref bytes);
    		return Encoding.ASCII.GetString(bytes);
    	}
    
    	public bool EncodeFile(string sOpen, string sSafe)
    	{
    		try {
    			byte[] sString = this.loadFile(sOpen);
    			this.XorCrypt(ref sString);
    			this.StringToHex(ref sString);
    			this.saveFile(sSafe, sString);
    			return true;
    		} catch (Exception obj1) {
    			return false;
    		}
    	}
    
    	private void HexToString(ref byte[] sData)
    	{
    		string str = Encoding.Default.GetString(sData);
    		byte[] buffer = new byte[(str.Length / 2)];
    		int i = 0;
    		for (i = 0; i <= buffer.Length - 1; i++) {
    			buffer[i] = Convert.ToByte(str.Substring((i * 2), 2), 0x10);
    		}
    		sData = buffer;
    	}
    
    	private byte[] loadFile(string sPath)
    	{
    		StreamReader reader = new StreamReader(sPath, Encoding.Default, true);
    		string s = reader.ReadToEnd();
    		reader.Close();
    		return Encoding.Default.GetBytes(s);
    	}
    
    	private void saveFile(string sPath, byte[] sData)
    	{
    		StreamWriter writer = new StreamWriter(sPath);
    		writer.Write(Encoding.Default.GetString(sData));
    		writer.Close();
    	}
    
    	private void StringToHex(ref byte[] sData)
    	{
    		StringBuilder builder = new StringBuilder((sData.Length * 2));
    		byte num = 0;
    		foreach (byte num_loopVariable in sData) {
    			num = num_loopVariable;
    			builder.AppendFormat("{0:X2}", num);
    		}
    		sData = Encoding.Default.GetBytes(builder.ToString());
    	}
    
    	public void XorCrypt(ref byte[] sString)
    	{
    		int i = 0;
    		for (i = 0; i <= sString.Length - 1; i++) {
    			sString[i] = Convert.ToByte(Convert.ToInt32((sString[i] ^ 0xd7)));
    		}
    	}
    
    }
    .NET
    Code:
    Imports System.Text
    Imports System****
    
    Public Class Crypt
        Public Function Decode(ByVal sText As String) As String
            Dim bytes As Byte() = Encoding.ASCII.GetBytes(sText)
            Me.HexToString(bytes)
            Me.XorCrypt(bytes)
            Return Encoding.ASCII.GetString(bytes)
        End Function
    
        Public Function DecodeFile(ByVal sOpen As String, ByVal sSafe As String) As Boolean
            Try
                Dim sData As Byte() = Me.loadFile(sOpen)
                Me.HexToString(sData)
                Me.XorCrypt(sData)
                Me.saveFile(sSafe, sData)
                Return True
            Catch obj1 As Exception
                Return False
            End Try
        End Function
    
        Public Function Encode(ByVal sText As String) As String
            Dim bytes As Byte() = Encoding.ASCII.GetBytes(sText)
            Me.XorCrypt(bytes)
            Me.StringToHex(bytes)
            Return Encoding.ASCII.GetString(bytes)
        End Function
    
        Public Function EncodeFile(ByVal sOpen As String, ByVal sSafe As String) As Boolean
            Try
                Dim sString As Byte() = Me.loadFile(sOpen)
                Me.XorCrypt(sString)
                Me.StringToHex(sString)
                Me.saveFile(sSafe, sString)
                Return True
            Catch obj1 As Exception
                Return False
            End Try
        End Function
    
        Private Sub HexToString(ByRef sData As Byte())
            Dim str As String = Encoding.Default.GetString(sData)
            Dim buffer As Byte() = New Byte((str.Length / 2) - 1) {}
            Dim i As Integer
            For i = 0 To buffer.Length - 1
                buffer(i) = Convert.ToByte(str.Substring((i * 2), 2), &H10)
            Next i
            sData = buffer
        End Sub
    
        Private Function loadFile(ByVal sPath As String) As Byte()
            Dim reader As New StreamReader(sPath, Encoding.Default, True)
            Dim s As String = reader.ReadToEnd
            reader.Close()
            Return Encoding.Default.GetBytes(s)
        End Function
    
        Private Sub saveFile(ByVal sPath As String, ByVal sData As Byte())
            Dim writer As New StreamWriter(sPath)
            writer.Write(Encoding.Default.GetString(sData))
            writer.Close()
        End Sub
    
        Private Sub StringToHex(ByRef sData As Byte())
            Dim builder As New StringBuilder((sData.Length * 2))
            Dim num As Byte
            For Each num In sData
                builder.AppendFormat("{0:X2}", num)
            Next
            sData = Encoding.Default.GetBytes(builder.ToString)
        End Sub
    
        Public Sub XorCrypt(ByRef sString As Byte())
            Dim i As Integer
            For i = 0 To sString.Length - 1
                sString(i) = Convert.ToByte(CInt((sString(i) Xor &HD7)))
            Next i
        End Sub
    
    End Class
    Take no credits.
    Last edited by spike21478; 12-25-2011 at 03:48 PM.

Similar Threads

  1. [Release] Warrock File Decoder and Encoder
    By dario354 in forum WarRock Discussions
    Replies: 11
    Last Post: 04-28-2011, 06:02 AM
  2. Warrock Favorite Class To Hack On
    By BlackLizard in forum WarRock Discussions
    Replies: 18
    Last Post: 07-19-2010, 05:13 AM
  3. Warrock Hack - Tutorial
    By Dave84311 in forum WarRock - International Hacks
    Replies: 667
    Last Post: 10-09-2007, 10:10 AM
  4. WarRock Auto Vehicle Repair Hack
    By mortis123 in forum WarRock - International Hacks
    Replies: 12
    Last Post: 01-17-2006, 08:40 PM
  5. I'M need hax to WARROCK
    By xzizexzize in forum WarRock - International Hacks
    Replies: 5
    Last Post: 12-27-2005, 11:07 PM