Wanted: Python module allowing direct access to raw sectors ofharddrives (MFT, boot sector, etc.) in MS Windows

Claudio Grondi claudio.grondi at freenet.de
Tue Oct 11 09:47:12 EDT 2005


Thank you for your reply, even if currently not
that interesting for me because after the first
CD writer for IDE were available I stopped to
use SCSI and didn't come back to it since then.

Does the Python open() command not work the
same way for SCSI drives as for IDE or USB
drives (I can't try it myself, because of above)?

Claudio
P.S. for those who are interested I have uploaded a
Python script I wrote for myself to have a reference to
this subject to:
http://people.freenet.de/AiTI-IT/Python/HowTo_AccessRawSectorsOfPhysicalDrives.py
:-)

"sam" <samschul at pacbell.net> schrieb im Newsbeitrag
news:1128986917.703980.35230 at z14g2000cwz.googlegroups.com...
> The following site contains my routines to access information from the
> Microsoft SCSIPASSTHROUGH layer under windows. These routines allow you
> to access the storage devices mounted under windows using SCSI
> commands. The dll that I provide will work with Python 2.3
>
> http://starship.python.net/crew/samschul/
>
> Sam Schulenburg
>
> Claudio Grondi wrote:
> > Thank you Jeff very much for your quick reply.
> > It saved me really much time of digging in the wrong direction.
> >
> > <jepler at unpythonic.net> wrote in
> > news:<mailman.1864.1128983425.509.python-list at python.org>...
> > >> I took the advice from this web page:
> > >> http://support.microsoft.com/kb/q100027/
> > Ok, I had found this page myself during Googling, but I have missed just
> > to try to use the described way of addressing physical devices with file
> > opening in Python.
> > It works as expected with harddrives so you are right that you are
getting
> > the MBR with the proposed code.
> >
> > After some not always happy end adventures with Python
> > scripting I am impressed by the power of the concept behind
> > the language once again.
> >
> > Claudio
> >
> > >>(I don't know how this extends to floppies, and the 9x family of OSes
> > isn't
> > >>listed in "applies to", so this may not help your case)
> > >>Here, I open "physical drive 0" and see that the magic number
indicates a
> > valid
> > >>boot record. I believe it is the MBR.
> > >>>>> f = open('\\\\.\\PhysicalDrive0', 'rb')
> > >>>>> f.read(512)[-2:]
> > >>'U\xaa' # that is, hex 55 AA
> > >>I don't know much about low-level filesystem or partition details--I
got
> > the
> > >>tidbit about the 55 AA magic number from
> >
>>http://www-uxsup.csx.cam.ac.uk/pub/doc/suse/sles9/adminguide-sles9/ch08.ht
> > ml
> > >>Jeff
> > >><jepler at unpythonic.net> schrieb im Newsbeitrag
> > news:mailman.1864.1128983425.509.python-list at python.org...
>







More information about the Python-list mailing list