1个不稳定版本

0.1.0 2020年10月10日

#18 in #axis

MIT/Apache

38KB
966 代码行

axctl

AXIS通信设备的命令行界面。

安装

安装Rust。推荐使用rustup。然后

$ cargo install axctl

使用

$ axctl
  axctl 0.1.0
  
  
  USAGE:
      axctl [FLAGS] <SUBCOMMAND>
  
  FLAGS:
      -h, --help       Prints help information
      -q, --quiet      Print less information
      -v, --verbose    Print more information
      -V, --version    Prints version information
  
  SUBCOMMANDS:
      help     Prints this message or the help of the given subcommand(s)
      log      Print the system log
      shell    Run an interactive shell on an AXIS camera
$

日志

axctl log(又称axctl tail)显示系统日志,输出结果带颜色。类似于tail,它还支持-n-f

$ axctl log http://user:[email protected] -n 10 -f
2020-10-10T12:30:10.064-05:00 [ INFO    ] systemd[1] Condition check resulted in Temporary Directory (/tmp) being skipped.
2020-10-10T12:30:10.098-05:00 [ INFO    ] systemd[1] Starting Rotate log files...
2020-10-10T12:30:10.983-05:00 [ INFO    ] systemd[1] logrotate.service: Succeeded.
2020-10-10T12:30:11.024-05:00 [ INFO    ] systemd[1] Started Rotate log files.
2020-10-10T12:32:31.153-05:00 [ INFO    ] udhcpc[535] udhcpc: sending renew to 172.16.4.1
2020-10-10T12:32:33.199-05:00 [ INFO    ] udhcpc[535] udhcpc: lease of 172.16.4.30 obtained, lease time 600
2020-10-10T12:37:33.677-05:00 [ INFO    ] udhcpc[535] udhcpc: sending renew to 172.16.4.1
2020-10-10T12:37:35.716-05:00 [ INFO    ] udhcpc[535] udhcpc: lease of 172.16.4.30 obtained, lease time 600
2020-10-10T12:42:35.236-05:00 [ INFO    ] udhcpc[535] udhcpc: sending renew to 172.16.4.1
2020-10-10T12:42:37.268-05:00 [ INFO    ] udhcpc[535] udhcpc: lease of 172.16.4.30 obtained, lease time 600
^C
$

Shell

axctl shell为管理员提供root shell。

$ axctl shell http://user:[email protected]
 => connected to 172.16.3.233:54766 (session 5f602651-35ba-4534-aa61-c4d5ae432fc0)
sh: can't access tty; job control turned off
axis-00408cfb6888# head /proc/cpuinfo
processor	: 0
cpu		: CRIS
cpu revision	: 32
cpu model	: ARTPEC-3
cache size	: 32 KB
fpu		: no
mmu		: yes
mmu DMA bug	: no
ethernet	: 10/100 Mbps
token ring	: no
axis-00408cfb6888# exit

 => cleaning up session 5f602651-35ba-4534-aa61-c4d5ae432fc0
$

此功能生成互信TLS的密钥对,生成应用程序包,并将其上传到设备。它并没有真正安装应用程序——包验证失败——但作为副作用,它在/tmp中进行了内存更改,并在任意端口上运行侦听TLS连接的程序。axctl连接,双方都出示证书,双方都验证对方,最终您的终端连接到sh

依赖

~18–30MB
~484K SLoC