上等马还是下等马,英雄联盟LCUAPI研究

您所在的位置:网站首页 lol发上等马中等马是什么软件 上等马还是下等马,英雄联盟LCUAPI研究

上等马还是下等马,英雄联盟LCUAPI研究

2023-12-17 19:42| 来源: 网络整理| 查看: 265

前言

最近清明节家里蹲了3天,回归英雄联盟,玩了一会,能看到很多上等马下等马的快速喊话,比较好奇是怎么来的,所以有了这篇记录

image-20220405161252674image-20220405161252674

查了一下网上的所谓的插件,基本上都说不读内存,不修改客户端,这个能理解,但是吐槽一下,网上的确实🐴很多啊

image-20220405161419237image-20220405161419237

这个启动的时候就会释放一个文件,具体行为自己品,至少在我看来,调这些API,根本不需要这么多乱七八糟的行为,懂的都懂

铁易语言

image-20220405182657697image-20220405182657697image-20220405182735747image-20220405182735747image-20220405182434189image-20220405182434189image-20220405182445540image-20220405182445540image-20220405182521324image-20220405182521324image-20220405182537827image-20220405182537827LcuApi

在谷歌了一段时间后看到了一篇文章,说获取英雄联盟的客户端KEY和端口有两种方式,第一种就是WMIC,第二种就是取lockfile

image-20220405162013047image-20220405162013047image-20220405162026078image-20220405162026078

那么首先看看两种方法

wmic获取LeagueClientUx.exe

首先打开客户端

wmic PROCESS WHERE name='LeagueClientUx.exe' GET commandline

ps:一定要管理员权限运行CMD,不然获取不到

image-20220405163257536image-20220405163257536

这种用正则取匹配就可以了,再看看取lockfile

获取英雄联盟LockFileimage-20220405163505500image-20220405163505500image-20220405163527673image-20220405163527673

两种方式都行

纠正lockfile的错误

这里其实犯了一个错,当时还很懵逼,因为lockfile中的token和端口根本用不了,用的话会提示404

image-20220405172404025image-20220405172404025

找到一篇文章说,lockfile更新后失效的原因,所以只能用wmic的方式来获取了

获取当前账号信息image-20220405171714446image-20220405171714446import subprocess import requests requests.packages.urllib3.disable_warnings() requests.DEFAULT_RETRIES = 1000 class LcuApi: def __init__(self): self.url = None # Burp self.proxy = { "http": "192.168.31.102:1234", "https": "192.168.31.102:1234" } def getUserInfo(self): r = requests.get(url=self.url + "/lol-summoner/v1/current-summoner", verify=False) print(f''' 当前游戏名: {r.json()['displayName']} 当前PUUID: {r.json()['puuid']} 当前AccountID: {r.json()['accountId']} ''') def getParam(self): ''' From https://github.com/minhluu2000/Project-Lego and changed a little Get necessary for client-specific info through CommandLine ''' raw_output = subprocess.check_output( ['wmic', 'PROCESS', 'WHERE', "name='LeagueClientUx.exe'", 'GET', 'commandline']).decode('gbk') # Use GBK in case of Chinese character in path app_port = raw_output.split('--app-port=')[-1].split(' ')[0].strip('\"') auth_token = raw_output.split('--remoting-auth-token=')[-1].split(' ')[0].strip('\"') self.url = "https" + '://' + 'riot:' + auth_token + '@' + "127.0.0.1" + ':' + app_port run = LcuApi() run.getParam() run.getUserInfo()

Tips:注意这里运行Python脚本的时候必须管理员运行,如果不管理员运行的话就会出现下面的情况

image-20220405171802282image-20220405171802282

从报错中我们可以看到,这里取到的参数居然是CommandLine,就跟我们上面的报错一样,所以管理员运行就可以了

既然现在可以获取到英雄联盟账号信息了,那么接下来就比较简单了,就是调API的活了

image-20220405172700637image-20220405172700637

有个网站,显示所有的API

https://lcu.vivide.re/image-20220405172732008image-20220405172732008如何找到对局的API

奈何英语不是很好,在github看了别人写的go代码,找到了api接口

image-20220405182339507image-20220405182339507image-20220405181513913image-20220405181513913/lol-gameflow/v1/session image-20220405181632813image-20220405181632813

获取到了当前对局信息,然后继续调API,继续完善代码就可以了。

参考https://hextechdocs.dev/getting-started-with-the-lcu-api/https://www.bilibili.com/read/cv14115904?spm_id_from=333.999.0.0https://www.bilibili.com/read/cv6477040?spm_id_from=333.999.0.0https://www.youtube.com/watch?v=crKTr5EwwNM


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3