flat assembler
Message board for the users of flat assembler.

flat assembler > DOS > 7-ZIP encryption | password in commandline | ISR & TSR !


7-ZIP and my hack :
The hack is great, no need to fix 7-ZIP anymore
33%
 33%  [ 1 ]
The hack is great, nevertheless Igor should fix 7-ZIP ASAP
33%
 33%  [ 1 ]
Useless, no need to hide the PWD
33%
 33%  [ 1 ]
No need to use encryption
0%
 0%  [ 0 ]
No need to use 7-ZIP at all, WinRK is great !!!
0%
 0%  [ 0 ]
Total Votes : 3

Author
Thread Post new topic Reply to topic
DOS386



Joined: 08 Dec 2006
Posts: 1904
Code:
; REAL MODE Resident & Multithreading (TSR&ISR) example, 8086-compatible
; (CL) 2008-09-27 by DOS386 P.D. | ABUSE at your own risk !!!
;
; Compile with FASM, but this should REALLY be no longer surprising Very Happy
; Results in a DOS ".COM" executable, 343 bytes -> bloat !!!
;
; WARNING: This tool does one arguably exotic task very well !!!!!!!!!!!!!!!!
; WARNING: Will be very evil if you try to type in a password !!!!!!!!!!!!!!!
;
; http://board.flatassembler.net/topic.php?t=9256

; INT $1C - TIME - SYSTEM TIMER TICK
; Desc:   this interrupt is automatically called on each clock
;         tick by the INT 8 handler
; Notes:  this is the preferred interrupt to chain when a program needs to
;         be invoked regularly
;         not available on NEC 9800-series PCs
; SeeAlso: INT 8, INT $E2 "PC Cluster"

