The VLC media player not working (can not be run as root) | Backtrack 5


1. Open Konsole Terminal
2. Type
  cd /usr/bin/
  hexedit vlc
3. Press Tab -> Switch to ASCII
4. Press Ctrl+ S -> Search "geteuid"
Modify to "getppid"
5. Press Ctrl+ X -> Save


JavaScript - Example mm/dd/yyyy formatted dates | USA

// use a function for the exact format desired...
function MDYDateString(d){
  function pad(n){
    return n< 10? '0'+ n: n;
  }
  return pad(d.getUTCMonth()+ 1)+ '/'+ pad(d.getUTCDate())+ '/'+ d.getUTCFullYear();
}
// prints something like 12/20/2012
var d= new Date();
console.log(MDYDateString(d));

JavaScript - check starts with and ends with | test startsWith and endsWith

Add this functions to the String prototype:
if (typeof String.prototype.startsWith != 'function') {
  String.prototype.startsWith = function (str){
    return this.slice(0, str.length) == str;
  };
}
if (typeof String.prototype.endsWith != 'function') {
  String.prototype.endsWith = function (str){
    return this.slice(-str.length) == str;
  };
}
Then use it:
"Starts with JavaScript".startsWith("Starts"); // true
var foo= "Ends with JavaScript";
var bar= "JavaScript";
foo.startsWith(bar); // true

MySQL - ERROR 2002 (HY000): Can't connect to local MySQL server through socket | BackTrack 5

mysql -u root -p
****

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

mkdir /var/run/mysqld
touch /var/run/mysqld/mysqld.sock
chown -R mysql /var/run/mysqld
/etc/init.d/mysql restart



Google Chrome can not be run as root - BackTrack 5

Google Chrome can not be run as root.
Please start Google Chrome as a normal user. To run as root, you must specify an alternate --user-data-dir for storage of profile information.

1. Open Konsole Terminal

2. Type

  cd /opt/google/chrome/
  hexedit chrome

3. Press Tab -> Switch to ASCII

4. Press Ctrl+ S -> Search "geteuid"

  Modify to "getppid"

5. Press Ctrl+ X -> Save



Install Flash Player - BackTrack 5

  • As you may have noticed Flash Player does not work on Backtrack 5, so in order to fix this we first need to remove the current flash player by issuing the following commands:
root@bt:~# apt-get purge flashplugin-nonfree flashplugin-installer gnash gnash-common mozilla-plugin-gnash swfdec-mozilla
root@bt:~# rm -f /usr/lib/firefox/plugins/*flash*
root@bt:~# rm -f /usr/lib/firefox-addons/plugins/*flash*
root@bt:~# rm -f /usr/lib/mozilla/plugins/*flash*
root@bt:~# rm -f ~/.mozilla/plugins/*flash*so
root@bt:~# rm -rfd /usr/lib/nspluginwrapper
  • After removing flash we need to get the new flash player from the official website:
  1. Flash x64 ONLY FOR x64.
  2. Flash Player Download the .tar.gz file.
  • We will begin with Flash Square, SKIP THIS if you aren't using an x64 version of BackTrack.
root@bt:~# tar xvfz flashplayer10_2_p3_64bit_linux_111710.tar.gz
root@bt:~# chown root:root libflashplayer.so
root@bt:~# chmod 644 libflashplayer.so
root@bt:~# cp -f libflashplayer.so /usr/lib/mozilla/plugins/
root@bt:~# rm -rf libflashplayer.so
root@bt:~# ln -s /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/firefox/plugins/
  • Next up we will take care of the Flash Player:
root@bt:~# tar xvfz install_flash_player_10_linux.tar.gz
root@bt:~# mkdir ~/.mozilla/plugins
root@bt:~# mv -f libflashplayer.so ~/.mozilla/plugins/
root@bt:~# ln -s /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/firefox-addons/plugins/
root@bt:~# ln -s /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/xulrunner-addons/plugins/


  • We can test if flash player works over here.