Packages->FTP # and you will see Server Hostname ftp0X.powweb.com # # Go into /htdocs # Click on the "htdocs" in the list of directories and files. # After the screen update, make sure that you see # "You are here: /htdocs" at the top of the list. # # Make a new directory (for extratool.php and other tools) # Click "Make Dir" in the upper left side # Type in the name you can retain, all in lower case # without spcae or other special characters ("zzz" for example). # Push "Make Dir" button. # # Go to newly created directory # When the screen updates, click on the new directory you've just created. # You should see "You are here: /htdocs/newdir" at the top of the list. # # Copy & Paste extratools.php # Click "Create file" in upper left side just under "Make dir". # When new subwindow comes up, come back to this tab (or window) # and copy everything by: Ctrl-A then Ctrl-C # (or Edit menu -> select all, Edit->Copy) # Return to the Create file subwindow and paste everything with Ctrl-V # Type in "extratools.php" in the filename and push "save" # # Access extratools.php and setup password protection # In a new tab/window, access http://yoursite.com/newdir/extratools.php # ('yoursite.com/newdir' should be replaced with your domain name and # the name of directory you just created for extratools.php.) # # Click the link to password protection. # Enter username, password of your choice. # # Login and use extratools.php # Enter the username and password you chose when the usual # dialog window pops up. # # When extratools comes up, click on one of the link to install/update, # or run the tool. # # Once extratools.php is running, you can update itself # and any other tools just by clicking the Install/update link. # # Please see http://check-these.info/tools/ for the description of available tools. # ############################ # # v0.34 Added geturl() lowlevel socket function. # To avoid PowWeb's DNS related problems. # v0.35 Added Download and install Python2.4.1 precompiled binary. # v0.36 Added Domain Manager loader cgi # v0.37 Added "Ocaml Editor" # v0.38 bug fix # v0.39 dl.cgi added in the copying list of OcamlEditor # v0.40 Full Python installation added # v0.41 URL change for Python full package # v0.42 Modified to allow the change of toolpage format # v0.43 Added automatic password protection # It will create backup of old password file and create new one: # /www/U/USER/.extratools.wd # It will append IP protection (only if selected) # and password protection lines in the .htaccess # To remove protection, you have to manually edit these files # using OcamlEditor or other software. # v0.44 It won't work from Docroot (/htdocs) or cgi-bin, anymore. # v0.45 Minor modificsations around auto password protection # v0.45c A few stupid explanations added ... # v0.45d "Newbie Proof"(TM) instruction added. # v0.45e Added warning about 777 and 666 on PowWeb server, and correction code. # v0.46 Changed timeout value to 240 secs and buffer to 4096. # v0.47 Changed data site host IP # $ver = "0.47"; $CHECK_REMOTE_USER = 1; $lurl = 'http://check-these.info/tools/'; $Stime = time(); ini_set('max_execution_time', 240); $user = get_current_user(); $home = '/www/' .substr($user,0,1)."/$user"; ?> extratools.php ver.<?=$ver?>

Automatic installer for extratools


