peparse/example/peparse_example.dart

30 lines
606 B
Dart
Raw Normal View History

2023-07-28 10:28:59 +00:00
import 'dart:io';
import '../lib/peparse.dart';
void main() {
const filepath = "D:\\software\\qq\\Bin\\QQ.exe";
File file = File(filepath);
var data = ReaderSeeker(file.readAsBytesSync());
var header = ImageDocHeader(data);
print(header.toString());
data.seek(header.elfanew);
var nt = ImageNtHeaders32(data);
print(nt.toString());
print(data.position);
var sections = <ImageSectionHeader>[];
for (var i = 0; i < nt.fileHeader.numberOfSections; i++) {
sections.add(ImageSectionHeader(data));
}
for (var section in sections) {
print(section.toString());
}
}