Installing Compact Language Detection 2 (CLD2) on Ubuntu

Posted: April 2nd, 2014 | Author: | Filed under: IT Related | Tags: , , | 5 Comments »

I’ve been using chromium-compact-language-detector before, and when they moved to v2.0, chromium-compact-language-detector has been renamed in to Compact Language Detection 2 (CLD2). I’ve read blog post on the performance review and i’m really impressed. So let give them a try.

Install the dependencies:

sudo apt-get install mercurial gcc-multilib python-dev build-essential

Download CLD2 and the python binding:

cd /tmp/
svn checkout http://cld2.googlecode.com/svn/trunk/ cld2
hg clone https://code.google.com/p/chromium-compact-language-detector/

Compile CLD2 and install the lib (for 32bit) :

cd /tmp/cld2/internal/
cat compile_libs.sh | sed 's/\ \-m64\ //g' > compile_me.sh
chmod +x compile_me.sh
./compile_me.sh
sudo cp *.so /usr/lib/

Compile CLD2 and install the lib (for 64bit) :

cd /tmp/cld2/internal/
./compile_libs.sh
sudo cp *.so /usr/lib64/

Compile the python binding:

cd /tmp/chromium-compact-language-detector/
 
python setup.py build
python setup_full.py build
 
sudo python setup.py install
sudo python setup_full.py install

Give the library a test:

python test.py

For documentation:

python -c "import cld2; help(cld2.detect)"

Done! Thanks


Android Emulator Error on Ubuntu 64bit

Posted: August 2nd, 2012 | Author: | Filed under: IT Related | Tags: , , , | No Comments »
SDL init failure, reason is: No available video device

If you are getting the above error while launching Android emulator on 64bit OS, these are what you need to do:

sudo apt-get update
sudo apt-get install ia32-libs

Thats all.. Now relaunch you emulator.

Thanks

Updated on 7th August 2012

Here is another tips for you on How to Start Intel Hardware-assisted Virtualization (hypervisor) on Linux to Speed-up Intel Android x86 Gingerbread Emulator


Installation of Thug (a Python low-interaction honeyclient) on Ubuntu/Debian

Posted: May 21st, 2012 | Author: | Filed under: IT Related | Tags: , , , , , , , | 2 Comments »

Thug is a Python low-interaction honeyclient aimed at mimicking the behaviour of a web browser in order to detect and emulate malicious contents. [1]

I’m impressed with the artwork of @buffer AKA Angelo in his previous project, phoneyc and started to give a detail look and hacks on the project. While only 1 hack finished on my side, Angelo already release a brand new honeyclient based on Python + V8 JS engine called Thug. What a wonderful idea + talent

Here are some useful information that might help you to build and compile Thug + V8 on Ubuntu/Debian machine:

 

    • Install some dependencies
sudo apt-get install python-setuptools build-essential git-core subversion scons python-chardet python-html5lib libboost-python-dev libboost-dev python-pefile python-httplib2 python-cssutils libboost-thread-dev libc6-dev libreadline-dev libboost-system-dev
sudo easy_install beautifulsoup4
sudo apt-get install python-magic python-pydot
    • Obtain the codes via svn and git
cd ~
git clone https://github.com/buffer/thug.git
cd ~/thug/
svn checkout http://v8.googlecode.com/svn/trunk/ v8
    • Apply the Thug’s patch for V8
cp patches/V8-patch* .
patch -p0 < V8-patch1.diff
patch -p0 < V8-patch2.diff
rm V8-patch*
    • Build and compile python wrapper for V8. This process will compile the V8 engine at the same time
cd /tmp/
svn checkout http://pyv8.googlecode.com/svn/trunk/ pyv8
export V8_HOME=$HOME/thug/v8
cd pyv8 &amp;&amp; python setup.py build
sudo python setup.py install
    • If you came across the following warning, simply ignore it
#######################################################
#  WARNING: Building V8 with SCons is deprecated and  #
#  will not work much longer. Please switch to using  #
#  the GYP-based build now. Instructions are at       #
#  http://code.google.com/p/v8/wiki/BuildingWithGYP.  #
#######################################################
    • Now test your installation
cd ~/thug/src
python thug.py
    • With the previous test, you will get something similar to this:
Synopsis:
    Thug: Pure Python honeyclient implementation
 
    Usage:
        python thug.py [ options ] url
 
    Options:
        -h, --help          	Display this help information
        -o, --output=       	Log to a specified file
        -r, --referer=      	Specify a referer
        -p, --proxy=        	Specify a proxy (see below for format and supported schemes)
        -l, --local         
        -v, --verbose       	Enable verbose mode    
        -d, --debug         	Enable debug mode
        -u, --useragent=    	Select a user agent (see below for values, default: xpie61)
 
    Proxy Format:
        scheme://[username:password@]host:port (supported schemes:  http, socks4, socks5)
 
    Available User-Agents:
	xpie60			Internet Explorer 6.0 (Windows XP)
	xpie61			Internet Explorer 6.1 (Windows XP)
	xpie70			Internet Explorer 7.0 (Windows XP)
	xpie80			Internet Explorer 8.0 (Windows XP)
	w2kie60			Internet Explorer 6.0 (Windows 2000)
	w2kie80			Internet Explorer 8.0 (Windows 2000)

Reference:
[1] https://github.com/buffer/thug


Installation of libemu and pylibemu on Ubuntu/Debian

Posted: May 16th, 2012 | Author: | Filed under: IT Related | Tags: , , , | 5 Comments »

libemu is a small library written in C offering basic x86 emulation and shellcode detection using GetPC heuristics. It is designed to be used within network intrusion/prevention detections and honeypots. [1]

Here are some useful information that might help you to build and compile libemu on Ubuntu machine:

  • Install some dependencies for the building process
  • sudo apt-get install build-essential git-core autoconf libtool python-dev
  • Obtaining libemu via Git
  • cd /tmp/
    git clone git://git.carnivore.it/libemu.git
  • Configure and install
  • cd /tmp/libemu/
    autoreconf -v -i
    ./configure --enable-python-bindings --prefix=/opt/libemu
    sudo make install
    sudo ldconfig -n /opt/libemu/lib

Now install the pylibemu, the python wrapper for the Libemu library

  • Install some dependencies for the building process
  • sudo apt-get install python-dev python-setuptools
  • Obtaining pylibemu via Git
  • cd /tmp/
    git clone https://github.com/buffer/pylibemu.git
  • Build and install
  • cd /tmp/pylibemu/
    sudo sh -c "echo /opt/libemu/lib > /etc/ld.so.conf.d/pylibemu.conf"
    python setup.py build
    sudo python setup.py install

Yerp.. you are good to go.

Reference:
[1] http://libemu.carnivore.it


Dell EqualLogic PS Series iSCSI SAN Arrays – Storage Area Network

Posted: April 28th, 2009 | Author: | Filed under: IT Related | Tags: , , , | No Comments »

This is not the first time I deal with SAN device but I never use it with Ubuntu Linux before. Anyway, there is first time for everything.

After 15 minutes playing around with Open-iSCSI (it can be done in just a few seconds in Windows by using GUI based iSCSI Initiator), here is the howto (and at the same time as a note for myself)

1) Install Open-iSCSI Initiator

sudo apt-get install open-iscsi

2) If you want your computer manually connect to the SAN volume, proceed with step 3. But if you want your computer automatically connect to the volume, edit the iscsid configurtation file

sudo nano /etc/iscsi/iscsid.conf

And change the following parameters

  • isns.address = SAN-IP-ADDRESS-HERE
  • isns.port = 3260

3) If the restriction is based on IP (without password) procees with step 4. But if password is required, edit the iscsid configurtation file

sudo nano /etc/iscsi/iscsid.conf

And change/set the following parameters

  • node.session.auth.username = USER
  • node.session.auth.password = PASSWORD
  • discovery.sendtargets.auth.username = USER
  • discovery.sendtargets.auth.password = PASSWORD

