The complexity of urban combat environments, the coupling of task allocation and path planning, and the existence of dynamic targets significantly increased the complexity of coordinated UAV swarm attack tasks. In this work, we proposed a multi-UAV task allocation and path planning framework inspired by the collaborative hunting behaviour of wolf packs. This framework was based on a multi-target k-winner-take-all (k-WTA) algorithm and an improved grey wolf optimization (GWO) algorithm. Firstly, for the multi-task allocation problem in unknown environments, a multi-objective k-WTA algorithm was used for task allocation based on the competition mechanism, which realized fast task allocation in dynamic environments. Then, the advantages of GWO and genetic algorithm (GA) were combined through GA-WPO to overcome the random initialization problem of GWO by using GA as an initialization generator. A path planner based on GA-WPO was proposed to enable multi-UAVs to reach the target point safely in complex urban environments. Finally, the proposed path planner was used for multi-UAV path planning, and the effectiveness of the method was verified by a set of simulation experiments, which showed that the method better solved the coupling problem of path planning and task assignment for UAV swarm coordinated attack tasks.