Все довольно просто , пишу сейчас заказ на автобилд и додумалась до такой штуки Переводим байты в hex ip и build id находятся на строках 00014370 00014371 юзал для поиска hexed.it using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace glava7_urok2 { class Program { string writePath = @"C:\Users\Liza\source\repos\hexeditor\hexeditor\bin\Debug\build\hex.txt"; public static void DumpBuffer(byte[] buffer, int numbytes) { for (int i = 0; i < numbytes; i++) { byte b = buffer[i]; Console.Write($"{b} "); } Console.WriteLine(); } public static FileInfo[] GetFileList(string directoryName) { FileInfo[] files = new FileInfo[0]; try { DirectoryInfo di = new DirectoryInfo(directoryName); files = di.GetFiles(); } catch (Exception e) { Console.WriteLine($"Каталог неверен: {directoryName}"); Console.WriteLine(e.Message); } return files; } public static void DumpHex(FileInfo fileInfo) { FileStream fs; BinaryReader reader = null; try { fs = File.OpenRead(fileInfo.FullName); reader = new BinaryReader(fs); } catch (Exception e) { Console.WriteLine($"Не удаётся прочитать файл: {fileInfo.FullName}"); Console.WriteLine(e.Message); } for (int line = 1; true; line++) { byte[] buffer = new byte[10]; int numbytes = reader.Read(buffer, 0, buffer.Length); if (numbytes == 0) return; DumpBuffer(buffer, numbytes); } } static void Main(string[] args) { FileInfo[] files = GetFileList(@"C:\Users\Liza\source\repos\hexeditor\hexeditor\bin\Debug\build"); foreach (FileInfo file in files) { DumpHex(file); } } } } Код using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace glava7_urok2 { class Program { string writePath = @"C:\Users\Liza\source\repos\hexeditor\hexeditor\bin\Debug\build\hex.txt"; public static void DumpBuffer(byte[] buffer, int numbytes) { for (int i = 0; i < numbytes; i++) { byte b = buffer[i]; Console.Write($"{b} "); } Console.WriteLine(); } public static FileInfo[] GetFileList(string directoryName) { FileInfo[] files = new FileInfo[0]; try { DirectoryInfo di = new DirectoryInfo(directoryName); files = di.GetFiles(); } catch (Exception e) { Console.WriteLine($"Каталог неверен: {directoryName}"); Console.WriteLine(e.Message); } return files; } public static void DumpHex(FileInfo fileInfo) { FileStream fs; BinaryReader reader = null; try { fs = File.OpenRead(fileInfo.FullName); reader = new BinaryReader(fs); } catch (Exception e) { Console.WriteLine($"Не удаётся прочитать файл: {fileInfo.FullName}"); Console.WriteLine(e.Message); } for (int line = 1; true; line++) { byte[] buffer = new byte[10]; int numbytes = reader.Read(buffer, 0, buffer.Length); if (numbytes == 0) return; DumpBuffer(buffer, numbytes); } } static void Main(string[] args) { FileInfo[] files = GetFileList(@"C:\Users\Liza\source\repos\hexeditor\hexeditor\bin\Debug\build"); foreach (FileInfo file in files) { DumpHex(file); } } } } Второй вариант отлично подходит для нижнего кода в преобразования в байты using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Hex__Reader { class Program { static void Main(string[] args) { OpenFile(); } private static void OpenFile() { string[] digits = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F","G" }; using (System.IO.BinaryReader br = new System.IO.BinaryReader (new System.IO.FileStream ( @"C:\Users\Liza\source\repos\hexeditor\hexeditor\bin\Debug\build\build.exe", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None, 1024) ) ) { using (System.IO.StreamWriter sw = new System.IO.StreamWriter("HexFile.txt")) { byte[] inbuff = new byte[0]; int b = 0; while ((inbuff = br.ReadBytes(50)).Length > 0) { for (b = 0; b < inbuff.Length - 1; b++) { sw.Write(digits[(inbuff[b] / 16) % 16] + digits[inbuff[b] % 16] + " "); } sw.WriteLine(digits[(inbuff[b] / 16) % 16] + digits[inbuff[b] % 16]); } } } } } } Код using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Hex__Reader { class Program { static void Main(string[] args) { OpenFile(); } private static void OpenFile() { string[] digits = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F","G" }; using (System.IO.BinaryReader br = new System.IO.BinaryReader (new System.IO.FileStream ( @"C:\Users\Liza\source\repos\hexeditor\hexeditor\bin\Debug\build\build.exe", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None, 1024) ) ) { using (System.IO.StreamWriter sw = new System.IO.StreamWriter("HexFile.txt")) { byte[] inbuff = new byte[0]; int b = 0; while ((inbuff = br.ReadBytes(50)).Length > 0) { for (b = 0; b < inbuff.Length - 1; b++) { sw.Write(digits[(inbuff[b] / 16) % 16] + digits[inbuff[b] % 16] + " "); } sw.WriteLine(digits[(inbuff[b] / 16) % 16] + digits[inbuff[b] % 16]); } } } } } } Вот мы получили hex сори за быдло код сама его спизданула даже не меняла местами код . Работает и хуй с ним. Кидаем его в текстовый файл , а дальше считываем его и заменяем и добавляем нужные byte через replace and insert Таблица hex code http://www.celitel.info/klad/tabsim.htm Даем алфавит который ван нужен и переводим каждый символ в байты hex для легкого обращения Дальше как вставили и почудили текстовый документ нам нужно его с компилировать для это опять идем к спизженому коду и вуаля получаем байты для компляции public static byte[] StringToByteArrayFastest(string hex) { if (hex.Length % 2 == 1) throw new Exception("The binary key cannot have an odd number of digits"); byte[] arr = new byte[hex.Length >> 1]; for (int i = 0; i < hex.Length >> 1; ++i) { arr[i] = (byte)((GetHexVal(hex[i << 1]) << 4) + (GetHexVal(hex[(i << 1) + 1]))); } return arr; } public static int GetHexVal(char hex) { int val = (int)hex; //For uppercase A-F letters: //return val - (val < 58 ? 48 : 55); //For lowercase a-f letters: //return val - (val < 58 ? 48 : 87); //Or the two combined, but a bit slower: return val - (val < 58 ? 48 : (val < 97 ? 55 : 87)); } Код public static byte[] StringToByteArrayFastest(string hex) { if (hex.Length % 2 == 1) throw new Exception("The binary key cannot have an odd number of digits"); byte[] arr = new byte[hex.Length >> 1]; for (int i = 0; i < hex.Length >> 1; ++i) { arr[i] = (byte)((GetHexVal(hex[i << 1]) << 4) + (GetHexVal(hex[(i << 1) + 1]))); } return arr; } public static int GetHexVal(char hex) { int val = (int)hex; //For uppercase A-F letters: //return val - (val < 58 ? 48 : 55); //For lowercase a-f letters: //return val - (val < 58 ? 48 : 87); //Or the two combined, but a bit slower: return val - (val < 58 ? 48 : (val < 97 ? 55 : 87)); } Юзаем codeboom или lib или что вам душе угодно или просто vs и байиы в string Вуаля вот вы и сунули данные без билда в редлайне что позволит легко всунуть в бота тг на шарпах X)
pinilopa, + это работа с текстом и тд тебе охото тратить время ? Я же не кинула как я компилю , как я правильно вставляю hex байты и тд . Потому что its my code . Который + я сча еще заказчику не сдала :)
pinilopa, каждый раз код чужой не разберешь потому что одноразовые проекты , который ты местами будешь поправлять и одновременно разбираться. Если разбираться с кодом даже спизженным ты теряешь время свое и заказчика .
LolBall, это не весь готовый проект . Это я показал почти основу работы . Он считывает чистый билд . Дальше переводит его в hex . Чтобы не теребить себе мозги в hexed.it находишь значение buildid . Запомнил строку запомнил изначальные значения его . Ну и дальше просто берешь при помощи бота или имя или id для выдачи билда и вставляешь в hex . Второй код который я скинул я дал для перевода hex to byte обратно . Эти Byte компилишь в exe вот и билд
нет. Херовая идея. Лучше Mono.Cecil сразу же юзать, подменяя значения в редлайне. Допустим [chatid] заменять на id из бота. string UserChatid = e.Message.Chat.Id.ToString();
Lytik_inactive4477619, зависит от того на чём бот написан. Если на шарпе и телег.Боте могу подсказать реализацию. Но прик редлайна, что там строки хором+ ещё чем то кроются. Короч думаю лучшим вариантом будет анпакнуть ред(на форуме есть тип, который делал под это софт), потом через dnspy пропатчить строку [chatid] и уже дальше реплейсить.. Без головоёба.
string[] digits = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F","G" }; Код string[] digits = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F","G" }; Ауч!