Scripts – Cedric's Cruft http://www.ce3c.be Yet another blog about ... stuff. Fri, 04 Jul 2014 23:13:03 +0000 en-US hourly 1 https://wordpress.org/?v=5.1.12 An FTP Bridge (PHP) for hosts that do not provide FTP access. http://www.ce3c.be/41-an-ftp-bridge-php-for-hosts-that-do-not-provide-ftp-access/ http://www.ce3c.be/41-an-ftp-bridge-php-for-hosts-that-do-not-provide-ftp-access/#comments Mon, 10 Mar 2008 21:48:03 +0000 http://www.ce3c.be/2008,03,10/an-ftp-bridge-php-for-hosts-that-do-not-provide-ftp-access/ A couple of hosts do not provide FTP access (or only 1 ftp account, like one.com).
Therefor I needed a script that would be able to function as a bridge between my FTP client and the remote server b/c it's very difficult to maintain a site when having only a webbased file editor at your disposal.

First I thought to solve this problem by editing the source code of FileZilla which is in C++ and make it connect to a PHP file that will perform all the needed operations. Eg. the LIST command that is sent by FileZilla to the PHP file will make the script execute a listdir-function.
But due to my C++ skills  being very limited I looked for other possibilities, and ended up on the site of nanoFTPd. NanoFTPd is an ftp daemon written in PHP for unix systems only.
The idea is to let the FTP client connect to a centralized server running a modified version of nanoFTPd. Then nanoFTPd will connect to the server you actually wanted to access. It will fetch the output of, for example: the listdir-command and send it back to the ftp client.

FTP Bridge diagram

"Remote FTP server" in this image, actually stands for the php script that will execute the commands.

At the moment I already have a working version of this script, but it still has to be optimized.

  • There should be made some speed improvements: connecting to a centralized server first which will connect to another server too + fetching and sending the data back ... takes a lot of time! In orde to make this faster I will implement GZip encoding + improve nanoFTPd's code.
  • Compatibility has to be researched: I tested already on two servers which both gave different problems. (Especially with POSIX)
  • The code is messy and definitely needs cleaning up + adding comments.

When all of this is finished, I will offer this as a service: you will be able to connect to your server without needing FTP access, just placing a simple PHP script on your webspace!
The modified version of the script that has to run on a centralised server *might* be released under some kind of license, so you don't have to rely on my server.

]]>
http://www.ce3c.be/41-an-ftp-bridge-php-for-hosts-that-do-not-provide-ftp-access/feed/ 155
Skulls offline http://www.ce3c.be/31-skulls/ http://www.ce3c.be/31-skulls/#comments Wed, 15 Aug 2007 10:06:04 +0000 http://www.ce3c.be/2007,08,15/skulls/ I saw this coming I guess, but the Skulls-service is taking way-too-much load o_O
The service just got too much traffic,
So, today I'm shutting it down permanently 🙁

http://services.ce3c.be/skulls/ won't work any longer!
Sorry!

My account got suspended multiple times in the past three days because of this load,
that's why I had to do this.

]]>
http://www.ce3c.be/31-skulls/feed/ 5
Country Blocking (CIPRG) 0.8.1 http://www.ce3c.be/28-country-blocking-ciprg-081/ http://www.ce3c.be/28-country-blocking-ciprg-081/#comments Thu, 26 Jul 2007 14:31:19 +0000 http://www.ce3c.be/2007,07,26/country-blocking-ciprg-081/ I've rescripted the Country IP Ranges Generator in PHP (aka as Country Blocking or CIPRG), a few bugs have been fixed and the script is now powered by an SQLite database, which allows lists to be generated múch faster. 🙂

Major bugfix: countries with spaces (like United Kingdom) coudln't be generated with the country blocking script.
Everybody is free to use and change the script to suit your needs, but leave the link to ce3c.be -visible for visitors- in the script. The script uses S77.net's ip-to-country database, which can be found at Software77.net.

CIPRG v0.8.1

Features/Description:

  • The CIPRG can be used to generate the ipranges for a certain (or multiple) countries.
  • You may use the PHP script for generating blocklists (which you can eventually add in PeerGuardian).
  • The script may be used by webhosts or people who want to block certain countries from their service.
  • The script uses an SQLite-database to save the IP ranges in and can be auto-updated whenever you wish (eventually by using a cronjob).
  • It is able to return lists in an IPv4 dotted address or a proper address and the format (eg. Peerguardian blocklist) can be easily adjusted.
  • This script also contains s77.handler.php, which will download the ip-to-country database from Software77.net, it's very easy to make new handlers to fetch another ip2country database.
  • Proxies may be used too and can be set with just one line of code: define('PROXY', 'xx.xx.xx.xx:1234');

Requirements:

  • PHP using Safemode Off: the script can be used now using PHP versions < 5
  • SQLite: for the databse and the class
  • cURL: needed to update the ip-to-country database

Setup:

CHMOD your working dir, s77.tmp and ip2cdb to 777 if needed (those files may be named elseway and are defined in index.php). Normally the database should update itself when you try to generate a blocklist.

Download:

Don't worry, I didn't forget to add the download-link 😉

Download CIPRG v0.8.1 (link down, ask to reup if needed)

]]>
http://www.ce3c.be/28-country-blocking-ciprg-081/feed/ 14