Skip to content

Commit

Permalink
fix: directory with phar host prefix issue
Browse files Browse the repository at this point in the history
Fix directory with phar host prefix issue
Update Copyright year
Updated bin files permissions
New version 0.5.0.70

Closes 4
  • Loading branch information
Marco Cesarato committed Mar 11, 2020
1 parent b06e642 commit 8ddcc85
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# AMWSCAN - PHP Antimalware Scanner

**Version:** 0.5.0.69 beta
**Version:** 0.5.0.70 beta

**Github:** https://github.com/marcocesarato/PHP-Antimalware-Scanner

Expand Down
Empty file modified bin/build
100644 → 100755
Empty file.
Empty file modified bin/composer
100644 → 100755
Empty file.
Empty file modified bin/fix-cs
100644 → 100755
Empty file.
Empty file modified bin/fix-cs-all
100644 → 100755
Empty file.
Empty file modified bin/lint
100644 → 100755
Empty file.
Empty file modified bin/pre-commit
100644 → 100755
Empty file.
Empty file modified bin/run
100644 → 100755
Empty file.
Binary file modified dist/scanner
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0.69
0.5.0.70
20 changes: 15 additions & 5 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* PHP Antimalware Scanner.
*
* @author Marco Cesarato <[email protected]>
* @copyright Copyright (c) 2019
* @copyright Copyright (c) 2020
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
*
* @see https://github.com/marcocesarato/PHP-Antimalware-Scanner
Expand Down Expand Up @@ -34,7 +34,7 @@ class Application
*
* @var string
*/
public static $VERSION = '0.5.0.69';
public static $VERSION = '0.5.0.70';

/**
* Root path.
Expand Down Expand Up @@ -195,11 +195,11 @@ public function __construct()
private function init()
{
if (self::$ROOT === './') {
self::$ROOT = __DIR__;
self::$ROOT = self::currentDirectory();
}

if (self::$SCAN_PATH === './') {
self::$SCAN_PATH = __DIR__;
self::$SCAN_PATH = self::currentDirectory();
}
self::$PATH_QUARANTINE = self::$ROOT . self::$PATH_QUARANTINE;
self::$PATH_LOGS = self::$ROOT . self::$PATH_LOGS;
Expand Down Expand Up @@ -808,7 +808,7 @@ private function scan($iterator)
}
} elseif (in_array($confirmation, array('2'))) {
// Move to quarantine
$quarantine = self::$PATH_QUARANTINE . str_replace(realpath(__DIR__), '', $_FILE_PATH);
$quarantine = self::$PATH_QUARANTINE . str_replace(realpath(self::currentDirectory()), '', $_FILE_PATH);

if (!is_dir(dirname($quarantine))) {
if (!mkdir($concurrentDirectory = dirname($quarantine), 0755, true) && !is_dir($concurrentDirectory)) {
Expand Down Expand Up @@ -1073,4 +1073,14 @@ private function convertToBytes($from)

return $number * pow(1024, $pow);
}

/**
* Return real current path.
*
* @return string|string[]|null
*/
public static function currentDirectory()
{
return preg_replace('/^phar:\/\//i', '', __DIR__);
}
}
2 changes: 1 addition & 1 deletion src/Argument.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* PHP Antimalware Scanner.
*
* @author Marco Cesarato <[email protected]>
* @copyright Copyright (c) 2019
* @copyright Copyright (c) 2020
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
*
* @see https://github.com/marcocesarato/PHP-Antimalware-Scanner
Expand Down
2 changes: 1 addition & 1 deletion src/Argv.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* PHP Antimalware Scanner.
*
* @author Marco Cesarato <[email protected]>
* @copyright Copyright (c) 2019
* @copyright Copyright (c) 2020
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
*
* @see https://github.com/marcocesarato/PHP-Antimalware-Scanner
Expand Down
2 changes: 1 addition & 1 deletion src/CSV.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* PHP Antimalware Scanner.
*
* @author Marco Cesarato <[email protected]>
* @copyright Copyright (c) 2019
* @copyright Copyright (c) 2020
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
*
* @see https://github.com/marcocesarato/PHP-Antimalware-Scanner
Expand Down
4 changes: 2 additions & 2 deletions src/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* PHP Antimalware Scanner.
*
* @author Marco Cesarato <[email protected]>
* @copyright Copyright (c) 2019
* @copyright Copyright (c) 2020
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
*
* @see https://github.com/marcocesarato/PHP-Antimalware-Scanner
Expand Down Expand Up @@ -496,7 +496,7 @@ public static function helplist($type = null)
public static function helper()
{
self::displayTitle('Help', 'black', 'cyan');
$dir = __DIR__;
$dir = Application::currentDirectory();
$help = <<<EOD
Arguments:
Expand Down
2 changes: 1 addition & 1 deletion src/Definitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* PHP Antimalware Scanner.
*
* @author Marco Cesarato <[email protected]>
* @copyright Copyright (c) 2019
* @copyright Copyright (c) 2020
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
*
* @see https://github.com/marcocesarato/PHP-Antimalware-Scanner
Expand Down
2 changes: 1 addition & 1 deletion src/Deobfuscator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* PHP Antimalware Scanner.
*
* @author Marco Cesarato <[email protected]>
* @copyright Copyright (c) 2019
* @copyright Copyright (c) 2020
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
*
* @see https://github.com/marcocesarato/PHP-Antimalware-Scanner
Expand Down
2 changes: 1 addition & 1 deletion src/Flag.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* PHP Antimalware Scanner.
*
* @author Marco Cesarato <[email protected]>
* @copyright Copyright (c) 2019
* @copyright Copyright (c) 2020
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
*
* @see https://github.com/marcocesarato/PHP-Antimalware-Scanner
Expand Down
16 changes: 8 additions & 8 deletions src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace marcocesarato\amwscan;

include 'Argument.php';
include 'Argv.php';
include 'Console.php';
include 'CSV.php';
include 'Definitions.php';
include 'Flag.php';
include 'Deobfuscator.php';
include 'Application.php';
include './Argument.php';
include './Argv.php';
include './Console.php';
include './CSV.php';
include './Definitions.php';
include './Flag.php';
include './Deobfuscator.php';
include './Application.php';

$isCLI = (php_sapi_name() === 'cli');
if (!$isCLI) {
Expand Down

0 comments on commit 8ddcc85

Please sign in to comment.