; --- This was not made by me... ; --- This has been downloaded from the internet and blah blah blah... alias ftp { if ($window(@SB-FTP).x == $null) set %fintro true window -aesl20 @SB-FTP @Ftpoff if (%fintro) { unset %fintro } if ($sock(FTP) == $null) titlebar @SB-FTP -- Not connected .echo 4Click on the new window (8@SB-FTP) and Right click in it to connect... if ($1) { unset %autouser %autopass if ($2) { set %autouser $2 } if ($3) { set %autopass $3 } set %sbig $rand(5,9) set %startport $rand(1,20) sockclose FTP sockclose FTPSERVE if (%curport == $null) set %curport 21 set %site $1 sockopen FTP $1 %curport window @SB-FTP @Ftp .timer9987 0 120 noop } } on 1:sockopen:FTP: { clear @SB-FTP | clear -l @SB-Ftp if ($sockerr > 1) { fecho $pre Connection Error | halt } fecho $pre Connection Accepted, waiting for login titlebar @SB-FTP -- %site -- $sock($sockname).ip $+ , $+ %curport } on 1:sockclose:FTP: { fecho $pre Connection Terminated titlebar @SB-FTP -- Not connected clear -l @SB-Ftp window @SB-FTP @Ftpoff .timer9987 off } on 1:sockread:FTP: { sockread %params set %nmic $gettok(%params,1,32) if (%nmic == 250) || (%nmic == 230) { getdir if ( log isin %params) { fecho $pre Successfully logged in to $sock($sockname).ip locdisp $mircdir } halt } if (%nmic == 220) { fecho $pre Login Received if (%autouser) { fsock USER %autouser | unset %autouser | halt } fecho $pre Please type "USER username" editbox @SB-FTP USER halt } if (%nmic == 331) { if (%autopass) { fsock PASS %autopass | unset %autopass | halt } fecho $pre Please type "PASS password" editbox @SB-FTP PASS halt } if (%nmic == 226) { fecho $pre Transfer Complete halt } if (%nmic == 150) { fecho $pre $gettok(%params,2-999,32) halt } if (%nmic == 221) { fecho $pre $gettok(%params,2-999,32) halt } if (%nmic == 421) { fecho $pre $gettok(%params,2-999,32) halt } if (%nmic == 257) { fecho $pre Successfully Made Directory getdir halt } if (%nmic == 350) { fsock RNTO %rento unset %rento halt } if (%nmic == 530) { fecho $pre Bad username or password editbox @SB-FTP USER halt } if ($left(%params,4) == 230-) { fecho $mid(%params,5,999999) $+ $chr(160) halt } if (%nmic == 200) { if ($gettok(%params,2,32) == type) && (I isin $gettok(%params,5,32)) { fecho $pre Binary Mode Enabled halt } if ($gettok(%params,2,32) == type) && (A isin $gettok(%params,5,32)) { fecho $pre ASCII Mode Enabled halt } if ($gettok(%params,2,32) == PORT) { fecho $pre PORT Command Succesful halt } if ($gettok(%params,2,32) == NOOP) { fecho $pre NOOP Command Succusful (Anti-Idle) halt } } if (%params) { fecho %params } } on 1:sockclose:FTP: { fecho $pre Connection lost } on 1:INPUT: { if ($active != @SB-FTP) goto end if ($1 == USER) { fsock $1- } if ($1 == PASS) { fsock $1- } if ($1 == QUIT) { fsock $1- } if ($1 == CD) { fsock CWD $2- } if ($1 == BIN) { fsock TYPE I } if ($1 == ASC) { fsock TYPE A } if ($1 == HELP) { fsock HELP } if ($1 == DEL) { set %toexec DELE $sline($active,1) ybox halt } if ($1 == RAW) { fsock $2- } if ($1 == OPEN) { ftp $2 } if ($1 == DIR) { getdir } if ($1 == FDIR) { fulldir } if ($1 == GET) { fileget $2 } if ($1 == PUT) { fileput $2 } halt :end } alias -l listenup { sockclose FTPSERVE sockclose FTPCLIENT fsock PORT $replace($ip,.,$chr(44)) $+ , $+ %sbig $+ , $+ %startport set %port $calc( 256 * %sbig + %startport ) inc %startport socklisten FTPSERVE %port } on 1:socklisten:FTPSERVE: { sockaccept FTPCLIENT if (%job == fileput) crammit } on 1:sockread:FTPCLIENT: { goto %job :list sockread %sparams if (d isin $gettok(%sparams,1,32)) { lfecho $gettok(%sparams,9,32) halt } if ( $gettok(%sparams,9,32) == $null) { halt } lfecho $gettok(%sparams,9-99,32) halt :flist sockread %sparams if (%sparams == $null) { halt } write full.txt %sparams halt :fileget :loop sockread &bleh if (&bleh == $null) goto loop bwrite %filename -1 &bleh if ($sockbr == 0) upstats goto loop } on 1:sockclose:FTPCLIENT: { if (%job == fileget) { if ($window(@Ftp Get).x == $null) goto skip aline @Ftp Get Transfer Complete %getqueue aline @Ftp Get $calc(($ticks - %stime) / 1000) seconds if (%curdir) { aline @Directory $nopath(%filename) } if (%getqueue) { .timer 1 1 fileget %getqueue } :skip } if (%job == flist) { run full.txt } } alias -l upstats { goto %job :fileget if ($window(@Ftp Get).x == $null) halt rline @Ftp Get 2 $lof(%filename) Bytes halt } alias -l getdir { fecho $pre Receiving Directory listenup clear -l @SB-Ftp set %job list fsock LIST } alias -l fulldir { fecho $pre Receiving Directory listenup set %job flist write -c full.txt fsock LIST } alias -l fileget { if (%curdir == $null) { if ($exists(download)) set %filename $mircdirdownload\ $+ $1 else { set %filename $mircdir\ $+ $1 } } else { set %filename %curdir $+ $1 } if ($exists(%filename)) { set %que $$?="File exists, overwrite?" if (y !isin %que) halt } set %fext $gettok(%filename,2,46) if ((%fext == wav) || (%fext == mp3) || (%fext == jpg) || (%fext == gif) || (%fext == zip) || (%fext == exe) || (%fext == au) || (%fext == gz) || (%fext == bmp)) { fsock TYPE I } listenup set %job fileget set %getqueue $deltok($1-,1,32) write -c %filename window -c @Ftp Get window +tf @Ftp Get 20 20 200 20 @Ftpget Courier New titlebar @Ftp Get of $nopath(%filename) aline @Ftp Get Begining Transfer aline @Ftp Get 0 bytes set %stime $ticks fecho $pre Getting %filename fsock RETR $1 } alias -l fileput { listenup set %job fileput set %filename $gettok($1-,1,32) set %sendqueue $deltok($1-,1,32) window -c @Ftp Put window +tf @Ftp Put 20 20 200 20 @Ftpput Courier New titlebar @Ftp Put of $nopath(%filename) aline @Ftp Put Begining Transfer aline @Ftp Put 0 bytes set %stime $ticks fecho $pre Putting %filename fsock STOR $nopath($1) } alias -l crammit { set %totbytes $lof(%filename) set %counter 0 sendchunk } alias -l sendchunk { bread %filename %counter 2048 &bleh sockwrite -n FTPCLIENT &bleh %counter = %counter + 2048 if ($window(@Ftp Put).x == $null) halt rline @Ftp Put 2 %counter Bytes halt } on 1:sockwrite:FTPCLIENT: { if (%counter < %totbytes) sendchunk else { sockclose FTPCLIENT if ($window(@Ftp Put).x == $null) halt aline @Ftp Put Transfer Complete aline @Ftp Put $calc(($ticks - %stime) / 1000) seconds if (%sendqueue) fileput %sendqueue else { getdir } } } menu @FTP { dclick { if ( $gettok($sline($active,1),1,32) == ) fsock CWD $gettok($sline($active,1),2,32) else { fileget $sline($active,1) } } %empty .%alsoempty:halt .$nestal2(bogus):halt Navigate:halt - %ghere: { if ( $gettok($sline($active,1),1,32) != ) { fecho $pre Not a Directory | halt } fsock CWD $gettok($sline($active,1),2,32) } Up One Directory:fsock CWD ../ Enter Directory:fsock CWD $$?="Please enter remote directory" Make a Directory:fsock MKD $$?="Please enter a new directory" %rdir: { set %que $$?="Are you sure you wish to remove this directory?" if (y !isin %que) halt fsock RMD $gettok($sline($active,1),2,32) } - %inf1:halt - Refresh:getdir Get Full Info:fulldir Transfer Mode . Binary File Mode:fsock TYPE I .ASCII File Mode:fsock TYPE A %trans: { set %tot $sline($active,0) unset %getqueue set %counter 1 :loop if ( $gettok($sline($active,%counter),1,32) == ) { goto skip } set %getqueue %getqueue $gettok($sline($active,1),1,32) :skip if (%counter < %tot) { inc %counter | goto loop } if (%getqueue == $null) { fecho $pre Bad Selection | halt } fileget %getqueue } Put a File: fileput $$dir="Please Select a File:" %del: { if ( $gettok($sline($active,1),1,32) == ) { fecho $pre Not a File | halt } set %toexec fsock DELE $gettok($sline($active,1),1,32) ybox halt } %ren1: { if ( $gettok($sline($active,1),1,32) == ) { fecho $pre Not a File | halt } set %rento $$?="What would you like to name this file?" fsock RNFR $gettok($sline($active,1),1,32) } Local File List:locdisp %curdir - Client:halt - Connect to a Server:ftp $$?="Please enter a server" Current Port - %curport : set %curport $$?="Please enter a port number:" Launch Profile .%ftp.fav1:ftp $gettok(%ftp.fav1,1,32) $gettok(%ftp.fav1,2,32) $gettok(%ftp.fav1,3,32) .%ftp.fav2:ftp $gettok(%ftp.fav2,1,32) $gettok(%ftp.fav2,2,32) $gettok(%ftp.fav2,3,32) .%ftp.fav3:ftp $gettok(%ftp.fav3,1,32) $gettok(%ftp.fav3,2,32) $gettok(%ftp.fav3,3,32) .%ftp.fav4:ftp $gettok(%ftp.fav4,1,32) $gettok(%ftp.fav4,2,32) $gettok(%ftp.fav4,3,32) .%ftp.fav5:ftp $gettok(%ftp.fav5,1,32) $gettok(%ftp.fav5,2,32) $gettok(%ftp.fav5,3,32) .%ftp.fav6:ftp $gettok(%ftp.fav6,1,32) $gettok(%ftp.fav6,2,32) $gettok(%ftp.fav6,3,32) .%ftp.fav7:ftp $gettok(%ftp.fav7,1,32) $gettok(%ftp.fav7,2,32) $gettok(%ftp.fav7,3,32) .%ftp.fav8:ftp $gettok(%ftp.fav8,1,32) $gettok(%ftp.fav8,2,32) $gettok(%ftp.fav8,3,32) Manage Profiles .Create a Profile: ftpfav .Clear a Profile ..%ftp.fav1:unset %ftp.fav1* ..%ftp.fav2:unset %ftp.fav2* ..%ftp.fav3:unset %ftp.fav3* ..%ftp.fav4:unset %ftp.fav4* ..%ftp.fav5:unset %ftp.fav5* ..%ftp.fav6:unset %ftp.fav6* ..%ftp.fav7:unset %ftp.fav7* ..%ftp.fav8:unset %ftp.fav8* Disconnect:fsock QUIT } alias -l nestal2 { if ( $sline($active,2) ) { unset %stat1 %stat3 %del1 %ren1 %rdir %ghere set %inf1 Multiple Files Selected set %trans MGet Files unset %del halt } if ( $sline($active,1) ) { if ( $gettok($sline($active,1),1,32) == ) { unset %inf1 %trans %ren1 %del set %rdir Remove this Directory set %ghere Go Here halt } unset %rdir %ghere set %inf1 Selected File: $gettok($sline($active,1),1,32) set %trans Get this File set %ren1 Rename this File set %del Delete halt } unset %trans %ren1 %del %rdir %ghere set %inf1 None Selected } menu @Ftpoff { Client:halt - Connect to a Server:ftp $$?="Please enter a server" Current Port -- %curport : set %curport $$?="Please enter a port number:" Launch Profile .%ftp.fav1:ftp $gettok(%ftp.fav1,1,32) $gettok(%ftp.fav1,2,32) $gettok(%ftp.fav1,3,32) .%ftp.fav2:ftp $gettok(%ftp.fav2,1,32) $gettok(%ftp.fav2,2,32) $gettok(%ftp.fav2,3,32) .%ftp.fav3:ftp $gettok(%ftp.fav3,1,32) $gettok(%ftp.fav3,2,32) $gettok(%ftp.fav3,3,32) .%ftp.fav4:ftp $gettok(%ftp.fav4,1,32) $gettok(%ftp.fav4,2,32) $gettok(%ftp.fav4,3,32) .%ftp.fav5:ftp $gettok(%ftp.fav5,1,32) $gettok(%ftp.fav5,2,32) $gettok(%ftp.fav5,3,32) .%ftp.fav6:ftp $gettok(%ftp.fav6,1,32) $gettok(%ftp.fav6,2,32) $gettok(%ftp.fav6,3,32) .%ftp.fav7:ftp $gettok(%ftp.fav7,1,32) $gettok(%ftp.fav7,2,32) $gettok(%ftp.fav7,3,32) .%ftp.fav8:ftp $gettok(%ftp.fav8,1,32) $gettok(%ftp.fav8,2,32) $gettok(%ftp.fav8,3,32) Manage Profiles .Create a Profile: ftpfav .Clear a Profile ..%ftp.fav1:unset %ftp.fav1* ..%ftp.fav2:unset %ftp.fav2* ..%ftp.fav3:unset %ftp.fav3* ..%ftp.fav4:unset %ftp.fav4* ..%ftp.fav5:unset %ftp.fav5* ..%ftp.fav6:unset %ftp.fav6* ..%ftp.fav7:unset %ftp.fav7* ..%ftp.fav8:unset %ftp.fav8* Quit:window -c $active } alias -l ftpfav { if ( %ftp.fav1 ) { if (%ftp.fav2 ) { if (%ftp.fav3 ) { if (%ftp.fav4 ) { if ( %ftp.fav5 ) { if (%ftp.fav6 ) { if (%ftp.fav7 ) { if (%ftp.fav8 ) { echo -a $pre All slots full, please clear one halt } else set %cur 8 } else set %cur 7 } else set %cur 6 } else set %cur 5 } else set %cur 4 } else set %cur 3 } else set %cur 2 } else set %cur 1 set %ftp.fav $+ %cur $$?="Please enter a ftp site:" set %ftp.fav $+ %cur %ftp.fav [ $+ [ %cur ] ] $$?="Please enter a login:" set %ftp.fav $+ %cur %ftp.fav [ $+ [ %cur ] ] $$?="Please enter a password:" } on 1:CLOSE:@: { if (@SB-FTP isin $target) { sockclose FTP* window -c @Ftp Get window -c @Ftp Put window -c @Directory unset %curdir } if (@Directory isin $target) { unset %curdir } } alias -l fecho { if ($window(@SB-Ftp).x == $null) halt echo @SB-FTP $1- } alias -l lfecho { if ($window(@SB-Ftp).x == $null) halt aline -l @SB-FTP $1- } alias -l fsock { if ($sock(FTP) == $null) { fecho $pre Connection Lost titlebar @SB-FTP -- Not Connected window @SB-FTP @Ftpoff .timer9987 off halt } sockwrite -n FTP $1- } on 1:LOAD: { ftp } menu @Ftpget { Run this File:run %filename Close Window:window -c $active } menu @FtpPut { Close Window:window -c $active } alias -l locdisp { if (%curdir != $null) { if ($1 != %curdir) { set %olddir5 %olddir4 set %olddir4 %olddir3 set %olddir3 %olddir2 set %olddir2 %olddir1 set %olddir1 %curdir } } if ($1 == $null) set %curdir $sdir="Please select a directory" %curdir else { set %curdir $1 } window -c @Directory window -sl -t10,20 @Directory 20 20 100 300 @Dir Courier New set %counter 1 :loop set %tmp $remove($findfile( [ %curdir ] , *.* , %counter), %curdir) ; if (\ !isin %tmp) && (%tmp != $null) { aline @Directory $left( [ $nopath(%tmp) $str( ,20) ] ,20) $lof(%tmp) | inc %counter | goto loop } if (\ !isin %tmp) && (%tmp != $null) { aline @Directory $nopath(%tmp) | inc %counter | goto loop } titlebar @Directory %curdir } menu @Dir { %empty .%alsoempty:halt .$nestal(bogus):halt %stat3:halt %stat1:halt %stat2:halt %put1:pfile %del1: { set %que $$?="Are you sure you wish to remove this file?" if (y !isin %que) halt remove %curdir $+ $sline($active,1) dline $active $sline($active,1).ln } %run1:run %curdir $+ $sline($active,1) Close Window:window -c $active - Directory:halt Select New Directory:locdisp %olddir1:locdisp %olddir1 %olddir2:locdisp %olddir2 %olddir3:locdisp %olddir3 %olddir4:locdisp %olddir4 %olddir5:locdisp %olddir5 } alias -l pfile { set %tot $sline($active,0) unset %sendqueue set %counter 1 :loop set %sendqueue %sendqueue %curdir $+ $sline($active,%counter) if (%counter < %tot) { inc %counter | goto loop } fileput %sendqueue } alias -l nestal { if ( $sline($active,2) ) { unset %stat1 %stat3 %del1 %run1 set %stat2 Multiple Files Selected set %put1 Mput Files halt } if ( $sline($active,1) ) { unset %stat2 set %del1 Delete $sline($active,1) set %run1 Run $sline($active,1) set %stat3 Selected File: $sline($active,1) set %put1 Put this File set %stat1 Length -- $lof( [ [ %curdir ] $+ [ $sline($active,1) ] ] ) bytes } } alias ybox { window -p +bn @Yes\No 200 200 200 50 @Yes\No drawrect -f @Yes\No 15 1 1 1 200 100 drawrect -f @Yes\No 14 1 22 44 60 30 drawrect -f @Yes\No 14 1 115 44 60 30 drawtext @Yes\No 0 Times 23 35 49 Yes drawtext @Yes\No 0 Times 23 132 49 No drawtext @Yes\No 0 Times 23 45 12 Delete File? } menu @Yes\No { Mouse: { if ($inrect($mouse.x,$mouse.y,22,44,60,30)) { drawtext @Yes\No 6 Times 23 35 49 Yes } else { drawtext @Yes\No 0 Times 23 35 49 Yes } if ($inrect($mouse.x,$mouse.y,115,44,60,30)) { drawtext @Yes\No 6 Times 23 132 49 No } else { drawtext @Yes\No 0 Times 23 132 49 No } } SClick: { if ($inrect($mouse.x,$mouse.y,22,44,60,30)) { %toexec unset %toexec window -c $active } if ($inrect($mouse.x,$mouse.y,115,44,60,30)) { unset %toexec window -c $active } } } alias noop { if ($sock(FTP) == $null) { .timer9987 off | halt } fsock NOOP } alias pre { return $logo }