I took some source from LinuxSocket modified it, added a loop and a scanner function and took out some Constants and VOILA a scanner
note this version SUCKS UP TONS AND TONS OF MEM and Space if you don't pipe all errors to /dev/null
I need to work that out.
Code:
/*
* scan.c
* scanner written for Linux
* compile:
* gcc -o scan scan.c
* usage (RECOMMENDED)
* scan [IP] 2>/dev/null
* Original unmodified source can be found @ http://www.linuxsocket.org/
* New source created by Lucas Campbell
*
Copyright (C) 2002 Lucas Campbell
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/socket.h>
#include <resolv.h>
int main(int argc, char* argv[])
{ int acc;
int sockfd;
int j;
struct sockaddr_in dest;
char buffer[1024];
printf("WARNING, PIPE SCAN TO /dev/null\nscan address 2>/dev/null!");
printf("\nCtrl-C Now if you have not!\n");
sleep(2);
if(argv[1])
{
for(j = 20; j < 110; j++)
{
start:
/* Open socket for streaming */
if( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
perror("Socket");
j++;
goto start;
}
/* Init Server Address/port struct */
bzero(&dest,sizeof(dest));
dest.sin_family = AF_INET;
dest.sin_port = htons(j);
if ( inet_aton(argv[1], &dest.sin_addr.s_addr) == 0)
{
perror(argv[1]);
j++;
goto start;
}
if( connect(sockfd, (struct sockaddr*)&dest,sizeof(dest)) != 0)
{
perror("Connect ");
j++;
goto start;
}
bzero(buffer,1024);
recv(sockfd,buffer,sizeof(buffer),0);
printf("%s",buffer);
close(sockfd);
}
}
else
perror("Arguments\n");
return 0;
}