Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using ELFSharp.ELF;
- using ELFSharp.ELF.Sections;
- using System.IO;
- class Program
- {
- static void Main(string[] args)
- {
- string path = @"gdeliveryd";
- var elf = ELFReader.Load(path);
- var function = ((ISymbolTable)elf.GetSection(".symtab")).Entries
- .FirstOrDefault(ent =>
- ent.Type == SymbolType.Function &&
- ent.Name == "_ZN4GNET11GetSavedMsg7ProcessEPNS_8Protocol7ManagerEj"
- );
- if (function == null)
- throw new Exception("Function does not exists.");
- int address = int.Parse(function.ToString().Split(new [] { ": 0x" }, StringSplitOptions.None)[1].Split(',')[0], System.Globalization.NumberStyles.HexNumber) - 0x8048000;
- elf.Dispose();
- using (var writer = File.OpenWrite(path))
- {
- writer.Seek(address, SeekOrigin.Begin);
- writer.WriteByte(0xC3);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement