phpseclib di Codeigniter 3

public function login()

{

    set_include_path(get_include_path() . PATH_SEPARATOR . APPPATH.'third_party/phpseclib');

    include(APPPATH . 'third_party/phpseclib/Net/SSH2.php');

    include(APPPATH . 'third_party/phpseclib/Crypt/RSA.php');

    $ssh = new Net_SSH2('192.168.88.1:8888');

    $key = new Crypt_RSA();

    $key->loadKey(file_get_contents(APPPATH . 'third_party/phpseclib/privatekey.pem'));

    if (!$ssh->login('rest', $key)) {

        exit('Login Failed');

    }

    echo $ssh->exec(':put [/inter ether print]');

}


resource:

https://stackoverflow.com/questions/32762655/phpseclib-gives-me-a-strange-erros

https://phpseclib.sourceforge.net/ 

Monitoring Jaringan Mikrotik Dengan Telegram BOT

 {

    :local time [/sys clock get time]

    :local date [/sys clock get date]

    :local chat "-xxxxxxxx";

    :local bot "1234567890:qwertyuiopasdfghjklzxcvbnm";

    /tool fetch url="https://api.telegram.org/bot$bot/sendMessage?chat_id=$chat&parse_mode=markdown&text=\E2\9C\85  *UP*%0A%0A``` $time - $date```%0A" mode=https keep-result=no;

}


 {
    :local time [/sys clock get time]
    :local date [/sys clock get date]
    :local chat "-xxxxxxxx";
    :local bot "1234567890:qwertyuiopasdfghjklzxcvbnm";
    /tool fetch url="https://api.telegram.org/bot$bot/sendMessage?chat_id=$chat&parse_mode=markdown&text=\F0\9F\86\98  *DOWN*%0A%0A``` $time - $date```%0A" mode=https keep-result=no;
}

Enable SSL on Lighttpd webServer

 Firt install Lighttpd server, or you can see enable ssl lighttpd with other method


apt install lighttpd


apt install lighttpd-mod-openssl


cd /etc/lighttpd


openssl req -new -x509 -keyout lighttpd.pem -out lighttpd.pem -days 365 -nodes


chmod 400 server.pem


ln -s /etc/lighttpd/conf-available/10-ssl.conf /etc/lighttpd/conf-enabled/10-ssl.conf


systemctl restart lighttpd

Install SSL on Lighttpd webServer

Tutorial Install SSL on Lighttpd webServer 


apt install lighttpd


apt install lighttpd-mod-openssl


cd /etc/lighttpd


openssl req -new -x509 -keyout lighttpd.pem -out lighttpd.pem -days 365 -nodes


chmod 400 server.pem


#add vhost SSL to lighttpd.conf at the bottom


$SERVER["socket"] == ":443" {

    ssl.engine = "enable"

    ssl.pemfile = "/etc/lighttpd/server.pem"

  }

Install Lighttpd Webserver

 apt install lighttpd

For Loop JavaScript: Generate for PTR Record Cloudflare DNS

     <script>

        for (let counter =1; counter <= 10; counter++){

            document.writeln(`<pre>${counter}.xxx.xxx.xxx.in-addr.arpa. 1  IN  PTR ${counter}.xxx-xxx-xxx.domain.net.id.<br></pre>`)

        }

    </script>