As far as I know,lusting is one of the biggest sin a person can commit.
Yes God knows as he is antaryami or one who resides inside us.
The Vedas say that the Brahman or God has entered our body and has established himself in the mind.
Shariram brahma prAvishat.
Brahman (or God) has entered our body.
Eko ha devo manasi pravishtah.
The sole God (or the one God) has established himself in the mind.
Also, even if we think that we are talking or thinking or doing something secretly there is always a divine witness who is observing everything. So, there is nothing which we can do or even think in mind which won't be noticed by God.
Dvau samnishadya yat mantrayete rAja tat veda varunah tritiyah .
When you talk in secret, there is always the third observer, divine observer Varuna.
As far as I know,lusting is one of the biggest sin a person can commit
No, that's wrong. Lust is innate in human and other beings as well. Its a natural pravritti that is born in humans everyday along with the other pravrittis like hunger, thirst, desire for sleep etc.
Sarire JAyayate Nityam VAnchah NrinAm ChaturvidhAHa | Vubhuksha Cha PipAsA SusupsA Cha RatisprihA ||
Daily these four-fold desires are born in a human body-hunger,thirst,desire for sleep and desire for sex (RatisprihA)
So, being lusty in itself is not a sin. Just like being hungry or feeling sleepy are not sins.
But, if afflicted by lust one cohabits with someone who's another person's wife then that is a sin. If you are hungry then that's natural order but if tormented by hunger you eat something that's forbidden in scriptures then that becomes a sin.
Abbreviations used :
AV 11.8.30 ------> Atharva Veda Samhita, KAnda 11, Sukta 8, Mantra 30 etc.
Does god knows our thoughts?
Offcourse God know our thoughts, that's why he called as Anteryami (who knows every feeling/thoughts/imagination of our). All of your imagination is use to store in brain as a memory and God can read brain because it's his creation.
is it a sin to have lustful thoughts?
Thoughts alone can't do any sin but it's your decision (karma) that can do. What kind of decision you will make when your mind is full of lusting thoughts, that will decide sin or not.
To be more clear, decision (karma) can also be perform in non pysical way. For example: If someone is asking for help then if one will not do any help then this karma (decision, not phisical movement) is sin. That's mean you can do sin without moving phisicaly because some times not doing physical movement is sin. So your decision is know as karma, not your physical activities. And you will get Karma fal of your karma(decision).
Points to remember
In any case one must try to avoid these thoughts and should keep pure thoughts only. If you will keep negative feelings inside your mind than this feeling will force you to do any sin. Lets take an example of anger (another negative thought like lust), we all feel anger many times, and when our anger is more, then we lost control of our physical movement and eventually our movements started to act on its own and try to do anything that can calm our feelings of anger down. And we ended up doing any sin. We all have experienced result of our anger. So try to keep all negative thoughts away, so that these thoughts couldn't overtake control of our movements/decision.
I got this message below my answer
Some of the information contained in this post requires additional references. Please edit to add citations to reliable sources that support the assertions made here. Unsourced material may be disputed or deleted.
In this message they told me to add references BUT I have learned those from Bhagwat geeta shown in Ramanand Sagar's Shree Krishna and Mahabharat on starplus. And I don't remember which episode was that.
If after reading this, you think tv shows (only my trusted tv shows, not all) is not reliable then even online info regarding this in text form on different sites are also don't have any reliability.
Annamayya, a great devotee of Lord Venkateswara states rhyming (in Telugu) Kaami gani vadu Mokshagami kaadu. Among the four Purusharthas is contained lust, but must be confined to marriage relations only as a necessary transitional phase before attainment of Moksha.
Video KonarakTempleOfEducaton projects a view of ancient India (symbolically portrayed in temple architecture human interest education for every 5 years up to adulthood and beyond) when the four Arthas have their rightful and respected place in the Hindu scheme of life..start and end of lust included... reflecting Dr. Radhakrishna's quote that Hinduism is a way of life.
God being the in-dweller obviously knows our thoughts. Nothing can ever be kept away from him.
Having sensuous thoughts is a sin as it provokes us to perform such deeds. But, yes kama is human nature. Fulfilment of sexual desire is a part of human life.
We must hence transcend the feelings of lust. Lust exists only so long as we see a difference between man and woman. If we see the cosmic being in all, there is no scope for lust. This is the best way to get rid off lustful feelings.