what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Thrip Port Scanner

Thrip Port Scanner
Posted Aug 4, 2012
Authored by grell64

This is a multithreaded scanner that scans many ip addresses on a specified port simultaneously. It is very useful for finding insecure systems when used with such ports as 23 (Telnet) or 8080, which is the web interface for many routers. The author of this program takes no responsibility for the actions of its users.

tags | tool, web, scanner
systems | unix
SHA-256 | 8b00dfe8071bfc1a6b2d42de3eb31f6439e21d035b5ca397aa790740648b7fa1

Thrip Port Scanner

Change Mirror Download
/* 
Compile with: gcc thrip.c -o thrip -pthread

This is a multithreaded scanner that scans many ip addresses on a specified port simultaneously. It is very useful for finding insecure systems when used with such ports as 23 (Telnet) or 8080, which is the web interface for many routers. The author of this program takes no responsiblity for the actions of its users. If you have any comments or suggestions, feel free to contact me at this email: grell64@gmail.com. Thanks and enjoy.

-Grell
*/

#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>


void usage(char *);

void *net_thread(void *);

FILE *glob_file;

int glob_port;

static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;

static pthread_mutex_t mtx2 = PTHREAD_MUTEX_INITIALIZER;

int main(int argc, char *argv[])
{
int numthreads, rc;
long i;

srand(time(NULL));
if(argc != 3)
usage(argv[0]);

glob_port = atoi(argv[1]);
numthreads = atoi(argv[2]);
unsigned long *taskids[numthreads];
pthread_t thread_array[numthreads];

// generate array of random ip addresses
for(i = 0; i <= numthreads; i++)
{
taskids[i] = (long *) malloc(sizeof(long));
*taskids[i] = i;
rc = pthread_create(&thread_array[i], NULL, net_thread, (void *) taskids[i]);
}

// wait for all threads to finish

for(i = 0; i <= numthreads; i++)
{
pthread_join(thread_array[i], NULL);
}
return 0;
}

void usage(char *progname)
{
fprintf(stderr, "Usage: %s <port> <numthread>\n", progname);
exit(1);
}

void *net_thread(void *thr_arg)
{
int sockfd, s, g;
unsigned long connip;
unsigned int a, b, c, d;
struct sockaddr_in mysock;
char str_ip[30];


connip = (long) rand();
// separate bytes in connip

a = (connip >> 24 & 0xFF);
b = (connip >> 16 & 0xFF);
c = (connip >> 8 & 0xFF);
d = (connip & 0xFF);

if(a == 0x7F){ //loopback
return 0;
}


if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1){
perror("socket");
pthread_exit(NULL);
}

snprintf(str_ip, sizeof(str_ip), "%d.%d.%d.%d", a, b, c, d);

bzero(&mysock, sizeof(mysock));

mysock.sin_family = AF_INET;
mysock.sin_port = htons(glob_port); // short, network byte order
mysock.sin_addr.s_addr = htonl(connip);

if((connect(sockfd, (struct sockaddr *) &mysock, sizeof(mysock))) == -1){
switch(errno){
case ECONNREFUSED:
case ETIMEDOUT:
break;
default:
break;
}
return 0;
}
/* connection succeeds */
else{
g = pthread_mutex_lock(&mtx2);
printf("Port %d Open on %s\n", glob_port, str_ip);
g = pthread_mutex_unlock(&mtx2);
return 0;
}

return 0;
}
Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    0 Files
  • 9
    Sep 9th
    0 Files
  • 10
    Sep 10th
    0 Files
  • 11
    Sep 11th
    0 Files
  • 12
    Sep 12th
    0 Files
  • 13
    Sep 13th
    0 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    0 Files
  • 17
    Sep 17th
    0 Files
  • 18
    Sep 18th
    0 Files
  • 19
    Sep 19th
    0 Files
  • 20
    Sep 20th
    0 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close