Git Product home page Git Product logo

ecnu-net-login's Introduction

ECNU Internet Login/Logout

命令行登陆及注销华东师范大学网络验证系统 https://login.ecnu.edu.cn

ECNU 内网及外网各提供一个版本,根据需要使用:

注: 当前版本因为网络测试的原因可能会出现 实际上连接上但报错的情况

背景

  • 一个ID(学号/工号)同时只能让五台设备连接外网,如果有第六台设备联网时,最先连接的那一台设备会被强制断网
  • 并非所有设备都需要一直连外网
  • 当某台设备一段时间没有网络流量的时候,校园网网关会断开该设备与外网的连接

安装

# bash
git clone https://gitlab.lflab.cn/lflab/ecnu-net-login.git
cp ecnu-net-login/ecnu_net.py ~/.local/bin/ecnu_net
chmod +x ~/.local/bin/ecnu_net

使用

第一次使用会记录学号与密码(也可以不存储),后面则可以自动连接

  • 帮助: ecnu_net, ecnu_net -h
  • 联网: ecnu_net --login
  • 断网重连: ecnu_net --login --daemon (需要保存账号密码)
  • 断网: ecnu_net --logout
  • 更新参数: ecnu_net --update

后台运行 daemon mode

nohup ecnu_net --login --verbose --daemon >> ecnu_net.log 2>&1 &

当然也可以用 tmux

或者利用systemctl部署:

# "安装" ecnu_net
git clone https://gitlab.lflab.cn/lflab/ecnu-net-login.git
cp ecnu-net-login/ecnu_net.py /usr/local/bin/ecnu_net
chmod a+x /usr/local/bin/ecnu_net

# 部署服务
cp ecnu-net-login/ecnu_net.service /lib/systemd/system/ecnu_net.service

# 开机自启动
systemctl enable ecnu_net

# 把账号密码写入配置
ecnu_net --update
# 开启服务
systemctl start ecnu_net

TODO

  • 更快的检查网络开断的工具 (多线程)
  • register to pypi?

F.A.Q

  • 密码明文存储在~/.config/ecnu_net/config下,请确保其他人没有对此的权限

ecnu-net-login's People

Contributors

johnnychen94 avatar tianyilt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ecnu-net-login's Issues

ubuntu 2004 dh key too small

login的时候会报

urllib.error.URLError: <urlopen error [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1131)>

参考:
Temporarily fix TLS handshake failed "dh key too small" since openssl upgrade
See: https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1864689

解决方法是添加--ciphers 'DEFAULT:@SECLEVEL=1'

curl --ciphers 'DEFAULT:@SECLEVEL=1'  -d "action=login&username=用户名&password=密码&ac_id=1&save_me=0&ajax=1" "https://login.ecnu.edu.cn/srun_portal_pc.php?ac_id=1&"

目前要在urllib中实现可能需要改一下用requests修改ciphers参数, 不确定修改后是否会影响其他平台

OSError:[Errno 101] Network is unreachable

学长您好,我在实验室放了一个ubuntu20.04的服务器,之前饱受校园网 超过30分钟自动注销 的问题困扰,在使用了你们的脚本之后,坚持了一段时间,可惜还是中断了

错误复现

ecnu_net --update
ecnu_net --login --daemon

其中ecnu_net --update是明文存储密码的

之后服务突然断了,我联系同学帮忙看一下,当他第一时间进行登录的时候
image

网页出现错误,而且没有返回结果
之后同学插拔网线,再进入登录页面登录后成功了
我通过向日葵远程桌面软件进入查看后,发现问题出现在以下位置
image

logout失败

我调用:
ecnu_net --logout
反馈回来是:
image
一直反复,也不行

命令行报错

命令行报错,看不太懂这个证书是啥

curl --ciphers 'DEFAULT:@SECLEVEL=1' -d "action=login&username=id&password=passwd&ac_id=1&save_me=0&ajax=1" "https://login.ecnu.edu.cn/srun_portal_pc.php?ac_id=1&"
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.