Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sshuttle
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pub
sshuttle
Commits
da7a490c
Commit
da7a490c
authored
Jan 19, 2011
by
Avery Pennarun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ui-macos: Actually prompt for passwords instead of assuming a default.
parent
342ce128
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
32 deletions
+25
-32
askpass.py
ui-macos/askpass.py
+23
-26
main.py
ui-macos/main.py
+2
-2
prime-sudo.sh
ui-macos/prime-sudo.sh
+0
-4
No files found.
ui-macos/askpass.py
100755 → 100644
View file @
da7a490c
#!/usr/bin/env python
import
sys
,
os
,
re
,
subprocess
import
sys
,
os
,
re
,
subprocess
prompt
=
' '
.
join
(
sys
.
argv
[
1
:
2
])
.
replace
(
'"'
,
"'"
)
def
askpass
(
prompt
):
prompt
=
prompt
.
replace
(
'"'
,
"'"
)
if
'yes/no'
in
prompt
:
if
'yes/no'
in
prompt
:
print
"yes"
return
"yes"
sys
.
exit
(
0
)
script
=
"""
script
=
"""
tell application "Finder"
tell application "Finder"
activate
activate
display dialog "
%
s"
\
display dialog "
%
s"
\
...
@@ -16,16 +15,14 @@ script="""
...
@@ -16,16 +15,14 @@ script="""
with icon caution
\
with icon caution
\
with hidden answer
with hidden answer
end tell
end tell
"""
%
prompt
"""
%
prompt
p
=
subprocess
.
Popen
([
'osascript'
,
'-e'
,
script
],
stdout
=
subprocess
.
PIPE
)
out
=
p
.
stdout
.
read
()
rv
=
p
.
wait
()
if
rv
:
# if they press the cancel button, it returns nonzero
sys
.
exit
(
1
)
g
=
re
.
match
(
"text returned:(.*), button returned:.*"
,
out
)
if
not
g
:
sys
.
exit
(
2
)
print
g
.
group
(
1
)
p
=
subprocess
.
Popen
([
'osascript'
,
'-e'
,
script
],
stdout
=
subprocess
.
PIPE
)
out
=
p
.
stdout
.
read
()
rv
=
p
.
wait
()
if
rv
:
return
None
g
=
re
.
match
(
"text returned:(.*), button returned:.*"
,
out
)
if
not
g
:
return
None
return
g
.
group
(
1
)
ui-macos/main.py
View file @
da7a490c
import
sys
,
os
,
pty
import
sys
,
os
,
pty
from
AppKit
import
*
from
AppKit
import
*
import
my
,
models
import
my
,
models
,
askpass
def
sshuttle_args
(
host
,
auto_nets
,
auto_hosts
,
nets
,
debug
):
def
sshuttle_args
(
host
,
auto_nets
,
auto_hosts
,
nets
,
debug
):
argv
=
[
my
.
bundle_path
(
'sshuttle/sshuttle'
,
''
),
'-r'
,
host
]
argv
=
[
my
.
bundle_path
(
'sshuttle/sshuttle'
,
''
),
'-r'
,
host
]
...
@@ -147,7 +147,7 @@ class SshuttleController(NSObject):
...
@@ -147,7 +147,7 @@ class SshuttleController(NSObject):
self
.
logField
.
didChangeText
()
self
.
logField
.
didChangeText
()
def
promptfunc
(
prompt
):
def
promptfunc
(
prompt
):
print
'prompt!
%
r'
%
prompt
print
'prompt!
%
r'
%
prompt
return
'scss'
return
askpass
.
askpass
(
prompt
)
nets_mode
=
server
.
autoNets
()
nets_mode
=
server
.
autoNets
()
if
nets_mode
==
models
.
NET_MANUAL
:
if
nets_mode
==
models
.
NET_MANUAL
:
manual_nets
=
[
"
%
s/
%
d"
%
(
i
.
subnet
(),
i
.
width
())
manual_nets
=
[
"
%
s/
%
d"
%
(
i
.
subnet
(),
i
.
width
())
...
...
ui-macos/prime-sudo.sh
deleted
100755 → 0
View file @
342ce128
#!/bin/sh
clear
printf
"[local sudo] "
sudo true
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