Advertisement
Guest User

fatcon

a guest
Mar 25th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1.     startAt = all_bytes[sector_size + 4 + offset * sector_size:]
  2.     startCluster = (rootUpper + 1)
  3.    
  4.     if((myRange - 1) % 2 != 0):
  5.         endCluster = upper
  6.     else:
  7.         endCluster = myRange-1
  8.  
  9.     count = 0
  10.     start = rootUpper + 3
  11.     prevClusterValue = 0
  12.  
  13.     # print(startAt[500:560])
  14.     while count < endCluster:
  15.         cluster = startAt[count : count + 2]
  16.  
  17.         clusterValue = struct.unpack("<H", cluster)[0]
  18.  
  19.         if(cluster != b'\x00\x00'):
  20.             if(cluster == b'\xff\xff'):
  21.                 end = count + startCluster + 1
  22.                 result.append(str(start) + "-" + str(end) + " (" + str(end-start+1) + ") -> EOF")
  23.  
  24.             else:
  25.                 if(clusterValue - prevClusterValue > 1):
  26.                     # start = count + startCluster
  27.                     fragment = clusterValue * 2 + (rootUpper + 1) - 4
  28.                     start = count + startCluster
  29.                     # result.append(str(start) + "-" + str(count + clusterValue) + " (" + str(count + clusterValue-start+1) + ") -> " + str(fragment))
  30.                 prevClusterValue = clusterValue
  31.  
  32.         count = count + 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement