PinkD / corplink-rs

使用 rust 实现的飞连客户端
GNU General Public License v2.0
230 stars 31 forks source link

login_with_password报错 #18

Closed Jeffwhen closed 11 months ago

Jeffwhen commented 1 year ago
[2023-10-30T11:24:07Z INFO  corplink_rs::client] text={"code":0,"action":"","message":"","data":[]}
[2023-10-30T11:24:07Z INFO  corplink_rs::client] try to login with platform ldap
[2023-10-30T11:24:07Z INFO  corplink_rs::client] found set-cookie in header, saving cookie
[2023-10-30T11:24:07Z INFO  corplink_rs::client] text={"code":0,"action":"","message":"","data":{"mfa":false,"auth":["password"]}}
[2023-10-30T11:24:08Z INFO  corplink_rs::client] found set-cookie in header, saving cookie
[2023-10-30T11:24:08Z INFO  corplink_rs::client] text={"code":0,"action":"","message":"","data":{"login_result":"mobile","auth":["otp","mobile"]}}
thread 'main' panicked at src/client.rs:221:57:
called `Result::unwrap()` on an `Err` value: Error("missing field `url`", line: 1, column: 91)

这里返回 JSON 里面没有 url 字段导致出错,请教可能是什么原因?另外请教这个请求要的 url 用来做什么的?

是用来生成 otp 吗?如果 otp 可以直接生成那这一步有什么作用?

PinkD commented 1 year ago

https://github.com/PinkD/corplink-rs/blob/023e08e3ed356335088f4090dd421b55aeef4246/src/client.rs#L382-L402

参考这段代码。先登录,如果是 Andrioid 客户端(根据 UA 识别)登录成功,会返回一个 otp 的 uri ,解析可得到 otp token ,用于后续连接 vpn 时提供 2-fa ,然后获取 vpn 的信息来连接

PinkD commented 1 year ago

贴一个连接成功的 log 截图:

image

Jeffwhen commented 1 year ago

我这个服务器没有返回 url,有什么建议怎么跑通吗?

PinkD commented 1 year ago
  1. 可以尝试改一下 UA ,这个 UA 的版本应该有点久了
  2. 用软件抓手机飞连 App 登录的数据包(MITM ,需要 root),看一下请求和返回,然后按需修改代码做兼容。欢迎提 pr
PinkD commented 11 months ago

close due to no reply