pear2 / Net_RouterOS

This package allows you to read and write information from a RouterOS host using the MikroTik RouterOS API protocol.
http://pear2.php.net/PEAR2_Net_RouterOS
241 stars 116 forks source link

Login Problem on 6.45+ #47

Closed bluwebz closed 5 years ago

bluwebz commented 5 years ago

After os update login not working ....

ultimus247 commented 5 years ago

We are experiencing the same issue. Upgraded to 6.45 and our login broke. We were using version b5 instead of b6 but on upgrading to the new .phar file we get the following error: exception 'Exception' with message 'Class PEAR2\Net\RouterOS\Client could not be loaded from PEAR2/Net/RouterOS/Client.php, file does not exist (registered paths="phar:///public_html/PEAR2_Net_RouterOS-1.0.0b6file.phar/PEAR2_Net_RouterOS-1.0.0b6/src") [PEAR2_Autoload-@PACKAGE_VERSION@]' in phar:///public_html/PEAR2_Net_RouterOS-1.0.0b6file.phar/PEAR2_Net_RouterOS-1.0.0b6/src/PEAR2/Autoload.php:305 Stack trace:

0 [internal function]: PEAR2\Autoload::load('PEAR2\Net\Route...')

1 /public_html/sshtest.php(22): spl_autoload_call('PEAR2\Net\Route...')

2 {main}

boenrobot commented 5 years ago

Can you try installing the "dev-develop" version with composer?

There is a new login algorithm in 6.43+, though the old one should've remained supported for a while by RouterOS. Regardless, this new algorithm is supported in dev-develop.

This comment suggests not even dev-develop works with 6.45+, but again, I'll need some more information to debug.

boenrobot commented 5 years ago

I just tried to replicate with dev-develop, and I can't.

I can succesfully login to an 6.45.1 x86 VM using dev-develop.

However, 1.0.0b6 (and therefore dev-master) does fail to login, and the roscon message is clear enough that the error is on login. Of course, it doesn't include "new login protocol" in the list of possible reasons, since that wasn't a thing then.

ultimus247 commented 5 years ago

I was able to install composer and get the beta version with php composer.phar require pear2/net_routeros:@beta however I cannot seem to find the branch for dev-develop, I tried php composer.phar require pear2/net_routeros:@dev but that one didnt work.

Sorry been at this all morning the pear seems to be no longer supported, and the phar creation through pyrus is no longer able to be downloaded. Looks like composer is our last resort here.

ultimus247 commented 5 years ago

OK I got the develop files from the git repository, now just trying to figure out how to make composer use the local develop branch of the git project.

boenrobot commented 5 years ago

composer require pear2/net_routeros:dev-develop@dev

maximiliandallmair commented 5 years ago

any news?

umarzahid028 commented 5 years ago

any update??

nickarellano commented 5 years ago

any news? any update??

Authentication is working on the dev-develop branch.

maximiliandallmair commented 5 years ago

pear install pear2.php.net/PEAR2_Net_RouterOS-dev-develop@dev parsePackageName(): only one version/state delimiter "-" is allowed in "pear2.php.net/PEAR2_Net_RouterOS-dev-develop@dev" invalid package name/package file "pear2.php.net/PEAR2_Net_RouterOS-dev-develop@dev" install failed

boenrobot commented 5 years ago

develop versions are not available over PEAR(2) in any way.

And in fact, it seems like the pear2.php.net website has silently went down, meaning no PEAR2 package can be installed at all over PEAR.

They can only be installed via composer, as shown above. I'll try to make a phar soon, but if you're using composer, you can use it right now.

maximiliandallmair commented 5 years ago

I'll try to make a phar soon how soon?

adam-gweleg commented 5 years ago

composer require pear2/net_routeros:dev-develop@dev

can't install develop@dev

PS C:\xampp\htdocs\2> composer require pear2/net_routeros:dev-develop@dev ./composer.json has been created Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

Problem 1

