Esempio n. 1
0
    def run_5a(self, dir_prefix):
        # malicious peers lie about everything, but also directly attack the Observer all the time

        base_dir = prepare_experiments_dir(dir_prefix, exp_name="_exp_5a")

        # prepare attack plan for the malicious device and peers
        mp_attack_plan = {}
        for i in range(0, 20):
            mp_attack_plan[i] = []
            if i > 4:
                mp_attack_plan[i].append("1.1.1.0")
        attack_plan = get_two_part_attack_plan(n_rounds=20, n_peers=10)
        badmouthing_targets = ["1.1.1.11"]

        for n_good_peers in range(1, 10):
            ctrl = self.attack_parametrised(
                base_dir,
                exp_id=n_good_peers,
                n_good_peers=n_good_peers,
                n_peers=10,
                n_rounds=20,
                attack_plan=attack_plan,
                bad_peer_type="PeerLiarAndAttacker",
                bad_peer_params=(badmouthing_targets, mp_attack_plan),
                experiment_suffix="")
            ctrl.run_experiment()
            time.sleep(5)
Esempio n. 2
0
    def run_2b(self, dir_prefix):
        base_dir = prepare_experiments_dir(dir_prefix, exp_name="_exp_2b")

        attack_plan = get_staggered_attack_plan(n_rounds=20, n_peers=10)
        exp_id = 0
        ctrl = self.attack_parametrised(base_dir,
                                        exp_id=exp_id,
                                        n_good_peers=10,
                                        n_peers=10,
                                        n_rounds=20,
                                        attack_plan=attack_plan,
                                        experiment_suffix="")
        ctrl.run_experiment()
Esempio n. 3
0
    def run_2c(self, dir_prefix):
        # malicious device attacks different amounts of peers, no malicious peers are present

        base_dir = prepare_experiments_dir(dir_prefix, exp_name="_exp_2c")

        for n_victims in range(1, 10):
            attack_plan = get_attack_plan_with_given_victim_count(
                n_rounds=20, n_victims=n_victims)
            ctrl = self.attack_parametrised(base_dir,
                                            exp_id=n_victims,
                                            n_good_peers=10,
                                            n_peers=10,
                                            n_rounds=20,
                                            attack_plan=attack_plan,
                                            experiment_suffix="")
            ctrl.run_experiment()
            time.sleep(5)
Esempio n. 4
0
    def run_test_experiments(self, dir_prefix):
        observer_ips = ["1.1.1.0"]
        observed_ips = ["1.1.1.1"]
        base_dir = prepare_experiments_dir(dir_prefix, exp_name="_exp_0_tests")

        exp_id = 0

        ctrl = self.attack_parametrised(base_dir,
                                        exp_id=exp_id,
                                        n_good_peers=1,
                                        n_peers=2,
                                        n_rounds=3,
                                        bad_peer_type="PeerLiarEveryoneIsGood",
                                        attack_plan=None,
                                        experiment_suffix="_my_test_exp",
                                        observer_ips=observer_ips,
                                        observed_ips=observed_ips)
        ctrl.run_experiment()
Esempio n. 5
0
    def run_3b(self, dir_prefix):
        # malicious peers are praising the malicious device

        base_dir = prepare_experiments_dir(dir_prefix, exp_name="_exp_3b")

        # prepare attack plan for the malicious device
        attack_plan = get_staggered_attack_plan(n_rounds=20, n_peers=10)

        for n_good_peers in range(1, 10):
            ctrl = self.attack_parametrised(
                base_dir,
                exp_id=n_good_peers,
                n_good_peers=n_good_peers,
                n_peers=10,
                n_rounds=20,
                attack_plan=attack_plan,
                bad_peer_type="PeerLiarEveryoneIsGood",
                experiment_suffix="")
            ctrl.run_experiment()
            time.sleep(5)
Esempio n. 6
0
    def run_3c(self, dir_prefix, missing_setups=None):
        # malicious peers are praising the malicious device

        base_dir = prepare_experiments_dir(dir_prefix, exp_name="_exp_3c")

        for n_good_peers in range(3, 9):
            n_victims = n_good_peers

            exp_id = 10 * n_good_peers + n_victims
            attack_plan = get_attack_plan_with_given_victim_count(
                n_rounds=20, n_victims=n_victims)
            ctrl = self.attack_parametrised(
                base_dir,
                exp_id=exp_id,
                n_good_peers=n_good_peers,
                n_peers=10,
                n_rounds=20,
                attack_plan=attack_plan,
                bad_peer_type="PeerLiarEveryoneIsGood",
                experiment_suffix="")
            ctrl.run_experiment()
            time.sleep(5)
Esempio n. 7
0
    def run_4a(self, dir_prefix):
        # badmouthing
        # no need to run this on more reporters

        base_dir = prepare_experiments_dir(dir_prefix, exp_name="_exp_4a")

        # prepare attack plan for the malicious device
        attack_plan = get_two_part_attack_plan(n_rounds=20, n_peers=10)
        badmouthing_targets = ["1.1.1.11"]

        for n_good_peers in range(1, 10):
            ctrl = self.attack_parametrised(
                base_dir,
                exp_id=n_good_peers,
                n_good_peers=n_good_peers,
                n_peers=10,
                n_rounds=20,
                attack_plan=attack_plan,
                bad_peer_type="PeerBadmouthTarget",
                bad_peer_params=badmouthing_targets,
                experiment_suffix="")
            ctrl.run_experiment()
            time.sleep(5)