/*
* blackcore networking
* source@source.blackcore.net
*
* This IP generator works fast and efficiently because I took the inet_ntoa
* function out of the glibc source and put it in here, therefor it does not
* have to call an outside function.
*
* Compile: gcc -o genn genn.c -O2
* Compile: cl genn.c /DWIN32
* Generate a /8
* usage: ./genn 127.0.0.0 127.255.255.255
* Generate a /16
* usage: ./genn 127.16.0.0 127.16.255.255
* Generate a /8
* usage: ./genn 127.0.0.0 127.0.0.255
* Or learn to count
* usage: ./genn 1.0.0.0 9.0.0.0
*
* da fastest IP generator eva.
*
* da fastest IP generator eva. is a trademark of blackcore networking
Copyright 2006 blackcore networking
$Id: template_replace_with_filename.html,v 0 2006/04/09 10:11:28 webmaster Exp $ Copyright 2006, BrakCult.
Copyright 2006, blackcore networking.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include
#include
#ifdef WIN32
#include
#pragma comment(lib, "ws2_32.lib")
#else
#include
#endif
char *my_ntoa(unsigned long in) {
char string[4];
static char out[32];
memcpy(&string, (char *)&in, 4);
sprintf(out, "%d.%d.%d.%d", (unsigned char)string[3], (unsigned char)string[2], (unsigned char)string[1], (unsigned char)string[0]);
return out;
}
int main(int argc, char *argv[]) {
unsigned long start, end;
if (argc < 3) {
printf("usage: %s \n", argv[0]);
return 1;
}
start = ntohl(inet_addr((const char *)argv[1]));
end = (ntohl(inet_addr((const char *)argv[2]))) + 1;
while (start != end)
// for(;startend;start++)
printf("%s\n", my_ntoa(start++));
return 0;
}