Support for ZIP archives
This commit is contained in:
@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
use App\Classes\File;
|
||||
use App\Classes\FTN\Packet;
|
||||
use App\Models\{Address,Domain,Echomail,Setup};
|
||||
|
||||
@@ -46,8 +47,9 @@ class HomeController extends Controller
|
||||
*/
|
||||
public function pkt(Request $request)
|
||||
{
|
||||
$pkt = NULL;
|
||||
$pkt = collect();
|
||||
$file = NULL;
|
||||
$f = NULL;
|
||||
|
||||
if ($request->post()) {
|
||||
$request->validate([
|
||||
@@ -57,10 +59,12 @@ class HomeController extends Controller
|
||||
foreach ($request->allFiles() as $key => $filegroup) {
|
||||
if ($key !== 'file')
|
||||
continue;
|
||||
|
||||
foreach ($filegroup as $file) {
|
||||
try {
|
||||
$pkt = Packet::open($file);
|
||||
$f = new File($file);
|
||||
|
||||
foreach ($f as $packet)
|
||||
$pkt->push([$f->itemName()=>Packet::process($packet,$f->itemName(),$f->itemSize())]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return redirect()->back()->withErrors(sprintf('%s (%s:%d)',$e->getMessage(),$e->getFile(),$e->getLine()));
|
||||
@@ -72,8 +76,9 @@ class HomeController extends Controller
|
||||
}
|
||||
|
||||
return view('pkt')
|
||||
->with('file',$file)
|
||||
->with('result',$pkt)
|
||||
->with('file',$f)
|
||||
->with('filename',$f ? $file->getClientOriginalName() : NULL)
|
||||
->with('results',$pkt)
|
||||
->with('hexdump',$file ? hex_dump(file_get_contents($file)) : '');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user