Skip to content

Instantly share code, notes, and snippets.

@id4ehsan
Last active September 8, 2019 00:44
Show Gist options
  • Save id4ehsan/5ab3a8381ea10a610ef9b257d4aeb8b0 to your computer and use it in GitHub Desktop.
Save id4ehsan/5ab3a8381ea10a610ef9b257d4aeb8b0 to your computer and use it in GitHub Desktop.
phptunnel start project
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPTunnel Server Administration</title>
<link rel="shortcut icon" href="common/server.ico" type="image/x-icon" />
<script defer src="https://use.fontawesome.com/releases/v5.0.8/js/solid.js" integrity="sha384-+Ga2s7YBbhOD6nie0DzrZpJes+b2K1xkpKxTFFcx59QmVPaSA8c7pycsNaFwUK6l" crossorigin="anonymous"></script>
<script defer src="https://use.fontawesome.com/releases/v5.0.8/js/fontawesome.js" integrity="sha384-7ox8Q2yzO/uWircfojVuCQOZl+ZZBg2D2J5nkpLqzH1HY0C1dHlTKIbpRz/LG23c" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/css/tooltipster.min.css" integrity="sha256-pH1rXnKT93pKrqWn3yDTgwsQrK/M4sVMFL774/pfaas=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/js/jquery.tooltipster.min.js" integrity="sha256-lenj6loHcdfu6tFQPUHN6S2O7G2gv7yX/P9OnRc8lno=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qtip2/3.0.3/jquery.qtip.min.js" integrity="sha256-a+PRq3NbyK3G08Boio9X6+yFiHpTSIrbE7uzZvqmDac=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/qtip2/3.0.3/jquery.qtip.min.css" integrity="sha256-JvdVmxv7Q0LsN1EJo2zc1rACwzatOzkyx11YI4aP9PY=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/qtip2/3.0.3/jquery.qtip.min.css" integrity="sha256-JvdVmxv7Q0LsN1EJo2zc1rACwzatOzkyx11YI4aP9PY=" crossorigin="anonymous" />
<style>
body {
width: 100%;
}
#message {
display: none;
}
h3,
h6 {
width: 35%;
border: 5px solid red;
}
input,
label {
float: left;
}
</style>
</head>
<body>
<h1><em class="fas fa-cogs"></em>PHPTunnel Server Administration</h1>
<b id="message">PHPTunnel server messages:</b>
<h2>Tunnel Server</h2>
<h3 id="server_setting"><em class="fas fa-info-circle"></em>PHPTunnel Server Settings</h3>
<h4>HTTP Authentication Method:</h4>
<label for="none">None</label>
<input type="radio" name="AUTH_METHOD" value="none" id="none">
<label for="basic">Basic</label>
<input type="radio" name="AUTH_METHOD" value="basic" id="basic">
<h4>Authentication Source:</h4>
<label for="fixed">Fixed User list</label>
<input type="radio" name="AUTH_SOURCE" id="fixed">
<label for="ldap">LDAP</label>
<input type="radio" name="AUTH_SOURCE" id="ldap">
<label for="mysql">MySQL</label>
<input type="radio" name="AUTH_SOURCE" id="mysql">
<h5>User List</h5>
<h6 id="fixed_list"><em class="fas fa-info-circle"></em>Fixed User List Authentication</h6>
<select name="AUTH_USER" size=6>
</select>
<input type="button" value="Add" name="USADD" id="add_user">
<input type="button" value="Remove" name="USDEL" id="remove_user">
<input type="button" value="Modify" name="USMOD" id="modify_user">
<h5>LDAP</h5>
<h6 id="ldap_auth"><em class="fas fa-info-circle"></em>LDAP Authentication</h6>
<label for="ldap_server">Server:</label>
<input name="d_LDAP_SERVER" id="ldap_server" placeholder="LDAP Server">
<label for="ldap_port">Port:</label>
<input name="LDAP_PORT" id="ldap_port" placeholder="LDAP Port">
<label for="ldap_user">Username:</label>
<input name="LDAP_USER" id="ldap_user" placeholder="LDAP User">
<label for="ldap_pass">Password:</label>
<input name="LDAP_PASS" id="ldap_pass" placeholder="LDAP Password">
<label for="ldap_base">Base DN:</label>
<input name="LDAP_BASE" id="ldap_base" placeholder="LDAP Base DN">
<label for="ldap_filter">Filter:</label>
<input name="LDAP_FILTER" id="ldap_filter" placeholder="LDAP Filter">
<h5>MySQL</h5>
<h6 id="mysql_auth"><em class="fas fa-info-circle"></em>MySQL Authentication</h6>
<label for="mysql_server">Server:</label>
<input name="MYSQL_SERVER" id="mysql_server" placeholder="MySQL Server">
<label for="mysql_port">Port:</label>
<input name="MYSQL_PORT" id="mysql_port" placeholder="MySQL Port">
<label for="mysql_user">Username:</label>
<input name="MYSQL_USER" id="mysql_user" placeholder="MySQL User">
<label for="mysql_pass">Password:</label>
<input name="MYSQL_PASS" id="mysql_pass" placeholder="MySQL Password">
<label for="mysql_db">Database:</label>
<input name="MYSQL_DB" id="mysql_db" placeholder="MySQL Db Name">
<label for="mysql_query">Query:</label>
<input name="MYSQL_QUERY" id="mysql_query" placeholder="MySQL Query">
<h3 id="security_setting"><em class="fas fa-info-circle"></em>Security</h3>
<label for="limit_ip">Limit access to IPs:</label>
<input name="SEC_IP" id="limit_ip" placeholder="eg. 192.168.1.1">
<h2>Cascading</h2>
<h3 id="cascade"><em class="fas fa-info-circle"></em>SOCKS Cascading</h3>
<h4>Cascading enabled:</h4>
<label for="cascade_disable">disabled</label>
<input type="radio" name="CASCADING" value="0" id="cascade_disable">
<label for="cascade_socks4">SOCKS4</label>
<input type="radio" name="CASCADING" value="4" id="cascade_socks4">
<label for="cascade_socks5">SOCKS5</label>
<input type="radio" name="CASCADING" value="5" id="cascade_socks5">
<label for="cascade_server">Cascading Server:</label>
<input name="CAS_SERVER" id="cascade_server" placeholder="Cascade Server">
<label for="cascade_port">Cascading Server Port:</label>
<input name="CAS_PORT" id="cascade_port" placeholder="Cascade Port">
<label for="cascade_user">Cascading Server Username:</label>
<input name="CAS_AUTH_USER" id="cascade_user" placeholder="Cascade User">
<label for="cascade_pass">Cascading Server Password:</label>
<input name="CAS_AUTH_PASS" id="cascade_pass" placeholder="Cascade Pass">
<label for="use_pass">Use HTTP username/password</label>
<input type="checkbox" name="CAS_AUTH_PASSTHROUGH" value="1" id="use_pass">
<h2>Logging</h2>
<h3 id="loging"><em class="fas fa-info-circle"></em>Logfile and Loglevel</h3>
<label for="loglever">Log level:</label>
<input name="LOGLEVEL" id="loglever" placeholder="Only 0-4">
<label for="logfile">Log file name:</label>
<input name="LOGFILE" id="logfile" placeholder="eg. log.txt">
<label for="maxlogsize">Maximum logfile size:</label>
<input name="MAXLOGSIZE" id="maxlogsize" placeholder="eg. 10000">
<span>bytes</span>
<a href="" target="_blank">Click here to open the server log in a new window</a>
<h2>Miscelaneous</h2>
<h3 id="keepalive"><em class="fas fa-info-circle"></em>Tunnel Connection Keepalive</h3>
<label for="keepalive_enable">Enable Tunnel Keepalive</label>
<input type="checkbox" name="TKEEPALIVE_ENABLE" value="1" id="keepalive_enable">
<label for="keepalive_interval">Keepalive Interval</label>
<input name="TKEEPALIVE_INTERVAL" id="keepalive_interval" placeholder="eg. 1000">
<span>secs</span>
<h3 id="ipc"><em class="fas fa-info-circle"></em>Interprocess Communication</h3>
<label for="ipc_loadbalance">Support load balanced servers</label>
<input type="checkbox" name="IPC_LOADBALANCE" value="1" id="ipc_loadbalance">
<label for="ipc_tmpdir"> UNIX IPC Tempdir:</label>
<input name="IPC_TMPDIR" id="ipc_tmpdir" placeholder="eg. /tmp/">
<h3 id="ids"><em class="fas fa-info-circle"></em>Intrusion Detection and Countermeasures</h3>
<label for="ids_enable"> Enable Intrusion Detection </label>
<input type="checkbox" name="ID_ENABLE" value="1" id="ids_enable">
<label for="ids_maxaccess">Ban client IP after</label>
<input name="ID_MAXACCESS" id="ids_maxaccess" placeholder="eg. 100">
<span>attempts to access the tunnel server with invalid credentials.</span>
<label for="ids_timeout">These attempts must have been within an interval of</label>
<input name="ID_TIMEOUT" id="ids_timeout" placeholder="eg. 10">
<span>seconds.</span>
<label for="ids_bantimeout">The client IP will stay banned for</label>
<input name="ID_BANTIMEOUT" id="ids_bantimeout" placeholder="eg. 100000">
<span>seconds.</span>
<h3 id="encryption"><em class="fas fa-info-circle"></em>Encryption</h3>
<label for="force_encrypt">Disallow unencrypted tunnel client connections</label>
<input type="checkbox" name="ENCRYPTION_FORCE" value="1" id="force_encrypt">
<h3 id="admin"><em class="fas fa-info-circle"></em>Admin Interface </h3>
<label for="admin_ip">Limit access to IPs:</label>
<input name="ADMIN_IP" id="admin_ip" placeholder="eg. 127.0.0.1">
<label for="admin_user">Username:</label>
<input name="ADMIN_AUTH_USER" id="admin_user" placeholder="Admininstrator UserName">
<label for="admin_pass">Password:</label>
<input name="ADMIN_AUTH_PASS" id="admin_pass" placeholder="Administrator Password">
<h2>About</h2>
<h3 id="about"><em class="fas fa-info-circle"></em>About PHPTunnel</h3>
<p>PHPTunnel v~~RELVERSION~~ &copy;~~RELYEAR~~ by Ehsan AlemMohammadGhasemlou<a href="mailto:[email protected]">&lt;[email protected]&gt;</a></p>
<p>This software is licensed under the <a href="http://www.gnu.org/copyleft/gpl.html" target="_blank">GNU general public license</a></p>
<a href=""><img src="common/logo.jpg" alt="" ></a>
<object width="240" height="180" id="3dlogo" data="data" type="application/vnd.adobe.flash-movie">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="common/3dlogo.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="common/3dlogo.swf" quality="high" bgcolor="#ffffff" width="240" height="180" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<button type="button" value="Save" id="save">save</button>
<button type="reset" value="Reset" id="reset">reset</button>
<script>
var tips = {
"#server_setting": "<strong>Authentication Method</strong>:<br>Does the PHP tunnel script require authentication? Currently, only basic authentication is supported.",
"#fixed_list": "a list of Fixed number of user",
"#ldap_auth": "<strong>Filter</strong>:<br>This is the query that is sent to the LDAP server. If the query returns any entries, authentication is successful. The character sequences \'\\u\' and \'\\p\' are replaced by the username and password provided by the HTTP client. Example of a filter:<br>(&(uid=\\u) (pass=\\p))",
"#mysql_auth": "<strong>Query</strong>:<br>This is the query that is sent to the MySQL server. If the query returns any entries, authentication is successful. The character sequences \'\\u\' and \'\\p\' are replaced by the username and password provided by the HTTP client. Example of a query:<br>SELECTt * FROM users WHERE uid=\'\\u\' AND pass=PASSWORD(\'\\p\')",
"#security_setting": "<strong>Limit access to IPs</strong><br>A comma delimited list of IP adresses (netmask can be supplied) that are allowed to access the HTTPTunnel server, e.g. 127.0.0.1,10.0.0.0/8<br>Leave blank for no restrictions.<br>",
"#cascade": "Connections to the remote hosts can be made over a SOCKS4 or SOCKS5 proxy. Configure the SOCKS cascading here",
"#loging": "<strong>Loglevel</strong>:<br>- 0 = no logging<br>- 1 = log errors<br>- 2 = log connects/disconnects and warnings<br>- 3 = log data<br>- 4 = debug (not recommended)<br><strong>Maximum logfile size</strong>: After the logfile exceeds the specified size, it will be renamed to &lt;Logfilename>.old and a new logfile is opened",
"#keepalive": "Some proxies or HTTP-servers terminate connections after a fixed period of inactivity. To prevent disconnects because of that, we can send linefeeds to the tunnel, keeping it alive. Configure the Tunnel Keepalive here.",
"#ipc": "The HTTPTunnel script runs in multiple server threads which need to communicate with each other. This is done over sockets, preferably over UNIX domain sockets. This method, however is not available on all systems. TCP is used for fallback.<br><strong>Support load balanced servers</strong>:<br>must be checked if the script is hosted in a load balanced environment. This will force IPC to be done over TCP and additionally modify the protocol so that executing the script on different servers will be possible.<br><strong>UNIX IPC Tempdir</strong>:<br>is the directory where the UNIX socket files are created - specify with the the appending slash (e.g. /tmp/)",
"#ids": "For additional security, configure intrusion detection and countermeasures here.",
"#encryption": "Configure encryption options here.",
"#admin": "<strong>Limit access to IPs</strong><br>A comma delimited list of IP adresses (netmask can be supplied) that are allowed to access the admin interface, e.g. 127.0.0.1,10.0.0.0/8<br>Leave blank for no restrictions.<br>",
"#about": "About the Author and Version and licience "
}
var tipscaption = {
"#server_setting": "HTTPTunnel Server Settings",
"#fixed_list": "Fixed List Settings",
"#ldap_auth": "LDAP Authentication Settings",
"#mysql_auth": "MySQL Authentication Settings",
"#security_setting": "Security Settings",
"#cascade": "SOCKS Cascading Settings",
"#loging": "Log Settings",
"#keepalive": "Tunnel Connection Keepalive Settings",
"#ipc": "Interprocess Communication Settings",
"#ids": "Intrusion Detection Options",
"#encryption": "Encryption Options",
"#admin": "Admin Interface Options",
"#about": "About Software"
}
//$("h3").attr("class","tooltip");
$(document).ready(function() {
$.each(tips, function(index, value) {
//alert(index + ': ' + value);
//$(index).attr( "title", value );
//$(index).attr( "class", "tooltip" );
$(index).qtip({
content: {
text: value,
title: tipscaption[index],
//button: 'close'
}
});
});
$("#add_user").click(function() {
alert("add");
});
$("#modify_user").click(function() {
alert("modify");
});
$("#remove_user").click(function() {
alert("remove");
});
$("#save").click(function() {
alert("save");
});
$("#reset").click(function() {
alert("reset");
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment