Giter Site home page Giter Site logo

drcom4scut's Introduction

drcom4scut

当前版本 0.3.0

  • A 3rd-party DrCOM client for SCUT, written in Rust.
  • 华南理工大学第三方客户端,使用Rust语言编写。

用法

仅供不熟悉操作的同学参考,熟悉的话直接看命令行参数和配置项应该就知道怎么用了

  1. 下载 Release 并解压。
  2. 如在Windows系统,安装npcap
  3. 运行 drcom4scut,第一次会产生配置文件。
  4. 填写配置文件,通常只需要填写 usernamepassword 两项(注意yml文件格式)。
  5. 再次运行 drcom4scut,通常是可以正常运行的。
    • 如果不能,请查看控制台输出的提示。
      • 如果没有自动选择正确的网卡,请在配置文件中填写 macip 任意一项。其中 mac 是以冒号分隔的形式, ip 是你指定网卡对应设置的IP地址。
      • 如果出现不能读取配置文件,请检查填写的配置文件是否满足yml规范。

命令行参数

Usage: drcom4scut.exe [OPTIONS]

Options:
  -c, --config <config>      Path to config file. [default: config.yml]
  -D, --debug                Enable debug mode.
  -m, --mac <mac>            Ethernet Device MAC address.
  -i, --ip <ip>              IP address of the selected Ethernet Device.
  -u, --username <username>  Username to authorize.
  -p, --password <password>  Password to authorize.
  -H, --host <host>          Host to connect UDP server. Default value is 's.scut.edu.cn'.
  -N, --hostname <hostname>  Default value is current computer host name.
  -t, --time <time>          Time to reconnect automatically after you are not allowed to access Internet. Default value is 7:00.
  -h, --help                 Print help
  -V, --version              Print version

配置项

mac:   # (可选)网卡MAC地址,以冒号':'分隔
ip:   # (可选)网卡对应设置的IP地址
username: ''  # 账号(学号)
password: ''  # 密码
dns:   # 学校DNS服务器IP地址,默认已填入五山校区和大学城校区的DNS
  - 202.38.193.33
  - 222.201.130.30
  - 202.112.17.33
  - 222.201.130.33
host: s.scut.edu.cn   # (可选) 用于UDP连接的地址,通常不需要改动
hostname:   # (可选) 主机名,留空会使用当前电脑的主机名
time: 7:00   # (可选) 在收到“本时段禁止上网”后的重连时间,默认为7点整
reconnect: 15   # (可选) 出现意外情况时的重连间隔,默认为15秒
heartbeat:
  eap_timeout: 60   # (可选) EAP连接心跳间隔,默认为60秒
  udp_timeout: 12   # (可选) UDP连接心跳间隔,默认为12秒
retry:
  count: 2   # (可选) 错误重试次数
  interval: 5000   # (可选) 数据包重发间隔、错误重试间隔,默认为5000毫秒
log:
  enable_console: false   # (可选) 是否输出日志到控制台
  enable_file: false   # (可选) 是否输出日志到文件
  file_directory: ./logs   # (可选) 日志文件目录
  level: INFO   # (可选) 日志等级
data:   # (可选) 以下参数通常不需要填写,填写错误可能会导致不可预计的问题
  response_identity:
    unknown:
  response_md5_challenge:
    unknown:
  misc_info:
    unknown1:
    cks32_param:
    unknown2:
    os_major:
    os_minor:
    os_build:
    os_unknown:
    version:
    hash:

构建和编译

一般构建

cargo build --release
  • 如果你想去掉更好的日志功能而使用最简单的控制台日志,可以禁用 log4rs 特性

    cargo build --release --no-default-features
  • 需要使用 Nightly 版本的 Rust 进行编译。

  • 由于使用了 libpnet ,在Windows下需要安装 WinPcappcap 才能进行编译,详见libpnet

  • 目前在 Windows/Ubuntu(感谢hyh) 下编译通过,其余环境暂未测试。

OpenWRT

  • 由于并没有了解这方面,待补充。

许可证

LGPLv3


鸣谢

  • hyh
  • cq
  • 所有参与使用的同学

drcom4scut's People

Contributors

cq01 avatar sealoong 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  avatar

Watchers

 avatar  avatar  avatar

drcom4scut's Issues

Npcap Driver Nonpaged Pool Memory Leak

版本 Version

  • drcom4scut: 0.30
  • Npcap: 1.77

概述 Overview

drcom4scut 建立 EAP 会话后,Npcap 驱动程序缓存的报文不会被释放直至重启,Npcap 驱动程序占用的非分页池容量随网络传输数据量的增加而增加。

After drcom4scut established the EAP session, the frames stored by the Npcap driver will not not be released until reboot, and the nonpaged pool occupied by the Npcap driver increases with the increase of the amount of data transferred over the network.

细节 Detail

drcom4scut 建立 EAP 会话后,进行一些网络传输,随后使用 poolmon.exe -u -p -g pooltag.txt 分析驱动程序内存分配,发现具有 NpCDNpNLNpNBNpPD 标识的驱动程序使用了大量的非分页池。

After drcom4scut established the EAP session, make some network transfers, and then analyze the driver memory allocation using poolmon.exe -u -p -g pooltag.txt and finds that drivers with tags NpCD, NpNL, NpNB, NpPD use a large amount of nonpaged pools.

PoolMon

经查,该驱动程序是 Npcap。

The driver is Npcap.

https://github.com/nmap/npcap/blob/c7acb360ac1e5288379a746cf7691fa2b48e5684/packetWin7/npf/npf/memory_tags.h#L147-L148

测试 Test

应用程序
Application
驱动程序
Library
内存泄漏
Memory Leak
drcom4scut 0.3.0 WinPcap 4.1.3 No
drcom4scut 0.3.0 Npcap 1.71 No
drcom4scut 0.3.0 Npcap 1.72 No
drcom4scut 0.3.0 Npcap 1.73 No
drcom4scut 0.3.0 Npcap 1.74 No
drcom4scut 0.3.0 Npcap 1.75 No
drcom4scut 0.3.0 Npcap 1.76 Yes
drcom4scut 0.3.0 Npcap 1.77 Yes
Wireshark 2.5.1 Npcap 1.77 No
Wireshark 4.0.10 Npcap 1.77 No

这个报错是什么意思

thread 'main' panicked at 'Fail on getting ethernet device!: Os { code: 31, kind: Other, message: "连到系统上的设备没有
发挥作用。" }', src\main.rs:164:55
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

大概意思是没有检测到宽带信号接入?可是实际上宽带接入是正常的

网线拔出后无法触发异常处理,因此无法自动重连

有时候需要离线操作因此需要短暂几秒拔出网线,但是程序并没有捕捉到相应错误(已拔出网线),重新插入网线后也无法自动重连。

但是好像主程序本身是有异常处理的,或许是没有判断网线是否拔出?....

2023/09/19 WSL/Ubuntu均编译不过

如题,出错信息如下:

error[E0635]: unknown feature `proc_macro_span_shrink`
  --> /home/wsl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/lib.rs:92:30
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |                              ^^^^^^^^^^^^^^^^^^^^^^

RustC的版本信息:

rustc 1.74.0-nightly (65ea825f4 2023-09-18)
binary: rustc
commit-hash: 65ea825f4021eaf77f1b25139969712d65b435a4
commit-date: 2023-09-18
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0

切到stable和beta都不会卡在那里。但是,另外两个通道不能用#![feature],所以也编译不出来。
如何才能解决呢?

谢谢。

“带网络的安全模式”下无法使用

系统:Windows10 LTSC(1809)

报错如下:

PS C:\Users\redapple\Desktop\drcom4scut-windows> .\drcom4scut.exe
[2021-10-17 20:26:08][INFO][main] Start to run...
thread 'main' panicked at 'Unable to get interface list despite increasing buffer size', C:\Users\SeaLoong\.cargo\registry\src\github.com-1ecc6299db9ec823\pnet_datalink-0.27.2\src\winpcap.rs:349:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.