Comments (1)
Hi,
It's been a while the last time I looked at this and wasn't running this for quite a while now. However, from what I can recall:
@staticmethod
def get_offset_in_sb(fn):
off = 0
sb = EXT_SB
for i, v in sb:
if i == fn:
return off, sizeof(v)
off += sizeof(v)
return None, None
def read_superblock_in_dict(self, loc=SBLOCK_EXT2):
with open(self.fs, "rb") as f:
f.seek(loc)
for field in self.fields_sb:
self.sb[field[0]] = f.read(sizeof(field[1]))
def find_all_superblocks(self):
self.read_superblock_in_dict()
with open(self.fs, "rb") as f:
f.seek(0)
data = f.read()
# Using uuid because the EXT2 magic is too short to yield good results
matches = re.finditer(self.sb["e2fs_uuid"], data)
for m in matches:
bytearr = bytearray()
sb = m.span()[0] - 104
bytearr.append(data[sb + MAGIC_BYTES_OFF])
bytearr.append(data[sb + MAGIC_BYTES_OFF + 1])
if bytearr == EXT_MAGIC:
self.sb_locs.append(sb)
return self.sb_locs
This code was tested and ran with mostly ext2
at the time, as BSD had no full support for any of the advanced ext
features. It sounds that the naive pattern matching there fails for recent EXT-based file systems. In particular, the aforementioned sections would need some verification/updating and tests..
I'd be happy to test and merge a PR, as I currently don't have the time to fiddle with this myself :)!
from fisy-fuzz.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fisy-fuzz.