Installation failed, deleting ./composer.json.

maximiliandallmair commented 5 years ago

i still need a solution

wdjag commented 5 years ago

Hey mate, use command composer require pear2/net_transmitter:1.0.0b1 pear2/cache_shm pear2/net_routeros:dev-develop@dev It's work ;)

$php roscon.php -v IP USER PASSWORD
MODE |   LENGTH    |    LENGTH    |  CONTENTS
     |  (decoded)  |  (encoded)   |
-----|-------------|--------------|--------------------------------------------
NOTE |     Connection started     |
SEND |    <prompt> |     <prompt> | /system/package/print

SEND |    <prompt> |     <prompt> |

SENT |          21 |         0x15 | /system/package/print
SENT |           0 |         0x00 |
RECV |           3 |         0x03 | !re
RECV |           7 |         0x07 | =.id=*1
RECV |          21 |         0x15 | =name=routeros-mipsbe
RECV |          15 |         0x0F | =version=6.45.1
RECV |          32 |         0x20 | =build-time=jun/27/2019 10:23:23
RECV |          11 |         0x0B | =scheduled=
RECV |          15 |         0x0F | =disabled=false
RECV |           0 |         0x00 |
SEND |    <prompt> |     <prompt> | 
bluwebz commented 5 years ago

Thank you very much @wdjag Its work for me.

maximiliandallmair commented 5 years ago

still need pear solution¨ dont have composer

andrearos commented 5 years ago

Thank you @wdjag!!!!!!! I'm searching for a solution for weeks! It works for me!

egoan82 commented 5 years ago

Hey mate, use command composer require pear2/net_transmitter:1.0.0b1 pear2/cache_shm pear2/net_routeros:dev-develop@dev It's work ;)

$php roscon.php -v IP USER PASSWORD
MODE |   LENGTH    |    LENGTH    |  CONTENTS
     |  (decoded)  |  (encoded)   |
-----|-------------|--------------|--------------------------------------------
NOTE |     Connection started     |
SEND |    <prompt> |     <prompt> | /system/package/print

SEND |    <prompt> |     <prompt> |

SENT |          21 |         0x15 | /system/package/print
SENT |           0 |         0x00 |
RECV |           3 |         0x03 | !re
RECV |           7 |         0x07 | =.id=*1
RECV |          21 |         0x15 | =name=routeros-mipsbe
RECV |          15 |         0x0F | =version=6.45.1
RECV |          32 |         0x20 | =build-time=jun/27/2019 10:23:23
RECV |          11 |         0x0B | =scheduled=
RECV |          15 |         0x0F | =disabled=false
RECV |           0 |         0x00 |
SEND |    <prompt> |     <prompt> | 

Excelente con esto logre solucionar el problema de inicio de sesión. Excellent with this I managed to solve the login problem.

mvalsasna commented 4 years ago

develop branch + Net/Transmitter 1.0.0a3 1.0.0b2 work for me on routeros 6.45.6, thanks

is there a plan to release a Net/RouterOS RELEASE-1.0.0b7?

thanks for the good work

MAtteo

leo-combes commented 4 years ago

Thanks @wdjag, work like a charm!

blindrain commented 4 years ago

Still, Waiting on Net/RouterOS RELEASE-1.0.0b7? phar file.

Kamauink commented 4 years ago

So I can get the roscon.php file to connect seamlessly, however using both the Net/RouterOS RELEASE-1.0.0b6 and composer dev-develop@dev, I get a http 500 reply with no further info... anybody with a workaround?

Kamauink commented 4 years ago

Hey mate, use command composer require pear2/net_transmitter:1.0.0b1 pear2/cache_shm pear2/net_routeros:dev-develop@dev It's work ;)

$php roscon.php -v IP USER PASSWORD
MODE |   LENGTH    |    LENGTH    |  CONTENTS
     |  (decoded)  |  (encoded)   |
