Friday, August 22, 2014

Export a div element as a PDF in clientside

Hi guys,

When you are developing web applications sometimes you may have to export some of your DIV elements as pdfs or print them. I faced it. Search a lot in the net but did not find any good solution ubt found many options like calling to server to execute some scripts and do the thing. But that was not my case. I wanted to do it in the client side.

I found a solution. Actually this is not THE solution as this method will not directly do the thing. But using this method you will be able to get a PDF output of your html div element.

This is a simple jQuery plugin called printThis. This plugin will try to print the given div element. When we try to print, we can get a PDF output through it. Now that's what we want right?

First of all install jQuery to your page. And download the above mentioned plugin and install it as well.

Then use the following code to print the div.

 $("#mySelector").printThis({
       debug: false,                                       // show the iframe for debugging
       importCSS: true,                                // import page CSS
       printContainer: true,                          // grab outer container as well as the contents of the selector
       loadCSS: "path/to/my.css",               // path to additional css file
       pageTitle: "",                                     // add title to print page
       removeInline: false                           // remove all inline styles from print elements
 });

Thursday, August 21, 2014

Security testing for your Web applications

 Legal disclaimer: Only run ZAP against your own environments, i.e. Test, Staging environments. It is illegal to attack websites from competitors or other people.

This tutorial is written using the knowledge I gathered at a hackathon we did at 99X Technology.

Tools :

https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project


Download and install Zed Proxy server and start the app.




 Now to start with lets do a quick attack to our test site. insert your test site url to the field of "Url to Attack" and click on "Attack". For this test I will use a web application I developed. It is hosted in a IIS server hosted in the local machine it self. :)

"http://localhost:6406" is my Url to attack.

You will see a output like this. Attack results can be viewed in the "Attack" tab. After going through the analysis report, you can take necessary actions to protect your web applications from attackers.



If you want to test your web application against a specific type of attack you can right click the site which is listed in the sites tree view, right click on the site you want to test and then under attack you have several types of attack to test your application.



Updated Note:

To integrate Zed with your TFS build server, please refer following tutorial. Since it is almost a complete and very much descriptive tutorial I will not explain it here again. Credits should go to it's rightful author.

http://www.codeproject.com/Articles/708129/Automated-penetration-testing-in-the-Microsoft-sta



----------------

Another tool to test SQL Injections and XSS attacks is W3AF. A tutorial video on how to use the tool is given below. Video


Some other tools you can test your application are given below.

Wapiti : http://wapiti.sourceforge.net/
Wikito : http://research.sensepost.com/tools/web/wikto
Websecurify (Only few tools are available free. others are commercial plans) :
 https://suite.websecurify.com


For a complete list of testing apps, click here