[Solved] Trying to grep a hex pattern from a binary dump - not working

Hi all, I'm not sure if this is the right forum but as it is related to a scripting course I'm doing I couldn't see anywhere more suitable.
I have a raw disk dump that contains several jpeg images etc...  I'm trying to make a carving utility to extract the images using bash and ultimately grep to do the heavy lifting.
What I'm trying to do is to grep hex escaped character values within the raw disk dump to find the location where a jpeg image starts.  The jpeg image file header in hex is "ffd8ff".  The most straight forward example I could find for how to achieve this was from here: http://www.commandlinefu.com/commands/v … l-patterns
According to that page I should be able to execute grep -P "\xff\xd8\xff" diskdump.raw in order to be able to get some sort of match, however in spite of my certainty that there are a number of jpeg images in the disk dump (I created the disk dump) and the fact that I can use hex dump utilities to confirm the presence of the matching header grep is refusing to play ball and acknowledge a match. I don't know what to do, other people on the course are able to use grep this way with different distributions.
Does anyone know if this is a known issue, has anyone come across it before and, better yet, does anyone know how I can get grep to bend to my will on Arch?
Thanks in advance,
B
Last edited by Baz_ (2015-04-03 08:55:11)

Trilby wrote:
I think you'll need the -a flag for grep (unless you use ewaller's od approach):
man grep wrote:-a, --text
        Process a binary file as if it were text; this is equivalent to the --binary-files=text option.
I have tried "grep -a ...", "grep -Pa ..." and the version that works for my class mate "grep -obPa ..." plus several other variations of the above and none of them work.
I have a working version of a carver similar to ewaller's idea using a hexdump utility (xxd) rather than od but because of the fact that the header and footer could roll over from one line to another it is extremely inefficient as it requires two searches through the file to ensure that you have found the earliest header (the second search pads a few characters to the front of the raw dump depending on the size of the header).
The ability to search for a string of characters by their hex values with grep would lead to much more efficient code.
I don't suppose grep is due an update soon that might cause it to do what I want? Or even better is someone knows how to get grep as it stands to do what I want?
Thanks for your posts so far guys, much appreciated.
B