; INT $21 - TERMINATE AND STAY RESIDENT
;    AH = $31
;    AL = return code
;    DX = number of paragraphs to keep resident
; Notes: the value in DX only affects memory block containing PSP
;        additional memory allocated via AH=$48 is not affected
;        the minimum number of paragraphs which will remain resident is $12
;        save mem by releasing enviro before (see #01378 at AH=$26, AH=$49)
;        open files remain open, so one should close any files which will
;        not be used before going resident; to access a file which is left
;        open from the TSR, one must switch PSP segments first (see AH=$50)

; --------V-M0040004A--------------------------
; MEM 0040:004A - VIDEO - COLUMNS ON SCREEN $044A
; Size:   WORD
; --------V-M00400050--------------------------
; MEM 0040:0050 - VIDEO - CURSOR POSITIONS $0450
; Size:   8 WORD's (!!!) | low XX high YY
; Desc:   contains row and column position for the cursors on 8 pages (?)
; --------V-M00400084--------------------------
; MEM 0040:0084 - VIDEO - ROWS ON SCREEN MINUS ONE $0484
; Size:   BYTE

format binary as "COM"
use16
org $0100

define pope pop

; **********
; *  Yeah  *
; **********

          mov   ah, 9
          mov   dx, tx1
          int   $21                 ; Yeah Very Happy

          xor   ax, ax
          mov   es, ax              ; "PUSHW 0" is not 8086 compatible

          mov   ax, [es:$72]        ; INT $1C "seg"
          mov   [vvint1c+2], ax
          mov   ax, [es:$70]        ; INT $1C "of***"
          mov   [vvint1c], ax

; Now we have the old target in "vvint1c" , let's fire the thing off !!!

          push  cs
          pope  di           ; "seg"
          mov   si, llisr    ; "of***"
          call  sset1c       ; !!! HOT !!!
          jmp   lltsr
          ;----------

vvint1c:  dd 0                      ; Here we store the old INT $1C target
tx0:      db "Enter password:"      ; 15 chars
tx1:      db 13, 10, "7-ZIP fix/hack | DOS only !!!", 13, 10
          db "(CL) 2008-09-27 by DOS386 P.D. | ABUSE at your own risk !!!"
          db 13, 10, 36

; ***************************
; *  SUB , setting INT $1C  *
; ***************************

; IN: {DI:SI} new target | DI is "seg" | SI is "of***"
; TR: nothing !!!

sset1c:   cli
          push  es
          push  ax

          xor   ax, ax
          mov   es, ax              ; "PUSHW 0" is not 8086 compatible
          mov   word [es:$72], di   ; "seg"
          mov   word [es:$70], si   ; "of***"

          pope  ax
          pope  es
          sti
          ret
          ;----

; *******************************
; *  Here our great ISR begins  *
; *******************************

; BEWARE: On entry DS = ??? !!!

llisr:

          ; Preserve
          push  ds
          push  es
          push  ax
          push  bx
          push  cx
          push  dx
          push  di                  ; We MAY NOT USE SI !!!

          ; Set DS
          push  cs
          pope  ds                  ; Legal in RM

          ; ES to ZERO area
          xor   bx, bx
          mov   es, bx

          ; PEEK screen stuff
          mov   cl, [es:$0451]      ; Cursor line position (YY)
          mov   ch, [es:$0484]      ; Height of screen - 1 !!!
          mov   dl, [es:$044A]      ; Width of screen
          sub   dl, 2               ; Make too low by 2
          shl   dl, 1               ; Now in bytes, too low by 4
          mov   dh, 0               ; Need full 16-bit later, DH is reserved

          ; ES to screen
          mov   di, $B800           ; Text
          mov   es, di              ; Preserving BX from above

; Scan the line (15 chars)

; AH : lines counter (YY)
; AL : char
; BX : "base" address, adds by lines, ZERO from above
; CL : const: cursor line position (YY)
; CH : const: screen height in lines - 1 (YY)
; DX : const: width in bytes - 4 !!!
; DI : byte or char index in line, adds by 1 or 2

          mov   ah, 0

gg0:      xor   di, di              ; MOVNTQ DI, 0

gg1:      shl   di, 1
          mov   al, [es:bx+di]      ; Peek char from screen
          shr   di, 1

          cmp   al, [tx0+di]        ; CMP against our string
          jne   gg2                 ; Not found in this line

          inc   di
          cmp   di, 15              ; Hot string size
          jne   gg1                 ; Continue search in the line

; Found the evil string !!!
; Start trashing after (!!!) it - just right - MUL DI by 2
; Find out how to trash best Very Happy

          shl   di, 1
          cmp   ah, cl              ; Cursor in this line ?
          jne   gg4                 ; NO, delete chars

; YES: trash attributes only for now

gg3:      inc   di                  ; Skip char
          mov   byte [es:bx+di], 0  ; Poke attr to screen: BLACK !!!
          inc   di
          cmp   di, dx              ; Line done (expect 2 chars) ?
          jne   gg3                 ; Delete char attributes
          jmp   short gg2           ; Done
          ;--------------

; NO: trash the characters, restore attributes

gg4:      dec   di
          mov   al, [es:bx+di]      ; Steal "standard attribute" AKA 7 Wink
          inc   di
gg5:      mov   byte [es:bx+di], 45 ; Poke char "-" to screen
          inc   di
          mov   [es:bx+di], al      ; Poke attr to screen
          inc   di
          cmp   di, dx
          jne   gg5                 ; Delete char & its attr
          jmp   short gg2           ; Done
          ;--------------

; Evil string not found in this line

gg2:      cmp   ah, ch
          je    gg6                 ; Bottom reached, evil string not found
          inc   ah                  ; Line counter
          add   bx, dx              ; Width - 4 bytes
          add   bx, 4               ; Add stolen 4 bytes also
          jmp   short gg0           ; Next line, next attempt
          ;--------------

; Overscan

gg6:      xor   dx, dx
          mov   es, dx              ; "PUSHW 0" is not 8086 compatible
          mov   ax, [es:$046C]
          shr   ax, 1               ; SHR by > 1 is not 8086 compatible
          shr   ax, 1
          call  ssover

          pope  di
          pope  dx
          pope  cx
          pope  bx
          pope  ax
          pope  es
          pope  ds
          jmp   far [cs:vvint1c]
          ;---------------------

; OVERSCAN stuff
;
; Input colour in AL / AX
; Trashes AX and DX !!!

ssover:   push  ax           ; No BYTE PUSH after 8080 Sad((
          mov   dx, $03DA    ; Make sure in index mode in VGA
          in    al, dx
          mov   dx, $03BA    ; Make sure in index mode in EGA Very Happy
          in    al, dx
          mov   dx, $03C0    ; "ATC" hack
          mov   al, $11      ; Set border/overscan color
          out   dx, al
          pope  ax
          and   al, $1F
          out   dx, al
          mov   al, $20      ; Finalize it
          out   dx, al
          ret
          ;----

; Go TSR now !!!

lltsr:    mov   ax, $3100
          mov   dx, $28      ; $28 -> $0280 bytes resident, PSP hogs $0100 !
          int   $21          ; Go TSR !!!
          ;--------

    if ($ > $0270)
      error "You have a bloat problem !!!"
    end if

; END.
    


Download now (3'340 Bytes) :
http://board.flatassembler.net/download.php?id=3981

I fixed (or hacked Shocked ) what Igor was unable to fix within years (see 7-ZIP support forum) Smile

DOS only !!! But feel free to port, it's open source & public domain Confused
Post 27 Sep 2008, 11:16
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
Ummm, what exactly does it do?

_________________
----> * <---- My star, won HERE
Post 27 Sep 2008, 21:07
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16782
Location: In your JS exploiting you and your system
It appears to be a method to obscure/hide a password on the screen.

But why the hack? Would it not be easier to change the source code and recompile? 7-Zip is open source! That is kind of the point of open source so one can change it to suit one's needs/wants!
Post 28 Sep 2008, 04:41
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
revolution wrote:
appears to be a method to obscure/hide a password on the screen.


Very true Smile

Quote:
But why the hack? Would it not be easier to change the source code and recompile?


Regrettably NO. Sad

Quote:
7-Zip is open source! That is kind of the point of open source so one can change it to suit one's needs/wants!


I am aware if this. Regrettably I am not compatible with C++ Sad

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 28 Sep 2008, 06:18
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16782
Location: In your JS exploiting you and your system
DOS386 wrote:
Regrettably I am not compatible with C++
Why? What are the minimal requirements for C++? Perhaps you could consider rewiring your neural network.
Post 28 Sep 2008, 07:07
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
> Perhaps you could consider

dropping FASM ? Crying or Very sad

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 28 Sep 2008, 07:29
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16782
Location: In your JS exploiting you and your system
DOS386 wrote:
dropping FASM ?
If it requires dropping something then I suggest dropping DOS.
Post 28 Sep 2008, 07:43
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
revolution wrote:
then I suggest dropping DOS.


Excellent , revolutionary idea Shocked

Still, this is a FASM forum IIRC ...

Anyway, does 7-ZIP compile well for you ?
Post 28 Sep 2008, 08:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16782
Location: In your JS exploiting you and your system
DOS386 wrote:
Anyway, does 7-ZIP compile well for you ?
I've never tried, I am not compatible with C++ Razz
Post 28 Sep 2008, 08:38
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
revolution wrote:
never tried, I am not compatible with C++ Razz


COOL. At least we brewed 10 useless posts "helping" the DOS subforum today Very Happy
Post 28 Sep 2008, 08:52
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.