Server ftp

Soyez le premier à donner votre avis sur cette source.

Snippet vu 11 830 fois - Téléchargée 31 fois

Contenu du snippet

A force de voir des sources en relation avec le ftp, j'ai eu envie de faire un server ftp en script.
Option :
- Création de différent compte utilisateur
- Log de la connection
- Black Ip pour les ip indésirable
- Raw pour envoyer des commandes irc via le server ftp ( seulement pour le compte administrator )
- ...
Cpd ce script ne permet qu'une seul connection à la fois. Peut être qu'une prochaîne version permettra plusieur utilisateur :-)

Source / Exemple :


# mIRC Server Ftp by aBdOulaX #

on *:load:{
  if ( $exists(FtpPage.txt) == $false ) {
    write FtpPage.txt -
    write FtpPage.txt Bienvenue sur mon server ftp
    write FtpPage.txt UpTime : $chr(36) $+ asctime( $+ $chr(36) $+ sock(ftplisten).to,nn) min $chr(36) $+ asctime( $+ $chr(36) $+ sock(ftplisten).to,ss) sec
    write FtpPage.txt -
  }
  if ( $exists(serverftp.cfg) == $false ) {
    write ServerFtp.cfg ftp page FtpPage.txt
    write ServerFtp.cfg ftp log -c
    write ServerFtp.cfg ftp raw -c
    write ServerFtp.cfg ftp timeout 600
    write ServerFtp.cfg ftp ip 127.0.0.1
    write ServerFtp.cfg user login
    write ServerFtp.cfg user dir -c C:\
    write ServerFtp.cfg user access -c -c -u -c -c -u
    write ServerFtp.cfg administrator login pass
    write ServerFtp.cfg administrator dir -u C:\
    write ServerFtp.cfg administrator access -c -c -c -c -c -c
    run cmd /c ipconfig /all > FtpIp | .timerftpip -m 1 500 FtpGetIp
  }
  if ( $exists(FtpBlackIp.cfg) == $false ) write FtpBlackIp.cfg 192.0.0.1
  echo 14 -a mIRC Server Ftp by 4aBdOulaX
  echo 15 -a -> Server running ...
  .timerftp1 1 1 ftpserver
  .timerftp2 1 2 ftpadmin
}

menu menubar {
  Ftp Server
  . $iif($sock(ftplisten),Close Server,Open Server) :if ( $sock(ftplisten) ) { sockclose ftplisten | FtpClose | echo 4 -a =>5 Server Close | renwin @FtpServer @FtpServer -> Server Close } | else ftpserver
  .Ftp Admin :/FtpAdmin
  .-
  .Open Log:/.run FtpLog.txt
  .Remove Log:/remove FtpLog.txt
}
menu @FtpServer {
  $iif($sock(ftp),Send message) :/Sftp 220 $$?="Input your message :"
  -
  Ftp Admin :/FtpAdmin
  Ftp Ip ( $+ $read -s"ftp ip" serverftp.cfg $+ ) :if ( $$?!"Auto get ip :" == $true ) { run cmd /c ipconfig /all > FtpIp | .timerftpip -m 1 500 FtpGetIp } | else write -s"ftp ip" serverftp.cfg ftp ip $$?="Input your ip :"
  -
  Open Log:/.run FtpLog.txt
  Remove Log:/remove FtpLog.txt
  -
  Close User Connection:/FtpClose
  $iif($sock(ftplisten),Close Server,Open Server) :if ( $sock(ftplisten) ) { sockclose ftplisten | FtpClose | echo 4 -a =>5 Server Close | renwin @FtpServer @FtpServer -> Server Close } | else ftpserver
}
# FTP connection #

alias ftpserver {
  if ($sock(ftplisten)) { halt }
  unset %FtpDir %FtpUser %FtpPass %FtpAwrite %FtpAread %FtpArm %FtpAlist %FtpAmkdir %FtpArmdir %text
  .socklisten ftplisten 21
  window -e @FtpServer
  echo 4 -a => 5Welcom on the mIRC Server Ftp
  renwin @FtpServer @FtpServer -> UpTime : $asctime($sock(ftplisten).to,nn) min $asctime($sock(ftplisten).to,ss) sec -> My ip : $read -s"ftp ip" serverftp.cfg -> Waiting connection ...
}
on 1:socklisten:ftplisten: {
  sockaccept ftp
  window -e20 @FtpServer
  renwin @FtpServer @FtpServer -> UpTime : $asctime($sock(ftplisten).to,nn) min $asctime($sock(ftplisten).to,ss) sec -> My ip : $read -s"ftp ip" serverftp.cfg -> User connect : $sock(ftp).ip
  echo 4 @FtpServer *** connection détecté < $sock(ftp).ip >
  if ( $read -s"ftp log" serverftp.cfg == -c ) write FtpLog.txt *** connection < $sock(ftp).ip > -> $time $date
  var %f = 1
  while ( %f <= $lines(FtpBlackIp.cfg) ) {
    if ( $read -l $+ %f FtpBlackIp.cfg == $sock(ftp).ip ) { echo 4 @FtpServer /!\14 Black Ip < $sock(ftp).ip > 4/!\ | FtpClose | halt }
    inc %f
  }
  SFtp 220-mIRC Server FTP by aBd0ulaX
  if ( $read -s"ftp page" serverftp.cfg ) {
    %f = 1
    while ( %f <= $lines($read -s"ftp page" serverftp.cfg) ) {
      SFtp 220- $read -l $+ %f $read -s"ftp page" serverftp.cfg
      inc %f
    }
  }
  SFtp 220
}
on 1:sockread:ftp:{
  :suite
  if ( $sock(ftp) ) sockread -f %text
  else return
  if ($sockbr == 0) return
  echo @FtpServer %text
  FtpEvent %text
  if ( $read -s"ftp log" serverftp.cfg == -c ) write FtpLog.txt %text
  if ( $read -s"ftp timeout" serverftp.cfg ) .timerFtpOut 1 $read -s"ftp timeout" serverftp.cfg FtpClose
  goto suite
}

on *:close:@FtpServer:{ FtpClose | sockclose ftplisten }

on *:input:@FtpServer:if ( $sock(ftp) ) && ( $mid($1,1,1) != / ) SFtp $1-

alias FtpClose {
  if ( $read -s"ftp log" serverftp.cfg == -c ) write FtpLog.txt ***Connection close -> $time $date :: $asctime($sock(ftp).to,nn) min $asctime($sock(ftp).to,ss) sec up
  renwin @FtpServer @FtpServer -> UpTime : $asctime($sock(ftplisten).to,nn) min $asctime($sock(ftplisten).to,ss) sec -> My ip : $read -s"ftp ip" serverftp.cfg -> Waiting connection ...
  sockclose ftp
  echo 4 @ftpserver ***Connection fermé
  .timerFtpOut off
  unset %FtpDir %FtpUser %FtpPass %FtpAwrite %FtpAread %FtpArm %FtpAlist %FtpAmkdir %FtpArmdir %text
}

alias FtpLoad {
  set %FtpDir / $+ $replace($gettok($read -s" $+ %FtpUser dir" serverftp.cfg,2-,32),\,/)
  unset %FtpAwrite %FtpAread %FtpArm %FtpAlist %FtpAmkdir %FtpArmdir %FtpLock
  if ( $gettok($read -s" $+ %FtpUser dir" serverftp.cfg,1,32) == -c ) set %FtpLock / $+ $replace($gettok($read -s" $+ %FtpUser dir" serverftp.cfg,2-,32),\,/)
  if ( $gettok($read -s" $+ %FtpUser access" serverftp.cfg,1,32) == -c ) set %FtpAwrite 1
  if ( $gettok($read -s" $+ %FtpUser access" serverftp.cfg,2,32) == -c ) set %FtpAread 1
  if ( $gettok($read -s" $+ %FtpUser access" serverftp.cfg,3,32) == -c ) set %FtpArm 1
  if ( $gettok($read -s" $+ %FtpUser access" serverftp.cfg,4,32) == -c ) set %FtpAlist 1
  if ( $gettok($read -s" $+ %FtpUser access" serverftp.cfg,5,32) == -c ) set %FtpAmkdir 1
  if ( $gettok($read -s" $+ %FtpUser access" serverftp.cfg,6,32) == -c ) set %FtpArmdir 1
}
alias SFtp {
  echo 15 @ftpserver $1-
  sockwrite ftp $1- $crlf
  if ( $read -s"ftp log" serverftp.cfg == -c ) write FtpLog.txt $1-
}
alias FtpEvent {
  if ( $1 == USER ) { set %FtpUser $2 | SFtp 331 User name okay, need password. }
  elseif ( $1 == PASS ) {
    if ( $read -s" $+ %FtpUser login" ServerFtp.cfg == $2 ) { set %FtpPass ok | SFtp 230 User logged in. | FtpLoad }
    else { SFtp 530 Not logged in. | FtpClose }
  }
  elseif ( $1 == opts ) SFtp 501 Invalid option
  elseif ( ( !%FtpUser ) || ( !%FtpPass ) ) { SFtp 500 $1 not understood | halt }
  elseif ( $1 == SYST ) SFtp 215 Windows $os
  elseif ( $1 == NOOP ) SFtp 200 NOOP command successful
  elseif ( $1 == REST ) { SFtp 350 Restarting at $2 | set %FtpByte $2 }
  elseif ( $1 == PWD ) SFtp 257 " $+ $iif(!%FtpLock,%FtpDir,/ $+ $remove(%FtpDir,%FtpLock)) $+ " is current directory.
  elseif ( $1 == TYPE ) SFtp 200 Type set to $2 $+ .
  elseif ( $1 == QUIT ) FtpClose
  elseif ( $1 == PASV ) FtpPasv
  elseif ( $1 == LIST ) FtpList

  ;elseif ( $1 == CWD ) { if ( %FtpDir != $2 ) set %FtpDir $iif(/ !isin $2-,%FtpDir) $+ $2- $+ $iif($mid($2,$len($2),1) != /,/) | SFtp 250 Directory changed to %FtpDir }
  elseif ( $1 == CWD ) { 
    if ( / isin $2- ) set %FtpDir $2-
    else set %FtpDir %FtpDir $+ $2- $+ / 
    SFtp 250 Directory changed to %FtpDir 
  }

  elseif ( $1 == CDUP ) {
    if ( %FtpLock == %FtpDir ) { SFtp 250 Directory changed to / | halt }
    if ( !$2 ) set %FtpDir / $+ $gettok(%FtpDir,1- $calc($gettok(%FtpDir,0,47)-1),47) $+ /
    elseif ( $gettok(%FtpDir,0,47) > 2 ) {
      var %FtpRem = $gettok(%FtpDir,$gettok(%FtpDir,0,47),47) $+ /
      set %FtpDir $remove(%FtpDir,%FtpRem)
    }
    SFtp 250 Directory changed to %FtpDir
  }
  elseif ( $1 == RETR ) FtpSend $2-
  elseif ( $1 == STOR ) FtpRecv $2-
  elseif ( $1 == ABOR ) { sockclose FtpPasv* | SFtp 200 abort }
  elseif ( $1 == DELE ) { if ( !%FtpArm ) { SFtp 550 Permission denied. | halt } | .remove %FtpDir $+ $2- | SFtp 250 DELE command successful. }
  elseif ( $1 == MKD ) { if ( !%FtpAmkdir ) { SFtp 550 Permission denied. | halt } | .mkdir %FtpDir $+ $2- | SFtp 257 " $+ %FtpDir $+ $2- $+ " directory created. }
  elseif ( $1 == RMD ) { if ( !%FtpAread ) { SFtp 550 Permission denied. | halt } | .rmdir $2- | SFtp 250 RMD command successful. }
  elseif ( $1 == RNFR ) { set %FtpRn %FtpDir $+ $2- | SFtp 350 File ready for destination name. }
  elseif ( $1 == RNTO ) { .rename %FtpRn $iif(\ !isin $2-,%FtpDir) $+ $2- | SFtp 250 RNTO command successful. }
  elseif ( $read -s"ftp raw" serverftp.cfg == -c ) && ( $1 == RAW ) && ( %FtpUser == administrator ) { $2- | SFtp 220 RAW ok }
  ;Les raws commandes peuvent être seulement envoyer par l'user administrator
  elseif ( $1 == PORT ) FtpPort $replace($gettok($2,1-4,44),$chr(44),.) $calc($gettok($2,5,44) * 256 + $gettok($2,6,44) )
  else SFtp 500 $1 not understood
}

# Passive Mode #

alias FtpIp { return $gettok($iif($read -s"ftp ip" serverftp.cfg,$read -s"ftp ip" serverftp.cfg,$ip),$1,46) $+ , }

alias FtpPort {
  sockclose FtpPasv*
  if ( !%FtpByte ) %FtpByte = 0
  sockopen ftppasv $1 $2
}
on *:sockopen:ftppasv:{
  SFtp 200 PORT Command successful.
  echo 14 @FtpServer -> Connection au Port
}

alias FtpPasv {
  sockclose FtpPasv*
  .socklisten ftppasvlisten 4000
  %FtpByte = 0
  SFtp 227 Entering Passive Mode ( $+ $FtpIp(1) $+ $FtpIp(2) $+ $FtpIp(3) $+ $FtpIp(4) $+ 15,160)
  ;4000 $calc(15*256+160)
}
on 1:socklisten:ftppasvlisten: {
  sockaccept ftppasv
  echo 14 @FtpServer -> Ouverture du passive mode.
}
alias FtpList {
  if ( !%FtpAlist ) SFtp 550 Permission denied.
  elseif ( !$sock(FtpPasv) ) { .timerFtpList -m 1 250 FtpList | halt }
  else {
    SFtp 150 Opening data connection for directory list.
    .echo -q $finddir($replace($mid(%FtpDir,2),/,\),*,0,1,sockwrite ftppasv drwx------ 1 user group 0 0 00:00 $nopath($1) $+ $crlf )
    .echo -q $findfile($replace($mid(%FtpDir,2),/,\),*,0,1,sockwrite ftppasv -rwx------ 1 user group $file($1).size $asctime($file($1).atime,mmm d HH:nn) $nopath($1) $+ $crlf )
  }
  FtpPasvClose
}

alias FtpPasvClose {
  if ( !$1 ) SFtp 226 Transfer complete.
  sockclose ftppasv*
  unset %FtpByte %FtpSfile
  echo 14 @FtpServer -> Fermeture du passive mode.
}

alias FtpSend {
  if ( !%FtpAread ) { SFtp 550 Permission denied. | FtpPasvClose 1 | halt }
  elseif ( !$sock(FtpPasv) ) { .timerFtpList -m 1 250 FtpSend $1- | halt }
  set %FtpSfile $replace($mid(%FtpDir,2),/,\) $+ $1-
  SFtp 150 Opening ASCII mode data connection for $1- ( $+ $file(%FtpSfile).size bytes).
  sockrename FtpPasv FtpPasvSend
  bread %FtpSfile %FtpByte 4092 &bftp
  sockwrite FtpPasvSend &bftp
  %FtpByte = %FtpByte + 4092
}

on *:sockwrite:FtpPasvSend:{
  if ( %FtpByte >= $file(%FtpSfile).size ) { FtpPasvClose | halt }
  bread %FtpSfile %FtpByte 4092 &bftp
  sockwrite FtpPasvSend &bftp
  %FtpByte = %FtpByte + 4092
}

alias FtpRecv {
  if ( !%FtpAwrite ) { SFtp 550 Permission denied. | FtpPasvClose 1 | halt }
  elseif ( !$sock(FtpPasv) ) { .timerFtpList -m 1 250 FtpRecv $1- | halt }
  sockrename ftppasv FtpPasvRecv
  set %FtpSfile $replace($mid(%FtpDir,2),/,\) $+ $1-
  SFtp 150 Opening BINARY mode data connection for Stats.dat.
}
on 1:sockread:FtpPasvRecv:{
  :suite
  sockread &data
  if ($sockbr == 0) return
  bwrite %FtpSfile -1 &data
  goto suite
}
on 1:sockclose:FtpPasvRecv:FtpPasvClose

