Advertisement
miraip0ts

hex

Mar 29th, 2017
1,021
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2. # -*- coding: utf-8
  3.  
  4. import sys, sys, os, re, binascii
  5.  
  6. binarys = [
  7.     "dlr.arm:arm.hex",      #arm
  8.     "dlr.arm7:arm7.hex",    #arm7
  9.     "dlr.m68k:m68k.hex",    #m68k
  10.     "dlr.mips:mips.hex",    #mips
  11.     "dlr.mpsl:mpsl.hex",    #mpsl
  12.     "dlr.ppc:ppc.hex",      #ppc
  13.     "dlr.sh4:sh4.hex",      #sh4
  14.     "dlr.spc:spc.hex",      #spc
  15.     "dlr.x86:x86.hex"       #x86
  16.     ]
  17.  
  18. def insert_slashx(string, every=2):
  19.     return '\\x'.join(string[i:i+every] for i in xrange(0, len(string), every))
  20.  
  21. def splitCount(s, count):
  22.      return [''.join(x) for x in zip(*[list(s[z::count]) for z in range(count)])]
  23.  
  24. for bin in binarys:
  25.     try:
  26.         Input = bin.split(":")[0]
  27.         Output = bin.split(":")[1]
  28.         hexify = '\\x'+insert_slashx(binascii.hexlify(open(Input).read()))
  29.         echoify = "echo -en \'"+'\' >>lno\necho -en \''.join(splitCount(hexify,(64*2))) + '\' >>.bot'
  30.         f = open(Output, "w")
  31.         f.write(echoify)
  32.         f.close()
  33.     except:
  34.         pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement