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

Gallopsled / pwntools / 5436493948

pending completion
5436493948

push

github-actions

jasperla
add "retguard" property and display it with checksec

quoting http://undeadly.org/cgi?action=article;sid=20180606064444,
retguard is an "anti-ROP security mechanism, which uses random
per-function cookies to protect return addresses on the stack."

3968 of 6663 branches covered (59.55%)

6 of 6 new or added lines in 1 file covered. (100.0%)

12137 of 16984 relevant lines covered (71.46%)

0.71 hits per line

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

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

6
from . import random_funcs
1✔
7

8
# +------------------------------------------------------------------------+ 
9
# |                    ALPHANUMERIC MANIPULATIONS FUNCTIONS                | 
10
# +------------------------------------------------------------------------+ 
11

12
ALPHANUMERIC_BYTES = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
1✔
13

14
# return 1 if the byte is alphanumeric 
15
# ==================================== 
16
def alphanumeric_check(c):
1✔
17
   if type(c) == int:
×
18
      c = chr(c & 0xff)
×
19
   return c.isalnum()
×
20

21

22
# return a random alphanumeric byte 
23
# ================================= 
24
def alphanumeric_get_byte():
1✔
25
   return ord(random_funcs.randel(ALPHANUMERIC_BYTES))
×
26

27
# return a randomly selected alphanumeric byte less than max 
28
# ========================================================== 
29
#CSE author actually returns a byte <= max, not strictly < max
30
def alphanumeric_get_byte_ltmax(max):
1✔
31
   sz = 0
×
32
   while sz < len(ALPHANUMERIC_BYTES) and ord(ALPHANUMERIC_BYTES[sz]) <= max:
×
33
      sz += 1
×
34
   return ord(random_funcs.randel(ALPHANUMERIC_BYTES[:sz]))
×
35

36
# generate an alphanumeric offset such that c+offset is also alphanumeric 
37
# ======================================================================= 
38
def off_gen(c):
1✔
39
   if c >= 0 and c <= 0x4a:
×
40
      max = 16 * 7 + 10 - c
×
41
      while True:
42
         x = alphanumeric_get_byte_ltmax(max)
×
43
         if alphanumeric_check(c + x):
×
44
            return x
×
45
   return 0
×
46

47
# return an alphanumeric value ret such that c XOR ret is also alphanumeric
48
# =========================================================================
49
def alphanumeric_get_complement(c):
1✔
50
   c &= 0xff
×
51
   while True:
52
      ret = alphanumeric_get_byte()
×
53
      if alphanumeric_check(c ^ ret):
×
54
         return ret
×
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