Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Portscanner / C / Win -> zu langsam

Empfohlene Antworten

Veröffentlicht


#include <stdio.h>

#include <windows.h>




int main(int argc, char **argv)

{

  //Definitionen und Deklarationen

	int temp;

	int begin;

	int end;

	int sd;

	int loop;

	WSADATA firstsock;

	char hostname[100];

	struct sockaddr_in HOST_ADDR;



	// Input

	printf("Enter ip to scan :\t");

	gets(hostname);

	if(!(isdigit(hostname[0])))

		exit(EXIT_FAILURE);

	printf("Enter starting port :\t");

	scanf("%d" , &begin);

	printf("Enter ending port :\t");

	scanf("%d" , &end);

	system("cls");



	//Initialisiere winsock

	if (WSAStartup(MAKEWORD(2,0),&firstsock) != 0)

		{

		fprintf(stderr,"WSAStartup() failed!");

		exit(EXIT_FAILURE);

		}



	//Host definieren

	HOST_ADDR.sin_family = AF_INET;

	HOST_ADDR.sin_addr.s_addr = inet_addr(hostname);



	// Alle Daten Ausgeben und mainloop starten

	printf("Hostname:\t%s\t%d\n"

			"Startport:\t%d\n"

			"Endport:\t%d\n\n", hostname, HOST_ADDR.sin_addr.s_addr, begin, end);



	// Schleife um die einzelnen Ports abzufragen

	for(loop = begin; loop <= end; loop++)

		{

		HOST_ADDR.sin_port = htons(loop);


		//Socket öffnen

		sd = socket(AF_INET , SOCK_STREAM , IPPROTO_TCP);

		if (sd == -1)

			printf("Socket could not be created.\n");


		//Versuche mit Port zu verbinden

		temp = connect(sd , (struct sockaddr *)&HOST_ADDR , sizeof HOST_ADDR);

		if (temp == -1)

			printf("Port %d is closed.\n", loop);

		else

			printf("Port %d is open\n", loop);


		//Socket schließen

		temp = closesocket(sd);

		if (temp == -1)

			printf("Socket %s:%d could not be closed properly.\n",hostname, loop);

		}



	//Beende winsock

	WSACleanup();



	printf("Portscan has finished\n");

	system("pause");

	return EXIT_SUCCESS;

}

Pro Port braucht er eine halbe Sekunde.:upps

Was meint ihr wie kann ich den beschleunigen?

Grüße

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.