Advertisement
Guest User

code

a guest
Dec 21st, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. private void FindFile () {
  2. // TODO Auto-generated method stub
  3.  
  4. String S1;
  5. S1 = "4F 45 4D 5F 49 4E 46 4F 03 00 00 00 12 00 00 00";
  6. String S2;
  7. int x;
  8.  
  9. for (x = 1; x < 2; x++) {
  10.  
  11. try {
  12.  
  13. File file = new File("/storage/emulated/0/oeminfo.img");
  14. RandomAccessFile raf = new RandomAccessFile(file, "r");
  15.  
  16. Log.d(TAG, "Position to start: " + a);
  17. raf.seek(a);
  18. byte[] arr = new byte[16];
  19. raf.readFully(arr, 0, 16);
  20. StringBuilder sb = new StringBuilder();
  21. for (byte b : arr) {
  22. sb.append(String.format("%02X ", b));
  23. }
  24. S2 = sb.toString();
  25. Log.d(TAG, "We found: " + S2);
  26. Log.d(TAG, "NO found: " + S1);
  27.  
  28. if (S2 != S1) {
  29. Log.d(TAG, "Still not found. Searching next");
  30. a=a+16384;
  31. x=x-1;
  32. Log.d(TAG, "---------------SEPARATOR---------------");
  33. }
  34.  
  35. else {
  36. Log.d(TAG, "We find int! Start file Address: " + a);
  37. x=x+2;
  38. }
  39.  
  40. } catch (Exception e) {
  41. e.printStackTrace();
  42. }
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement