Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-25-2010, 07:17 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
GScript FTP Server

Remember how I said I wasn't going to do any more scripts in GScript?

Out of my obsession with backing up servers on Graal, I've made GBall, a system for compressing and expanding files on Graal servers. I've gone a step further now and written a complete FTP server for Graal, supporting file downloads and uploads, as well as complex rights control systems.



The server binds to a random port (it's not possible to specify a port to bind to with TSocket unless it's enabled by Stefan) and listens for incoming FTP connections. You can connect using any FTP client. I've tested the FTP client built into Windows Explorer, Filezilla, Transmit, and Cyberduck.

The port will change every time the server restarts or the FTP DBNPC is updated. You can use "/npc ftp" in RC to get the new port and host.

Features
  • Download files or entire folders (easy backups)
  • Compatible with virtually any FTP client, tested in several (see above; be sure to report unsupported FTP clients so I can fix the error)
  • Complex rights control based on the player's folder rights, prevents accidently giving a user too many rights (see below)
  • Writing is supported (see below for issues with uploading), and can be disabled for any user or for every user easily
  • Move, rename, or create directories

Active transfer mode is not supported; you must use passive mode.

Disclaimer
I wrote this out of sheer boredom, since I have no use for it now since I don't run a server, but I hope this may be useful. Keep in mind that while I have tested this as much as possible and can't find any security holes, they may exist. Please report any bugs and I will release a fix as fast as I can.

A note about uploads
Due to my nemesis, the flood alert, it's not possible to upload too much data. If you do, no scripts on the server will be able to write (or read?) to/from files. It is to your advantage not to cross this limit. There is no limit for reading. You shouldn't run into this problem unless you are uploading more than 10 MB of files in a short time. GScript also can not write to some file extensions. I don't have a list of allowed extensions, but most, such as txt, will work. Some folders also cannot be written to by script, such as logs and all script folders (weapons, scripts, npcs).

Rights system
Folder rights are inherited from the folder rights of the account of the user being used. If the NPC-server doesn't have rights to a folder, that user won't be able to upload or download files there. You can also completely disable writing in the script. If you are worried about security, don't give the NPC-server rights to any folders with confidential files, or just don't use this script.

Setup instructions
  1. Download the attached file and unzip it
  2. Create classes for each of the files named ftp_*.txt in the zip folder, and copy the scripts into them.
  3. Create a new DBNPC named FTP and place the script inside FTP.txt into it.
  4. Give your NPC-server folder rights to any folders you want to be able to access. You can give read or read/write rights. Note that it is a security risk to give the NPC-server rights, so do this with care. You can give rights to specific folders or blanket (e.g. rw */*, rw */*/*)
  5. Setup users in the DBNPC FTP. Follow the format in there and be sure to remove me. The users must be the account name of a player, and they will share that player's folder rights. Community names are not supported for obvious reasons.
  6. Use the command "/npc ftp" in RC to see where the FTP server is currently listening. If your client separates the host and port fields, the host is before the colon and the port is after.

Please report any bugs. Feedback is appreciated.

Thanks to death_striker for lending me his server to develop this on.
Attached Files
File Type: zip ftp_server.zip (8.1 KB, 527 views)
__________________
Reply With Quote
  #2  
Old 12-25-2010, 07:22 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
That's very impressive
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #3  
Old 12-25-2010, 07:25 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Wow.
Reply With Quote
  #4  
Old 12-25-2010, 07:28 AM
Matt Matt is offline
iZone Administrator
Matt's Avatar
Join Date: Apr 2005
Location: United States
Posts: 2,690
Matt is a jewel in the roughMatt is a jewel in the rough
Very impressive, nice work man. This will be more than useful to a lot of people. Chris for GST?!
__________________
Need Playerworld or Account support?
GraalOnline/Toonslab Support Center

Last edited by Matt; 12-25-2010 at 07:41 AM..
Reply With Quote
  #5  
Old 12-25-2010, 07:43 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Neat, wasn't aware that you could use TSockets without getting Stefan to enable the socket.
__________________
Quote:
Reply With Quote
  #6  
Old 12-25-2010, 08:11 AM
zephirot zephirot is offline
Banned?
Join Date: Sep 2004
Location: Paris
Posts: 1,311
zephirot is a name known to allzephirot is a name known to allzephirot is a name known to all
Send a message via AIM to zephirot Send a message via MSN to zephirot
Man you get **** done.
__________________

Quote:
Originally Posted by unixmad
Can you just shut up ?
MAGA
MFGA
MEGA
Reply With Quote
  #7  
Old 12-25-2010, 08:30 AM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
This is very cool o.o

You could assign users a public FTP space for uploads and whatnot, their own little folder.. Very awesome.
Reply With Quote
  #8  
Old 12-25-2010, 08:48 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
Very awesome, very wow. Nice job.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #9  
Old 12-25-2010, 09:26 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by WhiteDragon View Post
Wow.
My thought exactly. On a side note, I have to spread rep.
__________________
Reply With Quote
  #10  
Old 12-25-2010, 09:34 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by Crow View Post
My thought exactly. On a side note, I have to spread rep.
I have to wait twenty four hours
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #11  
Old 12-25-2010, 09:56 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Awesome work! I would have repp'd except the rep window hides behind the video =x
Reply With Quote
  #12  
Old 12-25-2010, 11:16 AM
LordSquirt LordSquirt is offline
|Mêrçy|
LordSquirt's Avatar
Join Date: Dec 2008
Location: NY
Posts: 958
LordSquirt is a name known to allLordSquirt is a name known to allLordSquirt is a name known to all
wow, I don't understand anything you just said, but just wow
__________________
Reply With Quote
  #13  
Old 12-25-2010, 11:20 AM
Seich Seich is offline
Noctorious' NeoHunter
Seich's Avatar
Join Date: Jun 2008
Location: Honduras
Posts: 193
Seich will become famous soon enough
Send a message via MSN to Seich Send a message via Yahoo to Seich
Quote:
Originally Posted by WhiteDragon View Post
Wow.
^Ditto.
Reply With Quote
  #14  
Old 12-25-2010, 11:57 AM
cyan3 cyan3 is offline
Registered User
cyan3's Avatar
Join Date: Nov 2005
Location: England
Posts: 2,919
cyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant future
Nice work.
Reply With Quote
  #15  
Old 12-25-2010, 01:04 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
wow
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:11 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.