Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

How would I go about doing this?


  • Please log in to reply
14 replies to this topic

#1 ViroDox

ViroDox

  • Members
  • 154 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:07:35 AM

Posted 24 April 2011 - 06:43 AM

Hi!
So I was being lazy and wanted a script that would constantly refresh the page and see if any slots are open, and keep looping.
I think I would have to do this in Java Script, which I am not too familiar with. Could you help me out to program this?



while(true) {
if (malwarebytes /= malwarebytes.html *A copy of the page with no slots open*) {
        	Open popup / Play Music / Etc
        	break;
}else {
Refresh page
}
It could also be a specific text. If there isn't "No available slots. Please check back at a later time." then do actions.
I don't think there is a refresh page, so I could use an autoclicker. (Wait, it would keep clicking it even if the loop ended :blink:)

*After this, I really need to learn Javascript. W3Schools FTW!!

Edited by ViroDox, 24 April 2011 - 06:59 AM.


BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:05:35 AM

Posted 24 April 2011 - 09:45 AM

What do you mean, see if a slot is open? You want to do more than just refresh a page which is easily done using HTML's meta-refresh. You want to check the condition of a page it seems. You can't check the condition of a page until the page is actually loaded, so you might need to explain what it is you are trying to do exactly.

Edited by groovicus, 24 April 2011 - 09:46 AM.


#3 ViroDox

ViroDox
  • Topic Starter

  • Members
  • 154 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:07:35 AM

Posted 24 April 2011 - 10:40 AM

I want to see if there isn't the text "No available slots. Please check back at a later time."
Since that text isn't there, it means that a slot is probably open and theres something on the page saying "Slot open".
And when that happens, it should pop up something or play music, etc.
Then it will break.

Else, it will refresh the page and re-run the loop.

Edited by ViroDox, 24 April 2011 - 10:41 AM.


#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:05:35 AM

Posted 24 April 2011 - 05:45 PM

You will need to create a script that loads the contents of the page as raw html, parse the html to see if the text "slot open' exists, and then carry out some action based on whether the desired text exists or not. Or if you use Firefox, you could create a Grease Monkey script to work with the existing page that you want to check, although the procedure is the same.

#5 ViroDox

ViroDox
  • Topic Starter

  • Members
  • 154 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:07:35 AM

Posted 25 April 2011 - 06:24 AM

You will need to create a script that loads the contents of the page as raw html, parse the html to see if the text "slot open' exists, and then carry out some action based on whether the desired text exists or not. Or if you use Firefox, you could create a Grease Monkey script to work with the existing page that you want to check, although the procedure is the same.

Thanks, so I would use javascript for this then?
Gonna also try out greasemonkey :dance:
I'm stuck :wacko:

Here's what I have so far, and it won't work, as in nothing pops up.
// ==UserScript==
// @name           Checker
// @namespace      http://www.wiikingdom.wordpress.com
// @description    Checks if page has slots open.
// @include        http://www.bleepingcomputer.com/admissions/
// ==/UserScript==


var productElement = document.getElementById("slot");
if (productElement != null)
{
alert('This is what an alert message looks like.');
}

Also need a refresh code.

Edited by ViroDox, 25 April 2011 - 07:39 AM.


#6 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:05:35 AM

Posted 25 April 2011 - 08:39 AM

Is the element that you need to retrieve actually called 'slot'? Where are you actually placing this code?

You are going to have to do some research first.

Edited by groovicus, 25 April 2011 - 10:27 AM.


#7 ViroDox

ViroDox
  • Topic Starter

  • Members
  • 154 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:07:35 AM

Posted 25 April 2011 - 02:55 PM

Here's what I have so far:
// ==UserScript==
// @name   		Checker
// @namespace  	http://www.wiikingdom.wordpress.com
// @description	Checks if page has slots open.
// @include    	http://www.bleepingcomputer.com/admissions/
// ==/UserScript==

while (true){
GM_xmlhttpRequest({
  method: "GET",
  url: "http://www.bleepingcomputer.com/admissions/",
  onload: function(response) {
	
	if(response.responseText.search(/slot open/i) > -1 )
	alert("A slot is open!! HURRY!!");
//Should I use break; or return false here? <== Question
	else
function reload()
	{
 		window.location.reload();
 	}
  }
});
}
I'm not entirely sure if the page reloads. After I run it it just freezes, then shows the stop script or continue message.
The error message works though (with the word slot, because it exists).

Edited by ViroDox, 25 April 2011 - 02:57 PM.


#8 Eyesee

Eyesee

    Bleepin Teck Shop


  • BC Advisor
  • 3,545 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:In the middle of Kansas
  • Local time:06:35 AM

Posted 25 April 2011 - 04:31 PM

Seems to me like a lot of work to go through just to see if BC has any slots open in the MRT training program.
Bookmarking that page would be a lot easier.
In the beginning there was the command line.

#9 ViroDox

ViroDox
  • Topic Starter

  • Members
  • 154 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:07:35 AM

Posted 25 April 2011 - 06:27 PM

Seems to me like a lot of work to go through just to see if BC has any slots open in the MRT training program.
Bookmarking that page would be a lot easier.

Yeah, but it would be nice to have an automated process doing it while I'm doing other things.

#10 Alanwh

Alanwh

  • Members
  • 171 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:California
  • Local time:03:35 AM

Posted 26 April 2011 - 12:24 PM

Seems to me like a lot of work to go through just to see if BC has any slots open in the MRT training program.
Bookmarking that page would be a lot easier.


Not to mention the strain it would cause to BleepingComputers Server... Constantly refreshing a page would take a considerable amount of bandwidth. Be careful.

#11 ViroDox

ViroDox
  • Topic Starter

  • Members
  • 154 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:07:35 AM

Posted 26 April 2011 - 02:00 PM

This isn't really a DoS, and I can make it sleep after every refresh for a specific period of time.

#12 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:06:35 AM

Posted 29 April 2011 - 07:18 AM

How about adding more code to email yourself if slot is open.

#13 Nile

Nile

  • Members
  • 79 posts
  • OFFLINE
  •  
  • Local time:07:35 AM

Posted 01 May 2011 - 06:30 PM

You can't send an email with Javascript.

#14 ThunderZ

ThunderZ

  • Deactivated
  • 4,454 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:35 AM

Posted 01 May 2011 - 06:57 PM

Maybe I am over simplifying, perhaps even depriving you of a learning\fun experience.

But if you use FF as your browser then toss in Noscript you will have the option in the right click menu of auto-refreshing a page. You can pick from a predefined time limit or set a custom one.

However, it playing a sound or popping-up a notice on a given event is another story.

#15 marlattts

marlattts

  • Members
  • 5 posts
  • OFFLINE
  •  
  • Local time:03:35 AM

Posted 18 November 2011 - 08:28 PM

Were you able to get your script to work? If so would you mind sharing it? I have a few sites where I could use something like this.

Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users