8
8
* License: GNU/GPLv2
9
9
* @see LICENSE.txt
10
10
*
11
- * This file: The scanner (last modified: 2021.05.28 ).
11
+ * This file: The scanner (last modified: 2021.06.10 ).
12
12
*/
13
13
14
14
namespace phpMussel \Core ;
@@ -497,6 +497,7 @@ private function recursor($Files = '', int $Depth = -1): void
497
497
$ this ->Loader ->Configuration ['files ' ]['filetype_greylist ' ]
498
498
], [$ xt , $ xts , $ gzxt , $ gzxts ]))
499
499
) {
500
+ $ this ->Loader ->InstanceCache ['blacklist_triggered ' ] = true ;
500
501
$ this ->Loader ->InstanceCache ['ThisScanDone ' ]++;
501
502
$ this ->Loader ->Events ->fireEvent ('countersChanged ' );
502
503
$ this ->Loader ->atHit ('' , $ fS , $ OriginalFilenameClean , sprintf (
@@ -2362,7 +2363,6 @@ private function archiveRecursor(string $Data, string $File = '', int $ScanDepth
2362
2363
2363
2364
/** Check whether Crx, and convert if necessary. */
2364
2365
if ($ this ->convertCrx ($ Data )) {
2365
-
2366
2366
/** Reset the file pointer (because the content has been modified anyway). */
2367
2367
$ File = '' ;
2368
2368
}
@@ -2433,7 +2433,6 @@ private function archiveRecursor(string $Data, string $File = '', int $ScanDepth
2433
2433
2434
2434
/** Handle zip files. */
2435
2435
if ($ Handler === 'ZipHandler ' ) {
2436
-
2437
2436
/**
2438
2437
* Encryption guard.
2439
2438
* @link https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
@@ -2463,7 +2462,6 @@ private function archiveRecursor(string $Data, string $File = '', int $ScanDepth
2463
2462
2464
2463
/** ZipHandler needs a file pointer. */
2465
2464
if (!$ File || !is_readable ($ File )) {
2466
-
2467
2465
/**
2468
2466
* File pointer not available. Probably already inside an
2469
2467
* archive. Let's create a temporary file for this.
@@ -2472,7 +2470,6 @@ private function archiveRecursor(string $Data, string $File = '', int $ScanDepth
2472
2470
$ Pointer = &$ PointerObject ->Filename ;
2473
2471
$ this ->Loader ->InstanceCache ['tempfilesToDelete ' ][] = $ Pointer ;
2474
2472
} else {
2475
-
2476
2473
/** File pointer available. Let's reference it. */
2477
2474
$ Pointer = &$ File ;
2478
2475
}
@@ -2485,14 +2482,12 @@ private function archiveRecursor(string $Data, string $File = '', int $ScanDepth
2485
2482
2486
2483
/** Handle tar files. */
2487
2484
if ($ Handler === 'TarHandler ' ) {
2488
-
2489
2485
/** TarHandler can work with data directly. */
2490
2486
$ ArchiveObject = new TarHandler ($ Data );
2491
2487
}
2492
2488
2493
2489
/** Handle rar files. */
2494
2490
if ($ Handler === 'RarHandler ' ) {
2495
-
2496
2491
/** Guard. */
2497
2492
if (!class_exists ('\RarArchive ' ) || !class_exists ('\RarEntry ' )) {
2498
2493
if (!$ this ->Loader ->Configuration ['signatures ' ]['fail_extensions_silently ' ]) {
@@ -2503,7 +2498,6 @@ private function archiveRecursor(string $Data, string $File = '', int $ScanDepth
2503
2498
2504
2499
/** RarHandler needs a file pointer. */
2505
2500
if (!$ File || !is_readable ($ File )) {
2506
-
2507
2501
/**
2508
2502
* File pointer not available. Probably already inside an
2509
2503
* archive. Let's create a temporary file for this.
@@ -2512,7 +2506,6 @@ private function archiveRecursor(string $Data, string $File = '', int $ScanDepth
2512
2506
$ Pointer = &$ PointerObject ->Filename ;
2513
2507
$ this ->Loader ->InstanceCache ['tempfilesToDelete ' ][] = $ Pointer ;
2514
2508
} else {
2515
-
2516
2509
/** File pointer available. Let's reference it. */
2517
2510
$ Pointer = &$ File ;
2518
2511
}
@@ -2525,7 +2518,6 @@ private function archiveRecursor(string $Data, string $File = '', int $ScanDepth
2525
2518
2526
2519
/** Handle PDF files. */
2527
2520
if ($ Handler === 'PdfHandler ' ) {
2528
-
2529
2521
/** Encryption guard. */
2530
2522
if ($ this ->Loader ->Configuration ['files ' ]['block_encrypted_archives ' ]) {
2531
2523
if (($ XPos = strrpos ($ Data , "\nxref " )) !== false && strpos ($ Data , "\n/Encrypt " , $ XPos + 5 ) !== false ) {
@@ -2547,16 +2539,13 @@ private function archiveRecursor(string $Data, string $File = '', int $ScanDepth
2547
2539
2548
2540
/** Archive object has been instantiated. Let's proceed. */
2549
2541
if (isset ($ ArchiveObject ) && is_object ($ ArchiveObject )) {
2550
-
2551
2542
/** No errors reported. Let's try checking its contents. */
2552
2543
if ($ ArchiveObject ->ErrorState === 0 ) {
2553
-
2554
2544
/** Used to count the number of entries processed. */
2555
2545
$ Processed = 0 ;
2556
2546
2557
2547
/** Iterate through the archive's contents. */
2558
2548
while ($ ArchiveObject ->EntryNext ()) {
2559
-
2560
2549
/** Skip directories (useless for scanning here). */
2561
2550
if ($ ArchiveObject ->EntryIsDirectory ()) {
2562
2551
continue ;
@@ -2983,11 +2972,10 @@ public function quarantine(string $In, string $Key, string $IP, string $ID): boo
2983
2972
}
2984
2973
}
2985
2974
$ Out =
2986
- "\x2f\x3d\x3d\x20phpMussel \x20Quarantined \x20File \x20Upload \x20\x3d" .
2987
- "\x3d\x5c\n\x7c\x20Time \x2fDate \x20Uploaded \x3a\x20" .
2975
+ "\x2f\x3d\x3d phpMussel Quarantined File Upload \x3d\x3d\x5c\n\x7c Time \x2fDate Uploaded \x3a " .
2988
2976
str_pad ($ this ->Loader ->Time , 18 , ' ' ) .
2989
- "\x7c\n\x7c\x20 Uploaded \x20 From \ x3a\x20 " . str_pad ($ IP , 22 , ' ' ) .
2990
- "\x20 \x7c\n\x5c" . str_repeat ("\x3d" , 39 ) . "\x2f\n\n\n" . $ Head . $ Out ;
2977
+ "\x7c\n\x7c Uploaded From \ x3a " . str_pad ($ IP , 22 , ' ' ) .
2978
+ " \x7c\n\x5c" . str_repeat ("\x3d" , 39 ) . "\x2f\n\n\n" . $ Head . $ Out ;
2991
2979
$ UsedMemory = $ this ->memoryUse ($ this ->Loader ->QuarantinePath );
2992
2980
$ UsedMemory ['Size ' ] += strlen ($ Out );
2993
2981
$ UsedMemory ['Count ' ]++;
@@ -3785,6 +3773,7 @@ private function metaDataScan(string $ItemRef, string $Filename, string &$Data,
3785
3773
!empty ($ this ->Loader ->Configuration ['files ' ]['filetype_greylist ' ]) &&
3786
3774
$ this ->containsMustAssert ([$ this ->Loader ->Configuration ['files ' ]['filetype_greylist ' ]], [$ xt , $ xts ])
3787
3775
)) {
3776
+ $ this ->Loader ->InstanceCache ['blacklist_triggered ' ] = true ;
3788
3777
$ this ->Loader ->atHit ($ Checksum , $ Filesize , $ ItemRef , sprintf (
3789
3778
$ this ->Loader ->L10N ->getString ('grammar_exclamation_mark ' ),
3790
3779
sprintf (
0 commit comments