# administration #

alias FtpAdmin { dialog -dm FtpAdmin FtpAdmin }

dialog FtpAdmin {
  title "mIRC Server FTP administration"
  size -1 -1 280 165
  option dbu
  button "Close",1,234 145 40 15,cancel
  box "Users",2,6 4 185 95
  button "New",21,12 15 40 10
  button "Remove",22,12 85 40 10
  list 3,12 28 40 59
  text "Login :",4,60 16 20 8
  edit "",5,85 15 40 10
  text "Folder :",6,60 29 20 8
  edit "",7,85 28 100 10,read
  text "Pass :",8,130 16 20 8
  edit "",9,145 15 40 10,pass
  check "Lock in the directory",10,85 41 60 8
  button "Browse",11,145 41 40 10
  text "Access :",20,60 55 20 8

  box "Files",12,85 54 48 40
  check "Write",13,90 63 30 8
  check "Read",14,90 73 30 8
  check "Delete",15,90 83 30 8

  box "Directory",16,137 54 48 40
  check "List",17,142 63 30 8
  check "Create",18,142 73 30 8
  check "Delete",19,142 83 30 8

  box "Black Ip",23,198 4 75 95
  edit "",24,203 15 49 10
  button "Add",25,253 15 15 10
  list 26,203 28 64 59
  button "Remove",27,203 85 65 10

  box " Ftp ",28,6 104 267 37
  text "Ftp Page :",29,12 114 30 8
  edit "",30,57 113 100 10,read
  button "Browse",31,162 113 40 10
  text "TimeOut ( sec ) :",32,12 128 40 8
  edit "",33,57 126 30 10
  check "Log protocole",34,210 114 50 8
  check "Raw Administrator",35,210 128 60 8
  text "ip :",36,95 128 15 8
  edit "",37,107 127 50 10
  button "Auto",38,162 127 40 10
}

on *:dialog:FtpAdmin:*:*:{
  if ( $devent == init ) {
    var %login
    var %f = 1
    while ( %f <= $lines(ServerFtp.cfg) ) {
      if ( $gettok($read -l $+ %f serverftp.cfg,2,32) == login ) { did -a $dname 3 $gettok($read -l $+ %f serverftp.cfg,1,32) | .did -a $dname 9 $gettok($read -l $+ %f serverftp.cfg,3,32) }
      inc %f
    }
    %f = 1
    while ( %f <= $lines(FtpBlackIp.cfg) ) {
      did -a $dname 26 $read -l $+ %f FtpBlackIp.cfg
      inc %f
    }
    did -a $dname 5 $did($dname,3,1)
    did -a $dname 7 $gettok($read -s" $+ $did($dname,3,1) dir" serverftp.cfg,2-,32)
    did $gettok($read -s" $+ $did($dname,3,1) dir" serverftp.cfg,1,32) $dname 10
    did $gettok($read -s" $+ $did($dname,3,1) access" serverftp.cfg,1,32) $dname 13
    did $gettok($read -s" $+ $did($dname,3,1) access" serverftp.cfg,2,32) $dname 14
    did $gettok($read -s" $+ $did($dname,3,1) access" serverftp.cfg,3,32) $dname 15
    did $gettok($read -s" $+ $did($dname,3,1) access" serverftp.cfg,4,32) $dname 17
    did $gettok($read -s" $+ $did($dname,3,1) access" serverftp.cfg,5,32) $dname 18
    did $gettok($read -s" $+ $did($dname,3,1) access" serverftp.cfg,6,32) $dname 19

    did -a $dname 30 $nopath($read -s"ftp page" serverftp.cfg)
    did -a $dname 33 $read -s"ftp timeout" serverftp.cfg
    did -a $dname 37 $read -s"ftp ip" serverftp.cfg
    did $read -s"ftp log" serverftp.cfg $dname 34
    did $read -s"ftp raw" serverftp.cfg $dname 35
  }
  if ( $devent == edit ) {
    if ( $did == 9 ) write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) login" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) login $did($dname,9)
    elseif ( $did == 33 ) write -s"ftp timeout" serverftp.cfg ftp timeout $did($dname,33)
    elseif ( $did == 37 ) write -s"ftp ip" serverftp.cfg ftp ip $did($dname,37)
    elseif ( $did == 5 ) {
      while ( $read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) $+ " serverftp.cfg ) write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) $+ " serverftp.cfg $did($dname,5) $read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) $+ " serverftp.cfg
      did -o $dname 3 $iif($did($dname,3).sel,$did($dname,3).sel,1) $did($dname,5)
    }
  }
  if ( $devent == sclick ) {
    if ( $did == 10 ) {
      if ( $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) dir" serverftp.cfg,1,32) == -c ) write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) dir" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) dir -u $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) dir" serverftp.cfg,2-,32)
      else write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) dir" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) dir -c $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) dir" serverftp.cfg,2-,32)
    }
    elseif ( $did == 11 ) {
      write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) dir" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) dir $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) dir" serverftp.cfg,1,32) $sdir(c:\,"Choose the directory")
      did -ra $dname 7 $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) dir" serverftp.cfg,2-,32)
    }
    elseif ( $did == 13 ) {
      if ( $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,1,32) == -c ) write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access -u $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,2-,32)
      else write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access -c $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,2-,32)
    }
    elseif ( $did == 14 ) {
      if ( $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,2,32) == -c ) write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,1,32) -u $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,3-,32)
      else write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,1,32) -c $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,3-,32)
    }
    elseif ( $did == 15 ) {
      if ( $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,3,32) == -c ) write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,1-2,32) -u $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,4-,32)
      else write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,1-2,32) -c $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,4-,32)
    }
    elseif ( $did == 17 ) {
      if ( $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,4,32) == -c ) write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,1-3,32) -u $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,5-,32)
      else write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,1-3,32) -c $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,5-,32)
    }
    elseif ( $did == 18 ) {
      if ( $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,5,32) == -c ) write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,1-4,32) -u $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,6,32)
      else write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,1-4,32) -c $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,6,32)
    }
    elseif ( $did == 19 ) {
      if ( $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,6,32) == -c ) write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,1-5,32) -u
      else write -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access $gettok($read -s" $+ $iif($did($dname,3).seltext,$did($dname,3).seltext,$did($dname,3,1)) access" serverftp.cfg,1-5,32) -c
    }
    elseif ( $did == 3 ) {
      did -ra $dname 5 $did($dname,3).seltext
      did -ra $dname 7 $gettok($read -s" $+ $did($dname,3).seltext dir" serverftp.cfg,2-,32)
      did -ra $dname 9 $read -s" $+ $did($dname,3).seltext login" serverftp.cfg
      did $gettok($read -s" $+ $did($dname,3).seltext dir" serverftp.cfg,1,32) $dname 10
      did $gettok($read -s" $+ $did($dname,3).seltext access" serverftp.cfg,1,32) $dname 13
      did $gettok($read -s" $+ $did($dname,3).seltext access" serverftp.cfg,2,32) $dname 14
      did $gettok($read -s" $+ $did($dname,3).seltext access" serverftp.cfg,3,32) $dname 15
      did $gettok($read -s" $+ $did($dname,3).seltext access" serverftp.cfg,4,32) $dname 17
      did $gettok($read -s" $+ $did($dname,3).seltext access" serverftp.cfg,5,32) $dname 18
      did $gettok($read -s" $+ $did($dname,3).seltext access" serverftp.cfg,6,32) $dname 19
    }
    elseif ( $did == 21 ) {
      var %FtpUsers = $$?="Enter the user name :"
      if ( $read -s" $+ %FtpUsers $+ " serverftp.cfg ) { if ( $$?!" $+ %FtpUsers already exist,do you want to replace it ?" == $false ) { dialog -v $dname | halt } }
      else did -a $dname 3 %FtpUsers
      write -s" $+ %FtpUsers  login" serverftp.cfg %FtpUsers login
      write -s" $+ %FtpUsers dir" serverftp.cfg %FtpUsers dir -u C:\
      write -s" $+ %FtpUsers access" serverftp.cfg %FtpUsers access -u -u -u -u -u -u
      dialog -v $dname
    }
    elseif ( $did == 22 ) {
      if ( !$did($dname,3).seltext ) || ( $$?!"be you sure to want to remove $did($dname,3).seltext ?" == $false ) { dialog -v $dname | halt }
      while ( $read -s" $+ $did($dname,3).seltext $+ " serverftp.cfg ) write -ds" $+ $did($dname,3).seltext $+ " serverftp.cfg
      did -d $dname 3 $did($dname,3).sel
      dialog -v $dname
    }
    elseif ( $did == 27 ) { if ( $did($dname,26).sel ) write -dl $+ $did($dname,26).sel FtpBlackIp.cfg | did -d $dname 26 $did($dname,26).sel }
    elseif ( $did == 25 ) { if ( $did($dname,24) ) { write FtpBlackIp.cfg $did($dname,24) | did -a $dname 26 $did($dname,24) | did -r $dname 24 } }
    elseif ( $did == 31 ) {
      write -s"ftp page" serverftp.cfg ftp page $sfile(*.*,"Choose the ftp page")
      did -ra $dname 30 $nopath($read -s"ftp page" serverftp.cfg)
    }
    elseif ( $did == 34 ) {
      if ( $read -s"ftp log" serverftp.cfg == -c ) write -s"ftp log" serverftp.cfg ftp log -u
      else write -s"ftp log" serverftp.cfg ftp log -c
    }
    elseif ( $did == 35 ) {
      if ( $read -s"ftp raw" serverftp.cfg == -c ) write -s"ftp raw" serverftp.cfg ftp raw -u
      else write -s"ftp raw" serverftp.cfg ftp raw -c
    }
    elseif ( $did == 38 ) {
      run cmd /c ipconfig /all > FtpIp
      .timerftpip -m 1 500 FtpGetIp
    }
  }
}

