execute command in python script
import os
os.system("ma Commande")
#Exemple:
os.system("cd Documents")
execute command in python script
import os
os.system("ma Commande")
#Exemple:
os.system("cd Documents")
python on read text execute command
import subprocess
# read in users and strip the newlines
with open('/tmp/users.txt') as f:
userlist = [line.rstrip() for line in f]
# get list of commands for each user
cmds = []
for user in userlist:
cmds.append('smbmap -u {} -p p@ssw0rd -H 192.168.2.10'.format(user))
# results from the commands
results=[]
# execute the commands
for cmd in cmds:
results.append(subprocess.call(cmd, shell=True))
# check for which worked
for i,result in enumerate(results):
if result == 0:
print(cmds[i])
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us