forked from apenwarr/sshuttle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A cute little GUI for sshuttle on MacOS, written using pyobjc. * macapp: ui-macos: call the main binary MacOS/Sshuttle. ui-macos/git-export.do: write the generated app to a branch. ui-macos/default.app.do: get rid of some duplicated files. ui-macos: Actually prompt for passwords instead of assuming a default. ui-macos: Don't enable connecting for hosts with Custom but zero subnets. ui-macos: Smoother log messages in the log window. ui-macos: Notice when we've connected; make debug logs optional. ui-macos: Much better connection status reporting. ui-macos/run.do: a shortcut for running debug.app. ui-macos/*: "a series of unfortunate events."
- Loading branch information
Showing
30 changed files
with
3,115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.pyc | ||
*~ | ||
/*.nib | ||
/debug.app | ||
/sources.list | ||
/Sshuttle VPN.app | ||
/*.tar.gz | ||
/*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>English</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>Sshuttle VPN</string> | ||
<key>CFBundleExecutable</key> | ||
<string>Sshuttle</string> | ||
<key>CFBundleIconFile</key> | ||
<string>app.icns</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>ca.apenwarr.Sshuttle</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>Sshuttle VPN</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>0.0.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>0.0.0</string> | ||
<key>LSUIElement</key> | ||
<string>1</string> | ||
<key>LSHasLocalizedDisplayName</key> | ||
<false/> | ||
<key>NSAppleScriptEnabled</key> | ||
<false/> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>GNU LGPL Version 2</string> | ||
<key>NSMainNibFile</key> | ||
<string>MainMenu</string> | ||
<key>NSPrincipalClass</key> | ||
<string>NSApplication</string> | ||
</dict> | ||
</plist> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>startAtLogin</key> | ||
<false/> | ||
<key>autoReconnect</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
redo-ifchange debug.app dist |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import sys, os, re, subprocess | ||
|
||
def askpass(prompt): | ||
prompt = prompt.replace('"', "'") | ||
|
||
if 'yes/no' in prompt: | ||
return "yes" | ||
|
||
script=""" | ||
tell application "Finder" | ||
activate | ||
display dialog "%s" \ | ||
with title "Sshuttle SSH Connection" \ | ||
default answer "" \ | ||
with icon caution \ | ||
with hidden answer | ||
end tell | ||
""" % prompt | ||
|
||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/runpython |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
APPL???? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* This rather pointless program acts like the python interpreter, except | ||
* it's intended to sit inside a MacOS .app package, so that its argv[0] | ||
* will point inside the package. | ||
* | ||
* NSApplicationMain() looks for Info.plist using the path in argv[0], which | ||
* goes wrong if your interpreter is /usr/bin/python. | ||
*/ | ||
#include <Python.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
char *path = strdup(argv[0]), *cptr; | ||
char *args[] = {argv[0], "../Resources/main.py", NULL}; | ||
cptr = strrchr(path, '/'); | ||
if (cptr) | ||
*cptr = 0; | ||
chdir(path); | ||
free(path); | ||
return Py_Main(2, args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
exec >&2 | ||
redo-ifchange runpython.c | ||
gcc -Wall -o $3 runpython.c \ | ||
-I/usr/include/python2.5 \ | ||
-lpython2.5 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
exec >&2 | ||
find -name '*~' | xargs rm -f | ||
rm -rf *.app *.zip *.tar.gz | ||
rm -f bits/runpython *.nib sources.list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
redo-ifchange bits/runpython MainMenu.nib | ||
rm -rf debug.app | ||
mkdir debug.app debug.app/Contents | ||
cd debug.app/Contents | ||
ln -s ../.. Resources | ||
ln -s ../.. English.lproj | ||
ln -s ../../Info.plist . | ||
ln -s ../../app.icns . | ||
|
||
mkdir MacOS | ||
cd MacOS | ||
ln -s ../../../bits/runpython Sshuttle | ||
|
||
cd ../../.. | ||
redo-ifchange $(find debug.app -type f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
TOP=$PWD | ||
redo-ifchange sources.list | ||
redo-ifchange Info.plist bits/runpython \ | ||
$(while read name newname; do echo "$name"; done <sources.list) | ||
|
||
rm -rf "$1.app" | ||
mkdir "$1.app" "$1.app/Contents" | ||
cd "$1.app/Contents" | ||
|
||
cp "$TOP/Info.plist" . | ||
|
||
mkdir MacOS | ||
cp "$TOP/bits/runpython" MacOS/Sshuttle | ||
|
||
mkdir Resources | ||
|
||
cd "$TOP" | ||
while read name newname; do | ||
[ -z "$name" ] && continue | ||
: "${newname:=$name}" | ||
outname=$1.app/Contents/Resources/$newname | ||
outdir=$(dirname "$outname") | ||
[ -d "$outdir" ] || mkdir "$outdir" | ||
cp "${name-$newname}" "$outname" | ||
done <sources.list | ||
|
||
cd "$1.app" | ||
redo-ifchange $(find . -type f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
exec >&2 | ||
IFS=" | ||
" | ||
redo-ifchange $1.app | ||
tar -czf $3 $1.app/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
exec >&2 | ||
IFS=" | ||
" | ||
redo-ifchange $1.app | ||
zip -q -r $3 $1.app/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
redo-ifchange $1.xib | ||
ibtool --compile $3 $1.xib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
redo-ifchange "Sshuttle VPN.app.zip" "Sshuttle VPN.app.tar.gz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# update a local branch with pregenerated output files, so people can download | ||
# the completed tarballs from github. Since we don't have any real binaries, | ||
# our final distribution package contains mostly blobs from the source code, | ||
# so this doesn't cost us much extra space in the repo. | ||
BRANCH=dist/macos | ||
redo-ifchange 'Sshuttle VPN.app' | ||
git update-ref refs/heads/$BRANCH origin/$BRANCH '' 2>/dev/null || true | ||
|
||
export GIT_INDEX_FILE=$PWD/gitindex.tmp | ||
rm -f "$GIT_INDEX_FILE" | ||
git add -f 'Sshuttle VPN.app' | ||
|
||
MSG="MacOS precompiled app package for $(git describe)" | ||
TREE=$(git write-tree --prefix=ui-macos) | ||
git show-ref refs/heads/$BRANCH >/dev/null && PARENT="-p refs/heads/$BRANCH" | ||
COMMITID=$(echo "$MSG" | git commit-tree $TREE $PARENT) | ||
|
||
git update-ref refs/heads/$BRANCH $COMMITID | ||
rm -f "$GIT_INDEX_FILE" |
Oops, something went wrong.