diff --git a/pycrate_sys/MBR.py b/pycrate_sys/MBR.py new file mode 100644 index 0000000..889f27d --- /dev/null +++ b/pycrate_sys/MBR.py @@ -0,0 +1,59 @@ +# -*- coding: UTF-8 -*- +#/** +# * Software Name : pycrate +# * Version : 0.3 +# * +# * Copyright 2018. Benoit Michau. ANSSI. +# * +# * This program is free software; you can redistribute it and/or +# * modify it under the terms of the GNU General Public License +# * as published by the Free Software Foundation; either version 2 +# * of the License, or (at your option) any later version. +# * +# * This program is distributed in the hope that it will be useful, +# * but WITHOUT ANY WARRANTY; without even the implied warranty of +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# * GNU General Public License for more details. +# * +# * You should have received a copy of the GNU General Public License +# * along with this program; if not, write to the Free Software +# * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# * 02110-1301, USA. +# * +# *-------------------------------------------------------- +# * File Name : pycrate_sys/MBR.py +# * Created : 2018-06-01 +# * Authors : Benoit Michau +# *-------------------------------------------------------- +#*/ + +from pycrate_core.elt import * +from pycrate_core.base import * +from pycrate_core.repr import * + +Buf.REPR_MAXLEN = 1024 + +class PTE(Envelope): + """Partition Table Entry + """ + _GEN = ( + Uint('Active', bl=1), + Uint('Status', bl=7, repr=REPR_HEX), + Uint24('CHSAddrFirst', repr=REPR_HEX), + Uint8('Type'), + Uint24('CHSAddrLast', repr=REPR_HEX), + Uint32('LBA'), + Uint32('NumOfSectors') + ) + +class MBR(Envelope): + """Master Boot Record + """ + _GEN = ( + Buf('Code', bl=0xDF0, rep=REPR_HD), + PTE('PTE_1'), + PTE('PTE_2'), + PTE('PTE_3'), + PTE('PTE_4'), + Uint16('55AA', rep=REPR_HEX) + ) diff --git a/pycrate_sys/__init__.py b/pycrate_sys/__init__.py new file mode 100644 index 0000000..d6fccba --- /dev/null +++ b/pycrate_sys/__init__.py @@ -0,0 +1,31 @@ +# -*- coding: UTF-8 -*- +#/** +# * Software Name : pycrate +# * Version : 0.3 +# * +# * Copyright 2018. Benoit Michau. ANSSI. +# * +# * This library is free software; you can redistribute it and/or +# * modify it under the terms of the GNU Lesser General Public +# * License as published by the Free Software Foundation; either +# * version 2.1 of the License, or (at your option) any later version. +# * +# * This library is distributed in the hope that it will be useful, +# * but WITHOUT ANY WARRANTY; without even the implied warranty of +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# * Lesser General Public License for more details. +# * +# * You should have received a copy of the GNU Lesser General Public +# * License along with this library; if not, write to the Free Software +# * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# * MA 02110-1301 USA +# * +# *-------------------------------------------------------- +# * File Name : pycrate_sys/__init__.py +# * Created : 2018-06-01 +# * Authors : Benoit Michau +# *-------------------------------------------------------- +#*/ +# +__all__ = ['MBR'] +__version__ = '0.3.0' diff --git a/setup.py b/setup.py index b00aa0a..595c6b8 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,7 @@ setup( "pycrate_csn1dir", "pycrate_mobile", "pycrate_corenet", + "pycrate_sys", ], test_suite="test.test_pycrate",