Page 1 of 1

HTML decrypter, In QBasic!!

Posted: Sat Feb 12, 2005 4:39 pm
by Rattrapmax6
:) Yay, I've had the bright Idea to make a HTML decrypter. Its not much now, but its somthing I'm playing around with for fun.. take a look...
(Reads TXT & HTM, but fails to read HTML dubbed files)

Code: Select all

DECLARE SUB PARAread ()
DECLARE SUB BODYRead ()
DECLARE SUB HEADRead ()
DECLARE SUB TTLPRT ()
DECLARE SUB Overflow ()
DECLARE SUB TAGCheck ()
DECLARE SUB OpenHTML ()
DECLARE SUB HTMLread ()
DECLARE SUB HTMLCheck ()
DIM SHARED html$, cont, htm$, para$, header$, html2$
CLS
INPUT "Enter .HTM Document:", htm$
CLS
CALL HTMLCheck
CALL OpenHTML
CALL TAGCheck
cont = 0
CALL HTMLread
PRINT cont

SUB BODYRead
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 3) = "<P>" THEN cont = cont + 2: CALL PARAread
LOOP
END SUB

SUB HEADRead
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 7) = "<TITLE>" THEN cont = cont + 6: CALL TTLPRT
LOOP
END SUB

SUB HTMLCheck
cont = 0
DO
cont = cont + 1
IF cont = LEN(htm$) THEN PRINT " Not .HTM/.TXT Document ": END
IF MID$(UCASE$(htm$), cont, 3) = "TXT" THEN EXIT DO
IF MID$(UCASE$(htm$), cont, 3) = "HTM" THEN EXIT DO
LOOP

END SUB

SUB HTMLread
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 6) = "<HEAD>" THEN CALL HEADRead
IF MID$(UCASE$(html$), cont, 6) = "<BODY>" THEN CALL BODYRead
IF MID$(UCASE$(html$), cont, 7) = "</HTML>" THEN END
LOOP
END SUB

SUB OpenHTML
OPEN htm$ FOR INPUT AS #1
DO
IF EOF(1) = -1 THEN EXIT DO
LINE INPUT #1, a$
html$ = html$ + a$
IF LEN(html$) = 199 THEN PRINT " File To Big! ": END
LOOP
CLOSE #1
END SUB

SUB PARAread
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 4) = "</P>" THEN EXIT DO
phs$ = phs$ + MID$(html$, cont, 1)
LOOP
PRINT
PRINT phs$
CALL HTMLread
END SUB

SUB TAGCheck
cont = 0
DO
cont = cont + 1
IF cont = LEN(html$) THEN PRINT " No <html> tag located ": END
IF MID$(UCASE$(html$), cont, 6) = "<HTML>" THEN EXIT DO
LOOP
END SUB

SUB TTLPRT
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 8) = "</TITLE>" THEN EXIT DO
ttl$ = ttl$ + MID$(html$, cont, 1)
LOOP
PRINT ttl$
PRINT
CALL HTMLread
END SUB
Text File or HTM file...

Code: Select all

<HTML>
<HEAD>
<TITLE>QB HTML READER!</TITLE>
</HEAD>
<BODY>
<P>This is a HTML paragraph being read by QBasic Yay!!</P>
</BODY>
</HTML>
It is limited to <html>, <head>, <body>, <p>, <title>, and their reverse tags.. Also sofar the file has to be less than 199 charaters.. :D This is just a decrypter for now, not a veiwer, so no mouse function is present.

Note: If you also like to mess around and improve on it, its a great introduction to using the MID$() statment for scanning files for infomation, feel free to do so.. :wink:

Posted: Sat Feb 12, 2005 7:47 pm
by MystikShadows
Not a bad first attempt at all Kevin. looks well made :-)

Posted: Sat Feb 12, 2005 8:45 pm
by Rattrapmax6
:) Yeah, its just a siple code now,. I was looking back over it and saw that it only read one <P> tag,. but that can be fixxed by chaning the "CALL HTMLread" to "CALL BODYread" at the PARAread SUB,..

But like you said it a first attemp, heh heh,. your not going to get two <P>s in a 199 char limit decypter that say much.. :wink: Thanks...

Posted: Sat Feb 12, 2005 10:58 pm
by Mitth'raw'nuruodo
I agree with MystikShadows.
I also agree with Rattrap.

heh...I'm just agreeing with everybody lol :lol:

Ya with that 2 Gig String thing in FB you should redo it in it....Yep
Also HTML is has a lot to it....just be glad your not doing Javascript also....*Mit shudders*....
:D

Posted: Sun Feb 13, 2005 8:22 am
by {Nathan}
JAVASCRIPT! AHH! *starts screaming like Homer Simpson and running around in circles* AHH! AHH! AHH!
:roll:

Posted: Sun Feb 13, 2005 8:29 am
by Rattrapmax6
:D Ha ha, Mitth, you sound like a regular FBer now.. :wink:

Posted: Sun Feb 13, 2005 8:34 am
by Mitth'raw'nuruodo
Really and all I did was see how pretty their site was....hmmm...

I haven't even touched a download yet....

Posted: Sun Feb 13, 2005 8:43 am
by Rattrapmax6
:) Bookmark this site for when you go to download, like I said b4, I realy think this is a cool FBIDE and compiler package, :wink:

http://www.hot.ee/fbide/

Check out the screens for it,. :)

Posted: Sun Feb 13, 2005 4:47 pm
by Mitth'raw'nuruodo
Thanks! :D

Posted: Sun Feb 13, 2005 4:53 pm
by Rattrapmax6
Okay, QB is not limited to 200 chars to straing$, it will hold 32767 chars.. Here I've modified to program to read it.. It also can read more that one <P> tag.. :wink:

Its at its best at the moment,. anymore and I'll have to convert to gfx texts to display <Hx> tags,. Its just a small decrypter still, and I don't plan to make it a viewer any time soon..

Code: Select all

DECLARE SUB PARAread ()
DECLARE SUB BODYread ()
DECLARE SUB HEADRead ()
DECLARE SUB TTLPRT ()
DECLARE SUB TAGCheck ()
DECLARE SUB OpenHTML ()
DECLARE SUB HTMLread ()
DECLARE SUB HTMLCheck ()
DIM SHARED html$, cont, htm$, para$, header$, html2$
CLS
INPUT "Enter .HTM/.TXT Document:", htm$
CLS
CALL HTMLCheck
CALL OpenHTML
CALL TAGCheck
cont = 0
CALL HTMLread
PRINT cont

SUB BODYread
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 3) = "<P>" THEN cont = cont + 2: CALL PARAread
LOOP
END SUB

SUB HEADRead
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 7) = "<TITLE>" THEN cont = cont + 6: CALL TTLPRT
LOOP
END SUB

SUB HTMLCheck
cont = 0
DO
cont = cont + 1
IF cont = LEN(htm$) THEN PRINT " Not .HTM/.TXT Document ": END
IF MID$(UCASE$(htm$), cont, 3) = "TXT" THEN EXIT DO
IF MID$(UCASE$(htm$), cont, 3) = "HTM" THEN EXIT DO
LOOP

END SUB

SUB HTMLread
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 6) = "<HEAD>" THEN CALL HEADRead
IF MID$(UCASE$(html$), cont, 5) = "<BODY" THEN CALL BODYread
IF MID$(UCASE$(html$), cont, 7) = "</HTML>" THEN END
LOOP
END SUB

SUB OpenHTML
OPEN htm$ FOR INPUT AS #1
DO
IF EOF(1) = -1 THEN EXIT DO
LINE INPUT #1, a$
html$ = html$ + a$
IF LEN(html$) = 32767 THEN PRINT " File To Big! ": END
LOOP
CLOSE #1
END SUB

SUB PARAread
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 4) = "</P>" THEN EXIT DO
phs$ = phs$ + MID$(html$, cont, 1)
LOOP
PRINT
PRINT phs$
CALL BODYread
END SUB

SUB TAGCheck
cont = 0
DO
cont = cont + 1
IF cont = LEN(html$) THEN PRINT " No <html> tag located ": END
IF MID$(UCASE$(html$), cont, 6) = "<HTML>" THEN EXIT DO
LOOP
END SUB

SUB TTLPRT
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 8) = "</TITLE>" THEN EXIT DO
ttl$ = ttl$ + MID$(html$, cont, 1)
LOOP
PRINT ttl$
PRINT
CALL HTMLread
END SUB
Text Document. or HTM Document.

Code: Select all

<HTML>
<HEAD>
<TITLE>QB HTML READER!</TITLE>
</HEAD>
<BODY>
<P>This is a HTML paragraph being read by QBasic, Yay!!</P>
<P>This is the second paragraph in QB!!</P>
<P>What the heck lets go for THREE!!</P>
<P>Stressing the string$ size it holds up 32767 chars 
for reading most HTML code as it is doing now! 
Enjoy this program. Its great for those who would 
like to learn how to use MID$() to scan files!</P>
</BODY>
</HTML>
Well there it is,.. Like I said befor, anyone interested in using the MID$() to read and sort information, this is a good example I think... And also any who like the idea can improve on it... :)

This is still limited to <html>, <head>, <body>, <title>, <p>, and their reverse tags.. but I moved the chars size up.. :wink: and if you havn't noticed, this reads more than one <P>,.. Its also case insesitive, so you can use <HTML>, <HtMl>, or <html> and it still work. :D

Posted: Sun Feb 13, 2005 6:17 pm
by Mitth'raw'nuruodo
Hey Ummm....why did you want to do this anyway?

Ya I guess I was wrong but still.... :(

Posted: Sun Feb 13, 2005 8:13 pm
by Rattrapmax6
:) , Nah, we all make mistakes, :wink:

Just for fun really, see if it really work.. it does so I'm happy.. :D

Posted: Sun Feb 13, 2005 9:43 pm
by Mitth'raw'nuruodo
Ya ok,

You know if Nathen got back to us on that parser thing yet? :?

Posted: Mon Feb 14, 2005 6:46 pm
by Rattrapmax6
Umm, no, but he posted above,. :wink: ,. I think he got our finished debbug, he said something bout a tutorial for it sometime back.. :)

Posted: Tue Feb 15, 2005 4:47 pm
by Mitth'raw'nuruodo
Oh, yeah that's right, I remember wondering why he was asking to do a tut on something he didn't know how to do....oh well :roll: