Webget ISO Grabber
When I am at school, and I read that Slackware 13 is out, I need to have it. And I want it at home. So, what I can do is SSH into my machine, wget it, and it is done when I'm at home.
But, at school SSH is blocked, and a lot of other things, like FTP, Youtube and they have a large Internet Filter.
So, I need to have an other solution. Now I have it.
Now, make a new file (index.php) and place this in it. Index.php wil be the download form:
<html>There are two fields, and 1 is the ISO file, and the other is the password. I have set up a password function, because I do not want others to go and download ISO's and stuff onto my PC.
<head>
<title>Wget Webinterface</title>
</head>
<body>
<form action=verwerk.php method="POST">
Welke ISO's moet ik ophalen?<br />
ISO 1: <input type=password name=iso /><br />
ISO 2: <input type=password name=ww /><br />
<input type="submit" value="Verzenden" />
</form>
</body>
</html>
Now make a file called verwerk.php and put this in it:
As you can see, it checks if the file is an valid URL, and if it is an ISO. If you do not do this, people could fill in something like "; rm -rf /var/www" in the ISO field, and then your whole /var/www would be away.<?php
$iso=$_POST['iso'];
$ww=$_POST['ww'];
if($ww == "[PUT YOUR PASSWORD HERE BETWEEN THE QUOTES]") {
if(!empty($iso)) {
if ( @fopen("$iso", r) ) {
echo "Iso Bestaat, We gaan Door<br /> \n";
if(preg_match("/^[a-z]+://([a-z]+.)*[a-z]+/[^ ;]+.iso$/i", "$iso")) {
echo"De link eindigd op .iso<br /> \n";
system("echo $iso > /var/tmp/iso_addr");
echo("De iso word gedownload.<br /> \n");
exec("[PATH TO SHELL.SH SCRIPT]shell.sh");
} else {
echo"De link eindigd niet op .iso...<br \>\n";
}
} else {
echo "De Link Klopt niet. Vul een goede link in.<br \>\n";
}} else {
echo"Je moet wel wat invullen<br \>\n";
}
} else {
echo "Je moet wel het tweede veld invullen.<br \>\n";
}?>
If you want other files, like .rar, change if(preg_match("/.iso/", "$iso")) { to if(preg_match("/.rar/", "$iso")) { . What this file does is put the location of the .iso file in a text file called /var/tmp/iso_addr. Now we are going to make a shell script which wgets the ISO. Be sure to change [PATH TO SHELL.SH SCRIPT] to the folder of shell.sh. And change "[PUT YOUR PASSWORD HERE BETWEEN THE QUOTES]" to your password. shell.sh:
As you can see I have a dir in my root folder named .iso where the ISO's are stored. Change it to your ISO dir.#!/bin/bash
DE_ISO=`cat /var/tmp/iso_addr`
ISO_DIR="/.iso"
cd $ISO_DIR
wget -c -t 0 --timeout=60 --waitretry=60 $DE_ISO &
Wget has a resume option, so if your connection is flanky, it will resume automaticly.
chmod the file to 755. ( chmod +x ./shell.sh) Now test it all out, and see if there comes an ISO into the folder. If it works, Good Job!