If you want to create an executable jar easily with Gradle and Groovy, it exist a project example on GitHub : https://github.com/bond-/gradle-groovy-jar-example
It permits me to save times !
Friday, May 9, 2014
Create an executable jar easily with Gradle and Groovy
Sunday, May 4, 2014
Firefox Hacks : Extract user information in your computer with Groovy !
Firefox stores all informations in a directory (In most cases, it is in $HOME/.mozilla directory or in C:\users\MUYSER\AppData\Roaming\Mozilla\Firefox\Profiles\). For example, there is addon list, search history, cookies ... but there is also logins and passwords ! So, if someone gets the contents of this directory, it will have all your life !
In this article, we will explain which information we could retreive and how. You will see it's simple !
Source code
Source code of this paper is available on GitHub : https://github.com/drieu/GFirefoxDataReadme file describes how to build and run the project.
Data stores in Sqlite files
How to use sqlite ?
Firefox uses SQLITE to store information. So, we found sqlite files in mozilla directory ( ex : cookies.sqlite ).To get information in theeses files, you need to know few commands.For example :
# cd $HOME/.mozilla/???
# sqlite3 cookies.sqlite
SQLite version 3.8.2 2013-12-06 14:53:30
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
Now, you can execute sqlite and sql commands.
Here is some useful commands :
Help
sqlite> .help
List all tables
sqlite> .tables
List fields of a table
sqlite> .schema moz_cookies
Select
sqlite> select * from moz_cookies
Quit
sqlite> .quit
Source code to extract sqlite datas.
Sqlite files list
Now, you know how to use sqlite commands, here is a list of sqlite files that you could find in the mozilla profile directory :cookies.sqlite
addons.sqlite
formhistory.sqlite
content-prefs.sqlite
healthreport.sqlite
permissions.sqlite
places.sqlite
signons.sqlite
webappsstore.sqlite
In next section of this article, we will see how programmaticaly, we will retreive these datas.
Get cookies list
We need a library to use SQLITE. For this article, we will use sqlite-jdbc ( https://bitbucket.org/xerial/sqlite-jdbc ). You can download jar files hereHere is simple example. You only have to change path to point to your sqlite file :
import groovy.sql.Sql
def url = "jdbc:sqlite:/home/USER/tmp/.mozilla/firefox/fe31xbna.default/cookies.sqlite"
def sql = Sql.newInstance(url, "org.sqlite.JDBC")
sql.eachRow("select DISTINCT host from moz_cookies") {
println("host= ${it.host}")
}
Get all user history
def sql = Sql.newInstance(url, "org.sqlite.JDBC")
sql.eachRow("select DISTINCT value from moz_formhistory") {
println("value= ${it.value}")
}
println("")
Get addons list
def sql = Sql.newInstance(url, "org.sqlite.JDBC")
sql.eachRow("select DISTINCT name from addon") {
println("name= ${it.name}")
}
println("")
See password
Master password stored in key3.db file. There is also signons.sqlite that contains encrypt username and password files.Here is how to see them :
sqlite>sqlite3 signons.sqlite
sqlite>select hostname,usernameField,passwordField,encryptedUsername,encryptedPassword from moz_logins limit 1;
Get passwords when no master password is set.
You only have to go in Menu Edit -> preferences-> Security and you can saw saved passwords.An other way to see passwords is to put key3.db and signons.sqlite and cert8.db in a new firefox profile.You will see it really simple :
1. Close firefox
2. Create a new profile with firefox ( firefox --ProfileManager )
3. Close firefox
4. Go in your new profile directory ( $HOME/.mozilla/...)
5. Replace key3.db, signons.sqlite, cert8.db by yours
6. Restart firefox
7. Then go in Menu Edit -> preferences-> Security
You will see all saved passwords !
So a good advice is to set a master password. But, it is only useful if an other person uses your computer. It can't show all your password. We will see next that store passwords even if there is a master master password isn't a good idea.
Get passwords when master password is set.
A first manner is to look at this article http://www.infond.fr/2010/04/firefox-passwords-management-leaks.htmlA second way ( more easy ) is to use Mozilla tools : http://securityxploded.com/firemaster.php
For example :
FireMaster.exe -q -b -m 3 -l 10 -c "abcdetps123" "c:\my test\firefox"
Conclusion
In this paper, we see how to get all firefox datas on your computer. Does that means that firefox is unsecure ? No. you can do the same things with other browser and application.So, you have to keep in mind which datas are on your computer.
If a person copy firefox directory for hacking purpose, it will have access to all your life !
A firefox plugin can access to informations.Do you have confidence in your plugins ?
An other important point to keep in mind datas you show to the internet like cookies.This datas can be used for commercial purpose and also by hacker to know your habits ...
gradlew idea : FAILURE: Could not determine which tasks to execute.
A small tips if you are not very familiar with gradle and gradlew.
Problem
To idealize my GroovyFx project, I have to use gradlew command :$gralew idea
I had the following error message :
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'idea' not found in root project 'tsecure'.
* Try:
Run gradlew tasks to get a list of available tasks.
Solution
You only have to add the following line to your build.gradle :
apply plugin: 'idea'
Then execute :
$gralew idea
Saturday, March 8, 2014
Grails : UnknownHostException at startup
I had the following error when starting Grails project :
| Error 2014-03-08 20:54:41,199 [localhost-startStop-1] ERROR [localhost].[/toolprod] - StandardWrapper.Throwable
Message: IO Exception: "java.net.UnknownHostException: blopux: blopux: Nom ou service inconnu" [90028-173]
To solve my problem, I had the hostname in /etc/hosts :
127.0.0.1blopux localhost
Sunday, February 16, 2014
firefox plugin
Recently, I wanted to learn how to make firefox plugin.To do that, I followed the official firefox tutorials: https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School
I was simple and quicly I obtain a result.
So, if you want to see from curiosity a firefox plugin, you can see my GitHub project : https://github.com/drieu/checker.
Tuesday, January 7, 2014
How to add a sitemap in my Grail war application ?
Today, I decided to add a sitemap for my new Grail website.First of all, I generated one by using online sitemap generator. For example, there is the following http://www.xml-sitemaps.com . You have to put your website url and it will produce sitemaps files (xml, zip, and so on). Here is an example of sitemap :
Then, I download the file sitemap.xml and I paste it in the web-app directory of my Grails application.After that, I modified my BuildConfig.groovy like the following :
That's all. Now, your sitemap is available in http://your.app.com/sitemap.xml and you can add for example to google webmaster tools.
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
<url>
<loc>http://opendoowap-totalprog.rhcloud.com/</loc>
</url>
<url>
<loc>http://opendoowap-totalprog.rhcloud.com/page/training</loc>
</url>
<url>
<loc>http://opendoowap-totalprog.rhcloud.com/page/about</loc>
</url>
<url>
<loc>http://opendoowap-totalprog.rhcloud.com/page/under</loc>
</url>
<url>
<loc>http://opendoowap-totalprog.rhcloud.com/page/website</loc>
</url>
</urlset>
Then, I download the file sitemap.xml and I paste it in the web-app directory of my Grails application.After that, I modified my BuildConfig.groovy like the following :
grails.war.copyToWebApp = { args ->To finish, I run grails war command and deploy it in Tomcat web container.
fileset(dir:"web-app") {
include(name: "js/**")
include(name: "css/**")
include(name: "fonts/**")
include(name: "images/**")
include(name: "WEB-INF/**")
include(name: "sitemap.xml")
}
}
That's all. Now, your sitemap is available in http://your.app.com/sitemap.xml and you can add for example to google webmaster tools.
Thursday, January 2, 2014
Grails meta tag and internationalization
If you used Grails with internationalization, you knew the use of <g:message> but how to use it in Meta tag content description ?
Here is how :
Subscribe to:
Posts (Atom)
