Monday, May 21, 2018

Run bash command with different external IP address

To run bash commands like nmap, mysql, psql, you need to hide your external IP address, if you do not want your external IP should be logged on remote server.

I am pretending you are already using http proxy or sock proxy.

To do this, open terminal and run following commands.

export http_proxy=ip-address:port-number
export https_proxy=ip-address:port-number


Example :
export http_proxy=35.192.xx.xx:3128
export https_proxy=35.192.xx.xx:3128

If you have installed Tor in ubuntu/centos/fedora and it is running on 9050 port, run command to export sock proxy.
 
export http_proxy=127.0.0.1:9050
export https_proxy=127.0.0.1:9050

Now if you run commands like mysqldump or pg_dump or mysql or psql, it will not log your IP address in remote server log.

Solution : II

If you are using tor, you can use torsocks command before these commands to hide your IP

torsocks mysql -h 39.xx.xx.xx -u root -p
The remote server ip 39.xx.xx.xx, will not log your external IP in its log, it will log the tor ip which you are currently using as a sock proxy.

Friday, April 20, 2018

Drupal : PHP Fatal error: Interface 'Symfony\Component\HttpKernel\HttpKernelInterface' not found in core/lib/Drupal/Core/DrupalKernelInterface.php on line 15

While running drupal import database command or any similar drupal command using command line, if you get following error :

Fatal error: Interface 'Symfony\Component\HttpKernel\HttpKernelInterface' not found in core/lib/Drupal/Core/DrupalKernelInterface.php on line 15

You need to update composer with optimize autoloader, Here is the command.

Solution :

composer update --optimize-autoloader

composer - mpdf - php fatal error : class mPDF not found

Same vendor folder of one server is not working on another server. There may be reason that working server has php 5.5 and non working server has php 5.6

Add following lines in file vendor/composer/autoload_classmap.php

'UCDN' => $vendorDir . '/mpdf/mpdf/classes/ucdn.php',
'bmp' => $vendorDir . '/mpdf/mpdf/classes/bmp.php',
'cssmgr' => $vendorDir . '/mpdf/mpdf/classes/cssmgr.php',
'directw' => $vendorDir . '/mpdf/mpdf/classes/directw.php',
'grad' => $vendorDir . '/mpdf/mpdf/classes/grad.php',
'mPDF' => $vendorDir . '/mpdf/mpdf/mpdf.php',
'meter' => $vendorDir . '/mpdf/mpdf/classes/meter.php',
'mpdfform' => $vendorDir . '/mpdf/mpdf/classes/mpdfform.php',
'otl' => $vendorDir . '/mpdf/mpdf/classes/otl.php',
'tocontents' => $vendorDir . '/mpdf/mpdf/classes/tocontents.php',
'wmf' => $vendorDir . '/mpdf/mpdf/classes/wmf.php',
Add following lines in file vendor/composer/autoload_static.php
'UCDN' => __DIR__ . '/..' . '/mpdf/mpdf/classes/ucdn.php',
'bmp' => __DIR__ . '/..' . '/mpdf/mpdf/classes/bmp.php',
'cssmgr' => __DIR__ . '/..' . '/mpdf/mpdf/classes/cssmgr.php',
'directw' => __DIR__ . '/..' . '/mpdf/mpdf/classes/directw.php',
'grad' => __DIR__ . '/..' . '/mpdf/mpdf/classes/grad.php',
'mPDF' => __DIR__ . '/..' . '/mpdf/mpdf/mpdf.php',
'meter' => __DIR__ . '/..' . '/mpdf/mpdf/classes/meter.php',
'mpdfform' => __DIR__ . '/..' . '/mpdf/mpdf/classes/mpdfform.php',
'otl' => __DIR__ . '/..' . '/mpdf/mpdf/classes/otl.php',
'tocontents' => __DIR__ . '/..' . '/mpdf/mpdf/classes/tocontents.php',
 'wmf' => __DIR__ . '/..' . '/mpdf/mpdf/classes/wmf.php',
Now run the same web page again in browser. You should not get error.