mIRC Home    About    Download    Register    News    Help

Print Thread
ftp #38335
25/07/03 10:20 PM
25/07/03 10:20 PM
Joined: Mar 2003
Posts: 437
M
MTech Offline OP
Fjord artisan
MTech  Offline OP
Fjord artisan
M

Joined: Mar 2003
Posts: 437
how can i check to see if a ftp is online, on port 21?

Re: ftp #38336
25/07/03 10:22 PM
25/07/03 10:22 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
codemastr  Offline
Hoopy frood
C

Joined: Dec 2002
Posts: 2,809
Umm well I guess you'd learn the FTP protocol and see if when you connect to port 21 you get a valid FTP response.

Re: ftp #38337
25/07/03 10:23 PM
25/07/03 10:23 PM
Joined: Mar 2003
Posts: 437
M
MTech Offline OP
Fjord artisan
MTech  Offline OP
Fjord artisan
M

Joined: Mar 2003
Posts: 437
yeah, but i was wondering if someone could help me that already knew it

Re: ftp #38338
25/07/03 10:30 PM
25/07/03 10:30 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
codemastr  Offline
Hoopy frood
C

Joined: Dec 2002
Posts: 2,809
Well the first (and easiest) step would be try and make sure sockopen suceeds on port 21, if it doesn't then you know there isn't an ftp server. Next thing you want to check for is probably going to be a 220 reply. The 220 reply looks like:

220 some-text-here
The text can be anything, so just check for the 220. In some circumstances, the server might be busy and to tell you this it will send a 120 reply. Again, you should only ensure that the first word is 120, the text after it will vary. Lastly, it may reply with a 421. This indicates it is an ftp server, but it doesn't want to let you connect. It is possible that other messages might be sent, but those are the standard ones that you should expect.

Re: ftp #38339
25/07/03 10:44 PM
25/07/03 10:44 PM
Joined: Jul 2003
Posts: 742
Ohio, U.S.A.
MTec89 Offline
Hoopy frood
MTec89  Offline
Hoopy frood

Joined: Jul 2003
Posts: 742
Ohio, U.S.A.
ok i did this:
Code:
alias cftp {
  if ($1 != $null) {
    sockopen ftp $1 21
  }
}
on *:SOCKREAD:ftp:{
  /sockread %temp
  /write ftp.txt %temp
}
on *:SOCKOPEN:ftp:{
  sockwrite -n $sockname GET / HTTP/1.1
  sockwrite -n $sockname Host: mtec89.ath.cx
  sockwrite -n $sockname Connection: keep-alive
  sockwrite $sockname $crlf
}

and got this:
Code:
220 MTec FTP
500 Unknown command.
500 Unknown command.
500 Unknown command.


so it knows it's online right? now how do i just make it check to see if its online, and do a command if its onlines, and if not, do nothing


http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: ftp #38340
26/07/03 12:33 AM
26/07/03 12:33 AM
Joined: Dec 2002
Posts: 774
T
theRat Offline
Hoopy frood
theRat  Offline
Hoopy frood
T

Joined: Dec 2002
Posts: 774
Why are you sending HTTP commands to FTP server, those are two diffrent protocols?


Code:
//if ( khaled isgod ) echo yes | else echo no
Re: ftp #38341
26/07/03 12:45 AM
26/07/03 12:45 AM
Joined: Jul 2003
Posts: 742
Ohio, U.S.A.
MTec89 Offline
Hoopy frood
MTec89  Offline
Hoopy frood

Joined: Jul 2003
Posts: 742
Ohio, U.S.A.
because i dont know anything about sockets, thats why im trying to get help..


http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: ftp #38342
26/07/03 03:58 AM
26/07/03 03:58 AM
Joined: Jul 2003
Posts: 742
Ohio, U.S.A.
MTec89 Offline
Hoopy frood
MTec89  Offline
Hoopy frood

Joined: Jul 2003
Posts: 742
Ohio, U.S.A.
can someone please help me with this?


