Add Zmodem/BINKP/EMSI

This commit is contained in:
Deon George
2021-04-01 21:59:15 +11:00
parent 619cabb751
commit b94e39c7af
33 changed files with 8216 additions and 42 deletions

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use App\Classes\Sock\SocketException;
use App\Classes\Sock\SocketServer;
use App\Classes\Protocol\Binkd as BinkdClass;
class BinkpReceive extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'binkp:receive';
/**
* The console command description.
*
* @var string
*/
protected $description = 'BINKP receive';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Log::info('Listening for BINKP connections...');
$server = new SocketServer(24554,'0.0.0.0');
$server->setConnectionHandler([new BinkdClass,'onConnect']);
try {
$server->listen();
} catch (SocketException $e) {
if ($e->getMessage() == 'Can\'t accept connections: "Success"')
Log::debug('Server Terminated');
else
Log::emergency('Uncaught Message: '.$e->getMessage());
}
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use App\Classes\Protocol\Binkd as BinkdClass;
use App\Classes\Sock\SocketClient;
use App\Models\Node;
class BinkpSend extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'binkp:send {ftn : FTN to Send to}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Binkp send';
/**
* Execute the console command.
*
* @return mixed
* @throws \App\Classes\Sock\SocketException
*/
public function handle()
{
Log::info('Call BINKP send');
$no = Node::findFTN($this->argument('ftn'));
$client = SocketClient::create($no->address,$no->port);
$o = new BinkdClass;
$o->session(BinkdClass::SESSION_BINKP,$client,$no);
Log::info(sprintf('Connection ended: %s',$client->getAddress()),['m'=>__METHOD__]);
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use App\Classes\Sock\SocketException;
use App\Classes\Sock\SocketServer;
use App\Classes\Protocol\EMSI as EMSIClass;
class EMSIReceive extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'emsi:receive';
/**
* The console command description.
*
* @var string
*/
protected $description = 'EMSI receive';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Log::info('Listening for EMSI connections...');
$server = new SocketServer(60179,'0.0.0.0');
$server->setConnectionHandler([new EMSIClass,'onConnect']);
try {
$server->listen();
} catch (SocketException $e) {
if ($e->getMessage() == 'Can\'t accept connections: "Success"')
Log::debug('Server Terminated');
else
Log::emergency('Uncaught Message: '.$e->getMessage());
}
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Console\Commands;
use App\Models\Node;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use App\Classes\Sock\SocketClient;
use App\Classes\Protocol\EMSI as EMSIClass;
class EMSISend extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'emsi:send {ftn : FTN to Send to}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'EMSI send';
/**
* Execute the console command.
*
* @return mixed
* @throws \App\Classes\Sock\SocketException
*/
public function handle()
{
Log::info('Call EMSI send');
$no = Node::findFTN($this->argument('ftn'));
$client = SocketClient::create($no->address,$no->port,38400);
$o = new EMSIClass;
$o->session(EMSIClass::SESSION_AUTO,$client,$no);
Log::info(sprintf('Connection ended: %s',$client->getAddress()),['m'=>__METHOD__]);
}
}

View File

@@ -60,7 +60,11 @@ class ImportPacket extends Command
'msgid'=>$o->msgid,
]);
$oo->area = $o->echoarea;
if (md5(utf8_decode($eo->message)) == md5($o->message))
{
$this->warn(sprintf('Duplicate message: %s@%s with id: %s',$o->from,$o->fqfa,$o->msgid));
break 2;
}
break;
@@ -150,4 +154,4 @@ class ImportPacket extends Command
}
}
}
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use App\Classes\Sock\SocketException;
use App\Classes\Sock\SocketServer;
use App\Classes\Protocol\Zmodem as ZmodemClass;
class ZmodemReceive extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'zmodem:receive';
/**
* The console command description.
*
* @var string
*/
protected $description = 'ZMODEM receive';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Log::info('Listening for ZMODEM connections...');
$server = new SocketServer(60177,'0.0.0.0');
$server->setConnectionHandler([new ZmodemClass,'onConnect']);
try {
$server->listen();
} catch (SocketException $e) {
if ($e->getMessage() == 'Can\'t accept connections: "Success"')
Log::debug('Server Terminated');
else
Log::emergency('Uncaught Message: '.$e->getMessage());
}
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use App\Classes\Protocol;
use App\Classes\Sock\SocketClient;
use App\Classes\Protocol\Zmodem as ZmodemClass;
class ZmodemSend extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'zmodem:send {ip}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'ZMODEM send';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Log::info('Call ZMODEM send');
[$address,$service_port] = explode(':',$this->argument('ip'),2);
$client = SocketClient::create($address,$service_port);
$o = new ZmodemClass;
$o->session(Protocol::SESSION_ZMODEM,$client);
Log::info(sprintf('Connection ended: %s',$client->getAddress()),['m'=>__METHOD__]);
}
}