Hire a merc or two. Set their stance to attack anything (bottom of your inflight options list). They will just hang around you, setting about anything that comes near you. You can hire them for just the one jump,or more.
Keep getting jumped by pirates when searching minerals in systems which apparently have minimal threat. One at a time I can deal with, but more than that and I'm screwed.
Getting quite frustrated now, as I can seem to do anything without getting aggro and/or shot to pieces.