Kkevsterrr / geneva

automated censorship evasion for the client-side and server-side
https://censorship.ai
BSD 3-Clause "New" or "Revised" License
1.94k stars 183 forks source link

How to evolve DNS strategies #63

Open Dong351 opened 1 year ago

Dong351 commented 1 year ago

command:python3 evolve.py --test-type dns --log debug --strategy "\/" Error:

Traceback (most recent call last):
  File "evolve.py", line 835, in <module>
    driver(sys.argv[1:])
  File "evolve.py", line 814, in driver
    hall_of_fame = genetic_solve(logger, options, ga_evaluator)
  File "evolve.py", line 526, in genetic_solve
    population = initialize_population(logger, options, canary_id, disabled=options["disable_action"])
  File "evolve.py", line 495, in initialize_population
    p = generate_strategy(logger, options["in-trees"], options["out-trees"], options["in-actions"],
  File "evolve.py", line 308, in generate_strategy
    strat.initialize(logger, num_in_trees, num_out_trees, num_in_actions, num_out_actions, seed, disabled=disabled)
  File "/root/xsd/pk/geneva/actions/strategy.py", line 75, in initialize
    self.init_from_scratch(num_in_trees, num_out_trees, num_in_actions, num_out_actions, disabled=disabled)
  File "/root/xsd/pk/geneva/actions/strategy.py", line 94, in init_from_scratch
    out_tree.initialize(num_out_actions, self.environment_id, disabled=disabled)
  File "/root/xsd/pk/geneva/actions/tree.py", line 47, in initialize
    self.trigger = actions.trigger.Trigger(None, None, None, environment_id=environment_id)
  File "/root/xsd/pk/geneva/actions/trigger.py", line 40, in __init__
    self.trigger_type, self.trigger_proto, self.trigger_field, self.trigger_value, self.gas_remaining = Trigger.get_rand_trigger(environment_id, 1)
  File "/root/xsd/pk/geneva/actions/trigger.py", line 61, in get_rand_trigger
    proto, field, value = actions.utils.get_from_fuzzed_or_real_packet(environment_id, real_packet_probability, enable_options=False, enable_load=False)
  File "/root/xsd/pk/geneva/actions/utils.py", line 403, in get_from_fuzzed_or_real_packet
    return packet.get_random()
  File "/root/xsd/pk/geneva/layers/packet.py", line 235, in get_random
    layer = self.get_random_layer()
  File "/root/xsd/pk/geneva/layers/packet.py", line 229, in get_random_layer
    return self.layers[random.choice(list(self.layers.keys()))]
  File "/usr/lib/python3.8/random.py", line 290, in choice
    raise IndexError('Cannot choose from an empty sequence') from None
IndexError: Cannot choose from an empty sequence