simple script to send notification on your phone on open door and more
This commit is contained in:
		
							
								
								
									
										23
									
								
								Investigation/tools/checkcrc.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Investigation/tools/checkcrc.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
def calc_crc(data):
 | 
			
		||||
    crc = 0xFFFF
 | 
			
		||||
    for pos in data:
 | 
			
		||||
        crc ^= pos 
 | 
			
		||||
        for i in range(8):
 | 
			
		||||
            if ((crc & 1) != 0):
 | 
			
		||||
                crc >>= 1
 | 
			
		||||
                crc ^= 0xA001
 | 
			
		||||
            else:
 | 
			
		||||
                crc >>= 1
 | 
			
		||||
    return crc
 | 
			
		||||
 | 
			
		||||
def checkLine(l):
 | 
			
		||||
   data = bytearray.fromhex(l)
 | 
			
		||||
   crc = calc_crc(data[:len(data)-2])
 | 
			
		||||
   return str(crc == int.from_bytes(data[-2:],byteorder='little', signed=False))
 | 
			
		||||
   #return "%04X %04X"%(crc,int.from_bytes(data[-2:],byteorder='little', signed=False))
 | 
			
		||||
   
 | 
			
		||||
 | 
			
		||||
with open("scan.txt") as f:
 | 
			
		||||
   for line in f:
 | 
			
		||||
       if len(line.strip()) > 0:
 | 
			
		||||
          print(line.strip() + "\t" + checkLine(line.strip()))
 | 
			
		||||
							
								
								
									
										15
									
								
								Investigation/tools/print.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								Investigation/tools/print.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
f=open("dump2.bin","rb")
 | 
			
		||||
def DataToHex(data):
 | 
			
		||||
   res = ""
 | 
			
		||||
   for c in data:
 | 
			
		||||
      res+=("%02X " % c)
 | 
			
		||||
   return res
 | 
			
		||||
 | 
			
		||||
while True:
 | 
			
		||||
   len = ord(f.read(1))
 | 
			
		||||
   timestamp1 = f.read(2)
 | 
			
		||||
   timestamp2 = f.read(2)
 | 
			
		||||
   data = f.read(len)
 | 
			
		||||
   print("%d:%d:%04X: %s" % (timestamp1[0]<<8|timestamp1[1],timestamp2[0]<<8|timestamp2[1], len,DataToHex(data)))
 | 
			
		||||
 | 
			
		||||
f.close()
 | 
			
		||||
		Reference in New Issue
	
	Block a user