It sounds like pantry moths. If it is, they are fairly easy to get rid of if you can find the source. Look very carefully at the hampster’s food, as that could be the source and/or the attraction. You can just squash them or purchase a sticky trap. Look for signs of cocoons, and clean them away. Keep all food and seeds in airtight containers, and you should be fine.