File Sumo 1 1



Today, I am going to share a writeup for the boot2root challenge of the Vulnhub machine “Sumo: 1”. It was an intermediate box based on the Linux machine. The goal for this machine is to read the flag file Download From Here Penetration Testing Methodology Network Scanning Netdiscover scan Nmap Scan Enumeration Enumerating HTTP service. Continue reading →. Sumo (Japanese: 相撲, Hepburn: sumō, lit. 'striking one another') is a form of competitive full-contact wrestling where a rikishi (wrestler) attempts to force his opponent out of a circular ring or into touching the ground with any body part other than the soles of his feet (usually by throwing, shoving or pushing him down). Sumo originated in Japan, the only country where it is.

CARLA has developed a co-simulation feature with SUMO. This allows to distribute the tasks at will, and exploit the capabilities of each simulation in favour of the user.

  • Run a custom co-simulation

Requisites

First and foremost, it is necessary to install SUMO to run the co-simulation. Building from source is recommended over a simple installation, as there are new features and fixes that will improve the co-simulation.

Once that is done, set the SUMO environment variable.

SUMO is ready to run the co-simulations. There are some examples in Co-Simulation/Sumo/examples for Town01, Town04, and Town05. These .sumocfg files describe the configuration of the simulation (e.g., net, routes, vehicle types...). Use one of these to test the co-simulation. The script has different options that are detailed below. For the time being, let's run a simple example for Town04.

File sumo 1 1/4

Run a CARLA simulation with Town04.

Then, run the SUMO co-simulation example.

Run a custom co-simulation

File Sumo 1 1

Create carla vtypes

With the script Co-Simulation/Sumo/util/create_sumo_vtypes.py the user can create sumo vtypes, the equivalent to CARLA blueprints, based on the CARLA blueprint library.

  • --carla-host(default: 127.0.0.1) — IP of the carla host server.
  • --carla-port(default: 2000) — TCP port to listen to.
  • --output-file(default: carlavtypes.rou.xml) — The generated file containing the vtypes.

This script uses the information stored in data/vtypes.json to create the SUMO vtypes. These can be modified by editing said file.

Warning

A CARLA simulation must be running to execute the script.

Create the SUMO net

The recommended way to create a SUMO net that synchronizes with CARLA is using the script Co-Simulation/Sumo/util/netconvert_carla.py. This will draw on the netconvert tool provided by SUMO. In order to run the script, some arguments are needed.

  • xodr_file — OpenDRIVE file .xodr.
  • --output'(default:net.net.xml) — output file .net.xml.
  • --guess-tls(default:false) — SUMO can set traffic lights only for specific lanes in a road, but CARLA can't. If set to True, SUMO will not differenciate traffic lights for specific lanes, and these will be in sync with CARLA.

The output of the script will be a .net.xml that can be edited using NETEDIT. Use it to edit the routes, add demand, and eventually, prepare a simulation that can be saved as .sumocfg.

The examples provided may be helpful during this process. Take a look at Co-Simulation/Sumo/examples. For every example.sumocfg there are several related files under the same name. All of them comprise a co-simulation example.

Run the synchronization

Once a simulation is ready and saved as a .sumocfg, it is ready to run. There are some optional parameters to change the settings of the co-simulation.

  • sumo_cfg_file — The SUMO configuration file.
  • --carla-host(default: 127.0.0.1) — IP of the carla host server
  • --carla-port(default: 2000) — TCP port to listen to
  • --sumo-host(default: 127.0.0.1) — IP of the SUMO host server.
  • --sumo-port(default: 8813) — TCP port to listen to.
  • --sumo-gui — Open a window to visualize the gui version of SUMO.
  • --step-length(default: 0.05s) — Set fixed delta seconds for the simulation time-step.
  • --sync-vehicle-lights(default: False) — Synchronize vehicle lights.
  • --sync-vehicle-color(default: False) — Synchronize vehicle color.
  • --sync-vehicle-all(default: False) — Synchronize all vehicle properties.
  • --tls-manager(default: none) — Choose which simulator should manage the traffic lights. The other will update those accordingly. The options are carla, sumo, and none. If none is chosen, traffic lights will not be synchronized. Each vehicle would only obey the traffic lights in the simulator that spawn it.

Warning

To stop the co-simulation, press Ctrl+C in the terminal that run the script.

Spawn NPCs controlled by SUMO

The co-simulation with SUMO makes for an additional feature. Vehicles can be spawned in CARLA through SUMO, and managed by the later as the Traffi Manager would do.

The script spawn_npc_sumo.py is almost equivalent to the already-known spawn_npc.py. This script automatically generates a SUMO network in a temporal folder, based on the active town in CARLA. The script will create random routes and let the vehicles roam around.

As the script runs a synchronous simulation, and spawns vehicles in it, the arguments are the same that appear in run_synchronization.py and spawn_npc.py.

  • --host(default: 127.0.0.1) — IP of the host server.
  • --port(default: 2000) — TCP port to listen to.
  • -n,--number-of-vehicles(default: 10) — Number of vehicles spawned.
  • --safe — Avoid spawning vehicles prone to accidents.
  • --filterv(default: 'vehicle.')* — Filter the blueprint of the vehicles spawned.
  • --sumo-gui — Open a window to visualize SUMO.
  • --step-length(default: 0.05s) — Set fixed delta seconds for the simulation time-step.
  • --sync-vehicle-lights(default: False) — Synchronize vehicle lights state.
  • --sync-vehicle-color(default: False) — Synchronize vehicle color.
  • --sync-vehicle-all(default: False) — Synchronize all vehicle properties.
  • --tls-manager(default: none) — Choose which simulator will change the traffic lights' state. The other will update them accordingly. If none, traffic lights will not be synchronized.

That is all there is so far, regarding for the SUMO co-simulation with CARLA.

File Sumo 1 123

Open CARLA and mess around for a while. If there are any doubts, feel free to post these in the forum.