104 lines
2.6 KiB
PHP
Executable File
104 lines
2.6 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
//use App\Models\Article;
|
|
use App\Services\TomTool\Http;
|
|
//use voku\helper\AntiXSS;
|
|
|
|
class TestsController
|
|
{
|
|
|
|
public function hook($sHostName = 'ssssss')
|
|
{
|
|
|
|
// // 定义要添加的配置
|
|
// $host = $sHostName;
|
|
// $hostname = "github.com";
|
|
// $user = "git";
|
|
// $identityFile = env("path_ssh")."/id_rsa_".$sHostName;
|
|
//
|
|
// // 构建配置字符串
|
|
// $config = "\nHost ".$host.".com\n";
|
|
// $config .= "\tHostName $hostname\n";
|
|
// $config .= "\tUser $user\n";
|
|
// $config .= "\tIdentityFile $identityFile\n";
|
|
//
|
|
// // 指定 SSH 配置文件路径
|
|
// $sshConfigFile = env("path_ssh")."/config";
|
|
//
|
|
// // 检查文件是否存在,如果不存在则创建
|
|
// if (!file_exists($sshConfigFile)) {
|
|
// touch($sshConfigFile);
|
|
// }
|
|
//
|
|
// // 追加配置到文件
|
|
// file_put_contents($sshConfigFile, $config, FILE_APPEND | LOCK_EX);
|
|
//
|
|
// // 设置文件权限
|
|
// chmod($sshConfigFile, 0600);
|
|
//
|
|
// echo "SSH config updated successfully.";
|
|
|
|
|
|
|
|
|
|
// exit;
|
|
// $t = [];
|
|
// $a = $t['zz']["cc"] += 10;
|
|
// $a = $t['zz']["cc"] += 10;
|
|
// tomd($a);
|
|
// exit;
|
|
@$k = $_GET["k"];
|
|
@$s = $_GET["s"];
|
|
|
|
if ($k !== "wocaonide") {
|
|
exit("?");
|
|
}
|
|
|
|
$s = '/'.$s;
|
|
|
|
//test
|
|
// $s = "\/AticleSet__1115zz__sale_rate 1118.118";
|
|
// $s = "\/git#LastTime 1";
|
|
$s= "/option#list";
|
|
|
|
$oHttp = new Http();
|
|
$oHttp->sMethod = "post";
|
|
$oHttp->sToUrl = env("APP_URL")."/api/tg/hook";
|
|
$oHttp->bIsJson = true;
|
|
$oHttp->aData = [
|
|
'update_id' => 123456789,
|
|
'message' => [
|
|
'message_id' => 1,
|
|
'from' => [
|
|
'id' => 7740568271,
|
|
'is_bot' => false,
|
|
'first_name' => 'John',
|
|
'last_name' => 'Doe',
|
|
'username' => 'johndoe',
|
|
'language_code' => 'en'
|
|
],
|
|
'chat' => [
|
|
'id' => -4668400285,
|
|
'first_name' => 'John',
|
|
'last_name' => 'Doe',
|
|
'username' => 'johndoe',
|
|
'type' => 'private'
|
|
],
|
|
'date' => 1610000000,
|
|
"text" => $s,
|
|
]
|
|
];
|
|
|
|
$r = $oHttp->send();
|
|
|
|
echo($r);
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|