主程序: K8Cscan 大型內網滲透自定義掃描器html
http://www.javashuo.com/article/p-xhgigpwl-kn.htmlgit
Cscan端口掃描插件源碼github
如下代碼編譯成netscan.dll,和Cscan.exe放在一塊兒便可,你們可根據須要自行定製需掃描的端口。tcp
固然也能夠直接調用s.exe,但網上部分版本的s,啓動多個時,S可能會崩潰或退出無結果返回。flex
再說調用DLL不會像調用s.exe那樣佔用資源,且會產生30個S掃描器進程(它不崩潰的話)spa
https://github.com/k8gege/K8CScan/blob/master/K8Cscan%20Moudle%20PortScan.cs插件
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; } } } }
效果:htm