示例#1
0
 def encDecoderLoopBuilder(self, input):
    output = ''
    if len(input) == 0:
       return output
    for p in input:
       if not alphanum_byte.alphanumeric_check(p):
          output += chr(alphanum_byte.alphanumeric_get_byte())
       else:
          output += p
    return output
示例#2
0
 def encDecoderLoopBuilder(self, input):
    output = ''
    if len(input) == 0:
       return output
    for p in input:
       if not alphanum_byte.alphanumeric_check(p):
          output += chr(alphanum_byte.alphanumeric_get_byte())
       else:
          output += p
    return output
示例#3
0
    def algo2(self):
        output = ''
        self.size += 4
        #SUBMIS rk, ri, #x*/
        output += ARM_Instructions.dpimm(SUB, MI, 1, self.k, self.i, self.x)
        #SUBPLS rk, ri, #x*/
        output += ARM_Instructions.dpimm(SUB, PL, 1, self.k, self.i, self.x)
        #SUBPL rj, ri, #x*/
        output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.i, self.x)

        quo = (self.size - 4) / 0x7a
        if quo >= 1:
            for p in range(quo):
                #SUBPL rj, rj, #0x7a*/
                output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.j,
                                                 0x7a)

        rem = (self.size - 4) % 0x7a
        if rem >= 1 and rem <= 0x4a:
            self.addr_offset = alphanum_byte.off_gen(rem)
            #SUBPL rj, rj, #(offset+rem)*/
            output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.j,
                                             self.addr_offset + rem)

        if rem >= 0x4b and rem < 0x7a:
            if alphanum_byte.alphanumeric_check(rem):
                self.addr_offset = alphanum_byte.alphanumeric_get_byte()
                #SUBPL rj, rj, #(rem)*/
                output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.j,
                                                 rem)
                #SUBPL rj, rj, #(offset)*/
                output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.j,
                                                 self.addr_offset)
            else:
                self.addr_offset = alphanum_byte.off_gen(rem - 0x5a)
                #SUBPL rj, rj, #0x5a*/
                output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.j,
                                                 0x5a)
                #SUBPL rj, rj, #(offset + (rem - 0x5a))*/
                output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.j,
                                                 self.addr_offset + rem - 0x5a)

        #SUBPL raddr, pc, rj ROR rk*/
        output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, 15, self.j,
                                              ROR, self.k)
        return output
示例#4
0
   def algo2(self):
      output = ''
      self.size += 4
      #SUBMIS rk, ri, #x*/
      output += ARM_Instructions.dpimm(SUB, MI, 1, self.k, self.i, self.x)
      #SUBPLS rk, ri, #x*/
      output += ARM_Instructions.dpimm(SUB, PL, 1, self.k, self.i, self.x)
      #SUBPL rj, ri, #x*/
      output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.i, self.x)

      quo = (self.size - 4) / 0x7a
      if quo >= 1:
         for p in range(quo):
            #SUBPL rj, rj, #0x7a*/
            output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.j, 0x7a)

      rem = (self.size - 4) % 0x7a
      if rem >= 1 and rem <= 0x4a:
         self.addr_offset = alphanum_byte.off_gen(rem)
         #SUBPL rj, rj, #(offset+rem)*/
         output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.j, self.addr_offset + rem)

      if rem >= 0x4b and rem < 0x7a:
         if alphanum_byte.alphanumeric_check(rem):
            self.addr_offset = alphanum_byte.alphanumeric_get_byte()
            #SUBPL rj, rj, #(rem)*/
            output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.j, rem)
            #SUBPL rj, rj, #(offset)*/
            output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.j, self.addr_offset)
         else:
            self.addr_offset = alphanum_byte.off_gen(rem - 0x5a)
            #SUBPL rj, rj, #0x5a*/
            output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.j, 0x5a)
            #SUBPL rj, rj, #(offset + (rem - 0x5a))*/
            output += ARM_Instructions.dpimm(SUB, PL, 0, self.j, self.j, self.addr_offset + rem - 0x5a)

      #SUBPL raddr, pc, rj ROR rk*/
      output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, 15, self.j, ROR, self.k)
      return output
