跳板攻击之:NPS代理转发
跳板攻击之:NPS代理转发
1 NPS介绍
官方介绍太官方了,看了还需要时间慢慢理解,因此写此文章,以具体案例方便理解
nps是一款轻量级、高性能、功能强大的内网穿透代理服务器。目前支持tcp、udp流量转发,可支持任何tcp、udp上层协议(访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析等等……),此外还支持内网http代理、内网socks5代理、p2p等,并带有功能强大的web管理端。
2 NPS特点
协议支持全面,兼容几乎所有常用协议,例如tcp、udp、http(s)、socks5、p2p、http代理...
全平台兼容(linux、windows、macos、群辉等),支持一键安装为系统服务
控制全面,同时支持服务端和客户端控制
https集成,支持将后端代理和web服务转成https,同时支持多证书
操作简单,只需简单的配置即可在web ui上完成其余操作
展示信息全面,流量、系统信息、即时带宽、客户端版本等
扩展功能强大,该有的都有了(缓存、压缩、加密、流量限制、带宽限制、端口复用等等)
域名解析具备自定义header、404页面配置、host修改、站点保护、URL路由、泛解析等功能
服务端支持多用户和用户注册功能
3 实验环境
3.1 实验准备
- 添加 A 记录 <your_vps_ domain> 指向 VPS IP
- Metasploitable主机开放了22,23与80端口与服务
3.2 实验拓扑

3.3 NPS配置
3.3.1 conf/nps.conf
appname = nps
#Boot mode(dev|pro)
runmode = dev
#HTTP(S) proxy port, no startup if empty
http_proxy_ip=0.0.0.0
http_proxy_port=80
https_proxy_port=443
https_just_proxy=true
#default https certificate setting
https_default_cert_file=conf/server.pem
https_default_key_file=conf/server.key
##bridge,默认是8084,此处修改为8081
bridge_type=tcp
bridge_port=8081
bridge_ip=0.0.0.0
# Public password, which clients can use to connect to the server
# After the connection, the server will be able to open relevant ports and parse related domain names according to its own configuration file.
public_vkey=Admin@123
#Traffic data persistence interval(minute)
#Ignorance means no persistence
#flow_store_interval=1
# log level LevelEmergency->0 LevelAlert->1 LevelCritical->2 LevelError->3 LevelWarning->4 LevelNotice->5 LevelInformational->6 LevelDebug->7
log_level=7
#log_path=nps.log
#Whether to restrict IP access, true or false or ignore
#ip_limit=true
#p2p
#p2p_ip=127.0.0.1
#p2p_port=6000
#web
web_host=a.o.com
web_username=fcarey
web_password=Aadmin@123
web_port = 8080
web_ip=0.0.0.0
web_base_url=
web_open_ssl=false
web_cert_file=conf/server.pem
web_key_file=conf/server.key
# if web under proxy use sub path. like http://host/nps need this.
#web_base_url=/nps
#Web API unauthenticated IP address(the len of auth_crypt_key must be 16)
#Remove comments if needed
#auth_key=test
#auth_crypt_key =1234567812345678
auth_crypt_key =admin123admin123
#allow_ports=9001-9009,10001,11000-12000
#Web management multi-user login
allow_user_login=false
allow_user_register=false
allow_user_change_username=false
#extension
allow_flow_limit=false
allow_rate_limit=false
allow_tunnel_num_limit=false
allow_local_proxy=false
allow_connection_num_limit=false
allow_multi_ip=false
system_info_display=false
#cache
http_cache=false
http_cache_length=100
#get origin ip
http_add_origin_header=false
#pprof debug options
#pprof_ip=0.0.0.0
#pprof_port=9999
#client disconnect timeout
disconnect_timeout=60
3.3.2 NPS配置客户端
| 类型 | 内容 |
|---|---|
| 备注 | Client1 |
Basic 认证用户名仅限Socks5、Web、HTTP转发代理 |
Client1 |
Basic 认证密码仅限Socks5、Web、HTTP转发代理 |
Aadmin@123 |
唯一验证密钥唯一值,不填将自动生成 |
Aadmin@123 |
| 允许客户端通过配置文件连接 | 是 |
| 压缩 | 是 |
| 加密 | 是 |

3.4 NPC 无配置文件连接 NPS
./npc -server=192.168.50.49:8081 -vkey=Aadmin@123 -type=tcp
3.4.1 若遇到错误提示:找不到配置文件
0.26.7 客户端无法无配置文件启动 · Issue #556 · ehang-io/nps · GitHub
下载客户端并解压,运行
./npc -server=xxxxxx:8024 -vkey=xxxxxx 2020/05/24 20:00:59.554 [I] [npc.go:231] the version of client is 0.26.7, the core version of client is 0.26.0
2020/05/24 20:00:59.570 [I] [control.go:97] Loading configuration file conf/npc.conf successfully
2020/05/24 20:01:20.574 [E] [control.go:111] dial tcp 172.0.0.1:8024: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
2020/05/24 20:01:20.575 [I] [control.go:102] Reconnecting...
中断运行并删除conf文件夹再运行
2020/05/24 19:57:37.941 [I] [npc.go:231] the version of client is 0.26.7, the core version of client is 0.26.0
2020/05/24 19:57:37.957 [E] [control.go:94] Config file conf/npc.conf loading error open conf/npc.conf: The system cannot
解决方式:
- 参数没传进去就用的配置文件,参数能不能传进去与你用的shell用法有关,换个shell试试
4 NPS代理socks
实现:kali通过socks代理,访问蓝队内网2 Metasploitable的 ssh 服务。
NPS WEB上配置:
类型 内容 模式 SOCKS代理 客户端 ID 2 备注 SOCKS_Proxy 服务端端口 2333 kali配置
/etc/proxychains4.conf:socks5 <your_vps_IP> 2333 Client1 Aadmin@123
- 代理服务器IP为:VPS 的 IP
kali通过NPS socks代理,访问蓝队内网2 Metasploitable的 ssh 服务。
# proxychains ssh msfadmin@192.168.50.49
The authenticity of host '192.168.50.49 (192.168.50.49)' can't be established.
ED25519 key fingerprint is SHA256:6Z6oAq5VrJ6itY95hYppj4VxvrdVRplMQGjvER7fBOE.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.50.49' (ED25519) to the list of known hosts.
msfadmin@192.168.50.49's password:
msfadmin@metasploitable:~$ id
uid=1000(msfadmin) gid=1000(msfadmin) groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),107(fuse),111(lpadmin),112(admin),119(sambashare),1000(msfadmin)
5 NPS HTTP 代理
实现:kali通过NPS HTTP代理,创建一个只有自己能访问到蓝队内网2 Metasploitable的 web 服务代理。
NPS WEB上配置:
类型 内容 模式 HTTP 客户端 ID 2 备注 HTTP_Proxy 服务端端口 8082 kali通过NPS HTTP 代理,访问到蓝队内网2 Metasploitable的 WEB 服务。

- 注:此处的用户与密码是创建客户端的时,配置完成的
6 NPS代理tcp
实现:kali通过NPS tcp代理,访问蓝队内网2 Metasploitable的 ssh 服务。
NPS WEB上配置:
类型 内容 模式 TCP 客户端 ID 2 备注 MSF_SSH 服务端端口 2222 目标 (IP:端口) 10.1.2.3:22kali通过NPStcp代理,访问蓝队内网2 Metasploitable的 ssh 服务。
# ssh msfadmin@192.168.50.49 2222
The authenticity of host '192.168.50.49 (192.168.50.49)' can't be established.
ED25519 key fingerprint is SHA256:6Z6oAq5VrJ6itY95hYppj4VxvrdVRplMQGjvER7fBOE.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.50.49' (ED25519) to the list of known hosts.
msfadmin@192.168.50.49's password:
msfadmin@metasploitable:~$ id
uid=1000(msfadmin) gid=1000(msfadmin) groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),107(fuse),111(lpadmin),112(admin),119(sambashare),1000(msfadmin)
7 NPS代理通过自定义域名访问内网的 Web 服务(域名解析功能)
实现:kali通过NPS 域名解析功能,使用
http://<your_vps_sub.domain>,访问蓝队内网2 Metasploitable 上的 WEB 服务器(80端口)。NPS WEB上配置:
类型 内容 客户端 ID 2 备注 DNS_Paser 主机 a.fcarey.com 模式 所有 URL路由 / 目标 (IP:端口) 10.1.2.3:80- 如果想访问
Win7上的web服务器(80端口),127.0.0.1
- 如果想访问
kali通过
http://a.fcarey.com:8888,访问蓝队内网2 Metasploitable上的 WEB 服务器(80端口)。
注:若没有域名又想做实验,确认效果:可以在本地修改host文件:
192.168.50.49 a.fcarey.com
8 NPS私密代理
实现:kali通过NPS 私密代理代理,创建一个只有自己能访问到蓝队内网2 Metasploitable的 telnet 服务代理。
NPS WEB上配置:
类型 内容 模式 私密代理 客户端 ID 2 备注 Screct_Proxy 目标 (IP:端口) 10.1.2.3:23唯一标识密钥 Aadmin@123 访问端命令(此处为Kali下的命令):
./npc -server=192.168.50.49:8081 -vkey=Aadmin@123 -type=tcp -password=Aadmin@123 -local_type=secret# npc -server=192.168.50.49:8081 -vkey=Aadmin@123 -type=tcp -password=Aadmin@123 -local_type=secret
2023/02/25 20:29:05.919 [I] [local.go:115] successful start-up of local tcp monitoring, port 2000
2023/02/25 20:29:32.319 [D] [local.go:117] new secret connection
kali通过NPS私密代理,访问到蓝队内网2 Metasploitable的 Telnet 服务。
# telnet -l msfadmin 127.0.0.1 2000
Password:
Last login: Fri Feb 24 12:00:19 EST 2023 from 10.1.2.1 on pts/2
Linux metasploitable 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686 The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law. To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
No mail.
msfadmin@metasploitable:~$
9 高级功能
10 交个朋友