Similar Messages

  • I tried to reset my Iphone 5 from the phone and not a computer.  I have had a blank screen with the apple logo and a full progress bar for over an hour.  I cant turn my phone off because the button on top is not working.

    I tried to reset my iphone 5 from the phone and not a computer.  I have had a blank screen with the apple logo and a full progress bar.  I can not get my phone to restart.  What can I do?

    Sorry i meant iOs5 to ios 5.0.1

  • HT201210 trying to download an instal ios 7 on my iphone 4s, after half an hour into the download it came up with a message saying failed and everytime i try again the download doesnt start. tried downloading from itunes aswel but not working. anyone know

    trying to download an instal ios 7 on my iphone 4s, after half an hour into the download it came up with a message saying failed and everytime i try again the download doesnt start. tried downloading from itunes aswel but not working. anyone know why?

    The servers are overloaded. There are a hundred million people all trying to download iOS 7 at one time. Try again later

  • HT201412 Safari could not open the page because the server stopped responding- new ipad mini's (2 from separate places) are not working with At & T router but computers work. Can you please help me. I've tried everything. Thanks ya'll!

    Safari could not open the page on my new ipad mini's because the server stopped responding- new ipad mini's (2 from separate places) are not working with At & T router but computers work fine. Yesterday I got it to work. Weird. Can you please help me. I've tried everything. Thanks ya'll!

    Hello SavannahSweetie,
    I was looking into the issue you are desribing, and found a great article for troubleshooting wifi connections with iOS devices. It's called iOS: Troubleshooting Wi-Fi networks and connections and can be found here: http://support.apple.com/kb/ts1398.
    Start with this section, and work your way down if needed.
    Basic troubleshooting
    Tap Settings > Wi-Fi and turn Wi-Fi off and then on again.
    Verify that you are in range of your Wi-Fi router or base station.
    Confirm that your Wi-Fi router and Cable/DSL modem are connected to power and turned on.
    Check whether other devices (portable computers, for example) are able to connect to the Wi-Fi network and access the Internet.
    Update your Wi-Fi router to the latest firmware.For AirPort Base Stations, refer to this article for information about firmware updates. For third-party Wi-Fi routers, check the manufacturer's website for details on updating your firmware.
    Restart your iOS deviceHold the On/Off button until "slide to power off" appears. Slide to power off your device. When it is off, press the On/Off button to turn it back on.
    All the best,
    Sterling

  • Yesterday suddenly the sound output from my Headphone is not working

    Hi, I've Mac Book Pro 15" with Retina display. Yesterday suddenly the sound output from my Headphone is not working. When I tried to solve this, I've noticed in system preferences it's jumping from Internal speakers to Head phone and vice versa. Can anyone help me on this issue please? I am using the original Apple Headset only.
    Thanks
    Babu
    <Re-Titled By Host>

    Tell us:
    OS X version ?
    What may have changed prior to the onset of the issue of "... suddenly... not working..." and " ... preferences ... jumping from ..." ? Software added, upgraded, updated?
    what precidely do you mean by " ... preferences ... jumping from ..." ?
    ÇÇÇ
    EDITadded
    I see that your Question has languished for some period of time without response. You have posted your issue in Using Apple Support Communities whose topic is 'How to use this forum software's interface, features and/or how to find what you wish'. It is a relatively low traffic and inappropriate forum for your problem. I will ask our Hosts to move it to " MacBook Pro " where it may get a more rapid response from your fellow users.
    endEDIT

  • I am trying to setup my new time capsule but it is not working. after entering the airport utility and locating the TC, after I tell the program to continue, the unit just disappear and the setup menu says there is an error. Any idea of what is happening?

    I am trying to setup my new time capsule but it is not working. after entering the airport utility and locating the TC, after I tell the program to continue, the unit just disappear from the menu and the setup menu says there is an error. I tried using the wireless connection, and also the cable, but none worked. Any idea of what could be happening?

    What are you setting it up as.. join wireless network .. the very worst setup, it will disappear.. reboot the whole network in order modem. router TC.. clients and it will likely reappear.
    Tell us what network setup you are using..
    If you setup with cable to a computer completely isolated from the network with TC also isolated.. finish the setup of everything you want. .before update.. then plug it into the network. .then restart everything in correct order.. it will work most of the time.

  • When trying to PDF a webpage into a PDF, it does not work, I go through all the steps as normal, and It does nothing. I can repeat my action, where instead of "printing" to adobe, it saves the file, which it doesn't save it at all. I can't even find the o

    When trying to PDF a webpage into a PDF, it does not work, I go through all the steps as normal, and It does nothing. I can repeat my action, where instead of "printing" to adobe, it saves the file, which it doesn't save it at all. I can't even find the original in my work folder. I need to know how to stop this from happeing and get it back to the way it has been working he last 6 months since i purchased this program.

    Hi pissedadobeuser,
    Does this issue occur with any particular web page?
    Are you able to print the webpage to 'Adobe PDF' to convert it to pdf.
    Which Browser version, OS version and Acrobat version are you using?
    Regards,
    Rave

  • The "always match my default message font" option in the Signature preferences from Mac Mail does not work if e-mail is received in other Mail Software. How can I make it work?

    The "always match my default message font" option in the Signature preferences from Mac Mail does not work if e-mail is received in other Mail Software. How can I make it work?

    I found this plugin which solved pretty much all of my mail font rendering problems.  It is designed for Lion, so don't know whether it will work but thought I would offer it up.
    http://noware-it.zxq.net/

  • Wish to post KeyNote file as pdf. Export from KN to iW not working

    Wish to post KeyNote file as pdf. Export from KN to iW not working - get blank screen. Tried to upload PDF to mobile me and link to that file - also didn't work. I'm not familiar with iFrames but have read about them in this forum - is that my only option? Why wouldn't a KN export work?
    Thanks, Brian

    I have just tried this with a test site and publishing to a folder and it does work perfectly for me.
    I had a Keynote document already so all I did was click on File and then selected the Print option. I then selected the save as pdf option the the pdf document was created on my desktop instantly.
    All I then did was open iWeb and type some words in a text box My Prices. I then highlighted My Prices and opened the Inspector and went to Hyperlink and clicked on the option Hyperlink to a file. I then selected the pdf file from my desktop.
    I then used ftp to a folder on my desktop and when I opened the appropriate page, I click on the words My Prices and the pdf file opened straight away.
    As OT has suggested, check that you have linked to the correct file. If it does not work, either you have not created the pdf correctly or at all or you have not linked to the correct file.
    As I said, it worked for me.

  • Help!!! I can not make or receive calls! other functions itself. Internet, sms, whatsapp work. I restored as new iphone from the phone and from itunes and still not working.

    I can not make or receive calls! other functions itself. Internet, sms, whatsapp work. I restored as new iphone from the phone and from itunes and still not working.
    Sorry for my english i'm spanish

    I have not tried that...I will look up the process so that I can do it correctly (and still transfer all of my files, contacts, etc).  Any suggestions?  What is the advantage of restoring as a new device..is this more akin to a complete wipe of a hard drive?

  • Trying to get a refund on an app that do not work, but the report a problem button is grey out

    Hi
    I'm trying to get a refund on an app that do not work, but the report a problem button is gray out & Apple wants £20.00 for support
    where do I go from here
    Thanks

    To report a problem less than 90 days:
    http://reportaproblem.apple.com
    Sign in with the AppleID and Password used for the purchase.
    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBooks Store purchase
    http://support.apple.com/kb/HT1933
    To report a problem greater than 90 days:
    http://www.apple.com/support/itunes/store

  • HT204407 Find my friends Icon disappeared after upgrade to ios 8. I tried restarting as well as reinstalled the app but its not working. I can find it in Usage, but not in spot light. Pla help!!j

    Find my friends Icon disappeared after upgrade to ios 8. I tried restarting as well as reinstalled the app but its not working. I can find it in Usage, but not in spot light. Pla help!!

    I have exactly the same problem on a 4S on iOS 8. Have tried uninstalling, deleting FMF from backup, resetting phone and restoring from backup, but the problem remains. Sometimes the icon appears on a backup Home screen in iTunes, but it never appears on the phone itself. The app is accessible by going to the store, purchases and opening it from there. The app appears to have been running the whole time, but becomes invisible anytime I return to the home screen.

  • Wireless keyboard numbers from 1-9 are not working .

    My wireless apple keyboard numbers from 1-9 are not working. No water was spilt on it and tried the numlock.
    I asked local store and he said that i should purchase a new one which i don't want to.
    Is there a solution ?? Please help

    Hi jacky256,
    If you are having issues with your Apple Wireless Keyboard, try the steps in the article below.  The section "Keyboard has one ore more keys that do not respond" may shed some light on this issue.
    Troubleshooting wireless mouse and keyboard issues - Apple Support
    https://support.apple.com/en-us/ts3048
    Regards.
    - Judy

  • Hi i have bought an iphone from dubai but its not working in pakistan

    hi i have bought an iphone from dubai but its not working in pakistan its not syncing my phone displaying mesage that invalid sim card. I have changed sim card but its not working. Can you please help to to make it work. Its a pay as u go phone.

    Fais1 wrote:
    I have called to the shop where i bought the phone they told me that phone is not locked. I have tried so many times but phone is not working vth any sim a part from the one i have bought from dubai. Pls let me know how to check that phone is locked or not. Thanks
    And, of course, they would NEVER lie to you after they already have your money...

  • Iphone 4: Home Button Not Working. The home button only works when it is connected to iTunes, once i disconnet it does not work, i have tried a restore to factory settings but it still is not working. Any suggestions?

    iphone 4: Home Button Not Working. The home button only works when it is connected to iTunes, once i disconnet it does not work, i have tried a restore to factory settings but it still is not working. Any suggestions?

    Apple, as I said, does not repair your iPhone. All hardware service issues are handled by replacing the unit. So they can't handle the home-button issue without also addressing the issue of the cracked screen, for which they'll almost certainly charge you. But you can make an appointment at an Apple Store or call Apple tech support and plead your case.
    Regards.