'; return ''; } # $hostname, $hostip, $uri; $address = gethostbyname($hostname); # echo $address." ".$hostname; # if( strpos('X'.$url, $lurl) == 1){ if($address == $hostname){ $address = $hostip; #echo "Using IP for $url"; } # return "$hostname, $uri,$hostip" ; $socket = socket_create(AF_INET, SOCK_STREAM, 0); if ($socket < 0) { echo "socket_create() failed: reason: " . socket_strerror($socket) . "\n"; } $result = socket_connect($socket, $address, $service_port); if ($result < 0) { $result = socket_connect($socket, $hostip2, $service_port); } if ($result < 0) { echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n"; } $in = "GET $uri HTTP/1.0\r\n"; $in .= "Host: $hostname\r\n"; $in .= "Connection: Close\r\n\r\n"; $out = ''; # echo "
$in";
    socket_write($socket, $in, strlen ($in));
  if($pn and ($fh = fopen($pn, 'w'))){
    $data = '';
    $header = '';
    $dlerror = 0;
    while ($out = socket_read($socket, 4096)) {
      if(! $header){
        $data .= $out;
        $i = strpos($data,"\r\n\r\n");
        if($i){ 
          $header = substr($data, 0,$i); 
          $data = substr($data, $i + 4);
          if(!fwrite($fh, $data) ){ 
            echo("Error: Failed to write $pn
\n"); echo "
$header\n----------$data
\n"; $dlerror = 1; } } }else{ if(!fwrite($fh, $out) ){ echo("Error: Failed to write $pn
\n"); $dlerror = 2; } } } socket_close($socket); fclose($fh); return $header; }else{ $data = ''; $header = ''; while ($out = socket_read($socket, 4096)) { $data .= $out; } socket_close($socket); $i = strpos($data,"\r\n\r\n"); if($i){ $header = substr($data, 0,$i); $data = substr($data, $i + 4); } return $data; } } function passwordform (){ echo << Do not use the same username/password combo as the OPS or FTP. This type of password protection isn't very strong.

If you are sure that you have fixed IP and you usually connect from there,
use IP protection + password protection.

Otherwise, use "Password protection only".
Username:
Password:
Reconfirm Password:
If you don't have fixed IP ==>

Skip protection for now.
ENDECHO; exit; } $cwd = getcwd(); if( fileinode("$home/htdocs") == fileinode($cwd) or basename($cwd) == "cgi-bin" ){ echo "

ERROR: This script will not work from $cwd
Please put it in a subdirectory under /htdocs of main domain and retry.

example: $home/htdocs/oddname/extratools.php

Use odd directory name to increase the security.

"; exit; } if(isset($_POST['uname'])){ $upass = stripslashes($_POST['upass']); $uname = stripslashes($_POST['uname']); /* echo << username:$uname password:$upass password2:${_POST['upass2']} ip:${_POST['uip']} submit:${_POST['submit']} ENDPASS; */ if( $uname == ''){ echo "

You must enter the username

"; passwordform(); } if( $upass == ''){ echo "

You must enter the password

"; passwordform(); } if( $_POST['upass'] != $_POST['upass2'] ){ echo "

You must enter the same password twice to confirm

"; passwordform(); } $seed = NULL; for ($i = 0; $i < 8; $i++) { $seed .= substr('0123456789abcdef', rand(0,15), 1); } $encoded_string = crypt($upass, "$1$".$seed); $passfile = "$home/.extratools.wd"; $passdata = $uname.":".$encoded_string."\n"; rename($passfile, "passfile.bak"); $fh = fopen($passfile, 'w'); fwrite($fh, $passdata); fclose($fh); $authpart = "\n#### Automatically generated and added by ${_SERVER['PHP_SELF']} ###\n"; if(substr($_POST['submit'],0,2) =="IP"){ $authpart .= " order deny,allow deny from all allow from ${_POST['uip']} "; } $authpart .= <<Password protection, done !
Click this link to login and continue. "; exit; }else if(isset($_GET['protect'])){ passwordform(); }else if($CHECK_REMOTE_USER and (!isset($_SERVER['REMOTE_USER'])) ){ echo "

Security Warning: no password protection detected

\nYou must protect this script by password, IP (or IP range), and/or other valid methods.

Click this link to protect it, now !


"; } function mywrite($pn, $ct, $mode = 'w'){ if($fh = fopen($pn,$mode)){ if(!fwrite($fh, $ct) ){ echo("Error: Failed to write $pn
\n"); } fclose($fh); }else{ echo("Error: Failed to open $pn
\n"); } } if( isset($_GET['install']) ){ $fn = $_GET['install']; #echo "Installing $fn"; $tn = preg_replace('/^(.*?)\.(php|cgi)$/','\1_\2.txt', $fn); chmod(".", 0710); # Force 710 if you like it or not. echo "

Installing '".$fn."'

\n"; echo "  Please, plase. please make sure to well protect this directory
\n"; echo "  Protect at least by the password protection. Use IP (range) protection, too, if possible.

\n"; echo "  Now, downloading. It may take a while....
\n"; ob_flush(); # $fl = file_get_contents($lurl.$tn); $bfn = $fn.".bak".substr($fn,strrpos($fn,'.')); unlink($bfn); rename($fn, $bfn); if( substr($fn,0,7) == "http://") { $furl = $fn; $fn = basename($fn); $tn = $fn; #echo "furl=$furl, fn=$fn\n
"; $fl = geturl($furl, $fn); }else{ $fl = geturl($lurl.$tn, $fn); } if((! $dlerror) and ($fn != $tn)){ echo '

Done! Book mark and access this link to use it ==> '.$fn."

\n"; }else{ echo "

Done!

\n"; } if( strpos($fn,'.php') ){ $perm = 0600; # default php permission }elseif(strpos($fn,'.cgi') ){ $perm = 0700; # default cgi permission }elseif(strpos($fn,'.htm') ){ $perm = 0640; # default public html permission }else{ $perm = 0600; # default data permission } chmod($fn, $perm);# or die("Error: chmod on $fn failed.
\n"); unset($_GET['install']); $pydir = 'py24'; if($fn == 'python24_powweb.zip'){ echo "Extracting and setting up Python
\n
";
      ob_flush();
      echo `exec 2>&1;mv -v $fn $home/;cd $home;unzip -o $fn; perl -i.bak -pe 's#/usr/local#'"$home/$pydir#g" $pydir/lib/python2.4/config/Makefile; echo "Done !!"`;
      echo '
'; echo "Please use '#!$home/$pydir/bin/python'
as the shbang line (the first line of your script).
\n"; }elseif($fn == 'python-2.4.tgz'){ echo "Extracting and setting up Python
\n
";
      ob_flush();
      echo `exec 2>&1;ls -l $fn;mkdir $home/$pydir;mv -v $fn $home/$pydir/; cd $home/$pydir; tar  --exclude '+*' --exclude 'lib/python2.4/test/*' -zxvf python-2.4.tgz; perl -i.bak -pe 's#/usr/local#'"$home/$pydir#g" $home/$pydir/lib/python2.4/config/Makefile; echo "Done !!"`;
      echo '
'; echo "Please use '#!$home/$pydir/bin/python'
as the shbang line (the first line of your script).
\n"; }elseif($tn == 'domain_cgi.txt'){ #echo "
$headers

"; $ct = file_get_contents($fn); $ct = str_replace('/www/U/USER', $home, $ct); #echo "
$ct

"; mywrite($fn,$ct); }elseif($tn == 'oced-3.08.3.zip'){ echo "Extracting and setting up Ocaml binary/library
\n
";
      ob_flush();
      echo `exec 2>&1;mv -v $fn $home/;here=\`pwd\`;cd $home;unzip -o $fn;echo "Done !!";echo "Copying Ocaml editor"; cp -v lib/ocaml/oced.ml.cgi lib/ocaml/dl.cgi \$here/;`; 
      echo '
'; echo "Now Ocaml Editor is ready.

Bookmark this URL oced.ml.cgi

\n"; } echo "
\n"; } # $list = file_get_contents($lurl); $list = geturl($lurl) ; preg_match_all('#.*?#i',$list, $m, PREG_SET_ORDER); echo '
'; foreach($m as $mi){ #$fn = str_replace('_','.',$mi[2]); $fn = $mi[2].'.'.$mi[3]; $url = str_replace('href="',"href=\"$lurl",$mi[0]); ?> '; echo "

Go and read the description of these tools => $lurl

\n"; echo "

Update this installer itself=> Get the latest version

\n"; #echo htmlentities($list); #echo $list; $Etime = time(); $Ptime = $Etime - $Stime; ?>
extraloos.php ver. (Processed in seconds)
Install/update
  
Run
  
source code =>
Install/update
  Python-2.4.1 mini
... Precompiled Mini package for PowWeb (FreeBSD4.11)
   source code => Python.org
Install/update
  Python-2.4 Full
... Precompiled Full binary package from FreeBSD mirror
  Other packages
Install/update
  domain.cgi
Run
  domain.cgi
Domain manager. (Requires one of Python package above)
Install/update
  Ocaml Editor
Run
  Ocaml Editor
File editor/directory browser with Ocaml developement system.
Create stand alone compact/fast binary CGI in a few seconds!