> > Sure, if you can tell me how to get the blob? gcc find_ibft.c -o find_ibft sudo ./find_ibft blob
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi@googlegroups.com To unsubscribe from this group, send email to open-iscsi+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/open-iscsi -~----------~----~----~----~------~----~------~--~---
#include <stdio.h> #include <errno.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <ctype.h> #include <stdint.h> const char *filename = "/dev/mem"; int main(int argc, char *argv[]) { int fd = 0; unsigned char *fbuf; unsigned char *p; struct stat buf; int i,len; unsigned int len_p; fd = open(filename, O_RDONLY); if (fd <= 0) { printf("Could not open; err: %d(%s)\n", errno, strerror(errno)); return errno; } if (stat(filename, &buf) != 0) { printf("Could not open; err: %d(%s)\n", errno, strerror(errno)); return errno; } len = 0x100000; // Up to 1MB. fbuf = mmap(0, len, PROT_READ, MAP_PRIVATE, fd, 0); if (fbuf == MAP_FAILED) { printf("Could not map: error: %d(%s)\n", errno, strerror(errno)); return errno; } len_p = 0; for (p = fbuf; p < fbuf + 0x100000; p += 4) { if (memcmp(p, "iBFT", 4) == 0) { len_p = *(unsigned int *)(p + 4); printf("iBFT detected. (%d)\n", len_p); break; } } if (len_p) { if (argc > 1) { int outfd; outfd = open(argv[1], O_RDWR|O_CREAT, 0644); if (outfd != -1) { write(outfd, p, len_p); close(outfd); } } printf("(%lx): DATA:\n", p); for (i = 0; i < len_p; i++) { if ((i % 70) == 0) printf("\n%.3x: ", i); if (isgraph(p[i])) printf("%c", p[i]); else printf("_"); // putchar(fbuf[i]); } printf("\n"); } else { printf("Bummer. No iBFT found.\n"); } if (munmap(fbuf, len)) { printf("Could not unmap: %d(%s)\n", errno, strerror(errno)); return errno; } close(fd); return 0; }