Archive for April, 2010

Enable iPod / iPhone Cracked Apps after jailbreak by blackra1n

Add source in Cydia:
Install Appsync

No Comments

Java Code Querying AD

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.ldap.Control;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.LdapContext;

public class TestLogin
private String domain;
private String ldapHost;
private String searchBase;

public static void main(String[] args){
TestLogin a = new TestLogin();
Map umap = a.authenticate("username", "password");

if (umap == null)
System.out.println("Login Failed");
else {
String s = umap.get("givenName").toString();
System.out.println("GIVEN NAME=" + s);

public TestLogin()
this.domain = "hkesprit";
this.ldapHost = "ldap://<DC Server>";
this.searchBase = "dc=<domain name>,dc=com";

public TestLogin(String domain, String host, String dn)
this.domain = domain;
this.ldapHost = host;
this.searchBase = dn;

public Map authenticate(String user, String pass)
String returnedAtts[] ={ "sn", "givenName", "mail" };
String searchFilter = "(&(objectClass=user)(sAMAccountName=" + user + "))";

//Create the search controls
SearchControls searchCtls = new SearchControls();

//Specify the search scope

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, ldapHost);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, user + "@" + domain);
env.put(Context.SECURITY_CREDENTIALS, pass);

LdapContext ctxGC = null;

ctxGC = new InitialLdapContext(env, null);

//Search objects in GC using filters
NamingEnumeration answer =, searchFilter, searchCtls);
while (answer.hasMoreElements())
SearchResult sr = (SearchResult);
Attributes attrs = sr.getAttributes();
Map amap = null;
if (attrs != null)
amap = new HashMap();
NamingEnumeration ne = attrs.getAll();
while (ne.hasMore())
Attribute attr = (Attribute);
amap.put(attr.getID(), attr.get());
return amap;
catch (NamingException ex)

return null;

No Comments

Integrated Windows Authentication in Java

Integrated Windows Authentication in Java

The intent of this project is to provide an alternative library (.jar file) that application servers (like Tomcat) can use as the means for authenticating clients (like web browsers).

If your organization is running Active Directory (AD) and all of your web applications go through Microsoft’s Internet Information Services (IIS), and IIS has Integrated Windows Authentication enabled, and everyone in your organization is using Internet Explorer (IE), then this project may not be of any interest to you.

This project may also not be of any interest to you if your organization is using jCIFS as the means to achieve Single Sign-On (SSO); there are other 3rd party products as well as open-source projects that will silently authenticate (no username/password prompt) browser requests to a protected web page. Perhaps some of these are more suitable for your organization’s needs.

However, if your organization uses java based web/application servers, and you prefer Kerberos/SPNEGO instead of NTLM as the authentication protocol, and you would rather have a Java Servlet Filter (JSR-53) based implementation instead of a container specific authentication module (JSR-196), and you want SSO
(no username/password prompt), then this project may be of some interest to you.

The most effective way to get started is to first go through the pre-flight checklist. One of the goals of the checklist is to identify configuration parameter values necessary during installation and configuration of the SPNEGO HTTP Servlet Filter. There are really only two steps to the install: 1) copy jar file and 2) modify web.xml file.

Unfortunately, that’s just the servlet filter install. You may also need to create two configuration files that your Java Runtime (JRE) will need as a part of Java’s security technology framework. Specifically, creating configuration files for the Java Authentication and Authorization Service (JAAS) package/extension and for the Java Generic Security Services (Java GSS) API. The pre-flight has instructions for these as well.

Finally, there’s nothing in the code base that is specific to AD. Theoretically, this code should also work with MIT Kerberos. There is also nothing in the code base that is specific to Tomcat or IE, or Windows or UNIX (but feel free to post messages in the Forum about any successes and/or failures).

No Comments

Sony a550 Creative Style

鮮艷一點 對比高一點 就直接標準 +1+1+2
拍鮮花的話 飽和度要低一點 就 標準 +0-1+2
拍人的話就 降低銳利度 大概就標準 +0+0+0
拍風景就 直接使用風景模式 +0+0+2

No Comments