Συντονιστής: konnn

#!/usr/bin/python
import subprocess
ECHO = "/usr/bin/echo"
ENCFS = "/usr/bin/encfs"
password = "password"
folderdir = "/home/chris/test"
enfolderdir = "/home/chris/.test"
p1 = subprocess.Popen([ECHO, password],\
stdout=subprocess.PIPE)
p2 = subprocess.Popen([ENCFS, "-S", enfolderdir, folderdir], stdin=p1.stdout, stdout=subprocess.PIPE)
chris@chris-Aspire-5732Z:~/Προγραμματισμός/PYTHON$ ./pexpect-example2.py
Traceback (most recent call last):
File "./pexpect-example2.py", line 12, in <module>
stdout=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1239, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory



clepto έγραψε:μπορώ να έχω 2 stdin σε μια Popen;


clepto έγραψε:να αλλα οταν σου ζηταει κωδικο και μετα επιβεβαιωση κωδικου; πως θα το κανεις;

encfs ~/.test ~/testp1 = subprocess.Popen([ECHO, passwd], stdout=subprocess.PIPE)
p2 = subprocess.Popen([ENCFS, "-S", enfolderdir, folderdir], stdin=p1.stdout, stdout=subprocess.PIPE)
έγραψε:encfs ~/.testy ~/testy
The directory "/home/savvas/.testy/" does not exist. Should it be created? (y,n) y
The directory "/home/savvas/testy" does not exist. Should it be created? (y,n) y
Creating new encrypted volume.
Please choose from one of the following options:
enter "x" for expert configuration mode,
enter "p" for pre-configured paranoia mode,
anything else, or an empty line will select standard mode.
?> p
Standard configuration selected.
Configuration finished. The filesystem to be created has
the following properties:
Filesystem cipher: "ssl/aes", version 3:0:2
Filename encoding: "nameio/block", version 3:0:1
Key Size: 192 bits
Block Size: 1024 bytes
Each file contains 8 byte header with unique IV data.
Filenames encoded using IV chaining mode.
File holes passed through to ciphertext.
Now you will need to enter a password for your filesystem.
You will need to remember this password, as there is absolutely
no recovery mechanism. However, the password can be changed
later using encfsctl.
New Encfs Password:
Verify Encfs Password:
$ read -s -p 'password>' pwd
$ touch ~/.encfs_pwd
$ chmod 600 ~/.encfs_pwd
$ echo "mypassword" >> ~/.encfs_pwd
$ encfs --extpass='/bin/cat ~/.encfs_pwd' ~/.box_enc ~/box#!/usr/bin/python
class passinput():
def __init__(self):
self.pass1 = ""
self.pass2 = ""
self.askpass()
self.passcheck()
def askpass(self):
self.pass1 = raw_input("Insert your password: ")
self.pass2 = raw_input("Type in your password again: ")
def passcheck(self):
while (self.pass1 != self.pass2):
print("Passwords do not match, try again!")
self.askpass()
print("password is: %s" % (self.pass1))
def startencfs(self):
import os
import os.path
import subprocess
import tempfile
ENCFS = "/usr/bin/encfs"
tmp = tempfile.mkstemp()[1]
with open(tmp, 'w') as f:
f.write(self.pass1)
print("File %s has the password: %s" % (tmp, self.pass1))
extpass = "/bin/cat %s" % (tmp)
enfolderdir = "/home/savvas/.testy"
folderdir = "/home/savvas/testy"
print("Creating folders")
if not os.path.exists(enfolderdir):
os.mkdir(enfolderdir, 0700) # mkdir and chmod 0700
if not os.path.exists(folderdir):
os.mkdir(folderdir, 0700)
print("Running encfs")
p2 = subprocess.Popen([ENCFS, "--extpass", extpass, enfolderdir, folderdir], \
stdout=subprocess.PIPE)
def main():
a = passinput()
a.startencfs()
if __name__ == "__main__":
main()
#!/usr/bin/python
class passinput():
def __init__(self):
self.pass1 = ""
self.pass2 = ""
self.askpass()
self.passcheck()
def askpass(self):
self.pass1 = raw_input("Insert your password: ")
self.pass2 = raw_input("Type in your password again: ")
def passcheck(self):
while (self.pass1 != self.pass2):
print("Passwords do not match, try again!")
self.askpass()
print("password is: %s" % (self.pass1))
def startencfs(self):
import os
import os.path
import subprocess
#import tempfile
ENCFS = "/usr/bin/encfs"
#tmp = tempfile.mkstemp()[1]
#with open(tmp, 'w') as f:
# f.write(self.pass1)
#print("File %s has the password: %s" % (tmp, self.pass1))
extpass = "/bin/echo %s" % (self.pass1)
enfolderdir = "/home/savvas/.testy"
folderdir = "/home/savvas/testy"
print("Creating folders...")
if not os.path.exists(enfolderdir):
os.mkdir(enfolderdir, 0700) # mkdir and chmod 0700
if not os.path.exists(folderdir):
os.mkdir(folderdir, 0700)
print("Running encfs...")
p2 = subprocess.Popen([ENCFS, "--extpass", extpass, enfolderdir, folderdir], \
stdout=subprocess.PIPE)
def main():
a = passinput()
a.startencfs()
if __name__ == "__main__":
main()
έγραψε:$ python test.py
Insert your password: axy783
Type in your password again: axy783
password is: axy783
Creating folders...
Running encfs...
$ encfsctl info ~/.testy/
Version 6 configuration; created by EncFS 1.7.4 (revision 20100713)
Filesystem cipher: "ssl/aes", version 3:0:0 (using 3:0:2)
Filename encoding: "nameio/block", version 3:0:0 (using 3:0:1)
Key Size: 192 bits
Using PBKDF2, with 167419 iterations
Salt Size: 160 bits
Block Size: 1024 bytes
Each file contains 8 byte header with unique IV data.
Filenames encoded using IV chaining mode.
File holes passed through to ciphertext.
