端口扫描代码_用编程语言实现端口扫描

hacker|
185

怎么 *** 一个BAT的端口扫描器

@echo off

setlocal enabledelayedexpansion

title 端口扫描器 by 风旋碧浪

color 4fMODE con: COLS=50 LINES=12

echo.echo 开始扫描,需要时间,请稍候……蚂掘

(echo.echo 端口蠢唯号 进程名称

echo.echo TCP协议: )端口查看.txt

echo.echo 正在扫描TCP协议……

for /f "skip=4 tokens=2,5" %%a in ('netstat -ano -p TCP') do (

for /f "tokens=2 delims=:" %%A in ("%%a") do set TCP端口=%%A

for /f "skip=2 delims=, tokens=1" %%A in ('tasklist /fi "PID eq %%b" /FO CSV') do set TCP进程=%%~A

echo !TCP端口! !TCP进程!端口查看.txt

)

echo UDP协议: 端口查看.txt

echo.echo 正在扫描UDP协议……

for /f "skip=4 tokens=2,4" %%a in ('netstat -ano -p UDP') do (

for /f "tokens=2 delims=:" %%A in ("%%a") do set UDP端口=%%A

for /f "skip=2 delims=, tokens=1" %%A in ('tasklist /fi "PID eq %%b" /FO CSV') do set UDP进程=%%~A

echo !UDP端闷档核口! !UDP进程!端口查看.txt

)

echo.echo.echo 扫描结束!请查看《端口查看.txt》文件!

pausenul

0条大神的评论

发表评论