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

Gallopsled / pwntools / 5500924378

pending completion
5500924378

push

github-actions

peace-maker
Update CHANGELOG

3968 of 6659 branches covered (59.59%)

12136 of 16977 relevant lines covered (71.48%)

0.71 hits per line

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

26.92
/pwnlib/encoders/arm/alphanumeric/random_funcs.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

5
import os
1✔
6
import random
1✔
7
import struct
1✔
8

9

10
# +------------------------------------------------------------------------+
11
# |                       RANDOM NUMBERS FUNCTIONS                         |
12
# +------------------------------------------------------------------------+
13

14
# get a random integer i (0<=i<maxv)
15
# ==================================
16
def random_get_int(maxv):
1✔
17
   return random.randrange(0, maxv)
×
18

19

20
def randel(arr):
1✔
21
   return arr[random_get_int(len(arr))]
×
22

23
def enc_data_msn(c, i):
1✔
24
   # c is the lsn to be encoded with a msn
25
   # lsn = least significant nibble  msn = most significant nibble
26
   if c <= i:
×
27
      if c == 0:
×
28
         #Randomly select and return from {5,7}
29
         return randel([5, 7])
×
30
      else:
31
         #Randomly select and return from {4,5,6,7}
32
         return randel([4,5,6,7])
×
33
   elif c == 0:
×
34
      #Randomly select and return from {3,5,7}
35
      return randel([3,5,7])
×
36
   elif c <= 0x0A:
×
37
      #Randomly select and return from {3,4,5,6,7}
38
      #CSE Why doesn't the author use 3 below then?
39
      return randel([4,5,6,7])
×
40
   else:
41
      return randel([4,6])
×
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