Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import binascii,struct
- class tools:
- def __init__(self, processid): #Default class params
- self.processid = processid
- def find_target_range(self):
- target = int("5afe708",16)
- maps_file = open("/proc/{}/maps".format(self.processid), 'r')
- for line in maps_file.readlines(): # for each mapped region
- splitter = line.split(" ") #Split the line into spaces
- region_low = int(splitter[0].split("-")[0],16) #region low of chunk
- region_high = int(splitter[0].split("-")[1],16) #region high of chunk
- if target > region_low:
- if target < region_high:
- returndata = {"region_low" : region_low,
- "region_high" : region_high}
- return(returndata)
- def find_mana_address(self,heapdata):
- print("Scanning memory , this could take a few seconds....")
- mem_file = open("/proc/{}/mem".format(self.processid), 'rb')
- region_low=heapdata["region_low"]
- region_high=heapdata["region_high"]
- mem_file.seek(region_low) #Goto the start address of our heap
- memoryposition = region_low #Just a buffer so we know what address we are at currently
- while memoryposition<region_high: #Stop searching when we exit end of heap
- memoryposition = memoryposition +8
- chunks=""
- count = 0
- while count<8: #Read every 8 bytes and stick them into a string
- count=count+1
- chunk = binascii.hexlify(mem_file.read(1))
- chunks = chunks + str(chunk)
- shifted_bytes = chunks.upper()
- if shifted_bytes == "F0AA780100000000":
- print("Signature found at - " + str(memoryposition))
- int_memory_address = (memoryposition+120)
- print("Memory address is - " + str(int_memory_address))
- return int_memory_address
- def read_address(self,address,size):
- mem_file = open("/proc/{}/mem".format(self.processid), 'rb')
- mem_file.seek(address) # seek to region start
- count = 0
- chunks = ""
- while count<size:
- count=count+1
- chunk = binascii.hexlify(mem_file.read(1))
- chunks = chunks + str(chunk)
- shifted_bytes = ("".join(map(str.__add__, chunks[-2::-2] ,chunks[-1::-2]))) #Split each byte and then reverse its order (but dont reverse the actual byte)
- value = (int(shifted_bytes,16))
- return value
- def ManaLoop(self,mana_memory_address):
- #This will just loop reading our mana amount and print whenever it changes. We could add sendhotkey here if mana is below X value ect to make
- #A safe cheat tool this should be on a thread really but its just a e.g:
- lastmana_value = 0 #Just a buffer
- while 1==1: #Loop forever
- mana_amount = self.read_address(mana_memory_address,4)
- if not lastmana_value == mana_amount:
- print("Mana Changed To :" + str(mana_amount))
- lastmana_value= mana_amount
- if __name__ == "__main__":
- #This is only true if this python file is ran directly
- test_process_id = 14982 #We can just get this from system monitor
- testhandler = tools(test_process_id)
- heapdata = (testhandler.find_target_range())
- mana_memory_address = testhandler.find_mana_address(heapdata)
- testhandler.ManaLoop(mana_memory_address)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement