fetching password expiration details via python script
up vote
0
down vote
favorite
i am new to python scripting, i am making a script to check password expiration details using python by calling net user cmd command, then copying and pasting the cmd output into the text file.i want to read that text file, extract just the password related details and then want to write password details in the new file. Also i am trying to get info if the user is admin or not using this code.
code is:
import os
import socket
os.system(r'net user administrator > admin_access.txt')
lines = open('admin_access.txt', 'r')
f = lines.readlines()
for y in f:`enter code here`
print(y)
lines.close()
python-3.x windows command-prompt
add a comment |
up vote
0
down vote
favorite
i am new to python scripting, i am making a script to check password expiration details using python by calling net user cmd command, then copying and pasting the cmd output into the text file.i want to read that text file, extract just the password related details and then want to write password details in the new file. Also i am trying to get info if the user is admin or not using this code.
code is:
import os
import socket
os.system(r'net user administrator > admin_access.txt')
lines = open('admin_access.txt', 'r')
f = lines.readlines()
for y in f:`enter code here`
print(y)
lines.close()
python-3.x windows command-prompt
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
i am new to python scripting, i am making a script to check password expiration details using python by calling net user cmd command, then copying and pasting the cmd output into the text file.i want to read that text file, extract just the password related details and then want to write password details in the new file. Also i am trying to get info if the user is admin or not using this code.
code is:
import os
import socket
os.system(r'net user administrator > admin_access.txt')
lines = open('admin_access.txt', 'r')
f = lines.readlines()
for y in f:`enter code here`
print(y)
lines.close()
python-3.x windows command-prompt
i am new to python scripting, i am making a script to check password expiration details using python by calling net user cmd command, then copying and pasting the cmd output into the text file.i want to read that text file, extract just the password related details and then want to write password details in the new file. Also i am trying to get info if the user is admin or not using this code.
code is:
import os
import socket
os.system(r'net user administrator > admin_access.txt')
lines = open('admin_access.txt', 'r')
f = lines.readlines()
for y in f:`enter code here`
print(y)
lines.close()
python-3.x windows command-prompt
python-3.x windows command-prompt
asked Nov 19 at 11:45
tasmiya sana
1
1
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373948%2ffetching-password-expiration-details-via-python-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown