Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit 766888c

Browse files
authored
Add files via upload
1 parent 3712cea commit 766888c

File tree

8 files changed

+250
-0
lines changed

8 files changed

+250
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<html>
2+
<head>
3+
<title>Untitled</title>
4+
</head>
5+
<body>
6+
<h1> cPanel Bridge </h1>
7+
<p> Access Denied </p>
8+
</body>
9+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
// WHM API SERVER EMULATOR
3+
include 'config.php';
4+
include 'servers/' . $reseller_server . '.php';
5+
6+
// Set the content type to XML
7+
header('Content-Type: application/json');
8+
9+
// Get the value of 'function' from the GET parameters
10+
$fake_endpoint = isset($_GET['function']) ? $_GET['function'] : '';
11+
12+
// Sanitize the input
13+
$fake_endpoint = strip_tags($fake_endpoint); // Remove any HTML or PHP tags
14+
$fake_endpoint = htmlspecialchars($fake_endpoint, ENT_QUOTES, 'UTF-8'); // Convert special characters to their HTML entities
15+
16+
// Remove the file extension from the variable
17+
$endpoint = pathinfo($fake_endpoint, PATHINFO_FILENAME);
18+
19+
if ($endpoint === "createacct" && function_exists($endpoint)) {
20+
// Define the arguments dynamically
21+
$arguments = ['arg1', 'arg2', 'arg3'];
22+
// call_user_func_array($endpoint, $arguments);
23+
echo '<createacct>';
24+
echo ' <result>';
25+
echo ' <options>';
26+
echo ' <ip>192.168.0.1</ip>';
27+
echo ' <nameserver>ns1.example-host.com</nameserver>';
28+
echo ' <nameserver2>ns2.example-host.com</nameserver2>';
29+
echo ' <nameserver3/>';
30+
echo ' <nameserver4/>';
31+
echo ' <nameservera/>';
32+
echo ' <nameservera2/>';
33+
echo ' <nameservera3/>';
34+
echo ' <nameservera4/>';
35+
echo ' <nameserverentry/>';
36+
echo ' <nameserverentry2/>';
37+
echo ' <nameserverentry3/>';
38+
echo ' <nameserverentry4/>';
39+
echo ' <package>package_name</package>';
40+
echo ' </options>';
41+
echo ' <rawout></rawout>';
42+
echo ' <status>1</status>';
43+
echo ' <statusmsg>Account Creation Ok</statusmsg>';
44+
echo ' </result>';
45+
echo '</createacct>';
46+
} elseif ($endpoint === "removeacct" && function_exists($endpoint)) {
47+
echo '<removeacct>';
48+
echo ' <result>';
49+
echo ' <status>1</status>';
50+
echo ' <statusmsg>Account Removal Ok</statusmsg>';
51+
echo ' </result>';
52+
echo '</removeacct>';
53+
} elseif (!function_exists($endpoint)) {
54+
// Invalid endpoint or endpoint not implemented
55+
http_response_code(501); // Set HTTP status code to 501 Not Implemented
56+
echo '<error>';
57+
echo ' <message>Endpoint Not Implemented</message>';
58+
echo '</error>';
59+
} else {
60+
// Invalid endpoint or endpoint not implemented
61+
http_response_code(501); // Set HTTP status code to 501 Not Implemented
62+
echo '<error>';
63+
echo ' <message>Endpoint Not Implemented</message>';
64+
echo '</error>';
65+
}
66+
?>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
// WHM API SERVER EMULATOR
3+
include 'config.php';
4+
include 'servers/' . $reseller_server . '.php';
5+
include 'servers/bridge.php';
6+
7+
// Set the content type to XML
8+
header('Content-Type: application/xml');
9+
10+
// Get the value of 'function' from the GET parameters
11+
$fake_endpoint = isset($_GET['function']) ? $_GET['function'] : '';
12+
13+
// Sanitize the input
14+
$fake_endpoint = strip_tags($fake_endpoint); // Remove any HTML or PHP tags
15+
$fake_endpoint = htmlspecialchars($fake_endpoint, ENT_QUOTES, 'UTF-8'); // Convert special characters to their HTML entities
16+
17+
// Remove the file extension from the variable
18+
$endpoint = pathinfo($fake_endpoint, PATHINFO_FILENAME);
19+
// Define the arguments dynamically
20+
$arguments = ['arg1', 'arg2', 'arg3'];
21+
if ($endpoint === "createacct" && function_exists($endpoint)) {
22+
23+
// call_user_func_array($endpoint, $arguments);
24+
echo '<createacct>';
25+
echo ' <result>';
26+
echo ' <options>';
27+
echo ' <ip>192.168.0.1</ip>';
28+
echo ' <nameserver>ns1.example-host.com</nameserver>';
29+
echo ' <nameserver2>ns2.example-host.com</nameserver2>';
30+
echo ' <nameserver3/>';
31+
echo ' <nameserver4/>';
32+
echo ' <nameservera/>';
33+
echo ' <nameservera2/>';
34+
echo ' <nameservera3/>';
35+
echo ' <nameservera4/>';
36+
echo ' <nameserverentry/>';
37+
echo ' <nameserverentry2/>';
38+
echo ' <nameserverentry3/>';
39+
echo ' <nameserverentry4/>';
40+
echo ' <package>package_name</package>';
41+
echo ' </options>';
42+
echo ' <rawout></rawout>';
43+
echo ' <status>1</status>';
44+
echo ' <statusmsg>Account Creation Ok</statusmsg>';
45+
echo ' </result>';
46+
echo '</createacct>';
47+
} elseif ($endpoint === "removeacct" && function_exists($endpoint)) {
48+
echo '<removeacct>';
49+
echo ' <result>';
50+
echo ' <status>1</status>';
51+
echo ' <statusmsg>Account Removal Ok</statusmsg>';
52+
echo ' </result>';
53+
echo '</removeacct>';
54+
} elseif ($endpoint === "detect_cpanel_bridge" && function_exists($endpoint)) {
55+
echo "<detect_cpanel_bridge>";
56+
echo "<result>";
57+
echo "<detected> true </detected>";
58+
echo "</result>";
59+
echo "</detect_cpanel_bridge>";
60+
} elseif (!function_exists($endpoint)) {
61+
// Invalid endpoint or endpoint not implemented
62+
http_response_code(501); // Set HTTP status code to 501 Not Implemented
63+
echo '<error>';
64+
echo ' <message>Endpoint Not Implemented</message>';
65+
echo '</error>';
66+
} else {
67+
// Invalid endpoint or endpoint not implemented
68+
http_response_code(501); // Set HTTP status code to 501 Not Implemented
69+
echo '<error>';
70+
echo ' <message>Endpoint Not Implemented</message>';
71+
echo '</error>';
72+
}
73+
?>
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
$config = array(
3+
'reseller_server' => 'mofh',
4+
'reseller_api_hostname' => 'optional',
5+
'reseller_api_username' => 'optional',
6+
'reseller_api_password' => 'optional',
7+
'reseller_api_port' => 'optional',
8+
'reseller_api_key' => 'optional',
9+
'reseller_api_token' => 'optional',
10+
'reseller_api_secret' => 'optional',
11+
'reseller_api_endpoint' => 'optional',
12+
'ifttt_webhook_key' => 'optional',
13+
'whm_api_username' => 'optional',
14+
'whm_api_password' => 'optional'
15+
);
16+
17+
18+
// Backwards Compatiablity
19+
$reseller_server = $config['reseller_server'];
20+
$reseller_api_hostname = $config['reseller_api_hostname']; // change optional to API hostname
21+
$reseller_api_username = $config['reseller_api_username']; // change username to API username
22+
$reseller_api_password = $config['reseller_api_password']; // change password to API password
23+
$reseller_api_port = $config['reseller_api_port']; // API port number, if applicable
24+
$reseller_api_key = $config['reseller_api_key']; // API key, if required
25+
$reseller_api_token = $config['reseller_api_token']; // API token, if required
26+
$reseller_api_secret = $config['reseller_api_secret']; // API secret key, if required
27+
$reseller_api_endpoint = $config['reseller_api_endpoint']; // API endpoint URL, if different from the default
28+
?>
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
include 'config.php';
3+
4+
$api = isset($_GET['api']) ? $_GET['api'] : '';
5+
6+
if ($api === 'xml') {
7+
// Include code for your "xml-api" functionality
8+
include 'apis/xml-api.php';
9+
} elseif ($api === 'json') {
10+
// Include code for your "json-api" functionality
11+
include 'apis/json-api.php';
12+
} elseif ($api === '') {
13+
// Handle the case when the API parameter is blank
14+
// Include code for your default functionality or display an error message
15+
echo 'API Parameter is blank';
16+
} else {
17+
// Invalid API or API not implemented
18+
http_response_code(404); // Set HTTP status code to 404 Not Found
19+
echo 'API Not Found';
20+
}
21+
?>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
function detect_cpanel_bridge() {
3+
echo "<cpanel_bridge>";
4+
echo "<detected> true </detected>";
5+
echo "</cpanel_bridge>";
6+
}
7+
?>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
function createacct($user,$pass,$email,$domain,$plan){
3+
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
4+
$ch = curl_init();
5+
6+
curl_setopt($ch, CURLOPT_URL, 'https://panel.myownfreehost.net/xml-api/createacct.php');
7+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
8+
curl_setopt($ch, CURLOPT_POST, 1);
9+
curl_setopt($ch, CURLOPT_POSTFIELDS, "api_user=$api_username&api_key=$api_password&username=$user&password=$pass&contactemail=$email&domain=$domain&plan=$plan");
10+
curl_setopt($ch, CURLOPT_USERPWD, 'username' . ':' . 'password');
11+
12+
$headers = array();
13+
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
14+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
15+
16+
$result = curl_exec($ch);
17+
if (curl_errno($ch)) {
18+
echo 'Error:' . curl_error($ch);
19+
}
20+
curl_close($ch);
21+
return $result;
22+
};
23+
?>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
function createacct($user,$pass,$email,$domain,$plan){
3+
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
4+
$ch = curl_init();
5+
6+
curl_setopt($ch, CURLOPT_URL, 'https://panel.myownfreehost.net/xml-api/createacct.php');
7+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
8+
curl_setopt($ch, CURLOPT_POST, 1);
9+
curl_setopt($ch, CURLOPT_POSTFIELDS, "api_user=$api_username&api_key=$api_password&username=$user&password=$pass&contactemail=$email&domain=$domain&plan=$plan");
10+
curl_setopt($ch, CURLOPT_USERPWD, 'username' . ':' . 'password');
11+
12+
$headers = array();
13+
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
14+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
15+
16+
$result = curl_exec($ch);
17+
if (curl_errno($ch)) {
18+
echo 'Error:' . curl_error($ch);
19+
}
20+
curl_close($ch);
21+
return $result;
22+
};
23+
?>

0 commit comments

Comments
 (0)