Great question, smelly cat!
I think that there are three sources: the person can be speaking from the flesh (that is his or her own natural inclinations, thus called the "flesh."); from the Spirit of God ( the Holy Spirit within), or from the enemy's influence on them..thus a wrongful spirit from within them.
If it is the enemy he can disquise himself as an "angel of light" and be very interesting and appealing at first and even hard to recognize as evil. He can even quote scriptures and does that quite well; but his suggestions and directions do not lead to peace..they lead to some kind of sin and self destructive behavior.
So, when I hear something which I question..I immediately line up what is said with what I know is in the scriptures and I pray that I can discern rightly.
And I remember and take courage because I know that Satan is a defeated and rebellious foe who Jesus defeated when He died on the cross. Yet Satan's plan is to bring anyone he can down with him in his defeat and rebellion against God. The thing is to recognize Him and His tricks, temptations, and modus operati. (way of operating). It can take much prayer and experience..but we are equipped in Christ to withstand and see through Satan's efforts.
I found Ephesians 6:10-17 excellent for showing how to put on the whole armour of Christ against the attacks of the enemy.
:bible: "Finally, be strong in the Lord and in his mighty power. Put on the full armor of God, so that you can take your stand against the devil's schemes. For our struggle is not against flesh and blood, but against the rulers, against the authorities, against the powers of this dark world and against the spiritual forces of evil in the heavenly realms. Therefore put on the full armor of God, so that when the day of evil comes, you may be able to stand your ground, and after you have done everything, to stand. Stand firm then, with the belt of truth buckled around your waist, with the breastplate of righteousness in place, and with your feet fitted with the readiness that comes from the gospel of peace. In addition to all this, take up the shield of faith, with which you can extinguish all the flaming arrows of the evil one. Take the helmet of salvation and the sword of the Spirit, which is the word of God. " (Ephesians 6: 10-17, NIV)
peace and blessings..:jesus-cross: