First of all the book looked fairly new so I don't think it was more than a few years old at the time and I'm 80% certain I picked it up in the young adult section at my public library. The story featured a boy whose parents were killed by space pirates and he was kidnapped by the pirate, who was pretty nasty, he eventually escaped and was taken to a planet of aliens that are at war with humans. They train him to be a spy and, I think, a hacker. I think I remember some sort of contact lens type device he uses to access computer terminals. I remember that he is a bit conflicted on whether he should help the aliens, who rescued him, or defect to the humans.
I don't remember how the book ends and believe me I know how vague this is...but I figured I might as well give it a shot. I would really like to re-read and finally finish the book. Thanks in advance!