上面的主机虽能上网,但是是内网,外面无法ssh连接进来,下面介绍如何使用内网穿透工具cpoalr远程。
下面以远程控制我的USB 随身wifi armbian为例:
- 在我的armbian上首先安装openssh
- apt-get install openssh-server service sshd start
- 注册cpolar账号
- 安装cpolar
curl -l https://www.cpolar.com/static/downloads/install-release-cpolar.sh |sudo bash
systemctl enable cpolar
systemctl start cpolar
4. 绑定token,登陆官网查看获取,绑定:
点击“”“验证”
在被控制机执行,token替换你的:
cpolar authtoken ODE3NmZjNtYzViMjdmY2I4YTUw
systemctl restart cpolar
回到cpolar的官网,点击“状态”:
其他使用功能参考:https://www.cpolar.com/blog/ssh-remote-linux-centos?channel=0&invite=4W3F
解决端口老换的问题:定时爬取端口,通过pushplus 推送到微信,以下为代码:
#!/usr/bin/env python3
# coding: utf-8
import requests
import re,time
now = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
def getdata():
session = requests.session()
url = "https://dashboard.cpolar.com/login"
#login
data = {
"login":"your_nme",
"password":"xxxx_your_sc"
}
session.post(url,data=data)
resp = session.get("https://dashboard.cpolar.com/status")
content = resp.text
content = re.findall('"#ZgotmplZ" target="_blank">tcp://(.+)</a></th>',content)[0]
return content +" -" + now
#send msg
def Pushplus(content):
#print(content)
token = '1b81b959bb_your_xxxx'
title = 'Today_ssh_code'
url = 'http://www.pushplus.plus/send?token=' + token + '&title=' + title + '&content=' + content + '&template=txt'
#print(url)
requests.get(url)
Pushplus(getdata())
加个定时任务就行了,以下是效果:
原文始发于微信公众号(网络铅笔头):内网穿透cpolar连内网armbian
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论