Skip to content
This repository has been archived by the owner on Aug 7, 2020. It is now read-only.

fix command checking #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions deblaze.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import base64
import Image
import datetime
from whichcraft import which

'''
Disclaimer: Quick and dirty hacktool for flex remoting server. I suck at python.
Expand Down Expand Up @@ -518,6 +519,9 @@
QmCC
"""

def is_tool(name):
"""Check whether `name` is on PATH and marked as executable."""
return which(name) is not None


def buildHTML(*args):
Expand Down Expand Up @@ -970,7 +974,7 @@ def run(self, *params):
############################
def findRemotingMethods(self, swf):

proc = subprocess.Popen(['./swfdump', '-D',swf,],
proc = subprocess.Popen(['swfdump', '-D',swf,],
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
Expand Down Expand Up @@ -1190,7 +1194,7 @@ def parse_params(params):
useragent = 'PyAMF/%s' % '.'.join(map(lambda x: str(x), pyamf.__version__))

if options.swf:
if not os.path.isfile('swfdump'):
if not is_tool('swfdump'):
print "Missing swfdump in current path, please copy for automated mode"
sys.exit(1)
swfsplit = options.swf.split('/')
Expand Down