¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

Creando un portscanner

Ir abajo

Creando un portscanner Empty Creando un portscanner

Mensaje  [G]host Jue Ago 18, 2011 4:49 am

Código:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Net.Sockets;
using System.Windows.Forms;

namespace PortScanner
{
   public partial class frmMain : Form
   {
      protected int StartPort;
      protected int EndPort;

      public frmMain()
      {
         InitializeComponent();
      }

      private void btnScan_Click(object sender, EventArgs e)
      {
         
         StartPort = Convert.ToInt32(numStart.Value);
         EndPort = Convert.ToInt32(numEnd.Value);
         
         prgScanning.Value = 0;
         
         prgScanning.Maximum = EndPort - StartPort + 1;
         
         Cursor.Current = Cursors.WaitCursor;
         
         for (int CurrPort = StartPort; CurrPort <= EndPort; CurrPort++)
         {
            TcpClient TcpScan = new TcpClient();
            try
            {
               
               TcpScan.Connect(txtIP.Text, CurrPort);
               
               txtLog.AppendText("Port " + CurrPort + " open\r\n");
            }
            catch
            {
               
               txtLog.AppendText("Port " + CurrPort + " closed\r\n");
            }
            
            prgScanning.PerformStep();
         }
         
         Cursor.Current = Cursors.Arrow;
      }

        private void frmMain_Load(object sender, EventArgs e)
        {

        }

        private void txtIP_TextChanged(object sender, EventArgs e)
        {

        }

        private void numStart_ValueChanged(object sender, EventArgs e)
        {

        }

        private void numEnd_ValueChanged(object sender, EventArgs e)
        {

        }
   }
}
[G]host
[G]host
Admin

Mensajes : 67
Puntos : 204
Reputación : 0
Fecha de inscripción : 24/10/2010
Edad : 33

https://ghost.activo.mx

Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.