LookingGlass icon indicating copy to clipboard operation
LookingGlass copied to clipboard

run commands (mtr, ping , traceroute) not working

Open dkraklan opened this issue 7 years ago • 7 comments

hello,

I've installed LookingGlass and installation went smooth, however when ever I input an IP and click run test it says loading for a half a second then goes back to run test and never provides any results.

I found an old issue suggesting to change to php 5.4 which i did. I've also tried php 7. I'm not sure what I'm missing any help would be greatly appreciated.

dkraklan avatar Jan 11 '18 14:01 dkraklan

Refer to:
https://github.com/telephone/LookingGlass/issues/44#issuecomment-333401402

Edit ajax.php and replace:

$output = $lg->$_GET['cmd']($_GET['host']);

with

$output = $lg->{$_GET['cmd']}$_GET['host']);

This works on all new PHP builds for me.

ghost avatar Jan 21 '18 01:01 ghost

Thank you! Are you able to explain what adding the curly braces does ?

dkraklan avatar Jan 23 '18 00:01 dkraklan

http://php.net/manual/en/migration70.incompatible.php

Changes to the handling of indirect variables, properties, and methods Indirect access to variables, properties, and methods will now be evaluated strictly in left-to-right order, as opposed to the previous mix of special cases.

andrew867 avatar Apr 04 '18 23:04 andrew867

Refer to: #44 (comment)

Edit ajax.php and replace:

$output = $lg->$_GET['cmd']($_GET['host']);

with

$output = $lg->{$_GET['cmd']}$_GET['host']);

This works on all new PHP builds for me.

You have to correct the 44th line as follows.

$output = $lg->{$_GET['cmd']}($_GET['host']);

maxigentr avatar Sep 18 '19 09:09 maxigentr

Putting this here for my future self, and likely for other people: if mtr returns an empty box, but ping, traceroute, etc work, it's likely because mtr is suid:

root@lg:/var/www/html# chsh -s /bin/bash www-data root@lg:/var/www/html# su www-data www-data@lg:/html$ mtr mtr: mtr should not run suid: No such file or directory www-data@lg:/html$

chmod u-s /usr/sbin/mtr fixed it.

damianharouff avatar Jul 17 '20 20:07 damianharouff

I replaced that line but doesnt work

kgrahul avatar Sep 27 '21 12:09 kgrahul