-----|-------------|--------------|--------------------------------------------
NOTE |     Connection started     |
SEND |    <prompt> |     <prompt> | /system/package/print

SEND |    <prompt> |     <prompt> |

SENT |          21 |         0x15 | /system/package/print
SENT |           0 |         0x00 |
RECV |           3 |         0x03 | !re
RECV |           7 |         0x07 | =.id=*1
RECV |          21 |         0x15 | =name=routeros-mipsbe
RECV |          15 |         0x0F | =version=6.45.1
RECV |          32 |         0x20 | =build-time=jun/27/2019 10:23:23
RECV |          11 |         0x0B | =scheduled=
RECV |          15 |         0x0F | =disabled=false
RECV |           0 |         0x00 |
SEND |    <prompt> |     <prompt> | 

So I can get the roscon.php file to connect seamlessly, however using both the Net/RouterOS RELEASE-1.0.0b6 and composer dev-develop@dev, I get a http 500 reply with no further info... anybody with a workaround?

boenrobot commented 4 years ago

Seems like you have another problem in your file that causes either a syntax error, or a fatal error before you even reach the authentication point.

Can you give an example full file you're trying to use?

Kamauink commented 4 years ago

Seems like you have another problem in your file that causes either a syntax error, or a fatal error before you even reach the authentication point.

Can you give an example full file you're trying to use?

Here's my script: Screenshot from 2020-07-17 13-43-58

i'm just trying to initiate a simple connection to the router, so as I was saying when I run "php roscon.php -v 192.168.88.1 user password" it works perfectly, but when i use the script, including classes from dev-develop@dev and PEAR2_Net_RouterOS-1.0.0b6', I get the 500 error. I have also downgraded to various versions of RouterOS with no luck.

boenrobot commented 4 years ago

That's not composer's autoloader, that's PEAR2's autoloader there. If you're installing from composer, you should be using the composer autoloader in vendor/autoload.php.

Kamauink commented 4 years ago

The same error persists even when i switch to vendor/autoload.php... i've exploited both PEAR2 and vendor classes and autoloads. If its not too much trouble, I could give you access to my system via teamviewer. I wouldnt mind the assist.

On Fri, 17 Jul 2020, 18:48 Vasil Rangelov, notifications@github.com wrote:

That's not composer's autoloader, that's PEAR2's autoloader there. If you're installing from composer, you should be using the composer autoloader in vendor/autoload.php.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pear2/Net_RouterOS/issues/47#issuecomment-660181420, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJJSQGBACVCUYWGYTAGEAHTR4BXDLANCNFSM4H4ZABTA .

maxwellrm commented 3 years ago

i solved with this, and work (mikrotik version 6,48)

Net_RouterOS/src/PEAR2/Net/RouterOS/Client.php between line 288 and 299

Changed this $request = new Request('/login'); $request->send($com); $response = new Response($com, false, $timeout); $request->setArgument('name', $username); $request->setArgument( 'response', '00' . md5( chr(0) . $password . pack('H*', $response->getProperty('ret')) ) ); $request->verify($com)->send($com);

to $request = new Request('/login'); $request->send($com); $response = new Response($com, false, $timeout); $request->setArgument('name', $username); $request->setArgument('password', $password); $request->verify($com)->send($com);

k3nshjnz commented 3 years ago

Can anyone update .phar file?

codsec commented 3 months ago

i solved with this, and work (mikrotik version 6,48)

Net_RouterOS/src/PEAR2/Net/RouterOS/Client.php between line 288 and 299

Changed this $request = new Request('/login'); $request->send($com); $response = new Response($com, false, $timeout); $request->setArgument('name', $username); $request->setArgument( 'response', '00' . md5( chr(0) . $password . pack('H*', $response->getProperty('ret')) ) ); $request->verify($com)->send($com);

to $request = new Request('/login'); $request->send($com); $response = new Response($com, false, $timeout); $request->setArgument('name', $username); $request->setArgument('password', $password); $request->verify($com)->send($com);

It works