http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: ftp #38343
26/07/03 07:13 AM
26/07/03 07:13 AM
Joined: Jan 2003
Posts: 3,012
New Hampshire, USA
KingTomato Offline
Hoopy frood
KingTomato  Offline
Hoopy frood

Joined: Jan 2003
Posts: 3,012
New Hampshire, USA
How about reading the RFC about FTP. Or is that again too hard a task for you, and looking for qwerty to spell it out for you again


-KingTomato
Re: ftp #38344
26/07/03 12:52 PM
26/07/03 12:52 PM
Joined: Jul 2003
Posts: 742
Ohio, U.S.A.
MTec89 Offline
Hoopy frood
MTec89  Offline
Hoopy frood

Joined: Jul 2003
Posts: 742
Ohio, U.S.A.
who is qwerty?


http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: ftp #38345
26/07/03 01:06 PM
26/07/03 01:06 PM
Joined: Dec 2002
Posts: 2,984
Hill End, NSW, Australia
Watchdog Offline
Hoopy frood
Watchdog  Offline
Hoopy frood

Joined: Dec 2002
Posts: 2,984
Hill End, NSW, Australia
Another chap that uses this web board.

qwerty

I just realised something too, it would be very hard to mis-spell his name.


Induced IRC
irc.induced.net
Re: ftp #38346
26/07/03 01:39 PM
26/07/03 01:39 PM
Joined: Mar 2003
Posts: 1,271
Sunnydale, CA
L
LocutusofBorg Offline
Hoopy frood
LocutusofBorg  Offline
Hoopy frood
L

Joined: Mar 2003
Posts: 1,271
Sunnydale, CA
You have no idea of the stupidity of some internet users then smile

Over 10% would misspell it on the first attempt


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
Re: ftp #38347
26/07/03 02:49 PM
26/07/03 02:49 PM
Joined: Dec 2002
Posts: 2,984
Hill End, NSW, Australia
Watchdog Offline
Hoopy frood
Watchdog  Offline
Hoopy frood

Joined: Dec 2002
Posts: 2,984
Hill End, NSW, Australia
lol.

*Watchdog slaps his jowls.


Induced IRC
irc.induced.net
Re: ftp #38348
26/07/03 03:32 PM
26/07/03 03:32 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
codemastr  Offline
Hoopy frood
C

Joined: Dec 2002
Posts: 2,809
You shouldn't have to send anything to the server, it should send you the 220 when you connect.

Re: ftp #38349
26/07/03 04:19 PM
26/07/03 04:19 PM
Joined: Jul 2003
Posts: 742
Ohio, U.S.A.
MTec89 Offline
Hoopy frood
MTec89  Offline
Hoopy frood

Joined: Jul 2003
Posts: 742
Ohio, U.S.A.
eh...this is too difficult...i have other projects to get done to worry about this...

thanks for ur time ;p


http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: ftp #38350
26/07/03 08:25 PM
26/07/03 08:25 PM
Joined: Dec 2002
Posts: 109
UK
T
tomalak16 Offline
Vogon poet
tomalak16  Offline
Vogon poet
T

Joined: Dec 2002
Posts: 109
UK
it's not that difficult..

Code:
alias cftp { sockopen ftp $$1 $iif($2,$2,21) | .timerWaitForFTP 1 5 echo -s FTP on $$1 is not responding or does not exist }
on *:sockread:ftp:{
   var %temp | sockread %temp
   if ($gettok(%temp,1,32) == 220) echo -s FTP on $sock($sockname).ip is online and serving
   if ($gettok(%temp,1,32) == 120) echo -s FTP on $sock($sockname).ip is online but busy
   if ($gettok(%temp,1,32) == 421) echo -s FTP on $sock($sockname).ip is online but not willing to serve
   unset %waitForFTP | sockclose ftp | .timerWaitForFTP off
}


<Ingo> I can't uninstall it, there seems to be some kind of "Uninstall Shield"