示例#5
0
   def algo1(self, input, begin_inp, iter):
      if len(input) == 0:
         return ''
      output = ''
      offset = 0x91
      for p in range(begin_inp, begin_inp + iter):
         y = ord(input[p])
         if alphanum_byte.alphanumeric_check(y):
            #SUBPL raddr, raddr, rj ROR rk*/
            output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)
            self.size += 4
            continue
         if y >= 0x80:
            if alphanum_byte.alphanumeric_check(~y):
               #EORPLS rk, rj, #~y*/
               output += ARM_Instructions.dpimm(EOR, PL, 1, self.k, self.j, ~y)
               #STRMIB rk, [raddr, #(-offset)]*/
               output += ARM_Instructions.lsbyte(STR, MI, self.k, self.addr, offset)
               #SUBMIS rk, ri, #x*/
               output += ARM_Instructions.dpimm(SUB, MI, 1, self.k, self.i, self.x)
               #SUBPL raddr, raddr, rj ROR rk*/
               output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)

               self.size += 4 * 4
               continue

            a = alphanum_byte.alphanumeric_get_complement(~y)
            b = (a ^ ~y) & 0xff
            #EORPLS rk, rj, #a*/
            output += ARM_Instructions.dpimm(EOR, PL, 1, self.k, self.j, a)
            #EORMIS  rk,  rk, #b*/
            output += ARM_Instructions.dpimm(EOR, MI, 1, self.k, self.k, b)
            #STRMIB rk, [raddr, #(-offset)]*/
            output += ARM_Instructions.lsbyte(STR, MI, self.k, self.addr, offset)
            #SUBMIS rk, ri, #x*/
            output += ARM_Instructions.dpimm(SUB, MI, 1, self.k, self.i, self.x)
            #SUBPL raddr, raddr, rj ROR rk*/
            output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)

            self.size += 4 * 5
            continue
         if self.x > y:
            z1 = self.x - y
            if alphanum_byte.alphanumeric_check(z1):
               #SUBPL rk, ri, #z*/
               output += ARM_Instructions.dpimm(SUB, PL, 0, self.k, self.i, z1)
               #STRPLB rk, [raddr, #(-offset)]*/
               output += ARM_Instructions.lsbyte(STR, PL, self.k, self.addr, offset)
               #SUBPL raddr, raddr, rj ROR rk*/
               output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)

               self.size += 4 * 3
               continue
         z2 = self.x + y
         if alphanum_byte.alphanumeric_check(z2):
            #RSBPL rk, ri, #z*/
            output += ARM_Instructions.dpimm(RSB, PL, 0, self.k, self.i, z2)
            #STRPLB rk, [raddr, #(-offset)]*/
            output += ARM_Instructions.lsbyte(STR, PL, self.k, self.addr, offset)
            #SUBPL raddr, raddr, rj ROR rk*/
            output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)

            self.size += 4 * 3
            continue
         z3 = self.x ^ y
         if alphanum_byte.alphanumeric_check(z3):
            #EORPLS rk, ri, #z*/
            output += ARM_Instructions.dpimm(EOR, PL, 1, self.k, self.i, z3)
            #STRPLB rk, [raddr, #(-offset)]*/
            output += ARM_Instructions.lsbyte(STR, PL, self.k, self.addr, offset)
            #SUBPL raddr, raddr, rj ROR rk*/
            output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)

            self.size += 4 * 3
            continue
         a2 = alphanum_byte.alphanumeric_get_complement(z3)
         b2 = a2 ^ z3
         #EORPLS rk, ri, #a*/
         output += ARM_Instructions.dpimm(EOR, PL, 1, self.k, self.i, a2)
         #EORPLS rk, rk, #b*/
         output += ARM_Instructions.dpimm(EOR, PL, 1, self.k, self.k, b2)
         #STRPLB rk, [raddr, #(-offset)]*/
         output += ARM_Instructions.lsbyte(STR, PL, self.k, self.addr, offset)
         #SUBPL raddr, raddr, rj ROR rk*/
         output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)

         self.size += 4 * 4


      return output
示例#6
0
   def algo1(self, input, begin_inp, iter):
      if len(input) == 0:
         return ''
      output = ''
      offset = 0x91
      for p in range(begin_inp, begin_inp + iter):
         y = ord(input[p])
         if alphanum_byte.alphanumeric_check(y):
            #SUBPL raddr, raddr, rj ROR rk*/
            output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)
            self.size += 4
            continue
         if y >= 0x80:
            if alphanum_byte.alphanumeric_check(~y):
               #EORPLS rk, rj, #~y*/
               output += ARM_Instructions.dpimm(EOR, PL, 1, self.k, self.j, ~y)
               #STRMIB rk, [raddr, #(-offset)]*/
               output += ARM_Instructions.lsbyte(STR, MI, self.k, self.addr, offset)
               #SUBMIS rk, ri, #x*/
               output += ARM_Instructions.dpimm(SUB, MI, 1, self.k, self.i, self.x)
               #SUBPL raddr, raddr, rj ROR rk*/
               output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)

               self.size += 4 * 4
               continue

            a = alphanum_byte.alphanumeric_get_complement(~y)
            b = (a ^ ~y) & 0xff
            #EORPLS rk, rj, #a*/
            output += ARM_Instructions.dpimm(EOR, PL, 1, self.k, self.j, a)
            #EORMIS  rk,  rk, #b*/
            output += ARM_Instructions.dpimm(EOR, MI, 1, self.k, self.k, b)
            #STRMIB rk, [raddr, #(-offset)]*/
            output += ARM_Instructions.lsbyte(STR, MI, self.k, self.addr, offset)
            #SUBMIS rk, ri, #x*/
            output += ARM_Instructions.dpimm(SUB, MI, 1, self.k, self.i, self.x)
            #SUBPL raddr, raddr, rj ROR rk*/
            output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)

            self.size += 4 * 5
            continue
         if self.x > y:
            z1 = self.x - y
            if alphanum_byte.alphanumeric_check(z1):
               #SUBPL rk, ri, #z*/
               output += ARM_Instructions.dpimm(SUB, PL, 0, self.k, self.i, z1)
               #STRPLB rk, [raddr, #(-offset)]*/
               output += ARM_Instructions.lsbyte(STR, PL, self.k, self.addr, offset)
               #SUBPL raddr, raddr, rj ROR rk*/
               output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)

               self.size += 4 * 3
               continue
         z2 = self.x + y
         if alphanum_byte.alphanumeric_check(z2):
            #RSBPL rk, ri, #z*/
            output += ARM_Instructions.dpimm(RSB, PL, 0, self.k, self.i, z2)
            #STRPLB rk, [raddr, #(-offset)]*/
            output += ARM_Instructions.lsbyte(STR, PL, self.k, self.addr, offset)
            #SUBPL raddr, raddr, rj ROR rk*/
            output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)

            self.size += 4 * 3
            continue
         z3 = self.x ^ y
         if alphanum_byte.alphanumeric_check(z3):
            #EORPLS rk, ri, #z*/
            output += ARM_Instructions.dpimm(EOR, PL, 1, self.k, self.i, z3)
            #STRPLB rk, [raddr, #(-offset)]*/
            output += ARM_Instructions.lsbyte(STR, PL, self.k, self.addr, offset)
            #SUBPL raddr, raddr, rj ROR rk*/
            output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)

            self.size += 4 * 3
            continue
         a2 = alphanum_byte.alphanumeric_get_complement(z3)
         b2 = a2 ^ z3
         #EORPLS rk, ri, #a*/
         output += ARM_Instructions.dpimm(EOR, PL, 1, self.k, self.i, a2)
         #EORPLS rk, rk, #b*/
         output += ARM_Instructions.dpimm(EOR, PL, 1, self.k, self.k, b2)
         #STRPLB rk, [raddr, #(-offset)]*/
         output += ARM_Instructions.lsbyte(STR, PL, self.k, self.addr, offset)
         #SUBPL raddr, raddr, rj ROR rk*/
         output += ARM_Instructions.dpshiftreg(SUB, 0, self.addr, self.addr, self.j, ROR, self.k)

         self.size += 4 * 4


      return output