Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

problem with real 2 script


ghost's Avatar
0 0

I have this vbscript I am using to loop though the possible combinations of years from (2004-2007), months (09-12 anyway) , days (01-31 even if there isn't that many in a month) and hours (1000-2400) looking for the backup files, but I can not seem to find the file… am i missing something??

Vbscript to locate backup file…

To use this code copy the code into note page and save the file with a .vbs extension and double click to run the script.

dim Ie
set ie = createobject("internetexplorer.application")
ie.Visible=true
r="http://hellboundhackers.org/challenges/real2/backups/backup_"
y=4
m = 1
d=1
h=1
For y= 4 to 7 
	For m= 9 to 12
		for d= 1 to 31
			for h= 1 to 24
				if len(m) = 1 then
					m = "0" & "" & m
				end if 
						
				if len(d) = 1 then
					d = "0" & "" & d
				end if
						
				url= r & "200" & y & "-" & m & "-" & d & "_"
				
				if Len(h) = 1 then
					url=url & "0" & h & "00.sql"
				Else
					url= url & h & "00.sql"
				End if
								
				ie.navigate url
				do while ie.readystate <> 4
					'wait until the page completes loading so we can access the dom
					wscript.sleep 0250
				loop
				st=ie.document.getElementsByTagName("pre").length
				' If our document contains a pre tag we are looking at a text file
				if st=1 then
					'throw an error so the script stop executing leaving us on this page
					msqbox(ie.document.getElementsByTagName("pre").count)
				end if
				next 
			next 
	next 	
next

ghost's Avatar
0 0

Well, I'd disable smileys, first… it's hard to see your code clearly with ;) in the way.

Second, are you sure there would be a <pre> tag in the correct file? You can output plain text to a webpage without pre… instead of looking in the elements of the page for the tag you assume is there, why not try telling the program to look at the innerHTML to see if "Page cannot be located" or whatever IE error occurs? Then, you could wait for the page where it doesn't occur and Msgbox the URL.

As a possible other suggestion, you might want to look into using the MSHTML class to chew through the IE documents. It's not necessary but, if you keep encountering problems with your script, that might overcome them.


ghost's Avatar
0 0

and also, those are spoilers. Your code is spoiler.

You need to ask: 'Does anyone want to view my real2 code and tell me what am I doing wrong?'

Not post the code in the forum.