Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8196afc6
authored
Feb 05, 2013
by
tarokkk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Basic nx pwd coder
parent
381884f5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
531 additions
and
56 deletions
+531
-56
miscellaneous/laborclient/enc.pl
+181
-0
miscellaneous/laborclient/enc.py
+121
-0
miscellaneous/laborclient/rdp
+140
-0
miscellaneous/laborclient/store_gui.py
+89
-56
No files found.
miscellaneous/laborclient/enc.pl
0 → 100755
View file @
8196afc6
#!/usr/bin/perl
#http://www.nomachine.com/ar/view.php?ar_id=AR01C00125
use
strict
;
use
Time::
localtime
;
$::numValidCharList
=
85
;
$::dummyString
=
"{{{{"
;
#
#FOR TEST
#
my
$password
=
@ARGV
[
0
];
print
$password
,
"\n"
;
my
$scrambled_string
=
scrambleString
(
$password
);
print
$scrambled_string
,
"\n"
;
sub
getvalidCharList
{
my
$pos
=
shift
;
my
@validCharList
=
(
"!"
,
"#"
,
"\$"
,
"%"
,
"&"
,
"("
,
")"
,
"*"
,
"+"
,
"-"
,
"."
,
"0"
,
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
":"
,
";"
,
"<"
,
">"
,
"?"
,
"@"
,
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
,
"O"
,
"P"
,
"Q"
,
"R"
,
"S"
,
"T"
,
"U"
,
"V"
,
"W"
,
"X"
,
"Y"
,
"Z"
,
"["
,
"]"
,
"_"
,
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
,
"g"
,
"h"
,
"i"
,
"j"
,
"k"
,
"l"
,
"m"
,
"n"
,
"o"
,
"p"
,
"q"
,
"r"
,
"s"
,
"t"
,
"u"
,
"v"
,
"w"
,
"x"
,
"y"
,
"z"
,
"{"
,
"|"
,
"}"
);
return
$validCharList
[
$pos
];
}
sub
encodePassword
{
my
$p
=
shift
;
my
$sPass
=
":"
;
my
$sTmp
=
""
;
if
(
!
$p
)
{
return
""
;
}
for
(
my
$i
=
0
;
$i
<
length
(
$p
);
$i
++
)
{
my
$c
=
substr
(
$p
,
$i
,
1
);
my
$a
=
ord
(
$c
);
$sTmp
=
(
$a
+
$i
+
1
)
.
":"
;
$sPass
.=
$sTmp
;
$sTmp
=
""
;
}
return
$sPass
;
}
sub
findCharInList
{
my
$c
=
shift
;
my
$i
=
-
1
;
for
(
my
$j
=
0
;
$j
<
$::numValidCharList
;
$j
++
)
{
my
$randchar
=
getvalidCharList
(
$j
);
if
(
$randchar
eq
$c
)
{
$i
=
$j
;
return
$i
;
}
}
return
$i
;
}
sub
getRandomValidCharFromList
{
my
$tm
=
localtime
;
my
$k
=
(
$tm
->
sec
);
return
0
;
}
sub
scrambleString
{
my
$s
=
shift
;
my
$sRet
=
""
;
if
(
!
$s
)
{
return
$s
;
}
my
$str
=
encodePassword
(
$s
);
if
(
length
(
$str
)
<
32
)
{
$sRet
.=
$::dummyString
;
}
for
(
my
$iR
=
(
length
(
$str
)
-
1
);
$iR
>=
0
;
$iR
--
)
{
#
#Reverse string.
#
$sRet
.=
substr
(
$str
,
$iR
,
1
);
}
if
(
length
(
$sRet
)
<
32
)
{
$sRet
.=
$::dummyString
;
}
my
$app
=
getRandomValidCharFromList
();
my
$k
=
ord
(
$app
);
my
$l
=
$k
+
length
(
$sRet
)
-
2
;
$sRet
=
$app
.
$sRet
;
for
(
my
$i1
=
1
;
$i1
<
length
(
$sRet
);
$i1
++
)
{
my
$app2
=
substr
(
$sRet
,
$i1
,
1
);
my
$j
=
findCharInList
(
$app2
);
if
(
$j
==
-
1
)
{
return
$sRet
;
}
my
$i
=
(
$j
+
$l
*
(
$i1
+
1
))
%
$
::numValidCharList
;
my
$car
=
getvalidCharList
(
$i
);
$sRet
=
substr_replace
(
$sRet
,
$car
,
$i1
,
1
);
}
my
$c
=
(
ord
(
getRandomValidCharFromList
()))
+
2
;
my
$c2
=
chr
(
$c
);
$sRet
=
$sRet
.
$c2
;
return
URLEncode
(
$sRet
);
}
sub
URLEncode
{
my
$theURL
=
$_
[
0
];
$theURL
=~
s/&/&/g
;
$theURL
=~
s/\"\"/"/g
;
$theURL
=~
s/\'/'/g
;
$theURL
=~
s/</</g
;
$theURL
=~
s/>/>/g
;
return
$theURL
;
}
sub
substr_replace
{
my
$str
=
shift
;
my
$ch
=
shift
;
my
$pos
=
shift
;
my
$qt
=
shift
;
my
@list
=
split
(
//
,
$str
);
my
$count
=
0
;
my
$tmp_str
=
''
;
foreach
my
$key
(
@list
)
{
if
(
$count
!=
$pos
)
{
$tmp_str
.=
$key
;
}
else
{
$tmp_str
.=
$ch
;
}
$count
++
;
}
return
$tmp_str
;
}
miscellaneous/laborclient/enc.py
0 → 100755
View file @
8196afc6
#!/usr/bin/python
import
sys
import
random
import
re
numValidCharList
=
85
dummyString
=
"{{{{"
def
getvalidCharList
(
pos
):
validcharlist
=
[
"!"
,
"#"
,
"$"
,
"
%
"
,
"&"
,
"("
,
")"
,
"*"
,
"+"
,
"-"
,
"."
,
"0"
,
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
":"
,
";"
,
"<"
,
">"
,
"?"
,
"@"
,
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
,
"O"
,
"P"
,
"Q"
,
"R"
,
"S"
,
"T"
,
"U"
,
"V"
,
"W"
,
"X"
,
"Y"
,
"Z"
,
"["
,
"]"
,
"_"
,
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
,
"g"
,
"h"
,
"i"
,
"j"
,
"k"
,
"l"
,
"m"
,
"n"
,
"o"
,
"p"
,
"q"
,
"r"
,
"s"
,
"t"
,
"u"
,
"v"
,
"w"
,
"x"
,
"y"
,
"z"
,
"{"
,
"|"
,
"}"
]
return
validcharlist
[
pos
]
def
encodePassword
(
p
):
sPass
=
":"
sTmp
=
""
if
not
p
:
return
""
for
i
in
range
(
len
(
p
)):
c
=
p
[
i
:
i
+
1
]
a
=
ord
(
c
)
sTmp
=
str
(
a
+
i
+
1
)
+
":"
sPass
+=
sTmp
sTmp
=
""
return
sPass
def
findCharInList
(
c
):
i
=
-
1
for
j
in
range
(
numValidCharList
):
randchar
=
getvalidCharList
(
j
);
if
randchar
==
c
:
i
=
j
return
i
return
i
def
getRandomValidCharFromList
():
#return getvalidCharList(random.randint(0,60))
return
getvalidCharList
(
0
)
def
scrambleString
(
s
):
sRet
=
""
if
not
s
:
return
s
strp
=
encodePassword
(
s
)
if
len
(
strp
)
<
32
:
sRet
+=
dummyString
for
iR
in
reversed
(
range
(
len
(
strp
)
-
1
)):
sRet
+=
strp
[
iR
:
iR
+
1
]
if
len
(
sRet
)
<
32
:
sRet
+=
dummyString
app
=
getRandomValidCharFromList
()
k
=
ord
(
app
)
l
=
k
+
len
(
sRet
)
-
2
sRet
=
app
+
sRet
for
i1
in
range
(
1
,
len
(
sRet
)):
app2
=
sRet
[
i1
:
i1
+
1
]
j
=
findCharInList
(
app2
)
if
j
==
-
1
:
return
sRet
i
=
(
j
+
l
*
(
i1
+
1
))
%
numValidCharList
car
=
getvalidCharList
(
i
)
sRet
=
substr_replace
(
sRet
,
car
,
i1
,
1
)
c
=
(
ord
(
getRandomValidCharFromList
()))
+
2
c2
=
chr
(
c
)
sRet
=
sRet
+
c2
return
URLEncode
(
sRet
)
def
URLEncode
(
url
):
theURL
=
url
#theURL =~ s/&/&/g;
url
=
re
.
sub
(
"&"
,
"&"
,
url
)
#theURL =~ s/\"\"/"/g;
url
=
re
.
sub
(
"
\"
"
,
"""
,
url
)
#theURL =~ s/\'/'/g;
url
=
re
.
sub
(
"
\"
"
,
"""
,
url
)
#theURL =~ s/</</g;
url
=
re
.
sub
(
"<"
,
"<"
,
url
)
#theURL =~ s/>/>/g;
url
=
re
.
sub
(
">"
,
">"
,
url
)
return
theURL
def
substr_replace
(
in_str
,
ch
,
pos
,
qt
):
clist
=
list
(
in_str
)
count
=
0
;
tmp_str
=
''
;
for
key
in
clist
:
if
count
!=
pos
:
tmp_str
+=
key
else
:
tmp_str
+=
ch
count
=
count
+
1
return
tmp_str
if
__name__
==
"__main__"
:
password
=
sys
.
argv
[
0
]
print
password
print
scrambleString
(
password
)
miscellaneous/laborclient/rdp
0 → 100755
View file @
8196afc6
#!/bin/bash
IFS
=
:
read
scheme user password host port
<<<
"
$*
"
case
$scheme
in
rdp
)
tmp
=
$(
mktemp
)
rdesktop
-khu
-E
-P
-0
-f
-u
"
$user
"
-p
"
$password
"
"
$host
"
:
"
$port
"
2>
$tmp
if
grep
'^ERROR'
<
$tmp
then
err
=
"
$(
grep
'^ERROR'
$tmp
)
"
rm /home/user/.ssh/known_hosts
/usr/NX/bin/nxclient
--dialog
error
--message
"
$err
"
&
fi
rm
$tmp
;;
nx
)
f
=
$(
mktemp
)
#pw=$(perl /usr/local/bin/enc.pl "$password"|tail -1|sed -e 's/\&/\&/g' -e 's/</\</g' -e 's/"/"/g' -e "s/'/\'/g")
pw
=
$(
perl /usr/local/bin/enc.pl
"
$password
"
|tail
-1
)
cat
>
"
$f
"
<<
A
<!DOCTYPE NXClientSettings>
<NXClientSettings application="nxclient" version="1.3" >
<group name="Advanced" >
<option key="Cache size" value="16" />
<option key="Cache size on disk" value="64" />
<option key="Current keyboard" value="true" />
<option key="Custom keyboard layout" value="" />
<option key="Disable DirectDraw" value="false" />
<option key="Disable ZLIB stream compression" value="false" />
<option key="Disable deferred updates" value="false" />
<option key="Enable HTTP proxy" value="false" />
<option key="Enable SSL encryption" value="true" />
<option key="Enable response time optimisations" value="false" />
<option key="Grab keyboard" value="false" />
<option key="HTTP proxy host" value="" />
<option key="HTTP proxy port" value="8080" />
<option key="HTTP proxy username" value="" />
<option key="Remember HTTP proxy password" value="false" />
<option key="Restore cache" value="true" />
<option key="StreamCompression" value="" />
</group>
<group name="Environment" >
<option key="CUPSD path" value="/usr/sbin/cupsd" />
</group>
<group name="General" >
<option key="Automatic reconnect" value="true" />
<option key="Command line" value="" />
<option key="Custom Unix Desktop" value="console" />
<option key="Desktop" value="gnome" />
<option key="Disable SHM" value="false" />
<option key="Disable emulate shared pixmaps" value="false" />
<option key="Link speed" value="lan" />
<option key="Remember password" value="true" />
<option key="Resolution" value="fullscreen" />
<option key="Resolution height" value="600" />
<option key="Resolution width" value="800" />
<option key="Server host" value="
${
host
}
" />
<option key="Server port" value="
${
port
}
" />
<option key="Session" value="unix" />
<option key="Spread over monitors" value="false" />
<option key="Use default image encoding" value="0" />
<option key="Use render" value="true" />
<option key="Use taint" value="true" />
<option key="Virtual desktop" value="false" />
<option key="XAgent encoding" value="true" />
<option key="displaySaveOnExit" value="true" />
<option key="xdm broadcast port" value="177" />
<option key="xdm list host" value="localhost" />
<option key="xdm list port" value="177" />
<option key="xdm mode" value="server decide" />
<option key="xdm query host" value="localhost" />
<option key="xdm query port" value="177" />
</group>
<group name="Images" >
<option key="Disable JPEG Compression" value="0" />
<option key="Disable all image optimisations" value="false" />
<option key="Disable backingstore" value="false" />
<option key="Disable composite" value="false" />
<option key="Image Compression Type" value="3" />
<option key="Image Encoding Type" value="0" />
<option key="Image JPEG Encoding" value="false" />
<option key="JPEG Quality" value="6" />
<option key="RDP Image Encoding" value="3" />
<option key="RDP JPEG Quality" value="6" />
<option key="RDP optimization for low-bandwidth link" value="false" />
<option key="Reduce colors to" value="" />
<option key="Use PNG Compression" value="true" />
<option key="VNC JPEG Quality" value="6" />
<option key="VNC images compression" value="3" />
</group>
<group name="Login" >
<option key="Auth" value="
${
pw
}
" />
<option key="Guest Mode" value="false" />
<option key="Guest password" value="" />
<option key="Guest username" value="" />
<option key="Login Method" value="nx" />
<option key="User" value="
${
user
}
" />
</group>
<group name="Services" >
<option key="Audio" value="false" />
<option key="IPPPort" value="631" />
<option key="IPPPrinting" value="false" />
<option key="Shares" value="false" />
</group>
<group name="VNC Session" >
<option key="Display" value="0" />
<option key="Remember" value="false" />
<option key="Server" value="" />
</group>
<group name="Windows Session" >
<option key="Application" value="" />
<option key="Authentication" value="2" />
<option key="Color Depth" value="8" />
<option key="Domain" value="" />
<option key="Image Cache" value="true" />
<option key="Password" value="EMPTY_PASSWORD" />
<option key="Remember" value="true" />
<option key="Run application" value="false" />
<option key="Server" value="" />
<option key="User" value="" />
</group>
<group name="share chosen" >
<option key="Share number" value="0" />
</group>
</NXClientSettings>
A
/usr/NX/bin/nxclient
--session
$f
;;
sshterm
)
#/usr/NX/bin/nxclient --dialog ok --message "Jelszó: $password" &
#rm /home/user/.ssh/known_hosts
#rxvt-unicode -e sh -c "ssh $user@$host -p$port; sleep 2"
gnome-terminal
-e
"sshpass -p "
$password
" ssh -o StrictHostKeyChecking=no
$user
@
$host
-p
$port
"
;;
*
)
xmessage
"
$scheme
is not supported."
;;
esac
echo
"
$*
"
>>
/tmp/protolog
miscellaneous/laborclient/store_gui.py
View file @
8196afc6
...
...
@@ -7,49 +7,64 @@ import base64
import
subprocess
import
os
def
keygen
(
length
=
1024
):
import
os
,
base64
from
datetime
import
date
from
Crypto.PublicKey
import
RSA
### Settings ###
KEY_DIR
=
"/tmp/"
KEY_FILE
=
KEY_DIR
+
"/id_rsa"
key
=
RSA
.
generate
(
length
,
os
.
urandom
)
try
:
pub
=
key
.
exportKey
(
'OpenSSH'
)
if
not
pub
.
startswith
(
"ssh-"
):
raise
ValueError
(
pub
)
except
:
ssh_rsa
=
'00000007'
+
base64
.
b16encode
(
'ssh-rsa'
)
exponent
=
'
%
x'
%
(
key
.
e
,
)
if
len
(
exponent
)
%
2
:
exponent
=
'0'
+
exponent
class
KeyGen
:
"""Attributes:
private_key
public_key
"""
ssh_rsa
+=
'
%08
x'
%
(
len
(
exponent
)
/
2
,
)
ssh_rsa
+=
exponent
def
__init__
(
self
):
self
.
private_key
,
self
.
public_key
=
self
.
keygen
(
2048
)
def
keygen
(
self
,
length
=
1024
):
"""Generate Keypair for SSH
(private_key, public_key)
"""
import
os
,
base64
from
datetime
import
date
from
Crypto.PublicKey
import
RSA
key
=
RSA
.
generate
(
length
,
os
.
urandom
)
try
:
pub
=
key
.
exportKey
(
'OpenSSH'
)
if
not
pub
.
startswith
(
"ssh-"
):
raise
ValueError
(
pub
)
except
:
ssh_rsa
=
'00000007'
+
base64
.
b16encode
(
'ssh-rsa'
)
exponent
=
'
%
x'
%
(
key
.
e
,
)
if
len
(
exponent
)
%
2
:
exponent
=
'0'
+
exponent
modulus
=
'
%
x'
%
(
key
.
n
,
)
if
len
(
modulus
)
%
2
:
modulus
=
'0'
+
modulus
ssh_rsa
+=
'
%08
x'
%
(
len
(
exponent
)
/
2
,
)
ssh_rsa
+=
exponent
if
modulus
[
0
]
in
'89abcdef'
:
modulus
=
'00'
+
modulus
modulus
=
'
%
x'
%
(
key
.
n
,
)
if
len
(
modulus
)
%
2
:
modulus
=
'0'
+
modulus
ssh_rsa
+=
'
%08
x'
%
(
len
(
modulus
)
/
2
,
)
ssh_rsa
+=
modulus
if
modulus
[
0
]
in
'89abcdef'
:
modulus
=
'00'
+
modulus
pub
=
'ssh-rsa
%
s'
%
(
base64
.
b64encode
(
base64
.
b16decode
(
ssh_rsa
.
upper
())),
)
return
key
.
exportKey
(),
"
%
s
%
s"
%
(
pub
,
"cloud-
%
s"
%
date
.
today
())
ssh_rsa
+=
'
%08
x'
%
(
len
(
modulus
)
/
2
,
)
ssh_rsa
+=
modulus
pub
=
'ssh-rsa
%
s'
%
(
base64
.
b64encode
(
base64
.
b16decode
(
ssh_rsa
.
upper
())),
)
return
key
.
exportKey
(),
"
%
s
%
s"
%
(
pub
,
"cloud-
%
s"
%
date
.
today
())
### Settings ###
KEY_DIR
=
"/tmp/"
KEY_FILE
=
KEY_DIR
+
"/id_rsa"
#Initalize keypair
private_key
,
public_key
=
keygen
(
2048
)
keygen
=
KeyGen
()
private_key
=
keygen
.
private_key
public_key
=
keygen
.
public_key
#Saver private_key
#Saver private_key
to KEY_FILE
with
open
(
KEY_FILE
,
'w'
)
as
f
:
f
.
write
(
private_key
)
#
pub_key_string
=
base64
.
b64encode
(
public_key
)
...
...
@@ -59,20 +74,31 @@ class Browser:
def
__init__
(
self
):
#Init window components
gobject
.
threads_init
()
self
.
window
=
gtk
.
Window
()
self
.
window
=
gtk
.
Window
(
type
=
gtk
.
WINDOW_TOPLEVEL
)
#Register window events
self
.
window
.
connect
(
"destroy"
,
self
.
destroy
)
#DEBUG
print
self
.
window
.
get_resizable
()
self
.
window
.
set_decorated
(
True
)
#self.window.connect(
self
.
window
.
set_title
(
"IK CloudStore Login"
)
self
.
window
.
set_default_size
(
1024
,
600
)
self
.
window
.
set_position
(
gtk
.
WIN_POS_CENTER
)
#Init toolbar
self
.
toolbar
=
gtk
.
Toolbar
()
#Init browser
self
.
browser
=
webkit
.
WebView
()
self
.
browser
.
connect
(
'onload-event'
,
self
.
load_committed_cb
)
# self.
browser
.open("http://10.9.1.86:8080")
self
.
browser
.
open
(
"https://cloud.ik.bme.hu/store/gui
/"
)
self
.
browser
.
connect
(
"navigation-requested"
,
self
.
on_navigation_requested
)
#self.
browser
.open("http://index.hu")
self
.
webview
=
webkit
.
WebView
()
self
.
webview
.
connect
(
'onload-event'
,
self
.
load_committed_cb
)
# self.
webview
.open("http://10.9.1.86:8080")
self
.
webview
.
open
(
"https://cloud.ik.bme.hu
/"
)
self
.
webview
.
connect
(
"navigation-requested"
,
self
.
on_navigation_requested
)
#self.
webview
.open("http://index.hu")
#Sample button
self
.
help_button
=
gtk
.
ToolButton
(
gtk
.
STOCK_HELP
)
...
...
@@ -85,15 +111,22 @@ class Browser:
self
.
toolbar
.
add
(
self
.
help_button
)
self
.
vbox
=
gtk
.
VBox
(
False
,
0
)
self
.
vbox
.
pack_start
(
self
.
toolbar
,
False
,
True
,
0
)
self
.
vbox
.
add
(
self
.
browser
)
self
.
scrolledwindow
=
gtk
.
ScrolledWindow
()
self
.
scrolledwindow
.
add
(
self
.
webview
)
self
.
vbox
.
add
(
self
.
scrolledwindow
)
self
.
window
.
add
(
self
.
vbox
)
#self.window.add(self.
browser
)
#self.window.add(self.
webview
)
self
.
window
.
show_all
()
def
destroy
(
self
,
dummy
):
self
.
browser
.
execute_script
(
"resetKey()"
)
self
.
webview
.
execute_script
(
"resetKey()"
)
gtk
.
main_quit
()
def
parse_remote_login
(
uri
):
#rdp:cloud:qYSv3eQJYY:152.66.243.62:23037
scheme
,
user
,
password
,
host
,
port
=
uri
.
split
(
':'
,
4
)
def
on_navigation_requested
(
self
,
view
,
frame
,
req
,
data
=
None
):
uri
=
req
.
get_uri
()
#print "On nav: " + uri
...
...
@@ -108,26 +141,26 @@ class Browser:
except
:
pass
if
scheme
==
'login'
:
self
.
browser
.
execute_script
(
"postKey(
\"
%
s
\"
)"
%
pub_key_string
)
self
.
browser
.
execute_script
(
"document.getElementById(
\"
login_button
\"
).hidden=true ;"
)
self
.
browser
.
execute_script
(
"document.getElementById(
\"
logout_button
\"
).hidden=false ;"
)
self
.
browser
.
execute_script
(
"document.getElementById(
\"
mount_button
\"
).hidden=false ;"
)
self
.
webview
.
execute_script
(
"postKey(
\"
%
s
\"
)"
%
pub_key_string
)
self
.
webview
.
execute_script
(
"document.getElementById(
\"
login_button
\"
).hidden=true ;"
)
self
.
webview
.
execute_script
(
"document.getElementById(
\"
logout_button
\"
).hidden=false ;"
)
self
.
webview
.
execute_script
(
"document.getElementById(
\"
mount_button
\"
).hidden=false ;"
)
return
True
elif
scheme
==
'logout'
:
self
.
browser
.
execute_script
(
"resetKey()"
)
self
.
browser
.
execute_script
(
"document.getElementById(
\"
logout_button
\"
).hidden=true ;"
)
self
.
browser
.
execute_script
(
"document.getElementById(
\"
login_button
\"
).hidden=false ;"
)
self
.
browser
.
execute_script
(
"document.getElementById(
\"
mount_button
\"
).hidden=true ;"
)
self
.
webview
.
execute_script
(
"resetKey()"
)
self
.
webview
.
execute_script
(
"document.getElementById(
\"
logout_button
\"
).hidden=true ;"
)
self
.
webview
.
execute_script
(
"document.getElementById(
\"
login_button
\"
).hidden=false ;"
)
self
.
webview
.
execute_script
(
"document.getElementById(
\"
mount_button
\"
).hidden=true ;"
)
return
True
elif
scheme
==
"mount"
:
self
.
mount_sshfs_folder
(
self
.
neptun
,
self
.
host
)
self
.
browser
.
execute_script
(
"document.getElementById(
\"
mount_button
\"
).hidden=true ;"
)
self
.
browser
.
execute_script
(
"document.getElementById(
\"
umount_button
\"
).hidden=false ;"
)
self
.
webview
.
execute_script
(
"document.getElementById(
\"
mount_button
\"
).hidden=true ;"
)
self
.
webview
.
execute_script
(
"document.getElementById(
\"
umount_button
\"
).hidden=false ;"
)
return
True
elif
scheme
==
"umount"
:
self
.
umount_sshfs_folder
()
self
.
browser
.
execute_script
(
"document.getElementById(
\"
mount_button
\"
).hidden=false ;"
)
self
.
browser
.
execute_script
(
"document.getElementById(
\"
umount_button
\"
).hidden=true ;"
)
self
.
webview
.
execute_script
(
"document.getElementById(
\"
mount_button
\"
).hidden=false ;"
)
self
.
webview
.
execute_script
(
"document.getElementById(
\"
umount_button
\"
).hidden=true ;"
)
return
True
else
:
return
False
...
...
@@ -140,12 +173,12 @@ class Browser:
result
=
subprocess
.
call
([
'/bin/fusermount'
,
'-u'
,
"/home/tarokkk/sshfs"
])
def
hello
(
self
,
widget
):
self
.
browser
.
open
(
"https://login.bme.hu/admin/"
)
self
.
webview
.
open
(
"https://login.bme.hu/admin/"
)
def
store
(
self
,
widget
):
self
.
browser
.
open
(
"https://cloud.ik.bme.hu/store/gui/"
)
self
.
webview
.
open
(
"https://cloud.ik.bme.hu/store/gui/"
)
def
load_committed_cb
(
self
,
web_view
,
frame
):
self
.
browser
.
execute_script
(
'document.getElementsByTagName("a")[0].target="";'
)
self
.
webview
.
execute_script
(
'document.getElementsByTagName("a")[0].target="";'
)
#uri = frame.get_uri()
#print uri
#print web_view.get_title()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment