抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

搭建Linux环境与安装busybox

1.环境

  • 系统

Windows

  • 测试手机

红米5A note(已经root)

  • 具有1台frp服务器,并且部署在外网

2.下载busybox,让Android的命令更加丰富

根据手机cpu架构下载对应架构的busybox,红米的cpu用的armv8架构,所以下载armv8的,这是官方链接,把busybox-armv8l另存为busybox

3.打开手机的adb远程端口

  1. 下载Android platform tools

官方链接

用adb工具链接手机,输入命令打开adb远程端口

1
2
3
4
#这个是在Windows的power shell中执行的,进入adb的工作目录
.\adb.exe tcpip 5555 (端口号)
.\adb.exe disconnect #端口所有adb链接
.\adb.exe connect 192.168.1.199:5555 (Android设备内网的IP地址)

4.有时候/system没办法挂载为可读可写时需要运行下面命令

1
2
3
.\adb.exe  root
.\adb.exe disable-verity
.\adb.exe reboot

之后就可以使用RE管理器挂载system挂载成可读可写了。

5.将用adb将busybox推送到手机上

1
2
.\adb.exe push ~/Desktop/busybox /system/xbin
.\adb.exe shell
1
2
3
4
5
$ cd /system/xbin
$ chmod 755 busybox
$ ./busybox --install .
#取消ls显示颜色,不然ls会有乱码显示
$ alias ls='busybox ls --color=never'

6.安装Linux环境(debian)

官方链接

  • 选择里面的ssh功能,然后启动linux容器,安装好之后,就会自动打开ssh 的22端口

7.挂载Android的盘到Linux容器上

  • 1,登陆本地设备查看挂载点,即是查看本地目录
  • 2,linux deploy 添加挂载点,将这个本地目录映射到容器上的挂载点上

格式为:本地目录:挂载目录

在此已经将所有的远程环境搭建完毕

搭建在手机上搭建frp客户端服务

1.下载frp客户端

官方链接

2.连接手机并且推送到手机上

1
2
3
#先确保/system为可读可写目录,如何连接可以
.\adb.exe root
.\adb.exe shell
1
2
3
$ cd /system/xbin
$ mkdir frp
# 将frp放到/system/xbin/frp文件夹上,并解压

3.修改配置文件,参考配置文件如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# [common] is integral section
[common]
# A literal address or host name for IPv6 must be enclosed
# in square brackets, as in "[::1]:80", "[ipv6-host]:http" or "[ipv6-host%zone]:80"
server_addr = frp 服务器的IP地址
server_port = frp 服务器的端口

# if you want to connect frps by http proxy, you can set http_proxy here or in global environment variables
# it only works when protocol is tcp
# http_proxy = http://user:passwd@192.168.1.128:8080

# console or real logFile path like ./frpc.log
log_file = ./frpc.log

# trace, debug, info, warn, error
log_level = info

log_max_days = 3

# for authentication
token = frp服务器授权码,要与服务器的一致

# set admin address for control frpc's action by http api such as reload,这个的作用时可以让frpc使用reload热重启
admin_addr = 192.168.0.104
admin_port = 端口
admin_user = xxxx
admin_passwd = xxxx
# connections will be established in advance, default value is zero
pool_count = 20

# if tcp stream multiplexing is used, default is true, it must be same with frps
tcp_mux = true

# your proxy name will be changed to {user}.{proxy}
user = 用户名

# decide if exit program when first login failed, otherwise continuous relogin to frps
# default is true
login_fail_exit = true

# communication protocol used to connect to server
# now it supports tcp and kcp, default is tcp
protocol = tcp

# specify a dns server, so frpc will use this instead of default one
dns_server = 8.8.8.8

# proxy names you want to start divided by ','
# default is empty, means all proxies
# start = ssh,dns

# heartbeat configure, it's not recommended to modify the default value
# the default value of heartbeat_interval is 10 and heartbeat_timeout is 90
# heartbeat_interval = 30
# heartbeat_timeout = 90

# ssh is the proxy name same as server's configuration
# if user in [common] section is not empty, it will be changed to {user}.{proxy} such as your_name.ssh

[phone_ssh]
# tcp | udp | http | https, default is tcp
type = tcp
local_ip = 127.0.0.1
local_port = ssh的本地端口
# true or false, if true, messages between frps and frpc will be encrypted, default is false
use_encryption = false
# if true, message will be compressed
use_compression = false
# remote port listen by frps
remote_port = 映射到frp服务器的端口,这个端口需要frp服务器开放才行

[phone_adb]
# tcp | udp | http | https, default is tcp
type = tcp
local_ip = 127.0.0.1
local_port = adb的本地端口,前文章是5555
# true or false, if true, messages between frps and frpc will be encrypted, default is false
use_encryption = false
# if true, message will be compressed
use_compression = false
# remote port listen by frps
remote_port = 映射到frp服务器的端口,这个端口需要frp服务器开放才行

#以下两处xxorg需要修改为你自己希望的二级域名,访问地址xxorg.frp[1].chuantou.org
#[xxorg]
# type = http
# local_ip = 127.0.0.1
# local_port = 80
# #custom_domains = test.xxorg.com
# subdomain = xxorg
# privilege_mode = true
# use_gzip = true
# use_encryption = true
#
#[tcp3389]
# type = tcp
# privilege_mode = true
# local_ip = 127.0.0.1
# local_port = 3389
# remote_port = 53389

4.启动frp客户端

1
$ ./frpc -c frpc.ini #-c后面接的的是配置文件名字

5.查看端口是否转发成功

至此,可以远程登陆手机和adb连接了。

可以用adb连接手机做一些操作了,如打开某软件,关闭某软件。登陆ssh,安装nginx服务器之类的了

评论