flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > linux data recovery program....need help

Author
Thread Post new topic Reply to topic
theoldnyx



Joined: 06 May 2007
Posts: 3
theoldnyx
well iam trying to write a data recovery program in assembly the program will target ext2 file system this is the first time for me to code in assembly
so i want to make it very simple here is what i know
-in ext2 file system after deleting the files the OS mark the file blocks as unallocated but the inode table still hold the file meta data so all what i have to do is to read the blocks that contain the files and recreate the file

the problems are :
1- i don't know how to read the inode table in asm?
2-if the file is scattered on more than one block how to but it all back or recreate it again?

Guys any thing will help tutorials,links,books,source codes just point me and i will do the rest

thanks
Post 06 May 2007, 18:51
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
vid
all you need should be in ext2 driver in linux sources
Post 06 May 2007, 20:17
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
arafel



Joined: 29 Aug 2006
Posts: 131
Location: Jerusalem, Israel
arafel
Post 07 May 2007, 20:09
View user's profile Send private message Reply with quote
theoldnyx



Joined: 06 May 2007
Posts: 3
theoldnyx
well guys i got most of the parts but only one piece is missing i got the block number of the deleted file so what i want to do is to write an asm code to seek to this block copy the data to another destination after searching i was n't able to find how to do so through assembly i got only one book called IMB PC assembly language and programming the code and interrupts are in this book but it was written for windows so any one know how to do it in assembly
Post 09 May 2007, 17:00
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
One thing i am not sure about, from reading your topic, is will your data recovery be run from a linux distro or are you coding on bear metal ( eg: no OS ) ?.
If its on top of linux try this:
If it with no OS let me know and i will give example.


Last edited by Dex4u on 10 May 2007, 17:20; edited 1 time in total
Post 09 May 2007, 19:13
View user's profile Send private message Reply with quote
theoldnyx



Joined: 06 May 2007
Posts: 3
theoldnyx
yes it's on top of linux and thanks for the system calls but i still unable to understand how to use sys_lseek or read i mean those are for files how can i use it for the hdd to read certain block?
thanks
Post 09 May 2007, 21:05
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
First i have deleted that link because it seems, to have been spammed Sad.
The way i would get info would be too, take a look at "system.inc" in the fasm source code for linux, there examples of all you need, in there.

Here is a simple example of how i would do it, (note: not tested) of
Move the file-pointer to the end of the file, with lseek.
Code:
        ; Some setup code goes here.        mov eax,5                  ;  eax = function 5 (open a file)        mov ebx,fil                ;  ebx = pointer to the file to open        mov ecx,2                  ;  opening flags (0=r/o 1=w/o 2=r/w)        int 80h                    ;  call linux   test    eax,eax       js      FileError            mov   dword[handle],eax           mov     ebx,[handle]         ; file handle     mov     ecx,ecx              ; zero ecx       xor     edx,edx              ; zero edx       mov     dl,2                 ; seek to end        call    lseek                ; call function        mov     dword[FileSize],eax  ; Save file size       ; Some more code would go here.;******************************************************; lseek  ;****************************************************** lseek: mov     eax,19               ; function number (19 lseek)     int     0x80                 ; call linux     retFileError:        mov   eax,1        xor   ebx,ebx        int   80h   fil   db "test.txt",0handle   dd 0FileSize dd 0    


Please not, i normal do not code in linux, but if i did i would code it like the above, i do use linux Wink.

[EDIT] I just reread you ? and this may help: http://www.linux.com/howtos/SCSI-2.4-HOWTO/rawdev.shtml
Post 10 May 2007, 19:19
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.