Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Port Scanner | This port scanner somehow took down runelocus.com

I introduce to you a port scanner i decided to make... very bored

Handler:
PHP Code

<?php 
using System
;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 
Port_Scanner.Handler
{
    class 
ProxyHandler
    
{
  List<
int> Ports = new List<int>();
  
int portindex;
  
int maxindex;
  
int minindex;
  
int currentport;
  public 
ProxyHandler(string range)
  {
    for (
int i = 1; i < int.Parse(range.Split('-')[1]) + 1; i++)
    
Ports.Add(i);
    
minindex = Ports.IndexOf(int.Parse(range.Split('-')[0]));
    
maxindex = Ports.IndexOf(int.Parse(range.Split('-')[1]));
    
portindex = minindex;
  }
  public 
int NextProxy()
  {
    if (
portindex <= maxindex)
    {
    
currentport = Ports[portindex];
    
portindex++;
    }
    else
    
currentport = maxindex + 2;
    return 
currentport;
  }
    }
} 

Usage
PHP Code

<?php 
using System
;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Net.Sockets;
using Port_Scanner.Handler;
namespace 
Port_Scanner
{
    class 
Program
    
{
  static 
ProxyHandler handle;
  static 
int threadcount = 0;
  static 
int amount = 0;
  static 
TcpClient scan;
  static 
string hostname;
static 
int threadsalive;
  static List<
int> openports = new List<int>();
  static 
string portrange;
  static 
void Main(string[] args)
  {
    
Console.Write("Threads to use: ");
    
threadcount = int.Parse(Console.ReadLine());
    
Console.Write("Hostname: ");
    
hostname = Console.ReadLine();
    
Console.Write("Port range(80-100)");
    
portrange = Console.ReadLine();
    
DoWork(threadcount);
  }
  private static 
void DoWork(int threads)
  {
    
handle = new ProxyHandler(portrange);
    
Thread[] PortScanner = new Thread[threads];
    for (
int i = 0; i < threads; i++)
    {
    
PortScanner[i] = new Thread(grabproxy);
    
PortScanner[i].Start();
    }
  }
  private static 
void grabproxy()
  {
    
int currentport = 0;
    
string[] range = portrange.Split('-');
    while ((
currentport = handle.NextProxy()) != int.Parse(range[1]) + 1)
    
portscanner(currentport, hostname);
    
amount++;
    
Console.WriteLine("Threads finished: " + amount);
threadsalive = threadcount - amount;
    if (
threadsalive == 0)
    {
    
Console.WriteLine("Job finished");
    
Console.WriteLine("Open Ports:");
    foreach (
int port in openports)
    
Console.WriteLine(port);
    
Console.Read();
    }
  }
  private static 
void portscanner(int port, string host)
  {
  
Console.WriteLine("attempting port " + port);

  try
  {
  
scan = new TcpClient(host, port);
  if (
scan.Connected)
  
openports.Add(port);
  }
  catch { }

  }
    }
} 
Why would a port scanner take down a site?

They probably just blocked your IP address for a little while.
(Jan 13, 2013 04:19 PM)DeadLine Wrote:  Why would a port scanner take down a site?

They probably just blocked your IP address for a little while.

Connect/Disconnect

I confirmed this by trying other hosts + downforeveryoneorjustme

Must have been a coincidence..
(Jan 13, 2013 04:20 PM)basis Wrote:  Connect/Disconnect

I confirmed this by trying other hosts + downforeveryoneorjustme

Must have been a coincidence..
Well you can now officially start selling this as a DoS tool.
(Jan 13, 2013 04:23 PM)DeadLine Wrote:  Well you can now officially start selling this as a DoS tool.

Funny, try it for yourself see if it takes it down
Uhmm. You must be testing this at some shitty hosts. Also some sites blocks sites for checking if they're online. Ex. HF would also be offline xD
(Jan 13, 2013 05:05 PM)BaussHacker Wrote:  Uhmm. You must be testing this at some shitty hosts. Also some sites blocks sites for checking if they're online. Ex. HF would also be offline xD

Not with runelocus, i just checked it and it appeared online on that site.

Oh well 🤗

Most likely a coincidence...
(Jan 13, 2013 04:23 PM)DeadLine Wrote:  Well you can now officially start selling this as a DoS tool.
Yeah, good luck with the sales.😏
Theoretically if the site had a lot of visitors at the time and you used this code to open a bunch of sockets to the server, it would start denying requests. But I think what happened was that your IP address probably got filtered by some firewall or anti dos software

Sorry for gravedigging didn't realize how old this thread was. Don't know how I ended up on it.
[Image: Syr3DlV.png]
(May 30, 2018 10:33 PM)gigajew Wrote:  Theoretically if the site had a lot of visitors at the time and you used this code to open a bunch of sockets to the server, it would start denying requests. But I think what happened was that your IP address probably got filtered by some firewall or anti dos software

Sorry for gravedigging didn't realize how old this thread was. Don't know how I ended up on it.

Usually someone else gravedigs the thread, so the thread gets bumped up, then later removes his post when he notices his mistake, but then the thread is already bumped for some people.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by DeltacoderDec 19, 2011 02:35 AM 5 718 Dec 19, 2011 02:35 AM
Last Post: daniellook