agentsclimarketplace

Pentest lab network services

Skill findscripter/everything-skills/08-security/pentest-lab-network-services

当需要在隔离靶场搭建并测试 HTTP/HTTPS/SNMP/SMB 等常见网络服务、用于练习服务枚举与日志分析时使用;做服务安装配置(Apache/IIS、snmpd、Samba)、防火墙放行、自签证书、枚举(snmpwalk/smbclient/enum4linux)与日志取证;不适用于生产环境、未授权扫描或真实攻击。触发词:靶场搭建、network 101、HTTP/HTTPS/SNMP/SMB 服务、服务枚举、Samba 共享From its SKILL.md

Install
npx -y skills add findscripter/everything-skills --skill pentest-lab-network-services

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

8.4 KB, ~2.7k tokens by cl100k_base, as published. Nobody here has run it

渗透实验网络服务搭建

仅限隔离靶场:本技能用于搭建供安全学习/演练的目标服务,必须在与生产隔离的实验环境中进行,且仅对自己拥有或获书面授权的系统操作。

何时使用

  • 需要快速搭一套常见可枚举服务(HTTP 80 / HTTPS 443 / SNMP 161 / SMB 445),作为渗透练习的「靶机」。
  • 想动手练习服务枚举、自签证书、共享权限、日志分析与取证的完整链路。
  • 给红蓝对抗、教学演示或工具验证准备可复现的目标环境。

不该用(负边界):

  • 任何生产/线上系统 —— 本技能故意配置弱口令社区串、匿名共享、777 权限,仅适合一次性靶场。
  • 对不属于自己或未获书面授权的目标做扫描/枚举 —— 属违法。
  • 需要的是「攻方方法论/报告」而非「搭目标」 —— 见 penetration-testing-methodology

前置条件:一台 Linux(推荐 Debian/Ubuntu,用 apt)或 Windows Server 作宿主,一台 Kali 作测试机,宿主管理员权限,基础网络知识(IP/端口),靶场与生产网络隔离。

步骤

  1. 选宿主与隔离网络,规划要开的服务与端口。
  2. 逐项安装配置服务(HTTP→HTTPS→SNMP→SMB),每项配完即放行防火墙并本机自测。
  3. 从 Kali 远程枚举验证(curl / nmap / snmpwalk / smbclient / enum4linux)。
  4. 制造并查看服务日志,练习日志解析与取证。
  5. 演练结束清理或销毁靶机(含 777 共享、明文社区串等不安全配置)。

通用约束:HTTP 80/TCP、HTTPS 443/TCP、SNMP 161/UDP、SMB 445/TCP、NetBIOS 137-139;服务要远程可达需绑定 0.0.0.0 而非 localhost

指令

1) HTTP 服务(80)

# Linux Apache
sudo apt update && sudo apt install apache2
sudo systemctl enable --now apache2
echo "<html><body><h1>Test Page</h1></body></html>" | sudo tee /var/www/html/index.html
curl http://localhost

Windows IIS:IIS 管理器 → Sites 右键 Add Website → 设站点名/物理路径 → 绑定 IP 与 80。 放行防火墙:

sudo ufw allow 80/tcp                                              # Linux
New-NetFirewallRule -DisplayName "HTTP" -Direction Inbound -Protocol TCP -LocalPort 80 -Action Allow   # Windows PS

2) HTTPS 服务(443,自签证书)

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
  -keyout /etc/ssl/private/apache-selfsigned.key \
  -out /etc/ssl/certs/apache-selfsigned.crt
sudo a2enmod ssl
sudo a2ensite default-ssl       # 先编辑 /etc/apache2/sites-available/default-ssl.conf 指向证书
sudo systemctl restart apache2
# 验证
nmap -p 443 192.168.1.1
openssl s_client -connect 192.168.1.1:443
curl -kv https://192.168.1.1

3) SNMP 服务(161/UDP)

sudo apt install snmpd snmp
# 编辑 /etc/snmp/snmpd.conf,加入(练习用,刻意弱配置):
#   rocommunity public
#   rwcommunity private
sudo systemctl restart snmpd

Windows:服务器管理器 → 添加功能 → SNMP Service → 在 服务→SNMP Service→属性 配置社区串。 枚举:

