View Full Version : ASM validate user input
fresh
08-25-2004, 05:15 AM
Hey, I'm looking for a simple user input validation script coded in assembly, I am using TASM as a compiler, btw.. all the example needs to do is validate user input against a variable or whatever.. I have very little experience with assembly but I do know how to code in C++ and VB, so that's a plus.. :)
any help is much appreciated.. thanks ;)
anubis
08-25-2004, 06:02 AM
what do you mean by script ???
what do you mean by user input validation ?
fresh
08-25-2004, 07:09 AM
ok sorry, I mean example source.. and I am only assuming you can write a COM file via ASM, which can except user input and then validate it.. like a password protection scheme would in any other language.. is that even possible with assembly and if not, what good is ASM?? thanks :)
JSoftware
08-25-2004, 07:15 AM
i didn't get what you wanted.. i would start out with some easier assembler programs.. i haven't figured int 16 keyboard input all out yet!
you could load a string to the si register and make a loop og cmp's and get some validations that way but try to tell a little more detailed what you need!
fresh
08-25-2004, 07:23 AM
I know what your saying.. but how to code it is were I am at a loss, what type of example would you say would be a good source to start with? I have already done the Hello World! LOL.. I'm looking to work on something more difficult, but something simple of course.. any suggestions or tutorials I can follow? Thanks and sorry about not fully explaining myself the first time ;)
JSoftware
08-25-2004, 07:42 AM
tmp DB 32 dup('?')
pass DB "Password"
succes DB "Access Granted!",0dh,0ah,"$"
getkeyin:
MOV AH,0CH
MOV AL,01H
INT 21H
CMP AL, 0DH
JE process
ADD tmp, AL
JMP getkeyin
process:
CMP tmp, pass
jne exit
mov dx, succes
mov ah,09h
int 21h
exit:
mov ah, 00h
int 21h
try this.. code made for nasm syntax. maybe you need to add some OFFSET's some where or something.. i suppose it works B)
anubis
08-25-2004, 08:25 AM
oooh... now i get what you mean... i was confused by your terminology
fresh
08-25-2004, 10:31 AM
thank you very much, even though right now I don't understand it, I now have a good reference to study from.. so thanks alot.. too bad it isn't TASM ready.. because I tried to compile it but it said this:
errors:
Illegal memory reference
Operand types do not match
Unexpected end of file encountered
and this is my source:
.MODEL SMALL
.STACK
.CODE
tmp DB 32 dup('?')
pass DB "Password"
succes DB "Access Granted!",0dh,0ah,"$"
getkeyin:
MOV AH,0CH
MOV AL,01H
INT 21H
CMP AL, 0DH
JE process
ADD tmp, AL
JMP getkeyin
process:
CMP tmp, pass
jne exit
mov dx, succes
mov ah,09h
int 21h
exit:
mov ah, 00h
int 21h
I mean I set that up right? Except for the fact that it isn't made to compile in TASM.. other than that I set the source up correctly right? BTW.. I know what you mean by OFFSETS, but I haven't found a understanding of them, any examples?? thanks :)
JSoftware
08-25-2004, 11:21 AM
tmp DB "??????????????????????????????"
pass DB "Password"
succes DB "Access Granted!",0dh,0ah,"$"
getkeyin:
MOV AH,0CH
MOV AL,01H
INT 21H
CMP AL, 0DH
JE process
OUT tmp, al
JMP getkeyin
process:
MOV si, tmp
CMP SI, pass
jne exit
mov dx, succes
mov ah,09h
int 21h
exit:
mov ah, 00h
int 21h
try this then
fresh
08-25-2004, 11:26 AM
nope, still no good, here is my errors:
Expecting scalar type
Operand types do not match
Operand types do not match
Operand types do not match
Unexpected end of file encountered
and of course the current attempt:
.MODEL SMALL
.STACK
.CODE
tmp DB "??????????????????????????????"
pass DB "Password"
succes DB "Access Granted!",0dh,0ah,"$"
getkeyin:
MOV AH,0CH
MOV AL,01H
INT 21H
CMP AL, 0DH
JE process
OUT tmp, al
JMP getkeyin
process:
MOV si, tmp
CMP SI, pass
jne exit
mov dx, succes
mov ah,09h
int 21h
exit:
mov ah, 00h
int 21h
BTW: I am using TASM.. thanks :)
JSoftware
08-25-2004, 12:08 PM
get nasm instead then :P
fresh
08-25-2004, 12:18 PM
haha ok.. is it free? and where can I get it... know nay links.. I'll search google i guess, thanks man :)
alright, found one, how do I compile with it, I mean what is the syntax to compile and link? I am now using NASM.. ;)
Mihail121
08-25-2004, 01:05 PM
Ok, i'll said it only one time so be carefull - RTFM. It's one of the most important programming rules and the abreviature stands for: Read The Fucking Manual.
In your case it means simply that you should simply check the docs that come with NASM. All lies there :)
davepermen
08-25-2004, 01:16 PM
it's called Read The FRIENDLY Manual, Mihail.. at least..... in public area.. :D
JSoftware
08-25-2004, 01:17 PM
make a simple text document: tmp.txt or tmp.asm
then from dos write:
nasm tmp.txt
and you'll get a nice file called: "tmp"
rename it to "tmp.com" or "tmp.exe"
viola!
(you could make some tricks so you don't have to rename but wtf..
fresh
08-25-2004, 10:31 PM
well NASM didn't come with a Fucking or Friendly manual.. LOL.. so I thought I'd ask.. Alright, I'll try that, and see what happens.. thanks alot guys :)
OK. This code is just not going to work.. lol.. is it missing something?
File Name:dis
error: attempt to define a local label before any non-local labels
error: parser: instruction expected
error: attempt to define a local label before any non-local labels
error: attempt to define a local label before any non-local labels
.MODEL SMALL
.STACK
.CODE
tmp DB "??????????????????????????????"
pass DB "Password"
succes DB "Access Granted!",0dh,0ah,"$"
getkeyin:
MOV AH,0CH
MOV AL,01H
INT 21H
CMP AL, 0DH
JE process
OUT tmp, al
JMP getkeyin
process:
MOV si, tmp
CMP SI, pass
jne exit
mov dx, succes
mov ah,09h
int 21h
exit:
mov ah, 00h
int 21h
thank you guys :)
P.s. what goes here:
tmp DB "??????????????????????????????"
I mean what goes in place of the ????????????????????? marks.. thanks
JSoftware
08-26-2004, 06:13 AM
nasm doen'st understand the DUP statement.. that's why we have to declare some space for the incomming text to the tmp variable
and you should remove the first 3 lines.. they aren't needed by the assembler linker
fresh
08-26-2004, 07:46 PM
hey I got the code compiled finally but how do I call the linker.. I looked threw the help file but it didn't specify.. does it compile and link in all one step or is it like TASM, two different steps?
Syntax would be great.. :)
JSoftware
08-26-2004, 10:23 PM
c++ nerd i suppose.. :) NETWIDE assembler code isn't compiled. it's directly linked. you don't have to output object code first
try typing: nasm -o output.exe input.asm
that should do the rename trick
fresh
08-27-2004, 10:10 AM
yeah can you tell.. lol
BTW: I compiled the code you gave me and for some reason it wont load, I did exactly what you said, but it just wont work, so I gave up on ASM, and went back to C++, atleast for something of this nature.. I still like ASM and want to learn the basics.. so thanks for giving me a head start man, I appreciate your help.. :)
JSoftware
08-27-2004, 11:25 AM
assembly nowadays.. (i haven't been programming asm for a long time) ... is mainly used for optimization. i don't think there's any reason for learning assembler if you are not a diehard optimization freak or microprocessor programmer. things like input from devices is just... a thing you could just as good do in a highlevel language. but methods handling simple math which you could perform faster using your own algo you could make better in assembler.
but i think i myself got a lot from learning assembler though it's mainly for microprocessor developement :yes:
fresh
08-30-2004, 12:49 AM
hey sorry for the slow reply.. yeah I agree, I thought it would be cool to make a few crackme's in ASM, but like you said it isn't logical to do so, if you can just do it faster in C++ or VB.. I agree ASM is well worth learning, so I think I'll continue to study it, but I don't think I will be using it to code with any time soon.. lol ;)
Thanks for all your help man, I appreciate it alot :D
anubis
08-30-2004, 06:24 AM
getting into assembler is a great way of improving ones understanding of computers. you should continue to learn it...
JSoftware
08-30-2004, 07:15 AM
i nod with anubis.. assembler is a bit tough to start out with but after the hard working and reading you feel like being able to read matrix code :D Hehe
disclaimer: Experience may vary.. but.. do it! :)
fresh
08-30-2004, 01:39 PM
yeah absolutly, I still am learning how the stack works and all that good stuff, so it will take some time again before I attempt to code with it.. it's rough to learn, but it's logical, so I think it is possible to read.. just hard to understand.. thats my problem.. lol ;)
Mihail121
08-30-2004, 02:14 PM
Not hard to learn, not hard to understand either if you have up the right stuff. Just two hours ago i found FreeDOS, which gives the answers to a lot of stuff in my coding life so here is what i can suggest to you:
1. Get FreeDOS OS (1 diskette) and install it
2. Get the best ASM book ever written - "Art of Assembly", it's free
3. Get Privalov's FlatASM
and enjoy the coding in it's pureness! That's what life's all about!
fresh
09-01-2004, 05:11 AM
cool man, I'll have to check those out :D
vBulletin, Copyright ©2000-2009, Jelsoft Enterprises Ltd.