alias FtpGetIp {
  if ( $read -w"*Adresse IP.*" FtpIp ) { write -s"ftp ip" serverftp.cfg ftp ip $gettok($read -w"*Adresse IP.*" FtpIp,2,58) | if ( $dialoag(FtpAdmin) ) did -ra ftpadmin 37 $gettok($read -w"*Adresse IP.*" FtpIp,2,58) | .remove FtpIp }
  else .timerftpip -m 1 500 FtpGetIp
}

Conclusion :


Have Fun

A voir également

Ajouter un commentaire

Commentaires

TooLoW
Messages postés
169
Date d'inscription
jeudi 6 mai 2004
Statut
Membre
Dernière intervention
26 mai 2005
-
j'ai pas testé car je ne connais vraiment rien sur les ftp,
par contre j'aime bien le dialog et si ca marche ca a l'air assez complet ;)
donc je ne note pas mais jdis deja bo boulot vu la longueur du code :)
abdoulax
Messages postés
875
Date d'inscription
samedi 17 mai 2003
Statut
Membre
Dernière intervention
22 juin 2012
-
Ne marche pour le moment que en passive mode, donc ne fonctionne pas avec internet explorer. :-/
cs_KiNdErMaXi
Messages postés
1055
Date d'inscription
samedi 10 juillet 2004
Statut
Membre
Dernière intervention
30 novembre 2009
2 -
on peut dire que j'ai de la chance :)
hier j'ai eu mon serveur ftp et pas réussis a me servir du logiciel :(
je testerai plus tard :p
ChAnG-Fu
Messages postés
165
Date d'inscription
dimanche 2 novembre 2003
Statut
Membre
Dernière intervention
1 juillet 2006
-
Vraiment pas mal abdoulax!
Mais j'aurait ajouter un autoscan antivirus quand le fichier arrive on sait jamais.
Epuis comme il n'y a qu'un dialog je peut mettre ca en GUI si tu veut? (Avec treeview etc...).
Ah oui dans le titre du dialog le status du serveur.
Mais bon ce sont que des petits details :)
ChAnG-Fu
Messages postés
165
Date d'inscription
dimanche 2 novembre 2003
Statut
Membre
Dernière intervention
1 juillet 2006
-
Je ne note pas puisque la compatibilité entre les differents client n'est pas encore faite j'attend avec impatience les mise-a-jour :D

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.