Eclipse Plugin CUI Installation

I like automated development environment setup such as yum, apt-get, MacPort, etc…

I use Eclipse & ADT for Android application development. I could automate its almost from CUI, but not Eclipse plugins. Subclipse, EGit, ADT, etc…

Now I found the one of the answer. It’s equinox.

Search

$ java -jar plugins/org.eclipse.equinox.launcher_<your version>.jar -application org.eclipse.update.core.standaloneUpdate -command search -from http://xxx/

example

$ java -jar plugins/org.eclipse.equinox.launcher_<your version>.jar -application org.eclipse.update.core.standaloneUpdate -command search -from https://dl-ssl.google.com/android/eclipse/
"Android Development Tools" com.android.ide.eclipse.adt 10.0.1.v201103111512-110841
"Android Traceview" com.android.ide.eclipse.traceview 10.0.1.v201103111512-110841
"Android DDMS" com.android.ide.eclipse.ddms 10.0.1.v201103111512-110841
"Android Hierarchy Viewer" com.android.ide.eclipse.hierarchyviewer 10.0.1.v201103111512-110841
Command completed successfully.

Install

$ java -jar plugins/org.eclipse.equinox.launcher_<your version>.jar -application org.eclipse.update.core.standaloneUpdate -command install -featureId <featureId> -version <version> -from http://xxx/

example

$ java -jar plugins/org.eclipse.equinox.launcher_<your version>.jar -application org.eclipse.update.core.standaloneUpdate -command install -featureId com.android.ide.eclipse.ddms -version 10.0.1.v201103111512-110841 -from https://dl-ssl.google.com/android/eclipse/

 
…We must specify equinox and feature version. I wrote simple python script.

pyecliplug.py

example

$ export ECLIPSE_ROOT=your eclipse path
$ ./pyecliplug.py search http://download.gna.org/eclox/update/
"Hot Eclox" org.gna.eclox.hot 0.7.3
"eclox" org.gna.eclox 0.6.5
"Eclox Hot" org.gna.eclox.hot 0.8.0
"Eclox" org.gna.eclox 0.8.0
Command completed successfully.
$ ./pyecliplug.py install http://download.gna.org/eclox/update/ org.gna.eclox.hot
Feature org.gna.eclox.hot 0.7.3 has successfully been installed
Command completed successfully.

It works fine, but installed plugin cannot uninstall from Eclipse GUI…

Posted in programming | Tagged | Leave a comment

Setup Android SDK r10, NDK r5b, ADT 10.0.0, Eclipse Helios on Ubuntu 10.04 32-bit

Setup environment to home directory.

Ant, Eclipse, Android SDK r10, Android NDK r5b

# Ant
sudo apt-get install ant1.8
# for Subclipse
sudo apt-get install subversion libsvn-java
cd ~
# Eclipse JDT
wget http://ftp.jaist.ac.jp/pub/eclipse/technology/epp/downloads/release/helios/SR2/eclipse-java-helios-SR2-linux-gtk.tar.gz
tar xvzf eclipse-java-helios-SR2-linux-gtk.tar.gz
# Android SDK r10
wget http://dl.google.com/android/android-sdk_r10-linux_x86.tgz
tar xvzf android-sdk_r10-linux_x86.tgz
# Android NDK r5b
wget http://dl.google.com/android/ndk/android-ndk-r5b-linux-x86.tar.bz2
tar xvjf http://dl.google.com/android/ndk/android-ndk-r5b-linux-x86.tar.bz2
# export path
echo 'export ANDROID_SDK=~/android-sdk-linux_x86' >> ~/.bashrc
echo 'export ANDROID_NDK=~/android-ndk-r5b' >> ~/.bashrc
echo 'export PATH=$PATH:~/eclipse' >> ~/.bashrc
echo 'export PATH=$PATH:~/android-ndk-r5b' >> ~/.bashrc
echo 'export PATH=$PATH:~/android-sdk-linux_x86/tools' >> ~/.bashrc
echo 'export PATH=$PATH:~/android-sdk-linux_x86/platform-tools' >> ~/.bashrc

relaunch terminal to apply export PATH.
 

Android SDK Packages

# install Android SDK Packages
android sdk update

Click “Accept All”, “Install” when “Choose Packages to Install” dialog appered.
 

Eclipse CDT

Install Eclipse CDT if you write C/C++ code on Eclipse.

  • Select Help -> Install New Software from menu.
  • Select Helios from Work with
  • Check Programming Languages -> C/C++ Development Tools, Click Next
  • Click Next
  • Check “I accept the terms of the license agreement”, Click Finish

Subclipse, EGit, ADT

Install Subclipse and EGit by update sites.

Posted in programming | Tagged , , , | 1 Comment

Windows SSPI Programming Practice Part 2

  • schannel_init.c
  • build and run it
  • $ cl schannel_init.c
    
    $ schannel_init.exe
    TLSPlainText
    	ContentType: 22
    	Version: 0x0301
    	Length: 108
    
    Handshake
    	Type: 1
    	Length: 104
    
    ClientHello
    	Version: 0x0301
    	GMT: 0x4d6ce81b
    	SessionID Length: 0
    	CipherSuite Count: 12
    		CipherSuite: 0x002f
    		CipherSuite: 0x0035
    		CipherSuite: 0x0005
    		CipherSuite: 0x000a
    		CipherSuite: 0xc013
    		CipherSuite: 0xc014
    		CipherSuite: 0xc009
    		CipherSuite: 0xc00a
    		CipherSuite: 0x0032
    		CipherSuite: 0x0038
    		CipherSuite: 0x0013
    		CipherSuite: 0x0004
    	CompressionMethod Count: 1
    		CompressionMethod: 0x00
    	Extension Length: 39
    		ExtensionType: 0xff01
    		Length: 1
    		ExtensionType: 0x0000
    		Length: 14
    		ExtensionType: 0x000a
    		Length: 6
    		ExtensionType: 0x000b
    		Length: 2
    

     

    Windows SSPI default cipher suites are …

    • Windows 7 SP1
      • RSA_WITH_AES_128_CBC_SHA(0x002f)
      • RSA_WITH_AES_256_CBC_SHA(0x0035)
      • RSA_WITH_RC4_128_SHA(0x0005)
      • RSA_WITH_3DES_EDE_CBC_SHA(0x000a)
      • ECDHE_RSA_WITH_AES_128_CBC_SHA(0xc013)
      • ECDHE_RSA_WITH_AES_256_CBC_SHA(0xc014)
      • ECDHE_ECDSA_WITH_AES_128_CBC_SHA(0xc0009)
      • ECDHE_ECDSA_WITH_AES_256_CBC_SHA(0xc000a)
      • DHE_DSS_WITH_AES_128_CBC_SHA(0x0032)
      • DHE_DSS_WITH_AES_256_CBC_SHA(0x0038)
      • DHE_DSS_WITH_3DES_EDE_CBC_SHA(0x0013)
      • RSA_WITH_RC4_128_MD5(0x0004)
    • Windows Vista
    • Windows XP SP0 ~ SP3
      • RSA_WITH_RC4_128_MD5(0x0004)
      • RSA_WITH_RC4_128_SHA(0x0005)
      • ECDHE_ECDSA_WITH_AES_256_CBC_SHA(0xc000a)
      • ECDHE_ECDSA_WITH_AES_128_CBC_SHA(0xc0009)
      • RSA_EXPORT1024_WITH_RC4_56_SHA(0x0064)
      • RSA_EXPORT1024_WITH_DES_CBC_SHA(0x0062)
      • RSA_EXPORT_WITH_RC4_40_MD5(0x0003)
      • RSA_EXPORT_WITH_RC2_CBC_40_MD5(0x0006)
      • DHE_DSS_WITH_3DES_EDE_CBC_SHA(0x0013)
      • DHE_DSS_WITH_DES_CBC_SHA(0x0012)
      • DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA(0x0063)

    They love AES. Good.

     

    References:

  • AcquireCredentialsHandle (Schannel) Function (Windows)
  • InitializeSecurityContext (Schannel) Function (Windows)
  • SCHANNEL_CRED Structure (Windows)
  • Posted in programming | Tagged , , | Leave a comment

    Windows SSPI Programming Practice Part 1

    I have written SSL/TLS program by OpenSSL. But not Windows SSPI. So I started to practice. Why ? OpenSSL’s binary is large. OpenSSL does not provide CA store for Windows system, and Windows system CA store is complex.

  • enum_sec_pkgs.c
  • #include <windows.h>
    #include <tchar.h>
    #include <stdio.h>
    #define SECURITY_WIN32
    #include <sspi.h>
    #include <schannel.h> /* for UNISP_NAME */
    
    #pragma comment(lib, "secur32.lib")
    
    int main(int argc, TCHAR** argv) {
    	ULONG i;
    	ULONG pcPackages = 0;
    	PSecPkgInfo pSecPkgInfo = NULL;
    	SECURITY_STATUS s;
    	
    	_tprintf(_T("EnumerateSecurityPackages() demo\n\n"));
    	
    	_tprintf(_T("UNISP_NAME = %s\n\n"), UNISP_NAME);
    	
    	s = EnumerateSecurityPackages(&pcPackages, &pSecPkgInfo);
    	if (s == SEC_E_OK) {
    		for (i = 0; i < pcPackages; i++) {
    			_tprintf(_T("%s: %s\n"), pSecPkgInfo[i].Name, pSecPkgInfo[i].Comment);
    		}
    		if (pSecPkgInfo) {
    			FreeContextBuffer(pSecPkgInfo);
    		}
    	}
    	
    	return 0;
    }
    
  • build it.
  • $ cl enum_sec_pkgs.c
    Microsoft (R) C/C++ Optimizing Compiler Version 16.xx.xxxxx.xx
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    enum_sec_pkgs.c
    Microsoft (R) Incremental Linker Version xx.xx.xxxxx.xx
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    /out:enum_sec_pkgs.exe
    enum_sec_pkgs.obj
    
  • run it.
  • $ enum_sec_pkgs.exe
    
    EnumerateSecurityPackages() demo
    
    UNISP_NAME = Microsoft Unified Security Protocol Provider
    
    Negotiate: Microsoft Package Negotiator
    NegoExtender: NegoExtender Security Package
    Kerberos: Microsoft Kerberos V1.0
    NTLM: NTLM Security Package
    Schannel: Schannel Security Package
    Microsoft Unified Security Protocol Provider: Schannel Security Package
    WDigest: Digest Authentication for Windows
    TSSSP: TS Service Security Package
    pku2u: PKU2U Security Package
    

     

    You can pass SecPkgInfo.Name to AcquireCredentialsHandle’s second argument.

    If you use Schannel, you should use UNISP_NAME for AcquireCredentialsHandle.

  • AcquireCredentialsHandle (Schannel) Function (Windows)
  • Posted in programming | Tagged , , | Leave a comment

    scons and osx framework

    Have you link osx framework libraries on scons?

    Program(
      target = 'foo',
      source = ['foo.c'],
      LINKFLAGS = ['-framework', 'CoreFoundation'],
    )
    

     

    If you have a Objective-C source, do it.

    Program(
      target = 'foo',
      source = ['foo.m'],
      LINKFLAGS = ['-lobjc', '-framework', 'CoreFoundation'],
    )
    

     

    If you don’t know framework name, check ‘/System/Library/Frameworks’ directory. You can find ‘Xxx.framework’ directories. Framework name is ‘Xxx’. If you include ‘Xxx/Yyy.h’, framework name will be ‘Xxx’ in most cases.

    Posted in programming, Uncategorized | Tagged , | Leave a comment

    scons and code coverage

    I love scons. I use gcov and lcov for code coverages. OK, let’s take coverage by gcov on scons.

    For simple executables, it’s very simple. The key points are CFLAGS and LIBS.

    Program(
    	target = 'hello',
    	source = ['main.c'],
    	CFLAGS = ['-fprofile-arcs', '-ftest-coverage'],
    	LIBS = ['gcov'],
    	)
    

    This works fine but I don’t want always to use gcov. I wanna use it only when I test. Let’s make it better.

    env = Environment()
    
    if (int(ARGUMENTS.get('gcov', 0))):
    	env.Append(CFLAGS = ['-fprofile-arcs', '-ftest-coverage'])
    	env.Append(LIBS = ['gcov'])
    
    env.Program(
    	target = 'hello',
    	source = ['main.c'],
    	)
    

    gcov generates *.gcda on compiled, *.gcno on executed. Let’s clean.

    env = Environment()
    
    TARGET = 'hello'
    
    def UsesGcov():
    	return int(ARGUMENTS.get('gcov', 0))
    
    if UsesGcov():
    	env.Append(CFLAGS = ['-fprofile-arcs', '-ftest-coverage'])
    	env.Append(LIBS = ['gcov'])
    	env.Clean(TARGET, 'main.gcno')
    	env.Clean(TARGET, 'main.gcda')
    
    env.Program(
    	target = TARGET,
    	source = ['main.c'],
    	)
    

    Next, convert gcov result to HTML by using lcov. I wrote additional python script ‘gcov.py’.

    import os
    import subprocess
    
    subprocess.call(['scons', '-c'])
    subprocess.call(['scons', 'gcov=1'])
    subprocess.call(['./hello'])
    
    DIR = 'gcov'
    if not os.path.exists(DIR):
    	os.mkdir(DIR)
    os.chdir(DIR)
    
    subprocess.call(['lcov', '-d', '../', '--capture', '-o', 'hello.info'])
    
    subprocess.call(['lcov', '-a', 'hello.info', '-o', 'all.info'])
    
    subprocess.call(['genhtml', 'all.info'])
    
    

    OK, you can get coverage repot to run it and find the reports on ‘gcov’ directory!

    python gcov.py
    

    Have a good scons and gcov time.

    Command-Line variable=value Build Variables

    Posted in programming | Tagged , | Leave a comment