private void GetObKeyFormLoLClientMemory() { Regex gameIdRegex = new Regex(@" [0-9]+ (?<KEY>.+) [0-9]+", RegexOptions.IgnoreCase); Match match = gameIdRegex.Match(exeData.CommandLine); ProcessMemory pm = new ProcessMemory(); if (!pm.openProcess("LolClient")) { Logger.Instance.WriteLog("Open process failed"); } if (_lastTimeAddress != 0) { FindOnKeyFromLastTimeAddress(pm); } if (obKey == null) { pm.recordMemorysInfo(false); uint[] result = pm.findString(match.Groups["KEY"].Value, Encoding.ASCII, 1); if (!FindObkeyInMemory(pm, result)) { result = pm.findString(match.Groups["KEY"].Value, Encoding.ASCII); FindObkeyInMemory(pm, result); } } pm.closeProcess(); }
public string GetSummonerName() { ProcessMemory pm = new ProcessMemory(); if (!pm.openProcess("LolClient")) { Logger.Instance.WriteLog("Open process failed"); } pm.recordMemorysInfo(false); string prefix = "@sec.pvp.net/"; uint[] address = pm.findString(prefix, Encoding.ASCII, 1); byte[] b = pm.readMemory((uint)(address[0] + prefix.Length), 64); pm.closeProcess(); int endPos = 0; while (b[endPos] != '\'' && b[endPos] != 0) { endPos++; } string name = Encoding.UTF8.GetString(b, 0, endPos); Logger.Instance.WriteLog("Summoner name is " + name); return(name); }
public static String GetExecutablePath(String processName) { String exePath = null; Process p = Utilities.GetProcess(processName); ProcessModule module = null; try { module = p.MainModule; } catch (Exception e) { Logger.Instance.WriteLog("Get process MainModule failed: " + e.Message); } try { exePath = module.FileName; } catch (Exception e) { Logger.Instance.WriteLog("Get process MainModule FileName failed: " + e.Message); } if (exePath == null) { try { exePath = LeagueOfLegendsAnalyzer.GetMainModuleFilepath(p.Id); } catch (Exception e) { Logger.Instance.WriteLog("GetExecutablePath: " + e.Message); } } if (exePath == null) { if (System.Environment.OSVersion.Version.Major >= 6) { ProcessMemory pm = new ProcessMemory(); pm.openProcess(Constants.LoLExeName); exePath = pm.GetProcessPath(); pm.closeProcess(); } } if (exePath == null) { Logger.Instance.WriteLog(String.Format("Can't get {0} path", processName)); } else { Logger.Instance.WriteLog(String.Format("{0} path is {1}", processName, exePath)); } return(exePath); }
private Boolean FindObkeyInMemory(ProcessMemory proc, uint[] addresses) { for (int i = 0; i < addresses.Length; i++) { byte[] memContent = proc.readMemory(addresses[i], 256); if (AnalyzeObKeyInMemoryBytesMethod1(memContent)) { _lastTimeAddress = addresses[i]; byte[] gid = proc.readMemory(addresses[i] + 25, 8).Reverse().ToArray(); gameId = (long)BitConverter.ToDouble(gid, 0); return(true); } } return(false); }
private Boolean FindOnKeyFromLastTimeAddress(ProcessMemory proc) { return(FindObkeyInMemory(proc, new uint[] { _lastTimeAddress })); }