1. Go to this page and download the library: Download azurre/iptables library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
azurre / iptables example snippets
use Azurre\Iptables\IptablesService;
use Azurre\Iptables\Table\Table;
use Azurre\Iptables\Table\TableFactory;
$iptables = new IptablesService();
$table = TableFactory::create(Table::TABLE_MANGLE);
$table->setRaw(shell_exec('iptables -nL --line-numbers -t ' . Table::TABLE_MANGLE));
$result = $iptables->parseIptablesChains($table);
$chains = $iptables->getChainsList();
use Azurre\Iptables\Target;
$newRule = new Rule(Target::ACCEPT, 'tcp', '127.0.0.1');
$cmd = $result->getChainByName('INPUT')->replaceRule($newRule, 1);
// To create shell comand like that:
// iptables -A INPUT -t mangle --match mac --mac-source 11:22:33:aa:bb:cc --jump RETURN
$command = new Command(Table::TABLE_MANGLE);
$cmd = $command->setMatch('mac', ['source' => '11:22:33:aa:bb:cc'])
->setJump('RETURN')
->append('INPUT');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.