Thursday, August 8, 2013

Modify iframe contents with Javascript

Conventionally, you are not allowed to play around with the contents of an iframe of external url with javascript. But with the use of javascript injections, you can do it very easily.
For example, you want to modify the values of text fields in the web page open in an iframe, but the web page is from an external url. What you would have tried first would have been:

But this does not work when you open the web page in a browser. So what to do? Let’s explore the possibilities of doing this with JavaScript Injections.
We know that we have the full permissions to modify the url of an iframe. So what we do is,
And viola! The username is changed!

Applications:
Possible applications of such injections are:
  • Automatic form filling Modifying the contents of iframe with
  • Automatic login by using
  • Automatic posting/commenting on sites like facebook, wordpress blogs, etc.
  • Or you can go further and insert a full javascript file into the external web page with:


Examples: Anything else you can imagine of!


Thursday, July 11, 2013

Setting Environment Variables in OS X

Have you ever asked yourself What is the proper way to modify environment variables like PATH in OS X?
You could use:
/etc/paths
~/.profile
~/.tcshrc

OR you can try by playing around with
/etc/launchd.conf

Please note that environment.plist does not work for applications launched via Spotlight. This is documented by Steve Sexton here
  1. Open a terminal prompt
  2. Type sudo vi /etc/launchd.conf (note: this file might not yet exist)
  3. Put contents like the following into the file
    	#setenv JAVA_VERSION 1.6
    	setenv JAVA_HOME /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    
    	setenv ANT_HOME /Applications/java/tools/apache-ant-1.8.2
    	setenv ANT_OPTS -Xmx512M
    
    	setenv MAVEN_OPTS -Xmx1024M
    	setenv M2_HOME /Applications/java/tools/apache-maven-3.0.2
    
    	setenv ATG_HOME /Applications/java/tools/Dynamo5.6.1
    
    	setenv DYNAMO_HOME /Applications/java/tools/Dynamo5.6.1/home
    
    	setenv ORACLE_HOME /opt/app/oracle/product/817 
     
  4. Save your changes in VI and reboot your Mac.
  5. Prove that your variables are working by opening a Terminal window and typing export and you should see your new variables. These will also be available in IntelliJ and other GUI apps you launch via Spotlight.