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, 05:40 PM
Post
#2
|
|
Knight Errant Group: Clan Members Posts: 645 Thank(s): 0 Points: 79 Joined: 18-November 07 From: Swindon Member No.: 43 |
duke nukem lol. was shareware Doom for me! in the school library having a mass sesh! lol funtimes.
Law -------------------- |
|
|
Lo-Fi Version | Time is now: 24th November 2024 - 12:13 PM |