mirror of https://github.com/nucypher/nucypher.git
Introducing Vladimir.
parent
dea99a9847
commit
75a7acc32d
|
@ -0,0 +1,28 @@
|
|||
from nucypher.characters.lawful import Ursula
|
||||
from nucypher.crypto.powers import CryptoPower
|
||||
from nucypher.utilities.sandbox import EvilMiddleWare
|
||||
|
||||
|
||||
class Vladimir(Ursula):
|
||||
"""
|
||||
The power of Ursula, but with a heart forged deep in the mountains of Microsoft or a State Actor or whatever.
|
||||
"""
|
||||
|
||||
network_middleware = EvilMiddleWare()
|
||||
|
||||
@classmethod
|
||||
def from_target_ursula(cls, target_ursula):
|
||||
"""
|
||||
Sometimes Vladimir seeks to attack or imitate
|
||||
|
||||
|
||||
a *specific* target Ursula.
|
||||
"""
|
||||
vladimir = cls(crypto_power=CryptoPower(power_ups=Ursula._default_crypto_powerups),
|
||||
rest_host=target_ursula.rest_information()[0].host,
|
||||
rest_port=target_ursula.rest_information()[0].port,
|
||||
checksum_address='0x0000badbadbadbad0000bad00bad00bad0000000', # Fradulent address
|
||||
certificate=target_ursula.rest_server_certificate(),
|
||||
is_me=False)
|
||||
vladimir._interface_signature_object = target_ursula._interface_signature_object # Asshole.
|
||||
return vladimir
|
|
@ -246,12 +246,26 @@ class MockRestMiddleware(RestMiddleware):
|
|||
return response
|
||||
|
||||
def put_treasure_map_on_node(self, node, map_id, map_payload):
|
||||
mock_client = self.__get_mock_client_by_ursula(node)
|
||||
mock_client = self._get_mock_client_by_ursula(node)
|
||||
response = mock_client.post("http://localhost/treasure_map/{}".format(map_id),
|
||||
data=map_payload, verify=False)
|
||||
return response
|
||||
|
||||
|
||||
class EvilMiddleWare(MockRestMiddleware):
|
||||
"""
|
||||
Middleware for assholes.
|
||||
"""
|
||||
def propagate_shitty_interface_id(self, ursula, shitty_interface_id):
|
||||
"""
|
||||
Try to get Ursula to propagate a malicious (or otherwise shitty) interface ID.
|
||||
"""
|
||||
mock_client = self._get_mock_client_by_ursula(ursula)
|
||||
response = mock_client.post("http://localhost/node_metadata".format(mock_client),
|
||||
verify=False,
|
||||
data=bytes(shitty_interface_id))
|
||||
return response
|
||||
|
||||
class MockArrangement(Arrangement):
|
||||
_arrangements = OrderedDict()
|
||||
|
||||
|
|
Loading…
Reference in New Issue