forked from mmtechnodrone/SSAK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjphs.py
97 lines (89 loc) · 3.59 KB
/
jphs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import os, pwd, sys, pexpect, re, struct, time
home = pwd.getpwuid(os.getuid()).pw_dir + '/SSAK/'
execdir = os.path.dirname(os.path.realpath(sys.argv[0]))
class jphs:
def jphideit2(self, widget):
os.environ["WINEDEBUG"] = "warn-all,-heap,-relay,err-all,fixme-all,trace-all"
os.environ["WINEPREFIX"] = home + "/wineprefix"
self.sfile = self.file.get_text()
self.spass = self.password.get_text()
self.hidefile = self.fchooser.get_filename()
filetype = self.fileinfo.get_text()
if self.sfile != '' and str.strip(self.spass) != '' and self.hidefile != None:
if "JPEG" in filetype:
head, tail = os.path.split(self.sfile)
needwin = ("OFF", "ON")[self.checkwin.get_active()]
if needwin == "ON":
outdir = home + tail + '/jphidewin'
progcmd = "/usr/bin/wine " + re.escape(execdir) + "/programs/Win/jphide.exe "
else:
outdir = home + tail + '/jphidelin'
progcmd = execdir + "/programs/" + self.arch + "/jphide "
if not os.path.isdir(outdir):
os.mkdir(outdir)
self.outfile = outdir + '/' +tail
if os.path.isfile(self.outfile):
os.remove(self.outfile)
cmd = progcmd + re.escape(self.sfile) + " " + re.escape(self.outfile) + " " + re.escape(self.hidefile)
child = pexpect.spawn(cmd)
child.expect('Passphrase:')
child.sendline(self.spass)
child.expect('Re-enter :')
child.sendline(self.spass)
child.expect(pexpect.EOF)
self.buffer1.set_text("Output file should be located here: " + self.outfile + "!")
self.showdiag()
else:
self.buffer1.set_text("Input file must be jpeg!")
self.showdiag()
else:
self.buffer1.set_text("You must select a valid input JPEG input file, a valid hide file and a password")
self.showdiag()
def jpseekit2(self, widget):
os.environ["WINEDEBUG"] = "warn-all,-heap,-relay,err-all,fixme-all,trace-all"
os.environ["WINEPREFIX"] = home + "/wineprefix"
self.sfile = self.file.get_text()
self.spass2 = self.password2.get_text()
filetype = self.fileinfo.get_text()
if self.sfile != '' and self.spass2 != '':
if "JPEG" in filetype:
head, tail = os.path.split(self.sfile)
needwin = ("OFF", "ON")[self.checkwin2.get_active()]
if needwin == "ON":
outdir = home + tail + '/jpseekwin'
if not os.path.isdir(outdir):
os.mkdir(outdir)
self.outfile = outdir + '/' + tail + '.txt'
if os.path.isfile(self.outfile):
os.remove(self.outfile)
cmd = "/usr/bin/wine " + re.escape(execdir) + "/programs/Win/jpseek.exe " + re.escape(self.sfile) + " " + re.escape(self.outfile)
child = pexpect.spawn(cmd)
child.expect('Passphrase:')
child.sendline(self.spass2)
child.expect(pexpect.EOF)
self.buffer1.set_text("Output file should be located here: " + self.outfile + "!")
self.showdiag()
os.chmod(self.outfile, 0o600)
else:
outdir = home + tail + '/jpseeklin'
if not os.path.isdir(outdir):
os.mkdir(outdir)
self.outfile = outdir + '/' + tail + '.txt'
if os.path.isfile(self.outfile):
os.remove(self.outfile)
cmd = execdir + "/programs/" + self.arch + "/jpseek " + re.escape(self.sfile) + " " + re.escape(self.outfile)
child = pexpect.spawn(cmd)
child.expect('Passphrase:')
child.sendline(self.spass2)
child.expect(pexpect.EOF)
time.sleep(3)
os.chmod(self.outfile, 0o600)
self.ident()
self.buffer1.set_text("Output file should be located here: " + self.outfile + "!")
self.showdiag()
else:
self.buffer1.set_text("Input file must be jpeg!")
self.showdiag()
else:
self.buffer1.set_text("You must select a valid file, and insert a password")
self.showdiag()