Tuesday, August 18, 2009

Scripting...I love weakly typed languages :P

Hi fellas I was a bit busy these few days. I was trying to get the basics of Scripting and i have been pretty successful. So here's my first UserScript for mozilla for the site travian.com. This little script lets you select all the checkboxes on the report page for quick deletion. Have fun :)

// Use this tiny little script to select/unselect all reports on the reports page
// of travian so that you could delete them quickly.
// ==UserScript==
// @name SlectAll
// @namespace obnoxiouscoder.blogspot.com
// @decription "Select All" reports on the page with a click for deletion.
// @include http//*.travian.*/berichte.php*
// @include *.travian.*/berichte.php*
// @email obnoxiouscoder@gmail.com
// ==/UserScript==
// *********************************************************


var nbsp = document.createTextNode( "\u00A0" );
var newChkBox = document.createElement("input");
newChkBox.type = "checkbox";
newChkBox.id = "chk_box";
newChkBox.addEventListener("click",function()
{
var chkBox = document.getElementsByTagName("input");
for(i=0; i
{
if(chkBox[i].getAttribute('type') == "checkbox")
{
if(chkBox[i].getAttribute("id") != "chk_box")
{
if(chkBox[i].checked == true)
{
chkBox[i].checked =false;
}
else
{
chkBox[i].checked = true;
}
}
}
}
},false);

//CheckBox Text
var newTxt = document.createElement("b");
newTxt.setAttribute("style","color: #00CC33;");
var chkboxTxt = document.createTextNode("SelectAll");
newTxt.appendChild(chkboxTxt);

//target Button
var trgtButton = document.getElementById("btn_delete");

//insertAfter Function.
function insertAfter(newElement,targetElement)
{
var parent = targetElement.parentNode;
if (parent.lastChild == targetElement)
{
parent.appendChild(newElement);
}
else
{
parent.insertBefore(newElement,targetElement.nextSibling);
}
}

//Lets Roll Baby
insertAfter(newChkBox,trgtButton);
newChkBox.parentNode.insertBefore(nbsp,newChkBox);
insertAfter(newTxt,newChkBox);

Sunday, August 2, 2009

Obnoxious Schemeing :P(Brute Forcer in Scheme)

Aah the woes of BruteForcing!!! I was racking my brain for some time to code a very nice bruteforcing algo. I had some ideas but they were all messy so had to stop. Finally i found one googling. It was awesome simply awesome. It was written in c# and i thought I too should get an implementation of the same in some other language that has not yet been implemented. So here's my shot at Fame :P.

I am in love with scheme. To me its the best language where you can understand looping(The thing we take for granted thanks to the For Loop). Its also the best language for understanding recursion. Recursion in scheme is simply superb!!!! So here's a little implementation of that awesome bruteforcing algo in scheme translated by me.

(define sb "")
(define charlst '(#\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z))
(define (Start length)
(let loop([i 0] [max length])
(cond
[(= i max) (IterateChars 0 sb length)]
[else (set! sb (string-append sb "a"))
(loop (+ i 1) max)])))
(define (IterateChars pos sb length)
(let loop([i 0] [max 26])
(cond
[(= i max) (display "")]
[else (string-set! sb pos (list-ref charlst i))
(cond
[(= pos (- length 1)) (display "\n") (display sb)]
[else (IterateChars (+ pos 1) sb length)])
(loop (+ i 1) max)])))
(Start 4)

In order to change the the length of the string just change (Start length) => length to desired choice. I must simply say that anyone who wants to understand Looping and Recursion better should give scheme a shot.

[More Details On Scheme]
en.wikipedia.org/wiki/Scheme_(programming_language)

[Get Compiler Here]
download.plt-scheme.org/drscheme/



skNiNe9's SKCrackMe #1


Its a Java crackme. I am trying to learn java so i gave it a shot. It uses DES encryption in ECB mode or rather DES decryption to verify the serial. This as how DES can be implemented in java.

import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;

public class DES
{
public byte[] getDES(byte[] inputbytes, byte[] keybytes) throws Exception
{
SecretKeySpec key = new SecretKeySpec(keybytes,"DES");
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] cryptedTxt = cipher.doFinal(inputbytes);
return cryptedTxt;
}
public byte[] decryptDES(byte[] inputbytes, byte[] keybytes) throws Exception
{
SecretKeySpec key = new SecretKeySpec(keybytes,"DES");
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] decryptedtxt = cipher.doFinal(inputbytes);
return decryptedtxt;
}
}

Have fun implementing DES :P