Say, I purchased an iPhone (not from Apple or any official reseller.)
How do I know that it's not Jailbroken?
PS. My concern is the presence of key loggers or other tracking software.
The best way is to go into Settings>General>About and scroll down until you see Serial Number. Apple has a verification website Here to determine if the iPhone you bought is authentic. All you have to do is enter your Serial Number. If it comes back with
"We're sorry, but this serial number is not valid."
Then your phone is non-authentic and fake.