Python Sockets Password Input - python

I am creating a basic login page using Python Sockets and I am trying to make the Password input blank when the user types, I am using CLIENT.send() to send the "Password: " string and CLIENT.recv(1024) to fetch the given data.

you can use the getpass library like this:
import getpass
password = getpass.getpass()
this will make the password variable get an input, but nothing will come up as you type

Related

What values to pass for arguments to WebConnect in the SMA-SunnyBoy package?

I'm trying to use the SMA-SunnyBoy Python package to pull data for a solar array. But I don't understand the example:
from sma_sunnyboy import *
client = WebConnect("192.168.0.10", Right.USER, "password")
I assume password is the password I use to access the SunnyPortal website, but how do I pass my username as Right.USER? And what IP address should I put for that first argument?

How to send SMS without FRM/MSG

A few days ago I decided to begin working on a program that would be able to send SMS messages without the use of Twilio. For those of you who don't know, Twilio is a website that can be used to send SMS messages with python. However, it holds back many features behind a paywall and is all around sub-par to a program that can send SMS without it. This is what I have so far:
import smtplib
from signin import emailadress, password, number
smtplibserver='smtp.gmail.com'
if __name__=="__main__":
server = smtplib.SMTP_SSL(smtplibserver, 465)
server.ehlo()
server.login(emailadress, password)
print("You're logged in!")
usertext = input("\nWhat is your message? ")
server.sendmail(emailadress, number, usertext)
print("\nSent!\n")
(signin is a separate file containing my email address, password, and phone number.)
This method works, but it adds a FRM/MSG to my text. For example, if my message is "Hello, world!" then the text will send as:
FRM:johnappleseed#gmail.com
MSG:Hello, world!
Twilio sends the message alone. How do I get rid of the FRM/MSG? I know I might have to use a completely different method do to so.

Fetch Mail from email account (Password contains Special Characters)

I am trying to fetch mail from a email account, I cannot login when I have password with special characters.
import imaplib
username = 'test#test.com'
password = "test!002"
imap_server = 'imap.test.com'
mail = imaplib.IMAP4_SSL(imap_server)
mail.login(username, password)
Output:
[AUTHENTICATIONFAILED] Invalid credentials(Failure)'
Exception in connectionb'[AUTHENTICATIONFAILED] Invalid credentials(Failure)
The same code works if I change the password which does not special Characters.
Can any one tell me how to login to imap with passwords containing special characters.
I'm not sure if this will help you but i have looked at the documentation and found this.
IMAP4.authenticate changed in version 3.5: string usernames and passwords are now encoded to utf-8 instead of being limited to ASCII.
You could try to encode the password, maybe the username also just in case, and retry it?
For more information please read:
IMAP4.authenticate(mechanism, authobject)

How can I use Windows authentication in lieu of storing / passing a password?

I am looking for a way to avoid storing / entering a password when attempting to connect to a Windows SharePoint site. I am using urllib2
The script functions correctly when I pass "user" and "password" as strings in the code below. I would rather leverage Windows Authentication to avoid having to store a password within the script.
import os
import urllib2
from ntlm import HTTPNtlmAuthHandler
user = '%s\%s' % ( os.environ["USERDOMAIN"], os.environ["USERNAME"] )
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, server, user, password)
Is there something akin to using "Trusted Connection" in pyodbc:
cnxn = pyodbc.connect("""Driver={SQL Server};Server=Whatever;Database=Whatever;**Trusted_Connection=yes**""")
After lengthy searching, I have come up empty. I am grateful for any suggestions.
If storing a password works, then I'd recommend just storing the password. Try using Python's keyring module to do this. https://pypi.python.org/pypi/keyring
This will keep the credentials secure on whatever platform the user is using to connect.

Python Hotmail login

I need a python script that prompts for a username and password and tries to login to Hotmail using those credentials, outputting whether they are valid or not.
Hotmail login!
import poplib
M = poplib.POP3_SSL('pop3.live.com', 995) #Connect to hotmail pop3 server
try:
M.user(raw_input("username: ")) #Get the username from the standar input
M.pass_(raw_input("password: ")) #Get the password from the standar input
except:
print "username or password incorrect"
else:
print "Successful login"
Edit: since you only need to know if you can do a login, I rewrite the code
If you lose connection during the typing the username or password, I don't know what will happend.
This is alternative if pop3 failed. just check login using IMAP for hotmail,live or now only outlook.com by using python outlook library you can download here :
https://github.com/awangga/outlook
import outlook
mail = outlook.Outlook()
mail.checkLogin()
it will attemp username and password for authentication validation.

Categories

Resources