• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Gallopsled / pwntools / 5190673800

pending completion
5190673800

Pull #2205

github-actions

web-flow
Merge 38675c90e into c72886a9b
Pull Request #2205: Fix stable Python 2 installation from a built wheel

3936 of 6604 branches covered (59.6%)

12074 of 16876 relevant lines covered (71.55%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.0
/pwnlib/encoders/arm/alphanumeric/__init__.py
1
# Copyright (c) 2013 Pratik Kumar Sahu, Nagendra Chowdary, Anish Mathuria
2
# Ported to Python by Gallopsled
3
from __future__ import absolute_import
1✔
4
from __future__ import division
1✔
5

6
import binascii
1✔
7
import random
1✔
8
import string
1✔
9
import sys
1✔
10

11
from pwnlib.context import context
1✔
12
from . import builder
1✔
13
from pwnlib.encoders.encoder import Encoder
1✔
14

15

16
class ArmEncoder(Encoder):
1✔
17
    arch = 'arm'
1✔
18

19
    blacklist  = {chr(c) for c in range(256) if chr(c) in (string.ascii_letters + string.digits)}
1✔
20
    icache_flush = 1
1✔
21

22
    def __call__(self, input, avoid, pcreg=None):
1✔
23
        # If randomization is disabled, ensure that the seed
24
        # is always the same for the builder.
25
        state = random.getstate()
×
26
        if not context.randomize:
×
27
            random.seed(1)
×
28

29
        try:
×
30
            b = builder.builder()
×
31

32
            enc_data = b.enc_data_builder(input)
×
33
            dec_loop = b.DecoderLoopBuilder(self.icache_flush)
×
34
            enc_dec_loop = b.encDecoderLoopBuilder(dec_loop)
×
35
            dec = b.DecoderBuilder(dec_loop, self.icache_flush)
×
36

37
            output, dec = b.buildInit(dec)
×
38

39
            output += dec
×
40
            output += enc_dec_loop
×
41
            output += enc_data
×
42

43
        finally:
44
            random.setstate(state)
×
45

46
        return output.encode()
×
47

48
class ThumbEncoder(ArmEncoder):
1✔
49
    arch = 'thumb'
1✔
50

51
    to_thumb = b'\x01\x30\x8f\xe2\x13\xff\x2f\xe1'
1✔
52

53
    def __call__(self, input, avoid, pcreg=None):
1✔
54
        return super(ThumbEncoder, self).__call__(self.to_thumb + input, avoid, pcreg)
×
55

56
encode = ArmEncoder()
1✔
57
ThumbEncoder()
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc