本文整理汇总了Python中utils.logMessage函数的典型用法代码示例。如果您正苦于以下问题:Python logMessage函数的具体用法?Python logMessage怎么用?Python logMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logMessage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: scanApplications
def scanApplications():
#app plists
appPlists = []
#dbg msg
utils.logMessage(utils.MODE_INFO, 'generating list of all installed apps')
#get all installed apps
installedApps = utils.getInstalledApps()
#now, get Info.plist for each app
for app in installedApps:
#skip apps that don't have a path
if not 'path' in app:
#skip
continue
#get/load app's Info.plist
plist = utils.loadInfoPlist(app['path'])
#skip apps that don't have Info.plist
if not plist:
#skip
continue
#save plist for processing
appPlists.append(plist)
#check all plists for DYLD_INSERT_LIBRARIES
# ->for each found, creates file object
return scanPlists(appPlists, APPLICATION_DYLD_KEY, isLoaded=True)
开发者ID:Marginal,项目名称:knockknock,代码行数:35,代码来源:dylib.py
示例2: storeApiResponse
def storeApiResponse(db, response):
cur = db.cursor()
logMessage('psql', 'Inserting response of \'%s\' api call' % (response.method))
cur.execute('INSERT INTO flickr_api (hash, api, params, main_arg, response) VALUES(%s, %s, %s, %s, %s)',
(response.digest(), response.method, json.dumps(response.params), response.main_arg, json.dumps(response.result)))
db.commit()
cur.close()
开发者ID:gianbottalico,项目名称:IRProject,代码行数:7,代码来源:database.py
示例3: scan
def scan(self):
#cron jobs files
cronJobFiles = []
#init results dictionary
results = self.initResults(CRON_JOBS_NAME, CRON_JOBS_DESCRIPTION)
#dbg
utils.logMessage(utils.MODE_INFO, 'running scan')
#get all files in kext directories
cronJobFiles.extend(glob.glob(CRON_JOB_DIRECTORY + '*'))
#process
# ->open file and read each line
for cronJobFile in cronJobFiles:
#open file
# ->read each line (for now, assume 1 cron job per line)
with open(cronJobFile, 'r') as file:
#read each line
for cronJobData in file:
#skip comment lines
if cronJobData.lstrip().startswith('#'):
#skip
continue
#create and append job
results['items'].append(command.Command(cronJobData.strip()))
return results
开发者ID:EntropyWorks,项目名称:knockknock,代码行数:35,代码来源:cronjob.py
示例4: scan
def scan(self):
#commands
commands = []
#dbg msg
utils.logMessage(utils.MODE_INFO, 'running scan')
#init results dictionary
results = self.initResults(LAUNCHD_CONF_NAME, LAUNCHD_CONF_DESCRIPTION)
#get all commands in launchd.conf
# ->note, commands in functions will be ignored...
commands = utils.parseBashFile(LAUNCHD_CONF_FILE)
#iterate over all commands
# ->instantiate command obj and save into results
for extractedCommand in commands:
#TODO: could prolly do some more advanced processing (e.g. look for bsexec, etc)
#instantiate and save
results['items'].append(command.Command(extractedCommand))
return results
开发者ID:EntropyWorks,项目名称:knockknock,代码行数:25,代码来源:launchdConf.py
示例5: scan
def scan(self):
#kexts
kexts = []
#dbg
utils.logMessage(utils.MODE_INFO, 'running scan')
#init results dictionary
results = self.initResults(KEXT_NAME, KEXT_DESCRIPTION)
#get all files in kext directories
for kextDir in KEXT_DIRECTORIES:
#dbg
utils.logMessage(utils.MODE_INFO, 'scanning %s' % kextDir)
#get kexts
kexts.extend(glob.glob(kextDir + '*'))
#process
# ->gets kext's binary, then create file object and add to results
for kextBundle in kexts:
#skip kext bundles that don't have kext's
if not utils.getBinaryFromBundle(kextBundle):
#next!
continue
#create and append
# ->pass bundle, since want to access info.plist, etc
results['items'].append(file.File(kextBundle))
return results
开发者ID:EntropyWorks,项目名称:knockknock,代码行数:35,代码来源:kext.py
示例6: scan
def scan(self):
#commands
commands = []
#dbg msg
utils.logMessage(utils.MODE_INFO, 'running scan')
#init results dictionary
results = self.initResults(RC_SCRIPT_NAME, RC_SCRIPT_DESCRIPTION)
#scan/parse all rc files
for rcScript in RC_SCRIPTS:
#get all commands in script file
# ->note, commands in functions will be ignored...
# of course, if the function is invoked, this invocation will be displayed
commands = utils.parseBashFile(os.path.join('/etc', rcScript))
#iterate over all commands
# ->instantiate command obj and save into results
for extractedCommand in commands:
#instantiate and save
results['items'].append(command.Command(extractedCommand, rcScript))
return results
开发者ID:Noktec,项目名称:knockknock,代码行数:27,代码来源:rcScript.py
示例7: scanLaunchItems
def scanLaunchItems(directories):
#launch items
launchItems = []
#results
results = []
#expand directories
# ->ensures '~'s are expanded to all user's
directories = utils.expandPaths(directories)
#get all files (plists) in launch daemon/agent directories
for directory in directories:
#dbg msg
utils.logMessage(utils.MODE_INFO, 'scanning %s' % directory)
#get launch daemon/agent
launchItems.extend(glob.glob(directory + '*'))
#process
# ->get all auto-run launch services
autoRunItems = autoRunBinaries(launchItems)
#iterate over all auto-run items (list of the plist and the binary)
# ->create file object and add to results
for autoRunItem in autoRunItems:
#create and append
results.append(file.File(autoRunItem[0], autoRunItem[1]))
return results
开发者ID:MrColon,项目名称:knockknock,代码行数:33,代码来源:launchDandA.py
示例8: scan
def scan(self):
#results
results = []
#dbg
utils.logMessage(utils.MODE_INFO, 'running scan')
#init results
# ->for for login hook
results.append(self.initResults(LOGIN_HOOK_NAME, LOGIN_HOOK_DESCRIPTION))
#init results
# ->for logout hook
results.append(self.initResults(LOGOUT_HOOK_NAME, LOGOUT_HOOK_DESCRIPTION))
#load plist
plistData = utils.loadPlist(LOGIN_WINDOW_FILE)
#make sure plist loaded
if plistData:
#grab login hook
if 'LoginHook' in plistData:
#save into first index of result
results[0]['items'].append(command.Command(plistData['LoginHook']))
#grab logout hook
if 'LogoutHook' in plistData:
#save into second index of result
results[1]['items'].append(command.Command(plistData['LogoutHook']))
return results
开发者ID:EntropyWorks,项目名称:knockknock,代码行数:35,代码来源:logHook.py
示例9: scan
def scan(self):
#results
results = []
#dbg msg
utils.logMessage(utils.MODE_INFO, 'running scan')
#init results
results = self.initResults(INSERTED_DYNAMIC_LIBRARIES_NAME, INSERTED_DYNAMIC_LIBRARIES_DESCRIPTION)
#scan launch items for inserted dylibs
launchItems = scanLaunchItems(LAUNCH_ITEMS_DIRECTORIES)
if launchItems:
#save
results['items'].extend(launchItems)
#scan all installed applications for inserted dylibs
applications = scanApplications()
if applications:
#save
results['items'].extend(applications)
return results
开发者ID:Noktec,项目名称:knockknock,代码行数:26,代码来源:dylib.py
示例10: scan
def scan(self):
#results
results = []
#dbg msg
utils.logMessage(utils.MODE_INFO, 'running scan')
#init results
# ->for launch daemons
results.append(self.initResults(LAUNCH_DAEMON_NAME, LAUNCH_DAEMON_DESCRIPTION))
#init results
# ->for launch agents
results.append(self.initResults(LAUNCH_AGENT_NAME, LAUNCH_AGENT_DESCRIPTION))
#scan for auto-run launch daemons
# ->save in first index of array
results[0]['items'] = scanLaunchItems(LAUNCH_DAEMON_DIRECTORIES)
#scan for auto-run launch agents
# ->save in second index of array
results[1]['items'] = scanLaunchItems(LAUNCH_AGENTS_DIRECTORIES)
return results
开发者ID:MrColon,项目名称:knockknock,代码行数:25,代码来源:launchDandA.py
示例11: scan
def scan(self):
#results
results = []
#dbg msg
utils.logMessage(utils.MODE_INFO, 'running scan')
#init results
# ->for launch daemons
results.append(self.initResults(LAUNCH_DAEMON_NAME, LAUNCH_DAEMON_DESCRIPTION))
#init results
# ->for launch agents
results.append(self.initResults(LAUNCH_AGENT_NAME, LAUNCH_AGENT_DESCRIPTION))
#init overriden items
# ->scans overrides plists, and populates 'overriddenItems' class variable
self.getOverriddenItems()
#scan for auto-run launch daemons
# ->save in first index of array
results[0]['items'] = self.scanLaunchItems(LAUNCH_DAEMON_DIRECTORIES)
#scan for auto-run launch agents
# ->save in second index of array
results[1]['items'] = self.scanLaunchItems(LAUNCH_AGENTS_DIRECTORIES)
return results
开发者ID:synack,项目名称:knockknock,代码行数:29,代码来源:launchDandA.py
示例12: kh_dbLoadRecords
def kh_dbLoadRecords(self, arg0, tokens, ref):
local_macros = macros.Macros(**self.env.db)
full_line = reconstruct_line(tokens).strip()
tokenLog = TokenLog()
tokenLog.tokenList = tokens
tokenLog.token_pointer = 1
args = parse_bracketed_macro_definitions(tokenLog)
nargs = len(args)
if nargs not in (1, 2, 3,):
msg = str(ref) + full_line
raise UnhandledTokenPattern, msg
utils.logMessage(arg0 + full_line, utils.LOGGING_DETAIL__NOISY)
dbFileName = local_macros.replace(utils.strip_quotes(args[0]))
if nargs in (2, 3,): # accumulate additional macro definitions
local_macros = self.parse_macro_args(args[1], ref, tokens, local_macros)
if nargs in (3,):
path = args[2]
# msg = str(ref) + full_line
if self.symbols.exists(path): # substitute from symbol table
path = self.symbols.get(path).value
if os.path.exists(path):
dbFileName = os.path.join(path, dbFileName)
try:
obj = database.Database(self, dbFileName, ref, **local_macros.db)
self.database_list.append(obj)
self.kh_shell_command(arg0, tokens, ref)
except text_file.FileNotFound, _exc:
msg = 'Could not find database file: ' + dbFileName
utils.detailedExceptionLog(msg)
return
开发者ID:prjemian,项目名称:iocdoc,代码行数:34,代码来源:command_file.py
示例13: scan
def scan(self):
#dbg msg
utils.logMessage(utils.MODE_INFO, 'running scan')
#init results dictionary
results = self.initResults(STARTUP_ITEM_NAME, STARTUP_ITEM_DESCRIPTION)
#iterate over all base startup item directories
# ->look for startup items
for startupItemBaseDirectory in STARTUP_ITEM_BASE_DIRECTORIES:
#get sub directories
# ->these are the actual startup items
startupItemDirectories = glob.glob(startupItemBaseDirectory + '*')
#check the sub directory (which is likely a startup item)
# ->there should be a file (script) which matches the name of the sub-directory
for startupItemDirectory in startupItemDirectories:
#init the startup item
startupItem = startupItemDirectory + '/' + os.path.split(startupItemDirectory)[1]
#check if it exists
if os.path.exists(startupItem):
#save
results['items'].append(file.File(startupItem))
return results
开发者ID:EntropyWorks,项目名称:knockknock,代码行数:30,代码来源:startupItem.py
示例14: __init__
def __init__(self, parent, command, path, args, ref, **env):
self.parent = parent
self.command = command
self.path = path
self.args = args
self.env = macros.Macros(**env)
self.reference = ref
utils.logMessage('command: ' + command + ' ' + args, utils.LOGGING_DETAIL__MEDIUM)
开发者ID:prjemian,项目名称:iocdoc,代码行数:8,代码来源:command_file.py
示例15: get
def get(self, filename, alternative = None):
'''
get a reference to a file from the cache
'''
if self.exists(filename):
utils.logMessage('cached file: ' + filename, utils.LOGGING_DETAIL__NOISY)
self.cache[filename].requested()
return self.cache.get(filename, alternative)
开发者ID:prjemian,项目名称:iocdoc,代码行数:8,代码来源:text_file.py
示例16: getCachedResultsFor
def getCachedResultsFor(db, digest):
cur = db.cursor()
cur.execute('SELECT response FROM flickr_api WHERE hash = %s', [digest])
t = cur.fetchone()
db.commit()
cur.close()
if t != None:
logMessage('psql', 'Fetched cached response')
return t[0]
else:
return None
开发者ID:gianbottalico,项目名称:IRProject,代码行数:12,代码来源:database.py
示例17: processFile
def processFile(self, filename):
'''
process just one file
'''
f = text_file.read(filename) # use the file cache
try:
tokenize.tokenize(f.iterator().readline, self.tokenReceiver)
except Exception, _exc:
msg = 'trouble understanding: ' + f.absolute_filename
msg += '\n' + str(_exc)
utils.logMessage(msg, utils.LOGGING_DETAIL__NOISY)
raise RuntimeError(msg)
开发者ID:prjemian,项目名称:iocdoc,代码行数:12,代码来源:token_support.py
示例18: kh_cd
def kh_cd(self, arg0, tokens, ref):
path = reconstruct_line(tokens).strip()
path = utils.strip_quotes(path) # strip double-quotes
if self.symbols.exists(path): # symbol substitution
path = self.symbols.get(path).value
path = self.env.replace(path) # macro substitution
if len(path) == 0:
path = self.startup_directory
if len(path) > 0 and os.path.exists(path):
if os.path.abspath(path) != os.getcwd(): # only cd if it is really different
os.chdir(path)
self.kh_shell_command(arg0, tokens, ref)
utils.logMessage(arg0 + ' ' + path, utils.LOGGING_DETAIL__MEDIUM)
开发者ID:prjemian,项目名称:iocdoc,代码行数:13,代码来源:command_file.py
示例19: listPlugins
def listPlugins():
#dbg msg
utils.logMessage(utils.MODE_INFO, 'listing plugins')
#interate over all plugins
for plugin in pluginManagerObj.getAllPlugins():
#dbg msg
# ->always use print, since -v might not have been used
print '%s -> %s' % (os.path.split(plugin.path)[1], plugin.name)
return
开发者ID:EntropyWorks,项目名称:knockknock,代码行数:13,代码来源:knockknock.py
示例20: scan
def scan(self):
# reported path
reportedPaths = []
# dbg msg
utils.logMessage(utils.MODE_INFO, "running scan")
# init results
results = self.initResults(UNCLASSIFIED_NAME, UNCLASSIFIED_DESCRIPTION)
# get all running processes
processes = utils.getProcessList()
# set processes top parent
# ->well, besides launchd (pid: 0x1)
utils.setFirstParent(processes)
# add process type (dock or not)
utils.setProcessType(processes)
# get all procs that don't have a dock icon
# ->assume these aren't started by the user
nonDockProcs = self.getNonDockProcs(processes)
# save all non-dock procs
for pid in nonDockProcs:
# extract path
path = nonDockProcs[pid]["path"]
# ignore dups
if path in reportedPaths:
# skip
continue
# ignore things in /opt/X11/
# ->owned by r00t, so this should be ok....
if path.startswith("/opt/X11/"):
# skip
continue
# save
results["items"].append(file.File(path))
# record
reportedPaths.append(path)
return results
开发者ID:STLVNUB,项目名称:knockknock,代码行数:51,代码来源:unclassified.py
注:本文中的utils.logMessage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论