1 Star 0 Fork 50

古木/K8tools

forked from 天明/K8tools 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
K8Cscan Moudle PortScan.cs 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
k8gege 提交于 2019-04-07 01:32 . Add files via upload
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Text.RegularExpressions;
using System.Net.Sockets;
//Cscan 3.1 PortScan Moudle
namespace CscanDLL
{
public class scan
{
public static string run(string ip)
{
if (string.IsNullOrEmpty(ip))
return "";
else
{
if (K8CheckPort(ip, 21))
Console.Write(ip + "\t21 Open\r\n");
if (K8CheckPort(ip, 80))
Console.Write(ip + "\t80 Open\r\n");
if (K8CheckPort(ip, 1433))
Console.Write(ip + "\t1433 Open\r\n");
if (K8CheckPort(ip, 3306))
Console.Write(ip + "\t3306 Open\r\n");
if (K8CheckPort(ip, 1521))
Console.Write(ip + "\t1521 Open\r\n");
if (K8CheckPort(ip, 3389))
Console.Write(ip + "\t3389 Open\r\n");
}
return "";
}
private static bool K8CheckPort(string ip, int Port)
{
//int Port = 21;
IPAddress scanip = IPAddress.Parse(ip);
IPEndPoint point = new IPEndPoint(scanip, Port);
try
{
TcpClient tcp = new TcpClient();
tcp.Connect(point);
//Console.WriteLine(scanip + "\t" + Port + "\tOpen");
return true;
}
catch (Exception ex)
{
//Console.WriteLine(scanip + "\t" + Port + "\tClose");
return false;
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PowerShell
1
https://gitee.com/gd8426/K8tools.git
git@gitee.com:gd8426/K8tools.git
gd8426
K8tools
K8tools
master

搜索帮助