New post
This commit is contained in:
parent
01b2495370
commit
534dc6ca72
31
content/post/4d6dbaefb80e4d1692af3b23ab8be33a/index.zh-cn.md
Normal file
31
content/post/4d6dbaefb80e4d1692af3b23ab8be33a/index.zh-cn.md
Normal file
@ -0,0 +1,31 @@
|
||||
+++
|
||||
author = "FlintyLemming"
|
||||
title = "在需要网络登录验证的环境安装 Linux"
|
||||
slug = "4d6dbaefb80e4d1692af3b23ab8be33a"
|
||||
date = "2021-04-22"
|
||||
categories = ["Linux", "Network"]
|
||||
tags = ["Ubuntu"]
|
||||
image = "https://img.mitsea.com/blog/posts/2021/04/%E5%9C%A8%E9%9C%80%E8%A6%81%E7%BD%91%E7%BB%9C%E7%99%BB%E5%BD%95%E9%AA%8C%E8%AF%81%E7%9A%84%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85%20Linux/philip-oroni-0cVTKWWAxV4-unsplash.jpg?x-oss-process=style/ImageCompress"
|
||||
+++
|
||||
|
||||
首先要了解下 Linux 中的 tty 的概念,具体可以看下面这个解释。简单来说(可能不严谨),你可以类比 macOS 或者 Windows 下的虚拟桌面。
|
||||
|
||||
[What does "TTY" stand for?](https://askubuntu.com/questions/481906/what-does-tty-stand-for)
|
||||
|
||||
那么启动安装镜像,进入安装界面,就像这样
|
||||
|
||||
![](https://img.mitsea.com/blog/posts/2021/04/%E5%9C%A8%E9%9C%80%E8%A6%81%E7%BD%91%E7%BB%9C%E7%99%BB%E5%BD%95%E9%AA%8C%E8%AF%81%E7%9A%84%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85%20Linux/Untitled.png?x-oss-process=style/ImageCompress)
|
||||
|
||||
默认应该是 tty1,可以尝试发送 Ctrl+Alt+F1,看看有没有反应,没有的话说明当前就是 tty1。
|
||||
|
||||
![](https://img.mitsea.com/blog/posts/2021/04/%E5%9C%A8%E9%9C%80%E8%A6%81%E7%BD%91%E7%BB%9C%E7%99%BB%E5%BD%95%E9%AA%8C%E8%AF%81%E7%9A%84%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85%20Linux/Untitled%201.png?x-oss-process=style/ImageCompress)
|
||||
|
||||
要登录公司网络,需要使用 curl 命令发送请求,所以切换到另一个 tty 以输入命令。这边发送 Ctrl+Alt+F2 组合键以切换到 tty2
|
||||
|
||||
然后输入命令登录网络即可。我这边用的是深信服的网络登录窗,如何写出这个命令的可以参考这篇文章获取思路。[使用 cli 登陆公司上网验证系统](https://blog.mitsea.com/ddfb7e62396b40c59f74432c862dea69)
|
||||
|
||||
![](https://img.mitsea.com/blog/posts/2021/04/%E5%9C%A8%E9%9C%80%E8%A6%81%E7%BD%91%E7%BB%9C%E7%99%BB%E5%BD%95%E9%AA%8C%E8%AF%81%E7%9A%84%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85%20Linux/Untitled%202.png?x-oss-process=style/ImageCompress)
|
||||
|
||||
最后,回到 tty1 正常安装系统即可。
|
||||
|
||||
> Photo by [Philip Oroni](https://unsplash.com/@philipsfuture?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) [Unsplash](https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
|
53
content/post/ddfb7e62396b40c59f74432c862dea69/index.zh-cn.md
Normal file
53
content/post/ddfb7e62396b40c59f74432c862dea69/index.zh-cn.md
Normal file
@ -0,0 +1,53 @@
|
||||
+++
|
||||
author = "FlintyLemming"
|
||||
title = "使用 cli 登陆公司上网验证系统"
|
||||
slug = "ddfb7e62396b40c59f74432c862dea69"
|
||||
date = "2020-11-09"
|
||||
categories = ["Linux", "Network"]
|
||||
tags = ["Ubuntu"]
|
||||
image = "https://img.mitsea.com/blog/posts/2020/11/%E4%BD%BF%E7%94%A8%20cli%20%E7%99%BB%E9%99%86%E5%85%AC%E5%8F%B8%E4%B8%8A%E7%BD%91%E9%AA%8C%E8%AF%81%E7%B3%BB%E7%BB%9F/pawel-wieladek-QpWb8mB1tVU-unsplash.jpg?x-oss-process=style/ImageCompress"
|
||||
+++
|
||||
|
||||
最近需要尝试在 Ubuntu 上部署一个项目,装好 Ubuntu Server 就傻眼了,公司有个上网登录窗,我不知道怎么登陆。于是想到了三个方法:
|
||||
|
||||
第一,安装桌面环境,这选择很多啊,要么就是直接把 gnome 给装回来;要么就在 Docker 里跑一个 LXQt,那里面有个浏览器
|
||||
|
||||
第二,我记得之前又看到过很扭曲的东西,就是通过 cli 使用浏览器,是那种模拟图形界面的,但我感觉过于扭曲…或者经过群友介绍,知道有 headless Chrome 这么个东西,关联的东西有 puppeteer
|
||||
|
||||
第三,网页上点击登陆无非就是发个简单的请求,curl 命令也许就能搞定
|
||||
|
||||
于是我决定先试试 curl。
|
||||
|
||||
首先看下公司的网络登录窗,貌似就是深信服的标准登陆页面
|
||||
|
||||
![](https://img.mitsea.com/blog/posts/2020/11/%E4%BD%BF%E7%94%A8%20cli%20%E7%99%BB%E9%99%86%E5%85%AC%E5%8F%B8%E4%B8%8A%E7%BD%91%E9%AA%8C%E8%AF%81%E7%B3%BB%E7%BB%9F/Untitled.png?x-oss-process=style/ImageCompress)
|
||||
|
||||
用开发者选项查看源代码,可以在 /ac_portal/share/res/js/logic_new.js 里看到登陆的 js 方法
|
||||
|
||||
```jsx
|
||||
function onPwdLogin(){
|
||||
if(!pwdValidtor())return;
|
||||
var params = {
|
||||
opr:'pwdLogin',//smsLogin表示短信认证登录,pwdLogin表示密码认证登录
|
||||
userName : $id("password_name").value,
|
||||
pwd : $id("password_pwd").value,
|
||||
rememberPwd : $id("rememberPwd").checked ? '1':'0'
|
||||
};
|
||||
loginRequest(params,"mode_password",$id("password_submitBtn"));
|
||||
}
|
||||
```
|
||||
|
||||
这样我们就得到了登陆请求的结构了,只需要构造这样一条命令即可
|
||||
|
||||
```shell
|
||||
curl -d "opr=pwdLogin&userName=<用户名,要带引号>&pwd=<密码,要带引号>&rememberPwd=1" http://<公司上网登录窗的地址>/ac_portal/login.php
|
||||
```
|
||||
|
||||
提示 logon success,成功
|
||||
|
||||
![](https://img.mitsea.com/blog/posts/2020/11/%E4%BD%BF%E7%94%A8%20cli%20%E7%99%BB%E9%99%86%E5%85%AC%E5%8F%B8%E4%B8%8A%E7%BD%91%E9%AA%8C%E8%AF%81%E7%B3%BB%E7%BB%9F/Untitled%201.png?x-oss-process=style/ImageCompress)
|
||||
|
||||
由于 curl 命令在几乎所有平台都可以用,所以可以自己设定一个开机自启的任务自动执行这么个命令,就不用每次上班打开电脑还要手动登陆了。
|
||||
|
||||
> Photo by [Paweł Wielądek](https://unsplash.com/@pawelwieladek?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
|
||||
|
Loading…
Reference in New Issue
Block a user