The air crew film people who look like they're breaking the law with a special camera strapped to the bottom of the aircraft.
Life saving
They radio through to police on the ground who track the offenders and arrest them for causing danger to themselves and others.
Cardiff is one of the worst areas in the country for railway vandalism and although the Hawk isn't cheap - it costs £3,000 a day to run - it saves lives.
Over the last three years 20 children have been killed on railway lines across in the UK.
Rocky, 10, from Cardiff, told Newsround: "You shouldn't play on the railways because you could get injured, damaged or die."