Site hosted by Angelfire.com: Build your free website today!
undefined
undefined
QBASIC Page


Welcome to the QBASIC programming webpage. Qbasic is alot better than GW-BASIC first because there are no line numbers, and second, there is a built in compiler that will compile your code into an executable (.exe) file. Qbasic is more powerful too.

This tutorial will be small because there is built in help with Qbasic that explains all the commands and stuff, so d/l Qbasic from the programs page and learn the language, then come back here to read the disscussions.

Here are some links to other Qbasic web pages that are cool:

Programmer's Playground
All BASIC Code Archive
Bowlerstrike's Qbasic Site
Acid Works

This is code for a Qgasic program:

start:
CLS
COLOR 2
PRINT "What is your name?"
INPUT n$
PRINT "Hello, "; n$
PRINT "1. Add"
PRINT "2. Subtract"
PRINT "3. Exit"
INPUT choice$
IF choice$ = "1" THEN GOTO 1
IF choice$ = "2" THEN GOTO 2
IF choice$ = "3" THEN GOTO 3
END
1
CLS
COLOR 15
INPUT "Enter first number to add: "; one%
INPUT "Enter second number to add: "; two%
sol% = one% + two%
PRINT "The sum is "; sol%
SLEEP 2
BEEP
GOTO start
END
2
CLS
COLOR 15
INPUT "Enter first number to subtract: "; three%
INPUT "Enter second number to subtract: "; four%
dif% = three% - four%
PRINT "The difference is "; dif%
SLEEP 2
BEEP
GOTO start
END
3
CLS
PRINT "Goodbye"
SLEEP 2
BEEP
END

I'm sure you can tell that this program lets you choose to either add or subtract numbers. Copy and paste the code in Qbasic if you want to run it.

CLS
Clear Screen

start:
a name with a : after it means its a label, so when the statement said GOTO start, the program knew where start was. If you want to use a number for a label you don't need to use the : Both ways are in the example code.

COLOR x
x = a number from 0 to 15, here's the color codes:

0 = Black
1 = Blue
2 = Green
3 = Cyan
4 = Red
5 = Purple
6 = Brown
7 = Grey
8 = Dark Grey
9 = Light Blue
10 = Light Green
11 = Light Cyan
12 = Pink
13 = Light Purple
14 = Yellow
15 = White

PRINT and INPUT are the same for GW-BASIC, but you can use INPUT to print text to the screen then have the user enter data from the same line. Both ways are used in the example code.

SLEEP x
x = numbr of seconds. The program will pause for x seconds then continue with the next line of code.

BEEP
This will make a beep sound. (so fancy)

IF THEN GOTO, these are all self explainatory, the example code will give you the basic usage.

Well that's about it, I gave you an example of a simple program and there's a tutorial to d/l on the programs page if you want to. Again, the built in help is great, that's how I learned Qbasic, so use that.



This part of the Qbasic page is going to on specific hacking related programming. Qbasic is newer than GW-BASIC and better and people actually know about it, so that's why I'm gonna go into writing hacking programs with Qb isntead of GW.

This program decrypts NCSA passwords. The file where user names and passwords are stored is called ftppass. The username is the first word on the line, then a colon and the encrypted password. Here's an example:
user:ucetcr&'()
Run this program and enter the encrypted password, then right after you hit enter, there should be a few lines that start with encrypted password: and a bunch of garbage, one line (usually the first) will have a word, thats the password for that account.
Here's the code:

CLS
SCREEN 12
COLOR 10
REM NCSA Decrypter
INPUT "Encrypted password:"; I$
FOR X = 1 TO 255
FOR Y = 1 TO LEN(I$)
Y$ = MID$(I$, Y, 1)
YA = ASC(Y$)
N = X XOR YA
IF N = 32 THEN F = 1
N$ = N$ + CHR$(N)
NEXT Y
IF F THEN PRINT "Possible password:"; N$
N$ = "": F = 0
NEXT X
PRINT "Finished."
SLEEP 2
END

Normal decryption programs tend to reverse the encryption algorithm, but this one doesn't, its a brute force crack. If you want to learn how to write decryption programs, you need to know alot about math, especially algorithms.



Home
Programming PAge