SOURCE CODE DO SCANNER :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.NetworkInformation;
using System.Globalization;
namespace Scanner
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public IPAddress ip;
public PingReply pr;
public string ip1;
public Ping ping;
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
for (int i = Convert.ToInt32(txtStart.Text); i <= Convert.ToInt32(txtEnd.Text); i++)
{
try
{
if (backgroundWorker1.CancellationPending == true)
{
e.Cancel = true;
break;
}
else
{
ip1 = (txtIp.Text + "." + i.ToString());
ip = IPAddress.Parse(ip1);
ping = new Ping();
pr = ping.Send(ip, 5);
backgroundWorker1.ReportProgress(i);
}
}
catch
{
}
}
}
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
if (pr.Status.ToString() == "Success")
{
resultsListView.Items.Add(ip1);
}
try { this.progressBar1.Value = e.ProgressPercentage; }
catch { this.progressBar1.Maximum += 1; }
}
private void btStart_Click(object sender, EventArgs e)
{
progressBar1.Value = 0;
progressBar1.Maximum = Convert.ToInt32(txtEnd.Text);
backgroundWorker1.RunWorkerAsync();
}
private void btCancelar_Click(object sender, EventArgs e)
{
if (backgroundWorker1.WorkerSupportsCancellation == true)
{
backgroundWorker1.CancelAsync();
}
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
MessageBox.Show("Scanner Terminou!");
}
}
}
Ferramentas Visual Studio: http://www.microsoft.com/visualstudio/11/pt-br/downloads
Baixar Código fonte: http://Baixar/Scanner.rar
Baixar Programa: http://Baixar/Scanner_exe.rar
Necessário para rodar .NET Framework 3.5