The thing is i dont have something well defined in mind. What i know is ; i have to find hardcoded passwords with maximum accuracy. This is the requirement.
Only the solution i can think of is what you suggested: Search for piece of code. But it is obvious that still some passwords may be missed and there may be false positives.
So i am wondering, may be there is a better way or technique that i cant just think of.
Just to give an example; sometime ago i was trying to find and classify code files according to programming languages those codes were programmed with. Only way i could think of was looking at the extension of the file name. But after some research on internet i found an algorithm. With this algorith it was possible to train the code with sample code pieces and then code was able to find programming languages used with %95 accuracy.
Hope this explains.