I have a bag of old unmarked PICs, possibly PIC18, but could be PIC16, and want to try to figure out what exact type they are and if they have already been programmed or not. Not even sure if they are of a EPROM or flash variant. Hoping to do this using an Arduino to write/read the PIC pins.
Methods that are potentially destructive to the PIC itself are acceptable, if that makes it easier, but would prefer to not connect it in a way that can fry other things around it.
The pin layout is largely compatible in Microchip's line and there is a device ID (part number and silicon revision) factory programmed at a fixed location in newer PIC devices.
Programmers such as PICKit attempt to read the device ID. As far as I know, Microchip does not publish an official exhaustive list of device IDs, however those who create programmers use that information so the information has been gathered- for example this list.
See also the ICSP Programming Guide for the expected locations.