跳板攻击之:NPS代理转发的更多相关文章
- ssh代理转发
实验环境 serverA:172.16.2.116 serverB:172.16.2.225 serverC:172.16.2.115 "代理转发"是针对ssh认证过程的一种转发 ...
- curl运行json串,代理转发格式
curl -b 'uin=o0450654733; skey=@tq9xjRvYy' -H "Content-Type: application/json" -X POST -d ...
- windows下使用密钥登录Linux及xshell代理转发
1.密钥登录原理 一般我们使用xshell访问远程主机(Linux主机)时,都是先请管理员给我们开一个账户,即为我们设置一个一个用户名和对应的密码,然后我们就可以使用下面的方式登录到远程主机了: 在这 ...
- IIS充当代理转发请求到Kestrel
接着上篇博文为ASP.NetCore程序启用SSL的code,这篇将介绍如何用IIS充当反向代理的角色转发请求到Kestrel服务器 与ASP.NET不同,ASP.netCore使用的是自托管web服 ...
- Nginx代理转发Apache+svn
1.安装svn和httpd yum install httpd yum install subversion mod_dav_svn 创建仓库目录 mkdir -p /var/www/svn 3.创建 ...
- nginx反向代理转发后页面上的js css文件无法加载【原创】
故障现象:nginx做代理转发后,发现页面上的js css文件无法加载,页面样式乱了. 原因:没有配置静态资源 解决js css文件无法加载无法访问的问题 解决办法: 修改配置文件nginx.conf ...
- Docker Kubernetes hostPort 代理转发
Docker Kubernetes hostPort 代理转发 hostPort: 1. 类似docker -p 映射宿主级端口到容器. 2. 容器所在的主机暴露端口转发到指定容器中. 3. hos ...
- IIS充当反向代理转发请求到Kestrel
接着上篇博文为ASP.NetCore程序启用SSL的code,这篇将介绍如何用IIS充当反向代理的角色转发请求到Kestrel服务器 介绍 与ASP.NET不同,ASP.netCore使用的是自托管w ...
- iis和apache共用80端口,IIS代理转发apache
为什么共用80端口应该不用多说了,服务器上程序运行环境有很多套,都想抢用80端口,所以就有了共用80端口的解决方案. 网上很多的教程一般都是设置APACHE使用默认80端口,代理转发IIS的网站,II ...
- (转)基于live555的流媒体代理转发服务器
对于并发量并不大而且对性能要求不是很高的流媒体传输模块,live555还是很好的选择,下面说一下我所实现的流媒体代理服务器(目前只能实现对H264单视频的转发)代理转发主要 对于并发量并不大而且对性能 ...
随机推荐
- <十>关于菱形继承
代码1 #include <iostream> using namespace std; class A{ public: A(int _a):ma(_a){ cout<<&q ...
- 【zookeeper】Zookeeper相关概念、重难点(myid)、语法、使用、工具
1234567890 1请按照我是想额度插入fvtgb6yhn7ujm8ik,9ol.
- Linux常用软件的安装及Nginx的使用
主要内容: 软件安装方式 上传与下载工具 常用软件的安装--jdk.tomcat.mysql.redis 项目的部署 Nginx的安装 Nginx的功能 静态网站部署 虚拟主机配置及端口绑定 域名绑定 ...
- 【大数据面试】Flink 04:状态编程与容错机制、Table API、SQL、Flink CEP
六.状态编程与容错机制 1.状态介绍 (1)分类 流式计算分为无状态和有状态 无状态流针对每个独立事件输出结果,有状态流需要维护一个状态,并基于多个事件输出结果(当前事件+当前状态值) (2)有状态计 ...
- java 如何正确使用接口返回对象Result
1. Result的使用 Result的使用,是java项目中开发接口的必备,它经常被我们用作接口的返回对象,方便前端或者其他程序的远程调用后处理业务.它一般包括以下几个属性: code:一般根据系统 ...
- vuex的使用详解
一.下载vuex 在store文件夹下的index.js中 官方文档:https://vuex.vuejs.org/zh/ 需要使用的页面 sotre中 mutations的调用方法 store ...
- javascript计算器
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- 【WPF】自定义一个自删除的多功能ListBox
原文地址 https://www.cnblogs.com/younShieh/p/17008534.html 如果本文对你有所帮助,不妨点个关注和推荐呀,这是对笔者最大的支持~ 我需要一个ListBo ...
- Python实验报告(第8章)
实验8:模块 一.实验目的和要求 1.了解模块的内容: 2.掌握模块的创建和导入方式: 3.了解包结构的创建和使用. 二.实验环境 软件版本:Python 3.10 64_bit 三.实验过程 1.实 ...
- 梯度下降算法 Gradient Descent
梯度下降算法 Gradient Descent 梯度下降算法是一种被广泛使用的优化算法.在读论文的时候碰到了一种参数优化问题: 在函数\(F\)中有若干参数是不确定的,已知\(n\)组训练数据,期望找 ...