Basic LDAP Search Filters

LDAP Search Command: ldapsearch -h <LDAPHost> -p <Port> -D <Bind DN> -w <Bind DN password> -b <Base DN> -s <Scope>  <LDAP Search Filter>

Ex: ldapsearch -h 192.168.1.2 -p 389 -D cn=admin,o=novell -w password -b o=novell -s sub cn=user

Below example are with attribute CN. But, You can use it with any attribute

1. Equal

CN=User  ==> returns all the entries which has attribute CN as “user” (case insensitive search)

2. presence:

CN=*  ==> returns all the enteries which has at least one value for attribute “CN”

3. start with

CN=User*  ==>  Returns all the entries which has at least one value for CN which starts with “User”

Matches:  User , User123 , User-123 , UserRam

Will not match: Use , AuserA , UseA

4. Ends with :

CN=*User  ==>  Returns all the entries which has at least one value for CN which ends with “User”

Matches: User , AUser , KJHksdahaksdjh*aUser , 7678User

Will not match :   User123 , User-123 , UserRam

5. Is not Equal to

(!(CN=User)) ==> Returns all the entries which does not have value for CN as “User”

6. like

CN~=User

6. Greater than

employeeId >= 100 ==> Returns all the entries whose employee ID is greater than 100

7. Less than

employeeId <= 100 ==> Returns all the entries whose employee ID is less than 100

Advertisements

Code : Automating Extension automation with Selenium

Below code is for Chrome. This will work for Firefox  with little change in code.

// Load extension file
File file = new File(“chrome.crx”);
ChromeOptions options = new ChromeOptions();
options.addExtensions(file);

// Launch browser instance with the extension
WebDriver driver = new ChromeDriver(options);

// Access Extension in browser window .. This further allows you to automate all the actions through Selenium
driver.get(“extension://palgcoflnoaklkflllnmheiollkgkipm/popup.html”);

Selenium : Opening a new Tab in browser (Firefox , Chrome or, Safari)


// Get Handle of current window/Tab
String parentHandle = driver.getWindowHandle();

// Get JavaExecuter instance from driver
JavascriptExecutor j = (JavascriptExecutor)driver;

// Open a new Tab with text on it as "Open New Tab
j.executeScript("function createDoc(){var w = window.open(); w.document.open(); w.document.write('Open New Tab'); w.document.close();}; createDoc();");

// Go to the newly opened window
for (String winHandle : driver.getWindowHandles()) {
driver.switchTo().window(winHandle);
Do your work
*/

// Go back to Parent Tab

driver.switchTo().window(parentHandle);

Approach to Automation of firefox and Chrome extensions using Selenium

Browser extensions does not use browser space for it’s GUI display and user interaction, this making it impossible to automate it through Selenium.

But, fortunately, you can run the extension in browser space with little trick and with that you can automate it using Selenium

Below steps will help you do exactly same for a Chrome extension called packman ( https://chrome.google.com/webstore/detail/pacman/palgcoflnoaklkflllnmheiollkgkipm)

Steps:

Way 1:

1.  go to Extension location on the disk . In case of Mac , it’s ~//Library/Application Support/Google/Chrome/Default/Extensions

2. You can find all the extension (installed) here, you can go to folder “palgcoflnoaklkflllnmheiollkgkipm”

palgcoflnoaklkflllnmheiollkgkipm can be found in the Chrome webstore URL

3. find all the html file under this folder. In most cases, you’ll find only one. ( You can use command like find . -name *html ). In case of Packman, you will find  –> ./1.26_0/popup.html

4. Access Pacman in browser interface

Type below in your Chrome Location bar:  chrome-extension://palgcoflnoaklkflllnmheiollkgkipm/popup.html

You can access packman in your browser i.e. You can automate them using Selenium.

On Firefox, the URL will be

chrome://pacman/content/pacman.xul

You can refer to below file to find the URL :

~/Library/Application\ Support/Firefox/Profiles/<profileName>/extensions/pacman\@oppermann.ch.xpi

However, there are some trick involved when it comes to automating it with Selenium. I’ll cover steps for doing it with Java/Python on Firefox and Chrome in next blog.

LDIF Examples : Add modify and Delete users (inetorgperson)

LDIF : Light weight Data Interchange format.

Please go through https://www.ietf.org/rfc/rfc2849.txt for reference

 

Case:  Add an entry to any LDAP Server. (Ex: InetOrgPerson)

Steps: Read the objectclass definition for the entry .

Must attributes for InetOrgPerson: CN (Common Name) and SN  (Surname)

Naming Attribute: UID / CN i.e. RDN (Relative Distinguished Name) can be CN or, UID.

Optional Attributes: Many ( Additionally all the attributes deifined in objectclasses which are used to derive InetOrgperson is available too)

 

Ex:  Adding a sample user “bob” under organization “troubleshoot:


dn: cn=bob,o=troubleshoot
changetype: add
objectclass: inetOrgPerson
cn: bob
sn: test
userpassword: sdh^@hg(^3
title: Test User
TelephoneNumber: 555 555 6666
mail: bob@troubleshoot.com

Ex: Adding additional attributes “UID” and country to entry “bob”


dn: cn=bob,o=troubleshoot
changetype: modify
add: uid
uid: bob-uid
-
add: c
c:UD

Ex: Adding one more value for mail


dn: cn=bob,o=troubleshoot
changetype: modify
add: mail
mail: newmailid@troubleshoot.com

Ex: Replacing all previous values of mail with a new one.


dn: cn=bob,o=troubleshoot
changetype: modify
replace: mail
mail: finalmail@troubleshoot.com

Ex: Delete title


dn: cn=bob,o=troubleshoot
changetype: modify
delete: title

Ex: Delete entry bob


dn: cn=bob,o=troubleshoot
changetype: delete

Let me know through comment if you need example for any of below or, you have any other question….. I’ll update the post with response asap…

Ex: Change RDN

Ex: Alias

Ex: Add to a group

Ex:

SSL V3 Poodle : Shell script to verify the server

Copy below as poodle.sh

Execute this command as below:

sh poodle.sh <site>

or,

sh poodle.sh <site>:<port>

 

#!/bin/sh
help()
{
echo
echo "Usage: "
echo "sh poodle.sh <hostname>:<port>"
echo
echo "Example"
echo "sh poodle.sh google.com:443"
echo "sh poodle.sh symantec.com:443"
exit
}

hostname=$1
if [ $# -ne 1 ]
then
help
elif [ "$hostname" == '-h' ]
then
help
fi

echo $hostname | grep ":" >/dev/null
if [ $? -ne 0 ]
then
hostname=$hostname:443
fi

echo "Sending Test request to $hostname....."

echo
echo

output=`openssl s_client -connect $hostname -ssl3 < /dev/null` 2>/dev/null

echo
echo
echo "Test Complete ....."
echo
echo
echo $output | grep "ssl handshake failure" >/dev/null
if [ $? -eq 0 ]
then

echo "Server verified : $hostname"
echo "Wow !! No POODLE issue found "

else

echo "Server checked: $hostname --> Issue exist "
echo "Please disble SSL V3 on the server"

fi


 

Testing Concept: One line definations

Role of a Test Engineer ? : Finding and reporting bugs that a customers/hackers can find (period).

Bug ?: Any deviation from expected outcome for a given action. Expected outcome is defined based on production Requirement Document (or, it’s derivatives)

Functional Testing ? : Testers will normally represent single user and exercise various functionality offered by product.

Browser compatibility ? : Part of functionality test cases that was executed on various OS/Browser combination to verify that it works on all or, major players

Performance ?: Tester tries to benchmark product for best numbers against given server configuration. One should make sure to minimize impact of external factors like network latency, other processes on server , client bottleneck etc.

Reliability? : Run some chosen test scenario for long duration (24 hrs to weeks) . This helps in detecting resource leaks.

Scalability?: Scaling different attribute of product to find their limits.

Stress? : product response under extreme load on Server ( The load could be on cpu cycle, memory due to other code running on system)

L10N?: Localization testing  : – Testing product to verify that it supports localized language.

i18n?: Internationalization testing. — Testing code for localization readiness.

Many more one liner definition to come with time…..