snmpwalk -c public -v1 192.168.1.1                                  # 全量
snmpwalk -c public -v1 192.168.1.1 1.3.6.1.2.1.1                    # 系统信息
snmpwalk -c public -v1 192.168.1.1 1.3.6.1.2.1.25.4.2.1.2          # 运行进程
snmp-check 192.168.1.1 -c public
onesixtyone -c /usr/share/seclists/Discovery/SNMP/common-snmp-community-strings.txt 192.168.1.1  # 爆破社区串

4) SMB 服务(445)

sudo apt install samba
sudo mkdir -p /srv/samba/share && sudo chmod 777 /srv/samba/share
# 编辑 /etc/samba/smb.conf,追加共享段:
#   [public]
#      path = /srv/samba/share
#      browsable = yes
#      guest ok = yes
#      read only = no
sudo systemctl restart smbd

Windows:建文件夹 → 右键属性→共享→高级共享 → 启用共享设权限 → 配 NTFS 权限。 枚举:

smbclient -L //192.168.1.1 -N        # 匿名列共享
smbclient //192.168.1.1/share -N     # 连接共享
smbmap -H 192.168.1.1
enum4linux -a 192.168.1.1            # 全量 SMB/NetBIOS 枚举
nmap --script smb-vuln* 192.168.1.1  # 漏洞脚本

5) 日志分析

sudo tail -f /var/log/apache2/access.log        # Apache 访问日志
sudo tail -f /var/log/apache2/error.log         # 错误日志
# Windows IIS 日志: C:\inetpub\logs\LogFiles\W3SVC1\
grep "POST" /var/log/apache2/access.log                          # 找 POST(可能含登录)
awk '{print $12}' /var/log/apache2/access.log | sort | uniq -c   # 统计 User-Agent

快速验活

curl -I http://target          # HTTP
curl -kI https://target        # HTTPS
snmpwalk -c public -v1 target  # SNMP
smbclient -L //target -N       # SMB

常用枚举工具:nmap(端口/脚本)、nikto(Web 漏扫)、snmpwalk(SNMP)、enum4linux(SMB/NetBIOS)、smbclient(SMB 连接)、gobuster(目录爆破)。

示例

示例 1 · HTTP 登录页靶标

sudo apt install apache2 && sudo systemctl start apache2
cat << 'EOF' | sudo tee /var/www/html/login.html
<html><body>
<form method="POST" action="login.php">
Username: <input type="text" name="user"><br>
Password: <input type="password" name="pass"><br>
<input type="submit" value="Login">
</form>
</body></html>
EOF
sudo ufw allow 80/tcp

随后从 Kali 访问该页提交表单,再在宿主 grep "POST" access.log 复盘日志,练习明文凭据取证。

示例 2 · SNMP 枚举靶标

sudo apt install snmpd
echo "rocommunity public" | sudo tee -a /etc/snmp/snmpd.conf
sudo systemctl restart snmpd
snmpwalk -c public -v1 localhost

示例 3 · SMB 匿名共享

sudo apt install samba
sudo mkdir /srv/samba/anonymous && sudo chmod 777 /srv/samba/anonymous
smbclient //localhost/anonymous -N

注意事项

  • 隔离与销毁:靶场须与生产隔离;用完销毁,弱口令社区串/匿名共享/777 权限绝不可遗留到真实环境。
  • 明文风险:SNMP v1/v2c 社区串、HTTP 表单均明文传输,仅适合受控演练,借此理解为何要升级到 SNMPv3/HTTPS。
  • 自签证书会触发浏览器告警,需手动接受或导入信任库;这正是练习点之一。
  • 默认禁匿名:真实系统通常默认关闭匿名 SMB;靶场为可枚举才刻意开启。
  • 远程不可达排查:① 防火墙未放行(ufw/iptables/Windows 防火墙);② 服务绑了 localhost,改 0.0.0.0;③ SNMP 超时先确认 UDP 161 开放与社区串正确;④ 服务起不来看 journalctl -u <服务名>;⑤ SMB 拒绝访问核对共享权限与凭据。

互见

  • related:penetration-testing-methodology —— 搭好靶标后用其方法论做端到端攻方演练
  • related:wireshark-traffic-analysis —— 抓取靶场流量,验证明文凭据/SNMP 串外泄
  • related:shodan-reconnaissance —— 服务/端口指纹识别的外部视角对照
  • combines_with:red-team-recon —— 对本靶标先做侦察与攻击面枚举
  • combines_with:linux-privilege-escalation —— 拿到靶机立足点后练习提权

本条采编自 sickn33/antigravity-awesome-skills(原 skill:network-101,作者 zebbern,MIT 许可),适配重写为中文 Agent 消费版。

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,852. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.