IPB





Welcome Guest ( Log In | Register )

> FTP scriptyness
MonkeyFiend
post 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 tongue.gif)***

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.


--------------------

Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
Magik5
post Oct 9 2008, 03:34 PM
Post #2


Paddle Master
**********

Group: Clan Members
Posts: 2,085
Thank(s): 30
Points: 317
Joined: 3-December 07
Member No.: 50




ive got 750 photos i took on my holiday to dorset i took a few weeks back, those are a select few =]


--------------------
Go to the top of the page
 
+Quote Post

Posts in this topic
- MonkeyFiend   FTP scriptyness   Oct 7 2008, 03:33 PM
- - Magik5   yeh good idea actually, never thought of packaging...   Oct 7 2008, 04:13 PM
- - Magik5   nice idea on the security thing as well, but the o...   Oct 8 2008, 08:28 AM
- - MonkeyFiend   Code that I routinely steal err.. I mean utilise f...   Oct 8 2008, 10:10 AM
- - Magik5   cheers for the links, will look into the sockets ...   Oct 8 2008, 12:12 PM
- - Magik6   Total jiberish   Oct 8 2008, 12:30 PM
- - MonkeyFiend   Well thats how I feel when I see a thread about mo...   Oct 8 2008, 12:39 PM
- - fido77   i don't understand most of that!!...   Oct 8 2008, 12:41 PM
- - Magik5   before i started this i was like ZOHNOES! my f...   Oct 8 2008, 12:41 PM
- - Magik5   but i still dont like regular expressions :s   Oct 8 2008, 01:01 PM
- - fido77   i'm startin to get it down. writin small progr...   Oct 8 2008, 01:10 PM
- - MonkeyFiend   [Warning: bad c# regex joke follows] What regula...   Oct 8 2008, 01:25 PM
- - fido77   i can't figure it out! whats the answer? l...   Oct 8 2008, 02:12 PM
- - Magik5   any character not equal to L... eh   Oct 8 2008, 02:48 PM
- - MonkeyFiend   Sorry... I'll get my coat   Oct 8 2008, 02:57 PM
- - Magik5   to be fair i did laugh for a few seconds   Oct 8 2008, 03:23 PM
- - fido77   i had myself a laugh too!   Oct 8 2008, 05:02 PM
- - Lawpf2001   GCSE IT = name sum input devices, make a stupid da...   Oct 8 2008, 06:53 PM
- - Magik5   i had to do that for alevels the first time i eve...   Oct 8 2008, 07:10 PM
- - Magik6   IT is bullshit, its more about how programs can be...   Oct 9 2008, 08:00 AM
- - MonkeyFiend   I did A-level IT - the teacher (now sacked) was an...   Oct 9 2008, 08:21 AM
- - Magik5   lol well ive learnt a hell of a lot more in this ...   Oct 9 2008, 08:29 AM
- - MonkeyFiend   vb was part of access/excel so I started veering t...   Oct 9 2008, 08:46 AM
- - Magik5   oo ok. your old =]   Oct 9 2008, 08:47 AM
- - fido77   what kind of place are you working at Magik5? only...   Oct 9 2008, 12:00 PM
- - Magik5   www.mediastation.co.uk - we are currently designin...   Oct 9 2008, 12:19 PM
- - fido77   the pics look good, when you gonna get more. i sho...   Oct 9 2008, 02:07 PM
- - Magik5   ive got 750 photos i took on my holiday to dorset ...   Oct 9 2008, 03:34 PM
- - Lawpf2001   duke nukem lol. was shareware Doom for me! in ...   Oct 9 2008, 05:40 PM
- - fido77   did you do any of the work on the showreels, magik...   Oct 14 2008, 03:08 PM
- - Magik5   no, that was all done before i got the job =] any...   Oct 14 2008, 05:04 PM
- - fido77   pretty coooooooool!!! heres my new t...   Oct 15 2008, 02:36 AM
- - GoochTyke   KEWL: heres one ive been workin on for a few we...   Oct 15 2008, 07:22 AM
- - Magik5   rofl   Oct 15 2008, 11:22 AM
- - fido77   maybe i should change mine to be more like yours G...   Oct 15 2008, 12:25 PM
- - Magik6   lol Gooch   Oct 15 2008, 01:34 PM
- - Magik5   FYI if you care or not, i dropped ftpwebrequest an...   Oct 22 2008, 02:10 PM


Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 28th November 2024 - 04:24 AM
Sneaky Monkeys Clan :: MonkeyFiend.com