403Webshell
Server IP : 23.94.149.180  /  Your IP : 216.73.216.147
Web Server : nginx/1.20.1
System : Linux deadrock 5.14.0-741.22.1.el9_9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 12 15:18:14 UTC 2026 x86_64
User : apache ( 48)
PHP Version : 8.6.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /files/www/voxsupport/files/fancy/docs/userguide/HTML/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /files/www/voxsupport/files/fancy/docs/userguide/HTML/perlexample.html
<html>
<head>
   <title>Perl example</title>
   <meta name="generator" content="Help & Manual">
   <meta name="keywords" content="">
</head>


  <!-- Redirect browser to index page if page is not in the content frame.
       This script is only valid for regular HTML export -->
  <script language="JavaScript">
       <!--
           if(top.frames.length==0) top.location.href='index.html?perlexample.html'
       //-->
  </script>


<body bgcolor="#FFFFFF">


<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#E2E2E2">
  <tr>
    <td align="left">
      
<span style="font-family:Helvetica,Arial; font-size:12pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:12pt; color:#000080"><b>Perl example
<br>
</b></span></span>
    </td>
    <td align="right">
     <font face="Arial" size="2">
     <a href="javaScript:parent.reDisplay('1.1',1,0)"><img src="ico_nav_up.gif" border=0 alt="Top"></a>&nbsp;
     <a href="javaScript:parent.reDisplay('3.2',1,0)"><img src="ico_nav_back.gif" border=0 alt="Previous"></a>&nbsp;
     <a href="javaScript:parent.reDisplay('3.4',1,0)"><img src="ico_nav_next.gif" border=0 alt="Next"></a>
     </font>
    </td>
  </tr>
</table>
<br>


<span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">The example below demonstrates how using a Perl script you can process files submitted by HTTP File Upload Applet.  The source code for this example may be found in the <span style="font-family:Courier New; font-size:10pt; color:#000000">examples/perl/receiver.pl</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"> file included with the HTTP File Upload Applet distribution.
<br>
<span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>

<br>
<span style="font-family:Helvetica,Arial; font-size:10pt; color:#008000"><b>Example</b></span></span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>

<br>
</span><span style="font-family:Courier New; font-size:10pt; color:#000000"><span style="font-family:Courier New; font-size:10pt; color:#008000">#!/usr/bin/perl</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000">#&nbsp;use&nbsp;CGI&nbsp;module</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
use&nbsp;CGI;
<br>
use&nbsp;File::Path;
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000">#&nbsp;define&nbsp;location&nbsp;where&nbsp;uploaded&nbsp;files&nbsp;will&nbsp;be&nbsp;stored,&nbsp;notice&nbsp;that&nbsp;permissions&nbsp;to&nbsp;write&nbsp;are&nbsp;needed&nbsp;</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000"><span style="font-family:Courier New; font-size:10pt; color:#0000FF">for</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000"><span style="font-family:Courier New; font-size:10pt; color:#008000">&nbsp;upload&nbsp;directory&nbsp;</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
$uploaddir&nbsp;=&nbsp;<span style="font-family:Courier New; font-size:10pt; color:#000080">'/var/uploads/'</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">;
<br>
$query&nbsp;=&nbsp;<span style="font-family:Courier New; font-size:10pt; color:#0000FF">new</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">&nbsp;CGI;
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000">#&nbsp;parse&nbsp;the&nbsp;name&nbsp;of&nbsp;file</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
$filename&nbsp;=&nbsp;$query-&gt;param(<span style="font-family:Courier New; font-size:10pt; color:#000080">"file"</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">);
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000">#&nbsp;Index&nbsp;where&nbsp;starts&nbsp;the&nbsp;file&nbsp;name&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
$index&nbsp;=&nbsp;rindex($filename,<span style="font-family:Courier New; font-size:10pt; color:#000080">"\\"</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">);
<br>

<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000">#&nbsp;Gets&nbsp;the&nbsp;directory&nbsp;&nbsp;path&nbsp;name&nbsp;from&nbsp;the&nbsp;file&nbsp;name</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
$dirName&nbsp;=&nbsp;substr($filename,&nbsp;<span style="font-family:Courier New; font-size:10pt; color:#000080">0</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">,$index+<span style="font-family:Courier New; font-size:10pt; color:#000080">1</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">);
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000">#&nbsp;Check&nbsp;the&nbsp;directory&nbsp;name</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
<span style="font-family:Courier New; font-size:10pt; color:#0000FF">if</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">($dirName&nbsp;ne&nbsp;<span style="font-family:Courier New; font-size:10pt; color:#000080">""</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">){
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-family:Courier New; font-size:10pt; color:#008000">#&nbsp;Concat&nbsp;the&nbsp;directory&nbsp;path&nbsp;name&nbsp;&nbsp;&nbsp;</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
&nbsp;&nbsp;&nbsp;&nbsp;$uploaddir&nbsp;=&nbsp;&nbsp;$uploaddir&nbsp;.&nbsp;$dirName;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-family:Courier New; font-size:10pt; color:#008000">#&nbsp;Make&nbsp;the&nbsp;directory&nbsp;</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000"><span style="font-family:Courier New; font-size:10pt; color:#0000FF">if</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000"><span style="font-family:Courier New; font-size:10pt; color:#008000">&nbsp;it&nbsp;does&nbsp;not&nbsp;exist</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-family:Courier New; font-size:10pt; color:#0000FF">if</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">(!&nbsp;-d&nbsp;$uploaddir){
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkpath&nbsp;$uploaddir;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;}
<br>
}
<br>

<br>
$filename&nbsp;=~&nbsp;s/.*[\/\\](.*)/$1/;
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000">#&nbsp;gets&nbsp;file&nbsp;handle</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
$upload_filehandle&nbsp;=&nbsp;$query-&gt;upload(<span style="font-family:Courier New; font-size:10pt; color:#000080">"file"</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">);
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000">#&nbsp;reads&nbsp;contents&nbsp;and&nbsp;saves&nbsp;it&nbsp;out</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
open&nbsp;UPLOADFILE,&nbsp;<span style="font-family:Courier New; font-size:10pt; color:#000080">"&gt;$uploaddir/$filename"</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">&nbsp;||&nbsp;&amp;upload_error;
<br>

<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000">#&nbsp;tells&nbsp;Perl&nbsp;to&nbsp;write&nbsp;the&nbsp;file&nbsp;in&nbsp;binary&nbsp;mode,&nbsp;rather&nbsp;than&nbsp;in&nbsp;text&nbsp;mode.&nbsp;</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
binmode&nbsp;UPLOADFILE;
<br>
<span style="font-family:Courier New; font-size:10pt; color:#0000FF">while</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">&nbsp;(&nbsp;&lt;$upload_filehandle&gt;&nbsp;)&nbsp;{
<br>
&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;UPLOADFILE;
<br>
}
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000">#&nbsp;close&nbsp;the&nbsp;file</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
close&nbsp;UPLOADFILE;
<br>

<br>
print&nbsp;$query-&gt;header();
<br>
print&nbsp;<span style="font-family:Courier New; font-size:10pt; color:#000080">"RESP.100"</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">;
<br>

<br>
sub&nbsp;upload_error&nbsp;{
<br>
&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;INFO&nbsp;<span style="font-family:Courier New; font-size:10pt; color:#000080">"****ES&nbsp;ERROR***\n"</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">;&nbsp;&nbsp;&nbsp;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;<span style="font-family:Courier New; font-size:10pt; color:#000080">"RESP.200"</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;exit;
<br>
}
<br>

<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>Installation</b>
<br>

<br>
</span></span><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="28"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">1.</span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">Change <span style="font-family:Courier New; font-size:10pt; color:#000000">$upload_dir</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"> variable in </span><span style="font-family:Courier New; font-size:10pt; color:#000000">receiver.pl</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"> script to point to directory path where file should be uploaded.  DO NOT include a </span><span style="font-family:Courier New; font-size:10pt; color:#000000">/</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"> at the end of this path.
&nbsp;<br>
</span></span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="28"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">2.</span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">Upload receiver.pl to the CGI directory on your web server.  Typically this directory is named <span style="font-family:Courier New; font-size:10pt; color:#000000">cgi-bin</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">.  Please consult your system administrator if you are unsure where this directory is located.
&nbsp;<br>
</span></span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="28"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">3.</span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">Add execute permissions to the <span style="font-family:Courier New; font-size:10pt; color:#000000">receiver.pl</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"> script.  You can do this by connecting to the web server using telnet or ssh, navigating to the CGI directory and issuing the command </span><span style="font-family:Courier New; font-size:10pt; color:#000000">chmod&nbsp;755&nbsp;receiver.pl</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
&nbsp;<br>
</span></span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="28"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">4.</span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">Set <span style="font-family:Courier New; font-size:10pt; color:#000000">url</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"> parameter in HTML applet code to point to url of this script e.g. </span><span style="font-family:Courier New; font-size:10pt; color:#000000">http://www.jscape.com/cgi-bin/receiver.pl</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
&nbsp;<br>
</span></span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="28"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">5.</span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">Done.  You may now run HTTP File Upload Applet
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"></span></td><td></td></tr></table><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
<span style="font-family:Courier New; font-size:10pt; color:#000000"></span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>See also</b>
<br>

<br>
</span></span><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><a href=javaScript:parent.reDisplay('2.8',1,0)>Specifying the upload URL</a>
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"></span></td></tr></table><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
</span>

</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit