SMTP Starttls() script login delay issue

I am running a python script in terminal that I use to send emails. When it comes time to log me in before sending emais the script uses:

o = smtplib.SMTP(“smtp.gmail.com:587”)
o.starttls()
o.login(gmail, password)

The first time I run the script it logs me in instantly but any instances afterwards it stalls for 40-90 seconds. I noticed if I disconnect and reconnect my wifi it will correct the problem but only for the first instance.

Is there anything in ParrotOS that might be causing the delay when creating the secure connection for login? Firewall?

I’m running the latest Parrot 64bit on my hard drive single OS and used the standard installer.

Close, Firejail! It takes some configuring but mostly just understanding how it works. I believe most people despise it at first before they understand how it works and how you customize it to work best for your specific needs, then (at least for me) it is one of my favorite features. Its one of the core features that makes Parrot, Parrot. Its a fascinating and powerful little tool (although tool is not the right word because its so much more than just a ‘tool’).

Ah okay. Yea I love the sandboxing, what great security. I noticed Parrot uses AppArmor as well. I will just have to study Firejail and see what I can configure!

…wait. Could my connection issue also be AppArmor?

It could be UFW (GUFW is the graphical interface of the firewall) Ive not had to alter any of my app armor settings yet though so it could be any one of those honestly. Can you provide more information on where it starts to hang? That might be helpful in trying to pinpoint which one needs adjusted for that particular script.

My ParrotSec didn’t come with ufw or gufw. Should I install?

If apparmour blocks anything it is logged into /var/log/messages
sudo cat /var/log/messages | grep -e 'apparmour' or grep your app name

But i doubt that is your problem, i would say there is a good chance its your code. Make sure you are closing the connection before starting a new one ect.

1 Like