Bienvenido a Tecnohackers

Tecnohackers » General del foro » Area de Programacion » Programacion a Bajo Nivel. APIs, Hooking, ASM, C/C++, etc. (Moderador: Doddy)
 » 

[C] ScanPort



Autor Tema: [C] ScanPort  (Leído 41 veces)

Desconectado Doddy

  • Moderator
  • Veterano
  • *****
  • Mensajes: 267
  • Slow Mind
[C] ScanPort
« en: Enero 08, 2012, 03:33:29 pm »
Un simple programa para scannear puertos, solo funciona bajo linux.

Código: No puedes ver links Registrate o Login
/**
* ScanPort 0.1
* Coded by Doddy H
**/

#include<stdio.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<stdlib.h>
#include<netdb.h>

void head() {
  printf("\n-- == ScanPort 0.1 == --\n");
}

void end() {
  printf("\n\nWritten By Doddy H\n\n");
}

int main(int argc,char **argv) {

  char *ip;
  int port,control,partedos,portstart,portend;
  struct sockaddr_in parteuno;

  head();
  if(argc != 4) {
    printf("\n[+] sintax : port <ip> <portstart> <portend>");
  } else {
    ip = argv[1];
    portstart = atoi(argv[2]);
    portend = atoi(argv[3]);
    printf("\n[+] Scanning %s\n",ip);
    printf("\n[+] Parameters : %d-%d\n",portstart,portend);
    for(port=portstart;port<portend;port++) {
      parteuno.sin_family=AF_INET;
      parteuno.sin_port=htons(port);
      parteuno.sin_addr.s_addr=inet_addr(ip);
      partedos=socket(AF_INET,SOCK_STREAM,0);
      control=connect(partedos,(struct sockaddr_in *)&parteuno,sizeof(parteuno));
      if(control>=0) {
        printf("\n[+] Port Found : %d",port);
      }   
    }
  }
  end();
  return 0;
}

/** The End ? **/

No puedes ver links Registrate o Login

Tags:

 

Related Topics

  Asunto / Iniciado por Respuestas Último mensaje
0 Respuestas
16 Vistas
Último mensaje Diciembre 01, 2011, 06:58:10 pm
por Doddy


SMF 2.0.2 | SMF © 2011, Simple Machines
Paginas Afiliadas
InfraBios - i-hacker - Twitter - FaceBook - Troyanosyvirus - LaWebDeGoku - daraxblog
Designed by Smf Personal