Skip to content

Commit

Permalink
Remove server and AppJailLauncher
Browse files Browse the repository at this point in the history
  • Loading branch information
krx committed Jul 13, 2017
1 parent 2b2a71d commit a61b4e6
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 220 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion tools/AppJailLauncher
Submodule AppJailLauncher deleted from d2d6f1
88 changes: 0 additions & 88 deletions tools/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,94 +8,6 @@
IS_LINUX = 'linux' in sys.platform
IS_WINDOWS = sys.platform == 'win32'

TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
RUNNER = os.path.join(TOOLS_DIR, 'challenge_runner.py')
AJL = os.path.join(TOOLS_DIR, 'AppJailLauncher', 'Debug', 'AppJailLauncher.exe')

# Key to get the server output fd
SERVER_OUT_KEY = 'SERVER_OUT_FD'

# Keys to grab the replay sync pipe fds
_RP_R = 'REPLAY_PIPE_R'
_RP_W = 'REPLAY_PIPE_W'

# Define all os-specific functions
if IS_WINDOWS:
import win32api
import win32pipe
import win32security
import win32file

def rp_create():
sattr = win32security.SECURITY_ATTRIBUTES()
sattr.bInheritHandle = 1
r, w = win32pipe.CreatePipe(sattr, 0)

os.putenv(_RP_R, str(int(r)))
os.putenv(_RP_W, str(int(w)))
return r, w

def rp_send_sync():
try:
fd = win32file._open_osfhandle(int(os.getenv(_RP_W)), os.O_APPEND)
os.write(fd, 'R')
os.close(fd)
except TypeError:
sys.stderr.write('Write end of sync pipe not specified\n')
except Exception as e:
print e

def rp_recv_sync():
try:
fd = win32file._open_osfhandle(int(os.getenv(_RP_R)), os.O_RDONLY)
while os.read(fd, 1) != 'R':
pass
os.close(fd)
except TypeError as e:
print e
sys.stderr.write('Read end of sync pipe not specified\n')
except Exception as e:
print e

def rp_close():
# Nothing to do here for windows
pass

def terminate(proc):
try:
win32api.TerminateProcess(proc._handle, 1)
except:
# An exception is thrown if the process has already terminated
pass

else:
PIPE_NAME = os.path.join(TOOLS_DIR, 'rpsync|')

def rp_create():
if not os.path.exists(PIPE_NAME):
os.mkfifo(PIPE_NAME)

def rp_send_sync():
try:
with open(PIPE_NAME, 'w+') as f:
f.write('R')
except TypeError:
sys.stderr.write('Write end of sync pipe not specified')

def rp_recv_sync():
try:
with open(PIPE_NAME, 'r') as f:
while f.read(1) != 'R':
pass
except TypeError:
sys.stderr.write('Read end of sync pipe not specified')

def rp_close():
os.remove(PIPE_NAME)

def terminate(proc):
proc.terminate()


def debug(s):
sys.stdout.write(str(s))
Expand Down
128 changes: 0 additions & 128 deletions tools/server.py

This file was deleted.

0 comments on commit a61b4e6

Please sign in to comment.