Skip to content

Commit

Permalink
add debug backtrace
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvar1984 committed Dec 2, 2019
1 parent fe2cd15 commit 3fb9751
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/Sqlscan.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@
namespace Cvar\Sqlscan;

class Sqlscan {
protected static $trace;
protected static $time;
private function println($var)
{
fprintf(STDOUT, '[#] %s%s', $var, PHP_EOL);
}
public function __setBreakPoint()
{
self::$time = microtime(true);
self::$strace = debug_backtrace();
}
public function __getBreakPoint()
{
$return=[
self::$trace,
round((microtime(true)-self::$time)*1000)
];
return json_encode($return, JSON_PRETTY_PRINT);
}
function __construct($url)
{
$this->println('including config');
//$this->println('including config');
$err = file_get_contents('phar://main.phar/sql.ini');
$err = trim($err, ',');
$err = explode(',', $err);
Expand Down Expand Up @@ -45,14 +60,14 @@ function __construct($url)
if (!preg_match('/=/', $urls[0])) {
continue;
}
$this->println('injecting magic char');
//$this->println('injecting magic char');
$urls[0] = str_replace('=', '=\'', $urls[0]);
$this->println('Testing : ' . $urls[0]);
$result = @file_get_contents($urls[0]);

foreach ($err as $errs) {
if (preg_match('/' . $errs . '/', $result)) {
$this->println('Vuln -> ' . $urls[0]);
$this->println('Hit (' . $errs . ')');
$file = @fopen('result.txt', 'a');
if(!$file) {
$this->println('warning can\'t write result');
Expand Down

0 comments on commit 3fb9751

Please sign in to comment.