FTP scriptyness |
FTP scriptyness |
Oct 7 2008, 03:33 PM
Post
#1
|
|
Security and Projects Group: Clan Dogsbody Posts: 4,687 Thank(s): 1098 Points: 2,440 Joined: 31-August 07 From: A Magical Place, with toys in the million, all under one roof Member No.: 1 |
Firstly would it not be easier to script it so that a bunch of files are packaged - zipped or preferably tarred and then upload the one file then untar it on the remote server??
Something like the following run on "Remote server" => "computer where files are kept" (Dirty FTP connections*) On server, create a local ghey.zip and fills it from the FTP request. WebRequest.RegisterPrefix("ftp://", FtpWebRequest.Creator); WebRequest request = WebRequest.Create("ftp://ftp.magik5likesmen.com/ghey.tar.gz"); WebResponse response = request.GetResponse(); Stream stream = response.GetResponseStream(); Stream local = File.Create("ghey.tar.gz"); byte[] buffer = new byte[1024]; int n; do { n = stream.Read(buffer, 0, buffer.Length); local.Write(buffer, 0, n); } while (n > 0); stream.Close(); local.Close(); **then something like.. (I can't remember the syntax )*** gz.UnTarGz("ghey.tar.gz", untarRoot, bNoAbsolute); Obviously this can be rejigged if you want to run as a script on the "computer where files are kept" > "Remote Server" type direction *I do it this way so that a remote secure server never accepts inbound FTP connections, it should always initiate outbound connections by script. This means that the script can run with limited permissions e.g. run under a user to reach the outside world and place files in a given limited directory with no permissions outside of that directory. A separate script with permissions to this directory but no permissions to the outside world can then be run to unpack and palce the files where they belong; this is purely limiting security. -------------------- |
|
|
Oct 9 2008, 12:19 PM
Post
#2
|
|
Paddle Master Group: Clan Members Posts: 2,085 Thank(s): 30 Points: 317 Joined: 3-December 07 Member No.: 50 |
www.mediastation.co.uk - we are currently designing a new wesbite as the current one is quite outdated
i mainly do flash design/programming - as3 ftw =] im currently doing a bit of php with c# because we got this job for ea - deadlines 2 weeks time tho so after that ill be going back to flash i expect but i can use most adobe tools like photoshop, after effects/premiere/dreamweaver etc etc, and im also doing some 3dsmax work in my own time as i love all things 3d =] i programmed about 1/2 of a 3d board game (but not the stereoscopic engine as m not that clever :s) currently on a well known companies website (pm me as im not publicly allowed to disclose who) =] i really enjoy working for this company as they do everything i would want to do =] i also like taking pictures... as seen um. <PLUG> here: http://www.dancotton.co.uk/Gallery </plug> heh 2 plugs in the same thread, whoo! im still finishing my gallery, its written in as3 and reads in from an external xml file with links to the images which are also external =] lol /fin -------------------- |
|
|
Lo-Fi Version | Time is now: 24th November 2024 - 01:35 PM |