Improved display of bad packets
This commit is contained in:
parent
109beb4f4f
commit
4016775b66
@ -36,6 +36,7 @@ class Message extends FTNBase
|
||||
'origin',
|
||||
'tearline',
|
||||
'tagline',
|
||||
'dump',
|
||||
];
|
||||
|
||||
// Single value kludge items
|
||||
@ -88,6 +89,8 @@ class Message extends FTNBase
|
||||
private array $header; // Message Header
|
||||
private Collection $kludge; // Hold kludge items
|
||||
|
||||
public string $dump; // Raw message
|
||||
|
||||
private string $user_from; // User message is From
|
||||
private string $user_to; // User message is To
|
||||
private string $subject; // Message subject
|
||||
@ -308,7 +311,7 @@ class Message extends FTNBase
|
||||
|
||||
} catch (InvalidFormatException|\Exception $e) {
|
||||
Log::error(sprintf('%s: ! Date doesnt parse [%s] (%s)',self::LOGKEY,$e->getMessage(),Arr::get($this->header,$key)));
|
||||
throw new \Exception($e->getMessage());
|
||||
throw new \Exception(sprintf('%s (%s)',$e->getMessage(),hex_dump(Arr::get($this->header,$key))));
|
||||
}
|
||||
|
||||
case 'flags':
|
||||
@ -492,6 +495,7 @@ class Message extends FTNBase
|
||||
Log::info(sprintf('%s:Processing message [%d] bytes from zone [%d]',self::LOGKEY,strlen($msg),$zone?->zone_id));
|
||||
|
||||
$o = new self($zone);
|
||||
$o->dump = $msg;
|
||||
|
||||
try {
|
||||
$o->header = unpack(self::unpackheader(self::header),substr($msg,0,self::HEADER_LEN));
|
||||
|
@ -43,26 +43,35 @@ class PacketInfo extends Command
|
||||
|
||||
$this->alert(sprintf('File Name: %s',$x));
|
||||
|
||||
$this->info(sprintf('Packet Type: %s',$pkt->type));
|
||||
$this->info(sprintf('From: %s to %s',$pkt->fftn,$pkt->tftn));
|
||||
$this->info(sprintf('Dated: %s',$pkt->date));
|
||||
$this->info(sprintf('Password: %s (%s)',$pkt->password,$pkt->password ? 'SET' : 'NOT set'));
|
||||
$this->info(sprintf('Messages: %d',$pkt->messages->count()));
|
||||
$this->info(sprintf('Tosser %d (%s) version %s',$pkt->software->code,$pkt->software->name,$pkt->software_ver));
|
||||
$this->info(sprintf('Packet Type : %s',$pkt->type));
|
||||
$this->info(sprintf('From : %s to %s',$pkt->fftn,$pkt->tftn));
|
||||
$this->info(sprintf('Dated : %s',$pkt->date));
|
||||
$this->info(sprintf('Password : %s (%s)',$pkt->password,$pkt->password ? 'SET' : 'NOT set'));
|
||||
$this->info(sprintf('Messages : %d',$pkt->messages->count()));
|
||||
$this->info(sprintf('Tosser : %d (%s) version %s',$pkt->software->code,$pkt->software->name,$pkt->software_ver));
|
||||
$this->info(sprintf('Capabilities: %x',$pkt->capability));
|
||||
$this->info(sprintf('Has Errors: %s',$pkt->errors->count() ? 'YES' : 'No'));
|
||||
$this->info(sprintf('Messages: %d',$pkt->count()));
|
||||
$this->info(sprintf('Has Errors : %s',$pkt->errors->count() ? 'YES' : 'No'));
|
||||
$this->info(sprintf('Messages : %d',$pkt->count()));
|
||||
|
||||
foreach ($pkt as $msg) {
|
||||
$this->warn(sprintf('- Date: %s',$msg->date));
|
||||
$this->warn(sprintf(' - FLAGS: %s',$msg->flags()->filter()->keys()->join(', ')));
|
||||
$this->warn(sprintf(' - From: %s (%s)',$msg->user_from,$msg->fftn));
|
||||
$this->warn(sprintf(' - To: %s (%s)',$msg->user_to,$msg->tftn));
|
||||
$this->warn(sprintf(' - Subject: %s',$msg->subject));
|
||||
try {
|
||||
$this->warn(sprintf('- Date : %s',$msg->date));
|
||||
$this->warn(sprintf(' - Flags : %s',$msg->flags()->filter()->keys()->join(', ')));
|
||||
$this->warn(sprintf(' - From : %s (%s)',$msg->user_from,$msg->fftn));
|
||||
$this->warn(sprintf(' - To : %s (%s)',$msg->user_to,$msg->tftn));
|
||||
$this->warn(sprintf(' - Subject: %s',$msg->subject));
|
||||
$this->warn(sprintf(' - Area : %s',$msg->echoarea));
|
||||
|
||||
if ($msg->errors)
|
||||
foreach ($msg->errors->errors()->all() as $error)
|
||||
$this->line(' - '.$error);
|
||||
if ($msg->errors)
|
||||
foreach ($msg->errors->errors()->all() as $error)
|
||||
$this->line(' - '.$error);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->error('! ERROR: '.$e->getMessage());
|
||||
$this->info('Message dump:');
|
||||
echo hex_dump($msg->dump);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($pkt->errors as $msg) {
|
||||
|
Loading…
Reference in New Issue
Block a user