private void btn_save_Click(object sender, EventArgs e) { string saveLocation = sfDialog(); saveINI(saveLocation); if (MessageBox.Show("Would you like to send this to the server?", "Oi m8", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { Thread iniThread = new Thread(new ThreadStart(delegate { try { TcpClient client = new TcpClient(Globals.IPAddr, Globals.SvrPort); NetworkStream nStream = client.GetStream(); EndianIO readerIO = new EndianIO(nStream, EndianStyle.BigEndian) { Writer = new EndianWriter(nStream, EndianStyle.BigEndian) }; EndianIO writerIO = new EndianIO(nStream, EndianStyle.BigEndian); writerIO.Writer.Write("2F9A59018B92AA2C3B375D0D66CF8255"); LMAOnlineLBS.sendINI(readerIO, writerIO, saveLocation); readerIO.Close(); writerIO.Close(); nStream.Close(); } catch { } })); iniThread.Start(); MessageBox.Show("INI sent to server and loaded.", "INI Sent!"); } }
public static void PokeRTHData(RTHData RTH_Data) { //If our XDKName is set if (AppSettings.Settings.XDKName == "") { throw new Exception( "The Xbox Development Kit could not be connected to because it's means of connection were not set."); } //Initialize our XDC360 XboxDebugCommunicator xdc = new XboxDebugCommunicator(AppSettings.Settings.XDKName); //Connect xdc.Connect(); //Get our Xbox Memory Stream XboxMemoryStream xbms = xdc.ReturnXboxMemoryStream(); //Initialize our Endian IO EndianIO IO = new EndianIO(xbms, EndianType.BigEndian); //Open our IO IO.Open(); //Loop through every RTH Data Block for (int index = 0; index < RTH_Data.RTH_Data_Blocks.Count; index++) { //Go to that RTH Data Block's memory offset IO.Out.BaseStream.Position = RTH_Data.RTH_Data_Blocks[index].Memory_Offset; //Write our data IO.Out.Write(RTH_Data.RTH_Data_Blocks[index].Data_Block); } //Close our IO IO.Close(); //Close our Xbox Memory Stream xbms.Close(); //Disconnect from our Xbox Development Kit xdc.Disconnect(); }
public void SaveData(Stream stream) { //Initialize our IO EndianIO IO = new EndianIO(stream, EndianType.BigEndian); //Open our IO IO.Open(); //Write our header string IO.Out.WriteAsciiString(RTHDataHeader.HeaderString, 4); //Write our header version IO.Out.Write(RTHDataHeader.Version); //Write our block count IO.Out.Write(RTH_Data_Blocks.Count); //Write our patch type IO.Out.Write((int)RTH_Data_Header.Patch_Type); //Write our author name IO.Out.WriteAsciiString(RTH_Data_Header.Author_Name, 32); //Write our patch description IO.Out.WriteAsciiString(RTH_Data_Header.Patch_Description, 256); //Write our author IP IO.Out.WriteAsciiString(RTH_Data_Header.Watermark, 16); //Loop through our blocks for (int index = 0; index < RTH_Data_Blocks.Count; index++) { //Write our memory offset IO.Out.Write(RTH_Data_Blocks[index].Memory_Offset); //Write our block size IO.Out.Write(RTH_Data_Blocks[index].Block_Size); //Write our data block IO.Out.Write(RTH_Data_Blocks[index].Data_Block); } //Close our IO IO.Close(); }
private void ChangeHaloODSTFillMode() { //If the user didnt set the XDK name. if (AppSettings.Settings.XDKName == "") { //Show our error. MessageBox.Show( "The Xbox Development Kit could not be connected to because it's means of connection were not set."); //Stop processing code in this stub. return; } //Initialize our Xbox Debug Communicator, with our XDK name/IP. XboxDebugCommunicator xdc = new XboxDebugCommunicator(AppSettings.Settings.XDKName); //Connect to our Xbox Debug Communicator. xdc.Connect(); //Create an Xbox Memory Stream. XboxMemoryStream xbms = xdc.ReturnXboxMemoryStream(); //Create an endian IO for our Memory Stream. EndianIO IO = new EndianIO(xbms, EndianType.BigEndian); //Open our IO. IO.Open(); //Go to the address of the fillmode. IO.SeekTo(0x821A8C60); //If our solid item is checked. if (menuButtonItem32.Checked) { //Write our solid value. IO.Out.Write(0x38800000); } //Otherwise if our Point item is checked. else if (menuButtonItem33.Checked) { //Write our point value. IO.Out.Write(0x38800001); } //Otherwise if our Wireframe item is checked. else if (menuButtonItem34.Checked) { //Write our wireframe value. IO.Out.Write(0x38800025); } //Close our IO. IO.Close(); //Disconnect from our Xbox. xdc.Disconnect(); }
private void buttonX9_Click(object sender, EventArgs e) { //If the Xbox_Debug_Communicator isn't null if (Xbox_Debug_Communicator != null) { //If it is connected.. if (Xbox_Debug_Communicator.Connected) { //Get our memory stream. XboxMemoryStream xms = Xbox_Debug_Communicator.ReturnXboxMemoryStream(); //Create our IO EndianIO IO = new EndianIO(xms, EndianType.BigEndian); //Open our IO IO.Open(); //Go to our offset IO.In.BaseStream.Position = 0x3A00C000 + 0x1A874; //Read our macbin byte[] macbin = IO.In.ReadBytes(0x1D0); //Close our IO IO.Close(); //Create our savefiledialog SaveFileDialog sfd = new SaveFileDialog(); //Set our filter sfd.Filter = "Mac Bin(.bin)|*.bin"; //Show our dialog, if the result is OK if (sfd.ShowDialog() == DialogResult.OK) { //Create our IO IO = new EndianIO(new FileStream(sfd.FileName, FileMode.Create), EndianType.BigEndian); //Open our IO IO.Open(); //Write our macbin data. IO.Out.Write(macbin); //Close our IO IO.Close(); //Show our messagebox MessageBox.Show("Done."); } return; } } //We aren't connected MessageBox.Show("You are not connected."); }
public BLFImageFile(Stream stream) { EndianIO iO = new EndianIO(stream, EndianType.BigEndian); iO.Open(); this.BLFHeader = new BLF_Header(iO, 0); this.BLFImage = Image.FromStream(new MemoryStream(iO.In.ReadBytes(this.BLFHeader.FileContentSize))); this.EOFFooter = new EOF_Footer(iO, (int)iO.In.BaseStream.Position); iO.Close(); }
public void SaveInfoFile(Stream stream) { EndianIO nio = new EndianIO(stream, EndianType.BigEndian); nio.Open(); nio.Out.WriteAsciiString("_blf", 4); nio.Out.Write(0x30); nio.Out.Write((short)1); nio.Out.Write((short)2); nio.Out.Write((short)(-2)); nio.Out.Write(new byte[0x22]); nio.Out.WriteAsciiString("levl", 4); nio.Out.Write((short)0); nio.Out.Write(new byte[] { 0x4d, 80, 0, 3 }); nio.Out.Write((short)1); nio.Out.Write(this.BLFHeader.Map_ID); nio.Out.Write(0x4c); nio.Out.BaseStream.Position = 0x44L; nio.Out.WriteUnicodeString(this.EnglishName, 0x20); nio.Out.WriteUnicodeString(this.JapaneseName, 0x20); nio.Out.WriteUnicodeString(this.GermanName, 0x20); nio.Out.WriteUnicodeString(this.FrenchName, 0x20); nio.Out.WriteUnicodeString(this.SpanishName, 0x20); nio.Out.WriteUnicodeString(this.LatinAmericaSpanishName, 0x20); nio.Out.WriteUnicodeString(this.ItalianName, 0x20); nio.Out.WriteUnicodeString(this.KoreanName, 0x20); nio.Out.WriteUnicodeString(this.ChineseName, 0x20); nio.Out.Write(new byte[0x40]); nio.Out.WriteUnicodeString(this.PortugueseName, 0x20); nio.Out.Write(new byte[0x40]); nio.Out.WriteUnicodeString(this.EnglishDescription, 0x80); nio.Out.WriteUnicodeString(this.JapaneseDescription, 0x80); nio.Out.WriteUnicodeString(this.GermanDescription, 0x80); nio.Out.WriteUnicodeString(this.FrenchDescription, 0x80); nio.Out.WriteUnicodeString(this.SpanishDescription, 0x80); nio.Out.WriteUnicodeString(this.LatinAmericanSpanishDescription, 0x80); nio.Out.WriteUnicodeString(this.ItalianDescription, 0x80); nio.Out.WriteUnicodeString(this.KoreanDescription, 0x80); nio.Out.WriteUnicodeString(this.ChineseDescription, 0x80); nio.Out.Write(new byte[0x100]); nio.Out.WriteUnicodeString(this.PortugueseDescription, 0x80); nio.Out.Write(new byte[0x100]); nio.Out.WriteAsciiString(this.MapImageFileName, 0x100); nio.Out.WriteAsciiString(this.MapFileName, 0x100); nio.Out.Write(new byte[0x3c3c]); int position = (int)nio.Stream.Position; nio.Out.WriteAsciiString("_eof", 4); nio.Out.Write(0x111); nio.Out.Write(0x10001); nio.Out.Write(position); nio.Out.Write((byte)3); nio.Out.Write(new byte[0x100]); nio.Close(); }
private void menuButtonItem28_Activate_1(object sender, EventArgs e) { //Inverse our check. menuButtonItem28.Checked = !menuButtonItem28.Checked; //Change our debug hud text. //If the user didnt set the XDK name. if (AppSettings.Settings.XDKName == "") { //Show our error. MessageBox.Show( "The Xbox Development Kit could not be connected to because it's means of connection were not set."); //Stop processing code in this stub. return; } //Initialize our Xbox Debug Communicator, with our XDK name/IP. XboxDebugCommunicator xdc = new XboxDebugCommunicator(AppSettings.Settings.XDKName); //Connect to our Xbox Debug Communicator. xdc.Connect(); //Create an Xbox Memory Stream. XboxMemoryStream xbms = xdc.ReturnXboxMemoryStream(); //Create an endian IO for our Memory Stream. EndianIO IO = new EndianIO(xbms, EndianType.BigEndian); //Open our IO. IO.Open(); //Goto the Address of the jump to the debug text. IO.SeekTo(0x821978B0); //If our print cam info item is checked.. if (menuButtonItem28.Checked) { //Write our ASM value indicating a no operation. IO.Out.Write(0x60000000);//Nop } //Otherwise else { //Write our jump offset. IO.Out.Write(0x419A01D8); } //Close our IO. IO.Close(); //Disconnect from our xbox. xdc.Disconnect(); }
private void menuBarItem2_BeforePopup(object sender, TD.SandBar.MenuPopupEventArgs e) { //If the XDK Name isn't blank if (AppSettings.Settings.XDKName != "") { //Initialize our Xbox Debug Communicator, with our Xbox Name XboxDebugCommunicator Xbox_Debug_Communicator = new XboxDebugCommunicator(AppSettings.Settings.XDKName); //Connect Xbox_Debug_Communicator.Connect(); //Get the memoryStream XboxMemoryStream xbms = Xbox_Debug_Communicator.ReturnXboxMemoryStream(); //Endian IO EndianIO IO = new EndianIO(xbms, EndianType.BigEndian); IO.Open(); //Loop through every ident for (int i = 0; i < identGrid.Items.Count; i++) { //Get the offset int offset = int.Parse(identGrid.Items[i].SubItems[1].Text.Substring(2), System.Globalization.NumberStyles.HexNumber) + Map.MapHeader.mapMagic; try { //Get the tagclass and name string tagClass = identGrid.Items[i].SubItems[2].Text; string tagName = identGrid.Items[i].SubItems[3].Text; //Get our tag ID int tagID = Map.IndexItems[Map.GetTagIndexByClassAndName(tagClass, tagName)].Ident; //Make our IO go to the offset IO.Out.BaseStream.Position = offset; //Write our tagclass IO.Out.WriteAsciiString(tagClass, 4); //Skip 8 bytes IO.Out.BaseStream.Position += 8; //Write our ID IO.Out.Write(tagID); } catch { } } IO.Close(); xbms.Close(); //Disconnect Xbox_Debug_Communicator.Disconnect(); MessageBox.Show("Done."); } else { //Show our error dialog MessageBox.Show("XDK Name/IP was not set. Please set it before continuing."); //Stop processing code. return; } }
public static byte[] ValueToBytes(float data) { MemoryStream ms = new MemoryStream(); EndianIO IO = new EndianIO(ms, EndianType.BigEndian); IO.Open(); IO.Out.Write(data); IO.In.BaseStream.Position = 0; byte[] array = IO.In.ReadBytes((int)IO.In.BaseStream.Length); IO.Close(); ms.Close(); return(array); }
/// <summary> /// This way of initializing an instance of RTH Data would allow you to read an existing RTH Data file, and rebuild it, or apply it. /// </summary> /// <param name="stream">This is the stream to read the existing RTH Data from</param> public RTHData(Stream stream) { //Initialize our IO EndianIO IO = new EndianIO(stream, EndianType.BigEndian); //Open our IO IO.Open(); //Initialize and read our RTHDataHeader RTH_Data_Header = new RTHDataHeader(IO); //Initialize RTH Blocks RTH_Data_Blocks = new RTHDataBlocks(IO); //Close our IO IO.Close(); }
public static byte[] ValueToBytes(float data, EndianType et) { var ms = new MemoryStream(); var io = new EndianIO(ms, et); io.Open(); io.Writer.Write(data); io.Reader.BaseStream.Position = 0; var array = io.Reader.ReadBytes((int)io.Reader.BaseStream.Length); io.Close(); ms.Close(); return(array); }
public BLFImageFile(Stream stream) { //Create our instance of the IO EndianIO IO = new EndianIO(stream, EndianType.BigEndian); //Open our IO IO.Open(); //Read our BLF Header BLFHeader = new BLF_Header(IO, 0); //Read our image BLFImage = Image.FromStream(new MemoryStream(IO.In.ReadBytes(BLFHeader.FileContentSize))); //Read our End of File EOFFooter = new EOF_Footer(IO, (int)IO.In.BaseStream.Position); //CloseIO IO.Close(); }
private void button2_Click(object sender, EventArgs e) { if (AppSettings.Settings.IP_and_XDK_Name == "") { OutputMessenger.OutputMessage("XDK Name not set. Please set it in settings before continuing.", this); } else { XboxDebugCommunicator communicator = new XboxDebugCommunicator(AppSettings.Settings.IP_and_XDK_Name); communicator.Connect(); communicator.Freeze(); XboxMemoryStream stream = communicator.ReturnXboxMemoryStream(); EndianIO nio = new EndianIO(stream, EndianType.BigEndian); nio.Open(); int tagIndexByClassAndName = Map.GetTagIndexByClassAndName(cmbxClass.Text, cmbxName.Text); string str = "Null"; string name = "Null"; if (tagIndexByClassAndName != -1) { str = Map.Index_Items[tagIndexByClassAndName].Class; name = Map.Index_Items[tagIndexByClassAndName].Name; } for (int i = 0; i < IdentGrid.SelectedItems.Count; i++) { int num3 = int.Parse(IdentGrid.SelectedItems[i].SubItems[1].Text.Substring(2), NumberStyles.HexNumber) + Map.Map_Header.mapMagic; if (tagIndexByClassAndName != -1) { nio.Out.BaseStream.Position = num3; nio.Out.WriteAsciiString(str, 4); } nio.Out.BaseStream.Position = num3 + 12; if (tagIndexByClassAndName != -1) { nio.Out.Write(Map.Index_Items[tagIndexByClassAndName].Ident); } else { nio.Out.Write(-1); } } nio.Close(); stream.Close(); communicator.Unfreeze(); communicator.Disconnect(); OutputMessenger.OutputMessage("Sucessfully poked " + IdentGrid.SelectedItems.Count.ToString() + " tag references to: \"" + name + "." + str + "\"", IdentGrid); } }
public void SaveBLFImage(Stream stream, BLFImageType imgType) { EndianIO nio = new EndianIO(stream, EndianType.BigEndian); nio.Open(); nio.Out.WriteAsciiString("_blf", 4); nio.Out.Write(0x30); nio.Out.Write((short)1); nio.Out.Write((short)2); nio.Out.Write((short)(-2)); nio.Out.Write(new byte[0x22]); nio.Out.WriteAsciiString("mapi", 4); MemoryStream stream2 = new MemoryStream(); if ((imgType == BLFImageType.BaseImage) | (imgType == BLFImageType.BaseImage)) { this.BLFImage.Save(stream2, ImageFormat.Jpeg); } else { this.BLFImage.Save(stream2, ImageFormat.Png); } byte[] buffer = stream2.ToArray(); stream2.Close(); nio.Out.Write((int)(buffer.Length + 20)); nio.Out.Write((short)1); nio.Out.Write((short)1); nio.Out.Write((int)imgType); nio.Out.Write(buffer.Length); nio.Out.Write(buffer); int position = (int)nio.Stream.Position; nio.Out.WriteAsciiString("_eof", 4); nio.Out.Write(0x111); nio.Out.Write(0x10001); nio.Out.Write(position); nio.Out.Write((byte)3); nio.Out.Write(new byte[0x100]); nio.Close(); }
public static void PrintCamDebugInfo(bool printingCam) { string xboxName = AppSettings.Settings.IP_and_XDK_Name; if (xboxName != "") { XboxDebugCommunicator communicator = new XboxDebugCommunicator(xboxName); communicator.Connect(); EndianIO nio = new EndianIO(communicator.ReturnXboxMemoryStream(), EndianType.BigEndian); nio.Open(); communicator.Freeze(); nio.Out.BaseStream.Position = 0x82191eecL; if (printingCam) { nio.Out.Write(0x60000000); } else { nio.Out.Write(0x419a01b0); } nio.Out.BaseStream.Position = 0x82191f04L; if (printingCam) { nio.Out.Write(0x60000000); } else { nio.Out.Write(0x419a01b0); } communicator.Unfreeze(); nio.Close(); communicator.Disconnect(); } else { MessageBox.Show("XDK name not set. Please set it in settings before continuing."); } }
private void buttonX1_Click(object sender, EventArgs e) { //If the XDK Name isn't blank if (AppSettings.Settings.XDKName != "") { //Initialize our Xbox Debug Communicator, with our Xbox Name XboxDebugCommunicator Xbox_Debug_Communicator = new XboxDebugCommunicator(AppSettings.Settings.XDKName); //Connect Xbox_Debug_Communicator.Connect(); //Get our memory stream XboxMemoryStream xbms = Xbox_Debug_Communicator.ReturnXboxMemoryStream(); //Create our IO EndianIO IO = new EndianIO(xbms, EndianType.BigEndian); //Open our IO IO.Open(); //If we are to remove soft barriers if (chkRemoveSoftBarriers.Checked) { } //Close our IO IO.Close(); //Disconnect Xbox_Debug_Communicator.Disconnect(); //Null our communicator Xbox_Debug_Communicator = null; } else { MessageBox.Show("No XDK Name is set. Please set it in settings before continuing."); } }
public InfoFile(Stream stream) { EndianIO iO = new EndianIO(stream, EndianType.BigEndian); iO.Open(); this.BLFHeader = new BLF_Header(iO, 0); iO.In.BaseStream.Position = 0x44L; this.EnglishName = iO.In.ReadUnicodeString(0x20); this.JapaneseName = iO.In.ReadUnicodeString(0x20); this.GermanName = iO.In.ReadUnicodeString(0x20); this.FrenchName = iO.In.ReadUnicodeString(0x20); this.SpanishName = iO.In.ReadUnicodeString(0x20); this.LatinAmericaSpanishName = iO.In.ReadUnicodeString(0x20); this.ItalianName = iO.In.ReadUnicodeString(0x20); this.KoreanName = iO.In.ReadUnicodeString(0x20); this.ChineseName = iO.In.ReadUnicodeString(0x20); iO.In.ReadBytes(0x40); this.PortugueseName = iO.In.ReadUnicodeString(0x20); iO.In.ReadBytes(0x40); this.EnglishDescription = iO.In.ReadUnicodeString(0x80); this.JapaneseDescription = iO.In.ReadUnicodeString(0x80); this.GermanDescription = iO.In.ReadUnicodeString(0x80); this.FrenchDescription = iO.In.ReadUnicodeString(0x80); this.SpanishDescription = iO.In.ReadUnicodeString(0x80); this.LatinAmericanSpanishDescription = iO.In.ReadUnicodeString(0x80); this.ItalianDescription = iO.In.ReadUnicodeString(0x80); this.KoreanDescription = iO.In.ReadUnicodeString(0x80); this.ChineseDescription = iO.In.ReadUnicodeString(0x80); iO.In.ReadBytes(0x100); this.PortugueseDescription = iO.In.ReadUnicodeString(0x80); iO.In.ReadBytes(0x100); this.MapImageFileName = iO.In.ReadAsciiString(0x100); this.MapFileName = iO.In.ReadAsciiString(0x100); iO.In.ReadBytes(0xbb74); this.EOFFooter = new EOF_Footer(iO, (int)iO.In.BaseStream.Position); iO.Close(); }
public static byte[] ValueToBytes(float data, EndianType et) { var ms = new MemoryStream(); var io = new EndianIO(ms, et); io.Open(); io.Writer.Write(data); io.Reader.BaseStream.Position = 0; var array = io.Reader.ReadBytes((int)io.Reader.BaseStream.Length); io.Close(); ms.Close(); return array; }
private void clientHandle(object clientObj) { TcpClient Client = (TcpClient)clientObj; TmpEntry entry = new TmpEntry(); NetworkStream nStream = Client.GetStream(); PoorManStream pmStream = new PoorManStream(nStream); IPAddr = Client.Client.RemoteEndPoint.ToString(); try { Globals.write("{0} [{1}] PING", Globals.allowAnonUsers ? "Anon" : "Client", IPAddr); entry.ClientIP = IPAddr.Split(':')[0]; BufferCount = 8; mainBuff = new byte[BufferCount]; myCockBuff = new byte[0x10]; if (nStream.Read(mainBuff, 0, 8) != 8) { Client.Close(); Globals.write("Niggered 1 - BuffCount: {0}", BufferCount); return; } EndianIO mainIO = new EndianIO(mainBuff, EndianStyle.BigEndian); uint CommandID = mainIO.Reader.ReadUInt32(); BufferCount = mainIO.Reader.ReadInt32(); if (BufferCount >= 0x8000) { Client.Close(); Globals.write("Niggered 2 - BuffCount: {0}", BufferCount); return; } mainBuff = new byte[BufferCount]; EndianIO writerIO = new EndianIO(pmStream, EndianStyle.BigEndian); EndianIO readerIO = new EndianIO(mainBuff, EndianStyle.BigEndian) { Writer = new EndianWriter(pmStream, EndianStyle.BigEndian) }; EndianWriter structIO = new EndianIO(myCockBuff, EndianStyle.BigEndian).Writer; if (pmStream.Read(mainBuff, 0, BufferCount) != BufferCount) { Client.Close(); Globals.write("Niggered 3 [{0}]", IPAddr); return; } switch (CommandID) { case Globals.XSTL_SERVER_COMMAND_ID_GET_SALT: getSalt(ref entry, readerIO, writerIO); break; case Globals.XSTL_SERVER_COMMAND_ID_GET_STATUS: xexChecks(ref entry, readerIO, writerIO); break; case Globals.XSTL_SERVER_COMMAND_ID_GET_CHAL_RESPONCE: //HVC(ref entry, readerIO, writerIO); getChallResp(ref entry, readerIO, writerIO); // Updated to HVC method break; case Globals.XSTL_SERVER_COMMAND_ID_UPDATE_PRESENCE: updatePresence(ref entry, readerIO, writerIO); break; case Globals.XSTL_SERVER_COMMAND_ID_GET_XOSC: getXOSC(ref entry, readerIO, writerIO); break; case Globals.XSTL_SERVER_COMMAND_ID_GET_INFO: returnInfo(ref entry, readerIO, writerIO); break; case Globals.XSTL_SERVER_COMMAND_ID_REDEEM_TOKEN: con_redeem(ref entry, readerIO, writerIO, structIO); break; case Globals.XSTL_SERVER_COMMAND_ID_LOL_SPOOFY: HandleSpoofy(ref entry); break; case Globals.XSTL_SERVER_COMMAND_ID_GET_MESSAGE: retMessage(ref entry, readerIO, writerIO, structIO); break; case Globals.XSTL_SERVER_COMMAND_ID_GET_PATCHES: patchData(ref entry, readerIO, writerIO); break; default: Globals.write("Client [{0}] Some f****r sent an invalid request! Gottem!", IPAddr); Client.Close(); // Invalid or unknown response. F**k'em. break; } //if (BufferCount >= 0x10) // ConsoleMySQL.saveConsole(ref entry); try { mainIO.Close(); readerIO.Close(); writerIO.Close(); structIO.Close(); } catch { } // Since we can't always do this... } catch (Exception ex) { if (Globals.printClientCrash) { Globals.write("Client [{0}] Crashed! Closed connection... Detailed: {1} || {2}", IPAddr, ex.Source, ex.Message); } Client.Close(); } }
private void getChallResp(ref TmpEntry entry, EndianIO readerIO, EndianIO writerIO) { SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider(); bool Crl = false, Fcrt = false, Type1kv = false; uint[] chalVars = { 0x23289d3 /*Num 9*/, 0xd83e /*Num10*/, 0x304000d /*Num11*/, 0x1F8FC0D /*num11-this (type1KV)*/ }; entry.ClientSession = Misc.BytesToHexString(readerIO.Reader.ReadBytes(0x10)); entry.ClientSalt = Misc.BytesToHexString(readerIO.Reader.ReadBytes(0x10)); if (BufferCount > 0x20) { Crl = readerIO.Reader.ReadBoolean(); Fcrt = readerIO.Reader.ReadBoolean(); Type1kv = readerIO.Reader.ReadBoolean(); } if (ConsoleMySQL.getConsole(ref entry, true)) { if (entry.ClientEnabled) { EndianIO seekIO = new EndianIO(Globals.ChalBytes, EndianStyle.BigEndian); seekIO.Stream.Seek(0x2EL, SeekOrigin.Begin); seekIO.Writer.Write((Type1kv ? (ushort)(chalVars[1] & -33) : chalVars[1])); seekIO.Stream.Seek(0x38L, SeekOrigin.Begin); seekIO.Writer.Write((Crl ? (chalVars[0] | (Fcrt ? 0x1000000 : 0x10000)) : chalVars[0])); seekIO.Writer.Write((Type1kv ? chalVars[2] - chalVars[3] : chalVars[2])); seekIO.Stream.Seek(0xEC, SeekOrigin.Begin); // HV Salt Begin sha1.TransformBlock(Misc.HexStringToBytes(entry.ClientSalt), 0, 0x10, null, 0); sha1.TransformBlock(Globals.HVBytes, 0x34, 0x40, null, 0); sha1.TransformBlock(Globals.HVBytes, 0x78, 0xf88, null, 0); sha1.TransformBlock(Globals.HVBytes, 0x100c0, 0x40, null, 0); sha1.TransformBlock(Globals.HVBytes, 0x10350, 0xDF0, null, 0); sha1.TransformBlock(Globals.HVBytes, 0x16D20, 0x2E0, null, 0); sha1.TransformBlock(Globals.HVBytes, 0x20000, 0xffc, null, 0); sha1.TransformFinalBlock(Globals.HVBytes, 0x30000, 0xffc); entry.ClientHVSalt = sha1.Hash; // HV Salt End seekIO.Writer.Write(entry.ClientHVSalt); seekIO.Writer.Flush(); seekIO.Close(); // End SeekIO BufferCount = 256; mainBuff = new byte[BufferCount]; Buffer.BlockCopy(Globals.ChalBytes, 0x20, mainBuff, 0x20, 0xE0);//Padding EndianIO statusIO = new EndianIO(mainBuff, EndianStyle.BigEndian); statusIO.Writer.Write(Globals.XSTL_STATUS_STEALTHED); writerIO.Writer.Write(mainBuff); File.WriteAllBytes("dmp\\resp.dmp", mainBuff); Globals.write("Client [{0}] HVSalt Sent - CPUKey: {1}", IPAddr, entry.CPUKey); } else { writerIO.Writer.Write(Globals.XSTL_STATUS_EXPIRED); } } else { writerIO.Writer.Write(Globals.XSTL_STATUS_ERROR); } }
public void SaveInfoFile(Stream stream) { //Create our instance of our IO EndianIO IO = new EndianIO(stream, EndianType.BigEndian); //Open our IO IO.Open(); //BLF Header #region BLF Header //Write our _blf string IO.Out.WriteAsciiString("_blf", 0x4); //Write the headersize IO.Out.Write(48); //Write the unknown values IO.Out.Write((short)1); IO.Out.Write((short)2); IO.Out.Write((short)-2); //Write the whitespace of blank values IO.Out.Write(new byte[0x22]); //Write our ending portion IO.Out.WriteAsciiString("levl", 0x4); IO.Out.Write((short)0); IO.Out.Write(new byte[0x4] { 0x4D, 0x50, 0x00, 0x03 }); IO.Out.Write((short)1); IO.Out.Write(BLFHeader.Map_ID); IO.Out.Write(76); #endregion //Write entires #region Entries //Go to our entry table IO.Out.BaseStream.Position = 0x44; //Write our names. IO.Out.WriteUnicodeString(EnglishName, 0x20); IO.Out.WriteUnicodeString(JapaneseName, 0x20); IO.Out.WriteUnicodeString(GermanName, 0x20); IO.Out.WriteUnicodeString(FrenchName, 0x20); IO.Out.WriteUnicodeString(SpanishName, 0x20); IO.Out.WriteUnicodeString(LatinAmericaSpanishName, 0x20); IO.Out.WriteUnicodeString(ItalianName, 0x20); IO.Out.WriteUnicodeString(KoreanName, 0x20); IO.Out.WriteUnicodeString(ChineseName, 0x20); //Write our blank IO.Out.Write(new byte[0x40]); //Finish reading our names IO.Out.WriteUnicodeString(PortugueseName, 0x20); //Write our blank IO.Out.Write(new byte[0x40]); //Write our descriptions IO.Out.WriteUnicodeString(EnglishDescription, 0x80); IO.Out.WriteUnicodeString(JapaneseDescription, 0x80); IO.Out.WriteUnicodeString(GermanDescription, 0x80); IO.Out.WriteUnicodeString(FrenchDescription, 0x80); IO.Out.WriteUnicodeString(SpanishDescription, 0x80); IO.Out.WriteUnicodeString(LatinAmericanSpanishDescription, 0x80); IO.Out.WriteUnicodeString(ItalianDescription, 0x80); IO.Out.WriteUnicodeString(KoreanDescription, 0x80); IO.Out.WriteUnicodeString(ChineseDescription, 0x80); //Write our blank IO.Out.Write(new byte[0x100]); //Finish reading descriptions IO.Out.WriteUnicodeString(PortugueseDescription, 0x80); //Write our blank IO.Out.Write(new byte[0x100]); //Write our resource filenames IO.Out.WriteAsciiString(MapImageFileName, 0x100); IO.Out.WriteAsciiString(MapFileName, 0x100); //Write unimportant IO.Out.Write(new byte[0x3C3C]); #endregion //TODO: Write the End of File Footer #region EOF Footer int totalSize = (int)IO.Stream.Position; IO.Out.WriteAsciiString("_eof", 4); IO.Out.Write(0x111); IO.Out.Write(0x10001); IO.Out.Write(totalSize); IO.Out.Write((byte)0x03); IO.Out.Write(new byte[0x100]); #endregion //Close our IO IO.Close(); }
public InfoFile(Stream stream) { //Initialize our IO. EndianIO IO = new EndianIO(stream, EndianType.BigEndian); //Open the IO IO.Open(); //Read our blf header, which is at offset 0 BLFHeader = new BLF_Header(IO, 0); //Go to our entry table IO.In.BaseStream.Position = 0x44; //Read our Names EnglishName = IO.In.ReadUnicodeString(0x20); JapaneseName = IO.In.ReadUnicodeString(0x20); GermanName = IO.In.ReadUnicodeString(0x20); FrenchName = IO.In.ReadUnicodeString(0x20); SpanishName = IO.In.ReadUnicodeString(0x20); LatinAmericaSpanishName = IO.In.ReadUnicodeString(0x20); ItalianName = IO.In.ReadUnicodeString(0x20); KoreanName = IO.In.ReadUnicodeString(0x20); ChineseName = IO.In.ReadUnicodeString(0x20); //Skip unimportant IO.In.ReadBytes(0x40); PortugueseName = IO.In.ReadUnicodeString(0x20); //Skip unimportant IO.In.ReadBytes(0x40); //Read our descriptions EnglishDescription = IO.In.ReadUnicodeString(0x80); JapaneseDescription = IO.In.ReadUnicodeString(0x80); GermanDescription = IO.In.ReadUnicodeString(0x80); FrenchDescription = IO.In.ReadUnicodeString(0x80); SpanishDescription = IO.In.ReadUnicodeString(0x80); LatinAmericanSpanishDescription = IO.In.ReadUnicodeString(0x80); ItalianDescription = IO.In.ReadUnicodeString(0x80); KoreanDescription = IO.In.ReadUnicodeString(0x80); ChineseDescription = IO.In.ReadUnicodeString(0x80); //Skip unimportant IO.In.ReadBytes(0x100); PortugueseDescription = IO.In.ReadUnicodeString(0x80); //Skip unimportant IO.In.ReadBytes(0x100); //Read the resource filenames MapImageFileName = IO.In.ReadAsciiString(0x100); MapFileName = IO.In.ReadAsciiString(0x100); //Skip unimportant IO.In.ReadBytes(0x3C3C); //Read our End of file footer EOFFooter = new EOF_Footer(IO, (int)IO.In.BaseStream.Position); //Close our IO IO.Close(); }
public static void LoadMap(LevelOption Level_Map, GameBuild build) { string xboxName = AppSettings.Settings.IP_and_XDK_Name; if (xboxName != "") { XboxDebugCommunicator communicator = new XboxDebugCommunicator(xboxName); try { communicator.Connect(); } catch (Exception ex) { throw new Exception("Not Connected"); } EndianIO nio = new EndianIO(communicator.ReturnXboxMemoryStream(), EndianType.BigEndian); nio.Open(); communicator.Freeze(); if (build == GameBuild.PreBeta) { nio.Out.BaseStream.Position = 0x83b8dea8L; } else { nio.Out.BaseStream.Position = 0x8357d140L; } nio.Out.WriteAsciiString(beta_mapScenarioPaths[(int)Level_Map], 0x100); if (build == GameBuild.PreBeta) { nio.Out.BaseStream.Position = 0x83b7fe78L; } else { nio.Out.BaseStream.Position = 0x8356f110L; } if (Level_Map <= LevelOption.boneyard) { nio.Out.Write((int)AppSettings.Settings.Force_Load_MapType); } else { byte[] buffer = new byte[4]; buffer[3] = 2; nio.Out.Write(buffer); } if (build == GameBuild.PreBeta) { nio.Out.BaseStream.Position = 0x83b7fe6eL; } else { nio.Out.BaseStream.Position = 0x8356f106L; } nio.Out.Write((byte)1); communicator.Unfreeze(); nio.Close(); communicator.Disconnect(); } else { MessageBox.Show("XDK name not set. Please set it in settings before continuing."); } }
public static void WriteEMF(string FilePath, ModelInfo Mi, Permutation.LOD LOD, bool ExportNodes, bool ExportMakers, System.Windows.Forms.TreeView treeView) { // Create our file EndianIO io = new EndianIO(FilePath, EndianType.LittleEndian); io.Open(); // Write out our header io.Out.Write(0x21666D65); // emf! io.Out.Write(0x00000001); // version #1 // Write our model name io.Out.Write(Mi.Name.ToCharArray()); io.Out.Write((byte)0x00); // Write our nodes if (ExportNodes) { io.Out.Write(Mi.Nodes.Count); for (int x = 0; x < Mi.Nodes.Count; x++) { io.Out.Write(Mi.Nodes[x].Name.ToCharArray()); io.Out.Write((byte)0x00); io.Out.Write(Mi.Nodes[x].ParentNodeIndex); io.Out.Write(Mi.Nodes[x].DefaultTranslationX); io.Out.Write(Mi.Nodes[x].DefaultTranslationY); io.Out.Write(Mi.Nodes[x].DefaultTranslationZ); io.Out.Write(Mi.Nodes[x].DefaultRotationI); io.Out.Write(Mi.Nodes[x].DefaultRotationJ); io.Out.Write(Mi.Nodes[x].DefaultRotationK); io.Out.Write(Mi.Nodes[x].DefaultRotationW); } } else { io.Out.Write((int)0); } // Write out our marker groups if (ExportMakers) { io.Out.Write(Mi.MarkerGroups.Count); for (int x = 0; x < Mi.MarkerGroups.Count; x++) { // Write our group name io.Out.Write(Mi.MarkerGroups[x].Name.ToCharArray()); io.Out.Write((byte)0x00); // Write out our markers io.Out.Write(Mi.MarkerGroups[x].Markers.Count); for (int y = 0; y < Mi.MarkerGroups[x].Markers.Count; y++) { io.Out.Write(Mi.MarkerGroups[x].Markers[y].RegionIndex); io.Out.Write(Mi.MarkerGroups[x].Markers[y].PermutationIndex); io.Out.Write(Mi.MarkerGroups[x].Markers[y].NodeIndex); io.Out.Write(Mi.MarkerGroups[x].Markers[y].TranslationX); io.Out.Write(Mi.MarkerGroups[x].Markers[y].TranslationY); io.Out.Write(Mi.MarkerGroups[x].Markers[y].TranslationZ); io.Out.Write(Mi.MarkerGroups[x].Markers[y].RotationI); io.Out.Write(Mi.MarkerGroups[x].Markers[y].RotationJ); io.Out.Write(Mi.MarkerGroups[x].Markers[y].RotationK); io.Out.Write(Mi.MarkerGroups[x].Markers[y].RotationW); io.Out.Write(Mi.MarkerGroups[x].Markers[y].Scale); } } } else { io.Out.Write((int)0); } // See how many regions are checked int count = 0; for (int x = 0; x < treeView.Nodes.Count; x++) { if (treeView.Nodes[x].Checked) { count++; } } // Write out our regions io.Out.Write(count); for (int x = 0; x < treeView.Nodes.Count; x++) { // Only if this region is slected if (treeView.Nodes[x].Checked) { // Write our region name io.Out.Write(Mi.Regions[x].Name.ToCharArray()); io.Out.Write((byte)0x00); // Get our perm count int pcount = 0; for (int y = 0; y < treeView.Nodes[x].Nodes.Count; y++) { if (treeView.Nodes[x].Nodes[y].Checked) { pcount++; } } // Write our perms io.Out.Write(pcount); for (int y = 0; y < treeView.Nodes[x].Nodes.Count; y++) { // Only if this perm is slected if (treeView.Nodes[x].Nodes[y].Checked) { // Write our perm name io.Out.Write(Mi.Regions[x].Permutations[y].Name.ToCharArray()); io.Out.Write((byte)0x00); // Get our model part from this perms LOD ModelPart part = Mi.ModelParts[Mi.Regions[x].Permutations[y].LODs[(int)LOD]]; // Write out our vertex format io.Out.Write(part.VertexFormat); #region Old Code /* * // Write out our submeshs * io.Out.Write(part.Submeshes.Count); * for (int z = 0; z < part.Submeshes.Count; z++) * { * // Write our vertex data * io.Out.Write(part.totalVertexCount); * for (int v = 0; v < part.totalVertexCount; v++) * { * io.Out.Write(part.VertexData[v].X); * io.Out.Write(part.VertexData[v].Y); * io.Out.Write(part.VertexData[v].Z); * io.Out.Write(part.VertexData[v].textureU); * io.Out.Write(part.VertexData[v].textureV); * * // If we have bone id's and skin weights * if (part.VertexFormat == 2) * { * io.Out.Write(part.VertexData[v].boneID1); * io.Out.Write(part.VertexData[v].boneID2); * io.Out.Write(part.VertexData[v].boneID3); * io.Out.Write(part.VertexData[v].boneID4); * io.Out.Write(part.VertexData[v].VertWeight1); * io.Out.Write(part.VertexData[v].VertWeight2); * io.Out.Write(part.VertexData[v].VertWeight3); * io.Out.Write(part.VertexData[v].VertWeight4); * } * } * * // Lets create our triangle list first * List<ushort> triangleList = new List<ushort>(); * for (int s = 0; s < part.Submeshes.Count; s++) * { * for (int i = part.Submeshes[s].SubsetIndex; * i < part.Submeshes[s].SubsetIndex + * part.Submeshes[s].SubsetCount; i++) * { * triangleList.AddRange(createTriangleList( * part.triangleStripData, * part.Subsets[i].FaceStart, * part.Subsets[i].FaceLength)); * } * } * * // Write our face data * io.Out.Write(triangleList.Count / 3); * for (int f = 0; f < triangleList.Count; f += 3) * { * io.Out.Write(triangleList[f]); * io.Out.Write(triangleList[f + 1]); * io.Out.Write(triangleList[f + 2]); * } * }*/ #endregion // We only have 1 submeshs io.Out.Write((int)1); // Lets write all our verts // Write our vertex data io.Out.Write(part.totalVertexCount); for (int v = 0; v < part.totalVertexCount; v++) { io.Out.Write(part.VertexData[v].X); io.Out.Write(part.VertexData[v].Y); io.Out.Write(part.VertexData[v].Z); io.Out.Write(part.VertexData[v].textureU); io.Out.Write(part.VertexData[v].textureV); // If we have bone id's and skin weights if (part.VertexFormat == 2) { io.Out.Write(part.VertexData[v].boneID1); io.Out.Write(part.VertexData[v].boneID2); io.Out.Write(part.VertexData[v].boneID3); io.Out.Write(part.VertexData[v].boneID4); io.Out.Write(part.VertexData[v].VertWeight1); io.Out.Write(part.VertexData[v].VertWeight2); io.Out.Write(part.VertexData[v].VertWeight3); io.Out.Write(part.VertexData[v].VertWeight4); } } // Lets create our triangle list first List <ushort> triangleList = new List <ushort>(); /*for (int s = 0; s < part.Submeshes.Count; s++) * { * for (int i = part.Submeshes[s].SubsetIndex; * i < part.Submeshes[s].SubsetIndex + * part.Submeshes[s].SubsetCount; i++) * { * triangleList.AddRange(createTriangleList( * part.triangleStripData, * part.Subsets[i].FaceStart, * part.Subsets[i].FaceLength)); * } * }*/ triangleList.AddRange(createTriangleList( part.triangleStripData, 0, part.totalFaceCount)); // Write our face data io.Out.Write(triangleList.Count / 3); for (int f = 0; f < triangleList.Count; f += 3) { io.Out.Write(triangleList[f]); io.Out.Write(triangleList[f + 1]); io.Out.Write(triangleList[f + 2]); } } } } } // Close our new file io.Close(); }
public void SaveBLFImage(Stream stream, BLFImageType imgType) { //Create our instance of our IO EndianIO IO = new EndianIO(stream, EndianType.BigEndian); //Open our IO IO.Open(); //Write our BLF Header #region BLF Header //Write our _blf string IO.Out.WriteAsciiString("_blf", 0x4); //Write the headersize IO.Out.Write(48); //Write the unknown values IO.Out.Write((short)1); IO.Out.Write((short)2); IO.Out.Write((short)-2); //Write the whitespace of blank values IO.Out.Write(new byte[0x22]); //Write our ending portion IO.Out.WriteAsciiString("mapi", 0x4); //Create our image stream. MemoryStream imageStream = new MemoryStream(); //Write our image to the stream if (imgType == BLFImageType.BaseImage | imgType == BLFImageType.Sm) { BLFImage.Save(imageStream, ImageFormat.Jpeg); } else { BLFImage.Save(imageStream, ImageFormat.Png); } //Get a useable byte array from it byte[] imageData = imageStream.ToArray(); //Close our imageStream imageStream.Close(); //Write imageData.length+20 IO.Out.Write(imageData.Length + 20); IO.Out.Write((short)1); IO.Out.Write((short)1); //Write our enum for image type. //JFIF = 0 //PNG = 1 IO.Out.Write((int)imgType); //Write our content File Size(image length) IO.Out.Write(imageData.Length); #endregion //Write our image data IO.Out.Write(imageData); //Write our End of File #region EOF Footer //get our current location for a size int totalSize = (int)IO.Stream.Position; //Write our EOF Data IO.Out.WriteAsciiString("_eof", 4); IO.Out.Write(0x111); IO.Out.Write(0x10001); IO.Out.Write(totalSize); IO.Out.Write((byte)0x03); IO.Out.Write(new byte[0x100]); #endregion //Close our IO IO.Close(); }
public void CreatePatch(HaloMap Orig, string ModdedMap, string PatchLocation, string Author, string Description) { //Write our patch file EndianIO pio = new EndianIO(PatchLocation, EndianType.LittleEndian); EndianIO mio = new EndianIO(ModdedMap, EndianType.LittleEndian); #region Old Code //Get our tag table starts for both maps int origTagTableStart = Orig.IndexItems[0].Offset; //Loop through all tags for (int index = 0; index < Orig.IndexHeader.tagCount; index++) { //If our indexed tag has a smaller offset than the current if (Orig.IndexItems[index].Offset < origTagTableStart) { //Set that offset as our starting point. origTagTableStart = Orig.IndexItems[index].Offset; } } /* * //Get our tag table starts for both maps * int modTagTableStart = Modded.IndexItems[0].Offset; * * //Loop through all tags * for (int index = 0; index < Modded.IndexHeader.tagCount; index++) * { * //If our indexed tag has a smaller offset than the current * if (Modded.IndexItems[index].Offset < modTagTableStart) * { * //Set that offset as our starting point. * modTagTableStart = Modded.IndexItems[index].Offset; * } * } */ //Get our table ends for both maps //int origTagTableEnd = new LocaleHandler(Orig).LocaleTables[0].LocaleTableIndexOffset; //int modTagTableEnd = new LocaleHandler(Modded).LocaleTables[0].LocaleTableIndexOffset; //Make sure our starts and ends match or else it won't be a good compare. //if (origTagTableStart != modTagTableStart && origTagTableEnd != modTagTableEnd) //{ //Show our error message // MessageBox.Show( // "The following two maps didn't not have the same meta table sizes and therefore... a patch cannot be properly made of these maps. The patching process will be discontinued."); //Stop processing code // return; // } #endregion //Open both map's IOs Orig.OpenIO(); pio.Open(); mio.Open(); pio.Out.Write(Author); pio.Out.Write(Description); //Setup our size and buffer size int perferdBuffSize = 0x1000000; int size = (int)Orig.IO.Stream.Length; //Create our 3 buffers, this way we don't have to mess around later byte[] obuf = new byte[perferdBuffSize], mbuf = new byte[perferdBuffSize], cbuf = new byte[perferdBuffSize]; //Set our positions Orig.IO.In.BaseStream.Position = origTagTableStart; mio.In.BaseStream.Position = origTagTableStart; //Now do our main compare loop :) unsafe { fixed(byte *pObuf = obuf, pMbuf = mbuf, pPbuf = cbuf) { int *ip1 = (int *)pObuf; int *ip2 = (int *)pMbuf; int *ip3 = (int *)pPbuf; int bufferSize = perferdBuffSize; int patchStart = 0; int patchSize = 0; for (int x = origTagTableStart; x < size; x += perferdBuffSize) { //Read our data bufferSize = Math.Min(perferdBuffSize, size - x); Orig.IO.In.Read(obuf, 0, bufferSize); mio.In.Read(mbuf, 0, bufferSize); //Lets compare for (int i = 0; i < bufferSize / 4; i++) { if (ip1[i] != ip2[i]) { //Are we just starting this patch? patchStart = x + (i * 4); patchSize = 0; while (i < (bufferSize / 4) && ip1[i] != ip2[i]) { ip3[patchSize / 4] = ip2[i]; i++; patchSize += 4; } //Lets write out this data pio.Out.Write(patchStart); pio.Out.Write(patchSize); pio.Out.Write(cbuf, 0, patchSize); } } } } } //Close up our patch pio.Close(); mio.Close(); }
private void clientHandle(object clientObj) { TcpClient Client = (TcpClient)clientObj; TmpEntry entry = new TmpEntry(); NetworkStream nStream = Client.GetStream(); PoorManStream pmStream = new PoorManStream(nStream); IPAddr = Client.Client.RemoteEndPoint.ToString(); //try { GlobalFunc.Write("{0} [{1}] PING", "Client", IPAddr); entry.client_ip = IPAddr.Split(':')[0]; mainBuff = new byte[8]; structBuff = new byte[0x10]; if (nStream.Read(mainBuff, 0, 8) != 8) { Client.Close(); GlobalFunc.Write("Client [{0}] Main Buffer Overflow", IPAddr); return; } EndianIO mainIO = new EndianIO(mainBuff, EndianStyle.BigEndian); uint CommandID = mainIO.Reader.ReadUInt32(); buffCount = mainIO.Reader.ReadInt32(); if (buffCount >= 0x8000) { Client.Close(); GlobalFunc.Write("Client [{0}] Main Buffer Overflow 0x8000 - Ret 0x{1}", IPAddr, buffCount.ToString("X")); return; } mainBuff = new byte[buffCount]; EndianIO writerIO = new EndianIO(pmStream, EndianStyle.BigEndian); EndianIO readerIO = new EndianIO(mainBuff, EndianStyle.BigEndian) { Writer = new EndianWriter(pmStream, EndianStyle.BigEndian) }; EndianWriter structIO = new EndianIO(structBuff, EndianStyle.BigEndian).Writer; if (pmStream.Read(mainBuff, 0, buffCount) != buffCount) { Client.Close(); GlobalFunc.Write("Client [{0}] Unexpected Buffer Size", IPAddr); return; } GlobalFunc.Write("COMMAND ID: {0}", Enum.GetName(typeof(cmdCode), Convert.ToUInt32(CommandID))); switch (Convert.ToUInt32(CommandID)) { case (uint)cmdCode.GET_SESSION: GET_SESSION(ref entry, readerIO, writerIO); break; case (uint)cmdCode.GET_STATUS: GET_STATUS(ref entry, readerIO, writerIO); break; case (uint)cmdCode.GET_CHAL_RESPONSE: GET_CHAL_RESPONSE(ref entry, readerIO, writerIO); break; case (uint)cmdCode.UPDATE_PRESENCE: UPDATE_PRESENCE(ref entry, readerIO, writerIO); break; case (uint)cmdCode.GET_XOSC: GET_XOSC(ref entry, readerIO, writerIO); break; case (uint)cmdCode.GET_INFO: break; case (uint)cmdCode.SND_SPOOFY: // No need right now break; case (uint)cmdCode.GET_MESSAGE: GET_MESSAGE(ref entry, readerIO, writerIO, structIO); break; case (uint)cmdCode.GET_PATCHES: GET_PATCH_DATA(ref entry, readerIO, writerIO); break; case (uint)cmdCode.GET_GUIDE_INFO: GET_GUIDE_INFO(ref entry, readerIO, writerIO, structIO); break; default: GlobalFunc.Write("Client [{0}] INVALID COMMAND CODE! Client Closed.", IPAddr); Client.Close(); break; } writerIO.Close(); readerIO.Close(); structIO.Close(); //} catch (Exception ex) { // if (Globals.b_printCrash) // GlobalFunc.Write("Client [{0}] Client Crash! Closed Connection. Detailed: {1} || {2}", IPAddr, ex.Source, ex.Message); // Client.Close(); //} }
private void GET_CHAL_RESPONSE(ref TmpEntry entry, EndianIO readerIO, EndianIO writerIO) { SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider(); bool Crl = false, Fcrt = false, Type1kv = false; uint[] chalVars = { 0x23289D3 /*Num 9*/, 0xD83E /*Num10*/, 0x304000D /*Num11*/, 0x1F8FC0D /*num11-this = (type1KV)*/ }; entry.client_session = readerIO.Reader.ReadBytes(0x10).BytesToHexString(); entry.client_salt = readerIO.Reader.ReadBytes(0x10).BytesToHexString(); entry.client_ecc_salt = readerIO.Reader.ReadBytes(0x2); GlobalFunc.Write("ECC Salt: {0}", entry.client_ecc_salt.BytesToHexString()); if (buffCount > 0x20) { Crl = readerIO.Reader.ReadBoolean(); Fcrt = readerIO.Reader.ReadBoolean(); Type1kv = readerIO.Reader.ReadBoolean(); } if (conMySQL.getConsole(ref entry, true)) { if (entry.client_enabled) { EndianIO seekIO = new EndianIO(Globals.by_chalBytes, EndianStyle.BigEndian); seekIO.Stream.Seek(0x2EL, SeekOrigin.Begin); seekIO.Writer.Write((ushort)(Type1kv ? (chalVars[1] & -33) : chalVars[1])); seekIO.Stream.Seek(0x38L, SeekOrigin.Begin); seekIO.Writer.Write((Crl ? ((Fcrt ? (uint)0x1000000 : 0x10000) | chalVars[0]) : chalVars[0])); seekIO.Writer.Write((Type1kv ? chalVars[2] - chalVars[3] : chalVars[2])); //seekIO.Stream.Seek(0x50, SeekOrigin.Begin); //seekIO.Writer.Write(hashECC(entry.client_ecc_salt)); seekIO.Stream.Seek(0xEC, SeekOrigin.Begin); // HV Salt Begin sha1.TransformBlock(Misc.HexStringToBytes(entry.client_salt), 0, 0x10, null, 0); sha1.TransformBlock(Globals.by_hvBytes, 0x34, 0x40, null, 0); sha1.TransformBlock(Globals.by_hvBytes, 0x78, 0xf88, null, 0); sha1.TransformBlock(Globals.by_hvBytes, 0x100c0, 0x40, null, 0); sha1.TransformBlock(Globals.by_hvBytes, 0x10350, 0xDF0, null, 0); sha1.TransformBlock(Globals.by_hvBytes, 0x16D20, 0x2E0, null, 0); sha1.TransformBlock(Globals.by_hvBytes, 0x20000, 0xffc, null, 0); sha1.TransformFinalBlock(Globals.by_hvBytes, 0x30000, 0xffc); entry.client_hvSalt = sha1.Hash; // HV Salt End seekIO.Writer.Write(entry.client_hvSalt); seekIO.Writer.Flush(); seekIO.Close(); // End SeekIO buffCount = 256; mainBuff = new byte[buffCount]; Buffer.BlockCopy(Globals.by_chalBytes, 0x20, mainBuff, 0x20, 0xE0);//Padding EndianIO statusIO = new EndianIO(mainBuff, EndianStyle.BigEndian); statusIO.Writer.Write((uint)respCode.RESP_STATUS_SUCCESS); writerIO.Writer.Write(mainBuff); File.WriteAllBytes("dmp\\resp.dmp", mainBuff); GlobalFunc.Write("Client [{0}] HVSalt Sent\r\n - Name: {1}\r\n - CPUKey: {2}", IPAddr, entry.client_name, entry.client_cpukey); } else { writerIO.Writer.Write((uint)respCode.RESP_STATUS_EXPIRED); } } else { writerIO.Writer.Write((uint)respCode.RESP_STATUS_ERROR); } }
static void Main(string[] args) { Console.Title = "LB Server - LMAOnline v3"; Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine( "\n\n +=============================================================+\n" + " |/////////////////////////////////////////////////////////////|\n" + " |/////////// LBS For LMAOnline V3 Has Been Started ///////////|\n" + " |///////////////////// This Shit's Funny /////////////////////|\n" + " |/////////////////////////////////////////////////////////////|\n" + " +=============================================================+\n" + " | Quick Commands |\n" + " +=============================================================+\n" + " | Submit INI = editINI Param[(str)loc] |\n" + " | Quick Restart = qrestart Param[(int)sec] |\n" + " | Test Connection = test |\n" + " | Shutdown Server = shutdown |\n" + " | INI Editor(GUI) = nano |\n" + " | Get Logs = rlogs |\n" + " | Get INI = rini |\n" + " +=============================================================+\n\n"); Again: Console.Write("\n Command: "); string command = Console.ReadLine(); try { client = new TcpClient(Globals.IPAddr, Globals.SvrPort); NetworkStream nStream = client.GetStream(); EndianIO readerIO = new EndianIO(nStream, EndianStyle.BigEndian) { Writer = new EndianWriter(nStream, EndianStyle.BigEndian) }; EndianIO writerIO = new EndianIO(nStream, EndianStyle.BigEndian); Thread.Sleep(1000); writerIO.Writer.Write("2F9A59018B92AA2C3B375D0D66CF8255"); switch (command.Split(' ')[0]) { case "qrestart": if (!(command.Split(' ').Length > 1)) { Write("Invalid secondary param! \"Param[(int)sec]\""); goto Again; } writerIO.Writer.Write(command); Write("Resp Back: {0}", readerIO.Reader.ReadUInt32() == XSTL_STATUS_SUCCESS ? "OK" : "ERR"); break; case "shutdown": writerIO.Writer.Write(command); Write("Resp Back: {0}", readerIO.Reader.ReadUInt32() == XSTL_STATUS_SUCCESS ? "OK" : "ERR"); break; case "rlogs": writerIO.Writer.Write(command); receiveLogs(readerIO, writerIO); break; case "rini": writerIO.Writer.Write(command); receiveINI(readerIO, writerIO); break; case "editINI": if (!(command.Split(' ').Length > 1)) { Write("Invalid secondary param! \"Param[(str)loc]\""); goto Again; } sendINI(readerIO, writerIO, command.Split(' ')[1]); break; case "test": writerIO.Writer.Write(command); Write(readerIO.Reader.ReadUInt32() == XSTL_STATUS_SUCCESS ? "It's AIVE! PRAISE ALLAH!" : "ded as fuk."); break; case "nano": //that linux reference tho Write("Enjoy the GUI fgt!"); frm_iniEdit iniEditor = new frm_iniEdit(); iniEditor.ShowDialog(); goto Again; default: Write("\"{0}\" is not a valid command!", command); break; } client.Close(); readerIO.Close(); writerIO.Close(); } catch (SocketException sockEx) { Write("Socket Error: {0}", sockEx.Message); client.Close(); } goto Again; }