4) Restart the open-iscsi service

sudo /etc/init.d/open-iscsi restart

5) Run open-iscsi administration utility with root privilege to discover available volume

sudo iscsiadm -m discovery -t sendtargets -p 192.168.10.1

where 192.168.10.1 is the IP of your SAN. If your configuration is working, you will get something similar to this :-

192.168.10.1:3260,1 iqn.2001-05.com.equallogic:0-8a0906-f260b4603-e8b0000001249f55-vss-control
192.168.10.1:3260,1 iqn.2001-05.com.equallogic:0-8a0906-6980b4603-a990000001f49f56-csmvol3
192.168.10.1:3260,1 iqn.2001-05.com.equallogic:0-8a0906-58c0b4603-1730000001c49f56-csmvol2
192.168.10.1:3260,1 iqn.2001-05.com.equallogic:0-8a0906-4280b4603-a410000001949f56-csmvol1

6) In this case, I want to connect to volume 1 (iqn.2001-05.com.equallogic:0-8a0906-4280b4603-a410000001949f56-csmvol1), so here is what I should do

sudo iscsiadm --mode node --targetname iqn.2001-05.com.equallogic:0-8a0906-4280b4603-a410000001949f56-csmvol1 --portal 192.168.10.1:3260 --login

And if you are successfully connected, you’ll get the following message

Logging in to [iface: default, target: iqn.2001-05.com.equallogic:0-8a0906-4280b4603-a410000001949f56-csmvol1, portal: 192.168.10.1,3260]
Login to [iface: default, target: iqn.2001-05.com.equallogic:0-8a0906-4280b4603-a410000001949f56-csmvol1, portal: 192.168.10.1,3260]: successful

7) Now, verify the device name that has been connected to your machine

tail -f /var/log/messages

And in my case, this is my output

Apr 28 09:42:48 xps kernel: [ 2514.014658] scsi 6:0:0:0: Direct-Access     EQLOGIC  100E-00          4.0  PQ: 0 ANSI: 5
Apr 28 09:42:48 xps kernel: [ 2514.016499] sd 6:0:0:0: [sdb] 209725440 512-byte hardware sectors: (107 GB/100 GiB)
Apr 28 09:42:48 xps kernel: [ 2514.017832] sd 6:0:0:0: [sdb] Write Protect is off
Apr 28 09:42:48 xps kernel: [ 2514.018256] sd 6:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Apr 28 09:42:48 xps kernel: [ 2514.019240] sd 6:0:0:0: [sdb] 209725440 512-byte hardware sectors: (107 GB/100 GiB)
Apr 28 09:42:48 xps kernel: [ 2514.019434] sd 6:0:0:0: [sdb] Write Protect is off
Apr 28 09:42:48 xps kernel: [ 2514.019836] sd 6:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Apr 28 09:42:48 xps kernel: [ 2514.019842]  sdb: sdb1
Apr 28 09:42:48 xps kernel: [ 2514.024882] sd 6:0:0:0: [sdb] Attached SCSI disk
Apr 28 09:42:48 xps kernel: [ 2514.026039] sd 6:0:0:0: Attached scsi generic sg2 type 0

The connected volume appear to be as SDB in my machine

8 ) If the volume already contain partition and already formated, you can straight away mount them, but if they dont have partition and filesystem yet, you can either use fdisk or gparted to create the partition and format them 😉

Enjoy..!~

Demo for fdisk -l output

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x12961295
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          12       96358+  de  Dell Utility
/dev/sda2   *          13        7661    61440592+   7  HPFS/NTFS
/dev/sda3            7662       11396    30001387+   b  W95 FAT32
/dev/sda4           11397       19457    64749982+   5  Extended
/dev/sda5           11397       11520      995998+  82  Linux swap / Solaris
/dev/sda6           11521       19457    63753921   83  Linux
 
Disk /dev/sdb: 107.3 GB, 107379425280 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00093e08
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       13054   104856223+  83  Linux

[Reference: Cyberciti & Ubuntu Forum]