The world, the flesh, and the devil are the three classic sources of temptation. Sometimes in working with people at the parish the question would come up: Did I think a certain temptation was from the devil?
Most of the time I think the question is uninteresting and without spiritual utility. On one level it doesn't matter where temptations are from; they should all be treated the same. Most of the time acts of archaeology on them only serve to flatter them with more attention.
In some moments, however, I think it may be useful to recognize an affliction or temptation as possibly diabolical. For example, such a recognition might inspire more urgency and effort in the surrender to prayer and the help of God. Or, one could find that the recognition of a temptation as diabolical might actually be encouraging; this sign that the devil has something real to lose in our case shows that we have become someone noteworthy in the economies of grace.
For me--and this is only my reflection and not some kind of official teaching--I categorize temptations and afflictions according to two main types, according to the means they attempt to use in me. If the temptation attempts to make use of concupiscence or laziness, sensuality, anger, resentment, or any other disorder in the will, I'm pretty much certain that the temptation is from the flesh or the world, or both.
There are, however, other temptations and afflictions that attempt to instrumentalize not vice, but virtue. It is only in these that I sometimes suspect the devil. To take a couple of stock examples, consider someone who is tempted to neglect prayer because his ministry or other work for the Kingdom of God is so necessary or important. The temptation has made use of his zeal and talent to cut him off from his daily contact with God. Or consider someone whose devotion to the beautiful and correct celebration of divine worship gets in the way of his praying--or maybe even attending--an otherwise valid but imperfect Eucharist.
These are the sorts of situations in which I sometimes suspect the devil. They are truly insidious temptations in that good and devout values get twisted in such way as to either get someone to cut himself off from the sources of grace, or from the situations in which God might want to use him as a source of grace for others.