All pastes #625501 Raw Edit

Mine

public text v1 · immutable
·published 2007-07-18 23:44 UTC
rendered paste body
/*
	cman - coleman port scanner
	authors	:	sunjester, rayb0t
	purpose	:	this application will take an ip address and
				a range of portnumbers and scan each host for
				the portnumbers specified.
*/

#include <stdio.h>
#include <windows.h>
#include <winsock.h>

int main() {
	//declare variables
	int a, b, c, d, startPortNum, endPortNum, currentPortNum;

	printf("\tSYNTAX: ipAddress [starting port number] [ending portnumber]\
		\n\t\t- Example: 127.0.0.1 80-6665\n\n");
	printf("cman> ");
	scanf("%d.%d.%d.%d %d-%d",&a, &b, &c, &d, &startPortNum, &endPortNum);
	currentPortNum = startPortNum;//set the current number to the startnumber

	//check for a valid range
	if(a>255 || a<0 || b>255 || b<0 || c>255 || c<0 || d>255 || d<0) {
		printf("Invalid Range!\n");
		return 1;
	}

	//increment our ip values
	while(a <= 255)
	{
		while(b <= 255)
		{
			while(c <= 255)
			{
				while(d <= 255)
				{
					//show current status
					printf("current port: %d\n", currentPortNum);
					printf("current ip  : %d.%d.%d.%d\n", a, b, c, d);

					system("cls");//clear screen
					currentPortNum++;//increment portnumber

					if(currentPortNum == endPortNum) {
						currentPortNum = startPortNum;//reset portnumber
						d++;//increment last number
					}
				}
				d = 0;
				c++;
			}
			c = 0;
			b++;
		}
		b = 0;
		a++;
	} 

	return 0;//normal termination
}