安卓设备使用curl命令-可请求https等

所需资源

  1. root过的安卓设备
  2. mertux.apk完整安装包下载地址

配置环境

确保安卓设备已完成root,安装termux.apk后若无进入图标可通过adb命令打开mertux应用页面,操作如下

// com.termux为应用包名
adb shell dumpsys package com.termux|grep "Activity"
// 根据展示结果,打开指定activity
adb shell am start com.termux/.HomeActivity

在安卓设备termux页面执行curl命令即可查看结果,参考结果演示即可

在安卓设备的termux页面,输入如下指令:

apt update
apt install apt-transport-https 
apt install curl

当执行apt install apt-transport-https 时可能出现错误:Package has no installation candidate,解决办法如下:

apt-get update
apt-get upgrade
apt-get install apt-transport-https 

若是提示Package has no installation candidate,则作如下操作:

// 安装vim
apt install vim

/*编辑/etc/apt/sources.list文件,更改内容为如下,即修改源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
*/
vi /etc/apt/sources.list

// 更新apt
apt-get update
apt-get upgrade
apt-get install apt-transport-https 

结果演示

执行curl -i https-url
查看请求结果如下:
在这里插入图片描述


版权声明:本文为itCatface原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。