Maybe you are looking for

  • How do I add pages to a photo book with the same number of photos per page.

    I want to add a photo book, select all the pages and tell the book to be 4 photos per page. And when I add new pages, I want those to have 4 photos. When ever I add, it just selects a random page and then I have to manually change that page to have 4

  • 3G or E not showing up on phone and internet not working

    I have a 3G phone and saw it said no service the other day so I rebooted and it had ATT with the bars but no 3G or E. Therefore I have no internet service unless on WIFI, am 9 days out of warrenty, and my husband's 3G is working fine on his iphone 4.

  • Vinyl records (yes)played thru computer

    Ok, I have  an HP media center m8013w  running Vista Home Premium ,which does more than I have learned how to use at this point. I have recently recovered some very (30+ year) old vinyl records that I owned in a previous life. I have a good quality t

  • Too Many open files in Solaris 10

    hi, I had an open files issue and updated the no of files descriptors with the following command(Solaris 10 running on SPARC) projmod -s -K 'process.max-file-descriptor=(basic,8192,deny)' PROJECTNAME i wanted to check is there any way to know if the

  • Finding field name

    Hi friends, I have to add two fields in a customer based report , i know only the description of field name 'Customer comments' and 'contact notes'. in which table i have to search for getting SAP database field. i have searched in customer master da