ASP + Serv-U implementing FTP code

xiaoxiao2021-03-06  41

ASP Serv-U implementing FTP code

<% '****************************** ******************* '* author: awaysrain (absolute zero) *' * completion time: 2003-10-10 * '* test environment: WIN2000SERVER, SERV-U 4.2-beta version * '************************************************************ ****** DIM INIPATH, INIFILENAME, INISTR, TMPSTR, N DIM Username, Password, TMP

Username = "myfso222" 'User name Password = "Awaysrain"' password TMP = "AI" randomly generates two lowercase letters, (should be randomly generated, but I omitted here) Password = TMP & UCase (MD5 (Password) )) 'Password, is MD5 encrypted, the MD5 encryption program of the Up Network, the specific algorithm is randomly generated two lowercase letters, then connects MD5 encryption with your password, and encrypts the randomly generated password and MD5 encrypted The result is stored as a password, and an example, for example, the AWAYSRAIN user, my password is first randomly generate two lowercase letters Ai, and I get AIAWAYSRAIN to get AIAWAYSRAIN MD5 encrypted 9118BFD94A9CE9CF37AE5BAA947ED596 put random build two Small write letters AI and MD5 encrypted results 9118BFD94A9CE9CF37AE5BAA947ED596 connection Get password Ai9118BFD94A9CE9CF37AE5BAA947ED596

Inipath = "D: / Program Files / Serv-U" 'INI file path inIfilename = "servudaemon.ini"' INI file name

Set fso = server.createObject ("scripting.filesystemObject") Set servuini = fso.opentextfile (Inipath & "& INIFILENAME, 1, FALSE)

Inistr = "" n = 0 AddedUserList = false

Set tf = fso.createtextfile (Inipath & "/" & Inifilename & "._Awaysrain.tmp", true) "Generates a new temporary INI file

Do while not servuini.atendofstream Tmpstr = Servuini.Readline

If INSTR ("AwaySrain ||" & Tmpstr, "Awaysrain || User")> 0 THEN 'Record the number of users from N = N 1 END IF

IF INSTR ("AWAYSRAIN ||" & Tmpstr, "AwaySrain || [User =")> 0 and not addeduserlist the 'Add the current user n = n 1 tf.writeLine ("User" & n & "=" & username & "| 1 | 0") AddedUserList = true end if tf.writeLine (tmpstr) loop servuini.close 'Add new user information, specific content can create a new user in Serv-U and confront the INI file

Tf.Writeline ("[user =" & username & "| 1]") 'User name tf.writeline ("password =" & password)' password tf.writeline ("Homedir = E: / TEMP") 'home directory Tf.writeline ("Relpaths = 1") 'Does the user locked the user in the primary directory Tf.Writeline ("MAXUSERSLOGINPERIP = 1")' The same IP simultaneously logs in Tf.WriteLine ("SpeedLimitdown = 102400") 'Maximum download speed Tf.Writeline ("Timeout = 600") 'Idle Time Time (Second) Tf.WriteLine ("Access1 = E: / TEMP | RLP")' Access Directory, can be not one, such as 'Access2 = E: / TEMP1 | RLP'

Tf.Close '-------------------- Backup original INI file ------------------- ----- set f1 = fso.getfile (Inipath & "/" & Inifilename) f1.copy (Inipath & "/" & INIFILENAME & "._Awaysrain.bak") f1.delete '------- ------------ Change the generated temporary INI file to formal ini -------------------------- Set f1 = fso.getfile (Inipath & "/" & INIFILENAME & "._AWAYSRAIN.TMP") f1.copy (Inipath & "/" & INIFILENAME) f1.delete

SET FSO = NOTHING%>

Note: The above code assumes that there is only one field in the format in Servudaemon.ini and has at least one user.

The SERVUDAEMON.INI file structure of the test is as follows: ==================================================== = 222 | 1 | 0 User2 = myfso111 | 1 | 0 [USER = 222 | 1] Password = hwB1ECF70CDAF5DAE2B981AE394EEFCDC0 HomeDir = E: / Temp RelPaths = 1 TimeOut = 600 access1 = E: / Temp | RLP [USER = myfso111 | 1] Password = ai9118BFD94A9CE9CF37AE5BAA947ED596 Homedir = E: / Temp Relpaths = 1 Timeout = 600 Access1 = E: / TEMP | RLP generated file structure after the file structure is as follows ======================== ========== [domain1] user1 = 222 | 1 | 0 USER2 = myfso111 | 1 | 0 user3 = myfso222 | 1 | 0 [user = 222 | 1] password = hWB1ECF70CDAF5DAE2B981AE394EEFCDC0 homeDir = E: / TEMP RelPaths = 1 TimeOut = 600 access1 = E: / Temp | RLP [USER = myfso111 | 1] Password = ai9118BFD94A9CE9CF37AE5BAA947ED596 HomeDir = e: / temp RelPaths = 1 TimeOut = 600 access1 = E: / Temp | RLP [USER = myfso222 | 1 ] Password = ai9118bfd94a9ce9cf37ae5baa947ed596 homedir = E: / Temp Relpaths = 1 timeout = 600 access1 = E: / Temp | RLP

转载请注明原文地址:https://www.9cbs.com/read-69087.html

New Post(0)