String changer early attempt

andrewkennedy1_at_ev1.net
Date: 01/30/04


Date: Fri, 30 Jan 2004 20:12:00 -0000


I am trying to modify this to slow down "string changers".
I put some comments on the string_changer section below.

Thanks,
          Andrew Kennedy

andrewkennedy2@ev1LOG.net
To respond by email remove the LOG from the address.

; no_no.asm Rename a file to current date mmddyy.ext
;
; email: andrewkennedy2@LOGev1.net (Remove LOG)
; Tasm code (c) Andrew Kennedy Jan 2004
;
; Help from Stealth, Raymond, Bitrake, Rudy Weiser, Frank Kotler,
;
; Win 98 + Long File Name support
; * Ask me about my very small command line shredder
; |------------------------------------------|
; | Feel free to use sections of the code |
; | but please credit me somewhere. |
; |------------------------------------------|

model small
stack 200h

data

       prescence db 'Andrew Kennedy 1/23/04'
       day db '00' ; storage for date
       month db '00'
       year db '00'
       DETA_it db "Don't hex with me"
       orig_name db 140 dup(?)
       new_name db 128 dup(?)
       name_length db ?
       ext_length dw ?
       extension db 10 dup(?)
       storage db 150 dup(?)
       fail db 13,10,'File not found.',13,10,'$'
       nofile db 13,10,'File not found.',13,10,'$'
       prompt db 13,10,'Filename to Rename -> ',13,10, '$'

code
begin:
       mov ax,@data
       mov ds,ax
       mov es,ax ; need this for function 7156h
                     
       mov dx, offset prompt
       mov ah,9
       int 21h
               
       mov orig_name,128 ; max characters in input
       lea dx,orig_name ; get filename
       mov ah,0ch ; flush keyboard buffer
       mov al,0ah ; buffered keyboard input
       int 21h
       xor ax,ax
       mov al,[orig_name + 1] ; how many chars entered
       add al,2 ; find position after last char
       mov si,ax ; move count to index register
       mov orig_name[si],00 ; make it into ascii string
         
       mov dx,offset orig_name + 2
       mov ax,7143h ; See if file exists
       int 21h ; carry flag set if problem

       jc short not_present
          
       mov cl,[orig_name + 1] ; how many bytes read in
       mov name_length,cl ; store filename length

       mov ch,00
       mov si,cx ; move count to index register
                           
       mov cl,[name_length] ; cx = total number of characters
                                   ; excluding the terminating <ENTER>

;string_changer: ; NEED TO CHECK VALUE OF STRING AND COMPARE AGAINST
                ; A STORED VALUE
                ; WE COULD ENCRYPT THE VALUE AND HIDE IT IN THE CODE SECTION
                ; BUT I'M JUST TRYING TO STOP GENERIC "HEXERS"

; lea si,[DETA_it]
; xor cx,cx
; mov di,si
; mov cl,[18]

; Look for a '\' which would indicate a path was specified
chk_path:
       lea si,[orig_name + 2]
       xor cx,cx
       mov di,si
       mov cl,[name_length]
       
       mov al,'\'
                                    ; c:\work.1\temp\test.asm
       add di,cx
       std ; scan from right to left <------
       dec di
       repne scasb ; zero flag set if "\"
       pushf
       push cx
       
       xor di,di
       xor si,si
       lea si,[orig_name + 2]
       pop cx
       add si,cx
       xor cx,cx
       cld ; scan from left to right
       mov di,si
       mov cl,[name_length]
       
       mov al,'.' ;
                                    ;
                                    ; c:\work.1\temp\test.asm
       repne scasb ; zero flag set if "."
       jnz short scan

; Store the file extension

extens:

       mov si,di ; the scanned input now is the source
       mov di,offset extension ;
       mov [ext_length],cx
       rep movsb ; move remaining chars into extension
       jmp short scan

not_present:
       mov dx,offset nofile
       mov ah,9
       int 21h
       mov ax,4c01h
       int 21h

; Store the path

