Commit 05665cb8 authored by Luke081515's avatar Luke081515

Merge remote-tracking branch 'origin/verbose-debug'

parents 0ec42fac 3bf28439
Pipeline #808 failed with stages
in 23 minutes and 3 seconds
......@@ -20,6 +20,7 @@ class Core extends Password {
private $version = "Cygnus-Framework V2.1 alpha";
private $ua;
private $maxlag;
private $debugMode = false;
private $FailedLoginCounter = 0;
/** initcurl
......@@ -63,7 +64,10 @@ class Core extends Password {
* @param $pUseHTTPS - [optional: true] if false, http will be used
* @param $assert - [optional: bot] if set to "user" instead, you can use a bot without flag
*/
public function initcurlArgs($job, $pUseHTTPS = true, $assert = "bot") {
public function initcurlArgs($job, $pUseHTTPS = true, $assert = "bot", $supress = false, $debugMode = false) {
if ($debugMode) {
$this->debugMode = true;
}
if ($assert !== "bot" && $assert !== "user")
exit(1);
$this->assert = $assert;
......@@ -78,7 +82,9 @@ class Core extends Password {
throw new Exception("Curl initialization failed.");
else
$this->curlHandle = $curl;
if (!$supress) {
echo "\n***** Starting up....\nVersion: " . $this->version . "\n*****";
}
$this->ua = "User:" . $this->username . " - " . $this->job . " - " . $this->version;
// change if you need more, default is 5
$this->setMaxlag(5);
......@@ -143,11 +149,15 @@ class Core extends Password {
sleep(10);
}
}
if ($success === true)
if ($success === true) {
if ($this->debugMode) {
echo "\nResult for " . $arguments . ":\n'" . $rqResult . "'";
}
return $rqResult;
else
} else {
throw new Exception("Curl request definitively failed: " . curl_error($this->curlHandle));
}
}
/** requireToken
* query the api for the token
* @author Hgzh / Luke081515 / MGChecker
......
......@@ -11,7 +11,14 @@ class Debug extends Core {
$this->setSite($this->askRequired('Enter the domain to use:'));
$this->setUsername($this->askRequired('Enter the username to use:'));
$this->setPassword($this->askRequired('Enter the password to use:'));
$this->initcurlArgs('Debug', true);
$assert = $this->askRequired('Enter the value for assert:');
$debug = $this->askRequired('Use verbose debug mode? [y/N]');
if (strtolower($debug) !== 'n') {
$debug = true;
} else {
$debug = false;
}
$this->initcurlArgs('Debug', true, $assert, false, $debug);
$this->login();
do {
$this->debug($this->askRequired("Name of the function you want to debug:"));
......
......@@ -19,7 +19,7 @@ class TestCore extends Core {
$this->setSite($loginData[1]);
$this->setUsername($loginData[2]);
$this->setPassword($loginData[3]);
$this->initcurlArgs('TestCore', true);
$this->initcurlArgs('TestCore', true, "bot", true);
$this->login();
}
/** execute
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment