56 lines
2.0 KiB
PHP
Executable File
56 lines
2.0 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* HAMID BITVISE - API pour connexions SSH/Terminal
|
|
* Utilisable depuis Bitvise, PuTTY, ou tout terminal SSH
|
|
*/
|
|
header('Content-Type: application/json');
|
|
|
|
$action = $_POST['action'] ?? $_GET['action'] ?? 'help';
|
|
$message = $_POST['message'] ?? $_GET['message'] ?? '';
|
|
|
|
$ctx = stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]);
|
|
|
|
switch ($action) {
|
|
case 'chat':
|
|
$resp = @file_get_contents("https://127.0.0.1:8443/hamid-api.php", false, stream_context_create([
|
|
'http' => ['method' => 'POST', 'header' => 'Content-Type: application/json',
|
|
'content' => json_encode(['message' => $message, 'provider' => 'mistral'])],
|
|
'ssl' => ['verify_peer' => false]
|
|
]));
|
|
$data = json_decode($resp, true);
|
|
echo json_encode(['response' => $data['response'] ?? 'Erreur']);
|
|
break;
|
|
|
|
case 'exec':
|
|
$code = $_POST['code'] ?? '';
|
|
$lang = $_POST['lang'] ?? 'python';
|
|
$resp = @file_get_contents("https://127.0.0.1:8443/hamid-code.php", false, stream_context_create([
|
|
'http' => ['method' => 'POST', 'header' => 'Content-Type: application/x-www-form-urlencoded',
|
|
'content' => "code=" . urlencode($code) . "&language=$lang"],
|
|
'ssl' => ['verify_peer' => false]
|
|
]));
|
|
echo $resp;
|
|
break;
|
|
|
|
case 'status':
|
|
echo json_encode([
|
|
'status' => 'HAMID BITVISE Online',
|
|
'version' => 'ULTRA MAX++ v4.0',
|
|
'endpoints' => ['chat', 'exec', 'translate', 'search', 'memory', 'calendar']
|
|
]);
|
|
break;
|
|
|
|
case 'help':
|
|
default:
|
|
echo json_encode([
|
|
'usage' => 'HAMID BITVISE API',
|
|
'actions' => [
|
|
'chat' => 'POST message=your_message',
|
|
'exec' => 'POST code=your_code&lang=python|php|bash',
|
|
'status' => 'GET status'
|
|
],
|
|
'example_curl' => 'curl -k "https://SERVER/hamid-bitvise.php?action=chat&message=hello"'
|
|
]);
|
|
}
|
|
|