-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpovs.py
32 lines (24 loc) · 862 Bytes
/
povs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""PoV models."""
__author__ = "Kevin Borgolte <[email protected]>, Giovanni Vigna <[email protected]>"
from helpers import perfect
import random
class PoV(object):
def __init__(self, binary, service, kind):
self.binary = binary # Target binary
self.service = service # Target service
self.kind = kind # Type (1: pc control, 2: page read)
def successful(self, target):
protection = target.services[self.service.name].binary.protection
r = random.random()
if r > protection:
return 1
else:
return 0
def __str__(self):
s = "PoV Service: %s Binary: %s Kind: %d" % \
(self.service.name,
self.binary.name,
self.kind)
return s