Commits

Mason Malone committed 7c33060

Tweaks/cleanup for vmpr.hta and changed vmpr.js to echo status messages even when verbose mode is off

Comments (0)

Files changed (2)

 <title>Virgin Mobile PIN Changer</title>
 <meta http-equiv="x-ua-compatible" content="ie=9">
 <HTA:APPLICATION 
-     APPLICATIONNAME="Virgin Mobile PIN Changer"
-     SCROLL="no"
-     SINGLEINSTANCE="yes"
+	APPLICATIONNAME="Virgin Mobile PIN Changer"
+	SCROLL="no"
+	SINGLEINSTANCE="yes"
 >
 <style type="text/css">
 div label { display: block }
 div { display: inline-block; padding: 5px }
 </style>
 <script language="VBScript">
-	Sub Window_onLoad
+	sub Window_onLoad
 		window.resizeTo 400,240
-	End Sub
+	end sub
 	
-    Sub RunProgram
+	sub RunProgram
+		dim phone, pin, freq, fuzz, output, verbose, command, objShell
+		
 		phone = document.getElementById("phone").value
 		pin = document.getElementById("pin").value
 		if (Len(phone) = 0) then
 		if (Len(fuzz)) then command = command & " --fuzz=" & fuzz
 		if (Len(output)) then command = command & " --output=" & output
 		if (verbose) then command = command & " --verbose"
-				
-        Set objShell = CreateObject("Wscript.Shell")
 		'Msgbox command
-        objShell.Run command
-    End Sub
+				
+		set objShell = CreateObject("Wscript.Shell")
+		objShell.run command, 1, false
+		window.close()
+	end sub
 </script>
 </head>
 <body>
 <form>
 <div>
-    <label for="phone">Phone number</label>
-    <input type="text" id="phone" size="10"/>
+	<label for="phone">Phone number</label>
+	<input type="text" id="phone" size="10"/>
 </div>
 <div>
-    <label for="pin">PIN</label>
-    <input type="text" id="pin" size="6"/>
+	<label for="pin">PIN</label>
+	<input type="text" id="pin" size="6"/>
 </div>    
 
 <div>    
-    <label for="freq">Frequency</label>
-    <input type="text" id="freq" value="180" size="6"/>
+	<label for="freq">Frequency in seconds</label>
+	<input type="text" id="freq" value="180" size="6"/>
 </div>
 <div>
-    <label>Fuzz factor</label>
-    <input type="text" id="fuzz" value="10" size="3"/>
+	<label>Fuzz factor</label>
+	<input type="text" id="fuzz" value="10" size="3"/>
 </div>
 <div>
-	<label for="output">Output</label>
-    <input type="file" id="output"/>
+	<label for="output">Where to write new PINs</label>
+	<input type="file" id="output"/>
+</div>
+<br/>
+<div>
+	Verbose output
+	<input type="checkbox" id="verbose" value="1"/>
 </div>
 <br/>
-<label for="verbose">Verbose</label>
-<input type="checkbox" id="verbose" value="1"/>
-
-<br/><br/>
 <input type="button" value="Run" name="run_button" onClick="RunProgram()">
 </form>
 </body>
                 this.die("Failed to write new PIN to file: " + pin, 1);
             }
             outFile.flush();
-        } else {
-            this.echo(pin);
         }
+        this.echo("Generated pin: " + pin);
         this.verboseEcho("Generated pin " + pin + ", now submitting PIN change form");
         // this is needed because the form to change the PIN is in an iframe,
         // which casper.fill() can't get to
     this.then(function() {
         this.verboseEcho('Submitted form. url = ' + this.getCurrentUrl() + ', title = ' + this.getTitle());
         var sleepTime = randomBetween(frequency - fuzz, frequency + fuzz);
-        this.verboseEcho("Sleeping for " + sleepTime + " seconds");
+        this.echo("Successfully changed PIN. Sleeping for " + sleepTime + " seconds.");
         this.wait(sleepTime * 1000);
     });
     this.thenOpen(pinChangeUrl);
 }
 
 casper
+    .echo("Accessing login page...")
     .start(pinChangeUrl)
     .userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1')
     .wait(randomBetween(500, 1500)) //anti-bot-detection
     .then(function login() {
-        this.verboseEcho("Submitting login form");
+        this.echo("Logging in...");
         this.fill('.login_form', {
             "min": phoneNum,
             "vkey": pin