/***********************************************
 * released under (E) licensing ...            *
 *        (E) RULES AND REGULATIONS            *
 * permission to use/rewrite/add     : granted *
 * permission to trojan/steal        : denied  *
 * permission to use illegally       : denied  *
 * permission to use on /dev/urandom : denied  *
 ***********************************************/
/* contact el8@press.co.jp for full license    */
/* code copyrighted by ~el8 -- don't infringe! */

/*
 * slowscan.c
 *
 * by hybrid [proof of concept code]
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <netinet/in.h>

int main(int argc, char * argv[])
{
struct sockaddr_in sin;
int fd,i,max=65535;


fd=socket(AF_INET,SOCK_STREAM,0);
if(fd<0)
puts("error"),exit(-1);

sin.sin_family=AF_INET;
sin.sin_addr.s_addr = inet_addr(argv[1]);

for(i=0;i<=max;i++)
{
sleep(atoi(argv[2])*1440);
sin.sin_port=htons(i);
if(connect(fd,(struct sockaddr *)&sin,sizeof(sin))<0)
continue;
else printf("port %i is open!\n", i);
}

close(fd);
return(0);
}


syntax highlighted by Code2HTML, v. 0.9.1