scan:
       lea si,[orig_name + 2]
       xor cx,cx
       mov di,si
       mov cl,[name_length]
       

       mov al,'\' ; c:\work.1\
       add di,cx
       std ; scan from right to left
       dec di
       repne scasb ; zero flag set if "\"
       popf
       jnz short no_path
       add cx,1 ; value is total # chars in path

no_path:
       push cx
       mov di,offset storage
       cld ; scan from left to right
       rep movsb ; store path to directory in storage
       mov al,0
       stosb ; make path ASCIZ
       pop cx
       mov name_length,cl ; store length of path

time:
       mov ah,4 ; get time
       int 1ah

       mov al,cl ; store time
       xor ah,ah ;
       mov bl,10h
       div bl
       add ax,3030h
       mov [year],al
       mov [year+1],ah
       mov al,dh
       xor ah,ah
       div bl
       add ax,3030h
       mov [month],al
       mov [month+1],ah
       mov al,dl
       xor ah,ah
       div bl
       add ax,3030h
       mov [day],al
       mov [day+1],ah
                  
       mov al, [month] ; build time-based new filename
       mov byte ptr new_name, al

       mov al, [month + 1]
       mov byte ptr new_name + 1, al

       mov al, [day]
       mov byte ptr new_name + 2, al
              
       mov al, [day + 1]
       mov byte ptr new_name + 3, al

       mov al, [year]
       mov byte ptr new_name + 4, al

       mov al, [year + 1]
       mov byte ptr new_name + 5, al
           
       mov di,offset new_name + 6
       mov al, '.' ; add the period (6 + 1)
       stosb
       mov si,offset extension ; add on file extension
       mov cx, [ext_length]
       rep movsb
                     
       xor cx,cx
       mov di,offset storage ;
       mov cl,[name_length]
       add di, cx ; move to end of storage

       xor cx,cx
       mov si,offset new_name ; source of extension
       mov cx, [ext_length] ; # of chars in the extension
       add cx,7 ; chars in new name plus the period
       rep movsb ; add new_name to end of storage

is_a_path:
       xor ax,ax
       xor dx,dx
       mov ax,7156h ; LFN rename file Win 98 +
       lea dx, orig_name + 2 ; old name
       lea di, storage ; sets the new name
       int 21h
        
is_there:
       cmp al,02h
       jz not_there
       jmp short exit

not_there:
       mov dx,offset fail
       mov ah,9
       int 21h
       mov ax,4c01h
       int 21h

exit:
       mov ax,4c00h
       int 21h

end begin



Relevant Pages

  • Re: Hashed password secure?
    ... > strongly suggest that you don't modify the standard crypt source on ... which obviously should be much more secure than Win98/NT ... that only opens up when a user logs on to ... store should be as safe as possible, and as resistent to brute force as ...
    (sci.crypt)
  • where is the problem with that source?
    ... i'll not modify much things. ... call PrintChain ... mov Old_Se,ES ...
    (comp.lang.asm.x86)
  • Re: How to modify the contents of a message submitted by Outlook for internal delivery
    ... As you are talking about _internal_ messages, you could modify their content ... > messages submitted by Outlook. ... > delivery from a MAPI client and I can modify messages that are ... > are submitted directly to the store and that only a copy of the RFC822 ...
    (microsoft.public.exchange2000.development)
  • Re: How to modify the contents of a message submitted by Outlook for internal delivery
    ... As you are talking about _internal_ messages, you could modify their content ... > messages submitted by Outlook. ... > delivery from a MAPI client and I can modify messages that are ... > are submitted directly to the store and that only a copy of the RFC822 ...
    (microsoft.public.exchange2000.general)
  • Re: How to modify the contents of a message submitted by Outlook for internal delivery
    ... As you are talking about _internal_ messages, you could modify their content ... > messages submitted by Outlook. ... > delivery from a MAPI client and I can modify messages that are ... > are submitted directly to the store and that only a copy of the RFC822 ...
    (microsoft.public.exchange.development)