本文整理匯總了Python中java.net.URL屬性的典型用法代碼示例。如果您正苦於以下問題:Python net.URL屬性的具體用法?Python net.URL怎麽用?Python net.URL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.net
的用法示例。
在下文中一共展示了net.URL屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _print_parsed_status
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def _print_parsed_status(self, fcount):
"""Prints the parsed directory status information"""
if self.parse_files and not self.loaded_plugins:
self._plugins_missing_warning()
if len(self.url_reqs) > 0:
self.update_scroll("[*] Example URL: %s" % self.url_reqs[0])
if self.print_stats:
report = (("[*] Found: %r files to be requested.\n\n" +
"[*] Stats: \n " +
"Found: %r files.\n") % (len(self.url_reqs), fcount))
if len(self.ext_stats) > 0:
report += ("[*] Extensions found: %s"
% str(dumps(self.ext_stats,
sort_keys=True, indent=4)))
else:
report = ("[*] Found: %r files to be requested.\n" %
len(self.url_reqs))
self.update_scroll(report)
return report
示例2: _update
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def _update(self):
"""Updates internal data"""
self.config["Input Directory"] = self.source_input
self.config["String Delimiter"] = self.delim.getText()
white_list_text = self.ext_white_list.getText()
self.config["Extension Whitelist"] = white_list_text.upper().split(',')
file_url = self.url.getText()
if not (file_url.startswith('https://') or file_url.startswith('http://')):
self.update_scroll("[!] Assuming protocol! Default value: 'http://'")
file_url = 'http://' + file_url
self.url.setText(file_url)
if not file_url.endswith('/') and file_url != "":
file_url += '/'
self.config["URL"] = file_url
# self.config["Cookies"] = self.cookies.getText()
# self.config["Headers"] = self.headers.getText()
del self.url_reqs[:]
self.curr_conf.setText(self.source_input)
# Window sizing functions
示例3: updateConfig
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def updateConfig(self,meh):
self._configSpider_NumberOfPages = int(self.spiderPagesTextField.getText())
if self.yesVerboseButton.isSelected():
self._verbose = True
else:
self._verbose = False
if self.yesInScopeButton.isSelected():
self._configInScope_only = True
else:
self._configInScope_only = False
fileType = []
fileTypeStr = self.fileTypeTextField.getText()
self._ignoreFileType = self.fileTypeTextField.getText().split(",")
self._logger.info("Config changed: " + "spiderNbrPages=" + str(self._configSpider_NumberOfPages) + ", Verbose is:" + str(self._verbose) + ", InScope is:" + str(self._configInScope_only) + ", fileTypeIgnored: " + str(self._ignoreFileType))
print "Now using config: " + "spiderNbrPages=" + str(self._configSpider_NumberOfPages) + ", Verbose is:" + str(self._verbose) + ", InScope is:" + str(self._configInScope_only) + ", fileTypeIgnored: " + str(self._ignoreFileType)
return
#add a URL to the list
示例4: runRequest
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def runRequest(self,url,responseQueue):
#TODO: After thread is done, in thread read the _requestQeue object
self._logger.debug("runRequest(URL): "+url)
self._logger.info("EXECUTING REQUEST FOR: "+url)
response = requests.get(url, headers=self._headers, allow_redirects=False)
responseQueue.put(response)
#TODO: Get code
#TODO: add page to SiteMap if not there already?
self._logger.debug("runRequest done for: "+url)
return
#TODO randomizedUserAgent
示例5: generateUrls
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def generateUrls(self, url, requestResponse):
urls = []
path = url.getPath()
parts = filter(None, path.split("/"))
for part in parts:
if "." in part:
continue
# Checks if /part../ results in 403
if not self.quickCheck(url, part, requestResponse):
continue
self._stdout.println("Potentially vulnerable: %s" % url)
replacement = "/%s../%s/" % (part, part)
urls.append(URL(url.toString().replace("/%s/" % part, replacement)))
if self.enableDirectoryGuessing:
urls = urls + self.guessDirectories(url, part)
return urls
示例6: doPassiveScan
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def doPassiveScan(self, ihrr):
try:
urlReq = ihrr.getUrl()
testString = str(urlReq)
linkA = linkAnalyse(ihrr,self.helpers)
# check if JS file
if ".js" in str(urlReq):
# Exclude casual JS files
if any(x in testString for x in JSExclusionList):
print("\n" + "[-] URL excluded " + str(urlReq))
else:
self.outputTxtArea.append("\n" + "[+] Valid URL found: " + str(urlReq))
issueText = linkA.analyseURL()
for counter, issueText in enumerate(issueText):
#print("TEST Value returned SUCCESS")
self.outputTxtArea.append("\n" + "\t" + str(counter)+' - ' +issueText['link'])
issues = ArrayList()
issues.add(SRI(ihrr, self.helpers))
return issues
except UnicodeEncodeError:
print ("Error in URL decode.")
return None
示例7: make_jar_classloader
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def make_jar_classloader(jar):
import os
from java.net import URL, URLClassLoader
url = URL('jar:file:%s!/' % jar)
if os._name == 'nt':
# URLJarFiles keep a cached open file handle to the jar even
# after this ClassLoader is GC'ed, disallowing Windows tests
# from removing the jar file from disk when finished with it
conn = url.openConnection()
if conn.getDefaultUseCaches():
# XXX: Globally turn off jar caching: this stupid
# instance method actually toggles a static flag. Need a
# better fix
conn.setDefaultUseCaches(False)
return URLClassLoader([url])
示例8: open_urlresource
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def open_urlresource(url):
import urllib, urlparse
import os.path
filename = urlparse.urlparse(url)[2].split('/')[-1] # '/': it's URL!
for path in [os.path.curdir, os.path.pardir]:
fn = os.path.join(path, filename)
if os.path.exists(fn):
return open(fn)
requires('urlfetch')
print >> get_original_stdout(), '\tfetching %s ...' % url
fn, _ = urllib.urlretrieve(url, filename)
return open(fn)
#=======================================================================
# Decorator for running a function in a different locale, correctly resetting
# it afterwards.
示例9: parse_bug_details
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def parse_bug_details(self, bug, plugin_name, _type):
content = "ID: <a href='https://wpvulndb.com/vulnerabilities/{}'>{}</a><br />Title: {}<br />Type: {}<br />".format(
bug['id'], bug['id'], bug['title'], bug['vuln_type'])
if 'reference' in bug:
content += "References:<br />"
for reference in bug['reference']:
content += "<a href='{}'>{}</a><br />".format(reference, reference)
if 'cve' in bug:
content += "CVE: {}<br />".format(bug['cve'])
if 'exploitdb' in bug:
content += "Exploit Database: <a href='https://www.exploit-db.com/exploits/{}/'>{}</a><br />".format(
bug['exploitdb'], bug['exploitdb'])
if 'fixed_in' in bug:
content += "Fixed in version: {}<br />".format(bug['fixed_in'])
content += "WordPress URL: <a href='https://wordpress.org/{type}/{plugin_name}'>https://wordpress.org/{type}/{plugin_name}</a>".format(
type=_type, plugin_name=plugin_name)
return content
示例10: make_jar_classloader
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def make_jar_classloader(jar):
import os
from java.net import URL, URLClassLoader
from java.io import File
if isinstance(jar, bytes): # Java will expect a unicode file name
jar = jar.decode(sys.getfilesystemencoding())
jar_url = File(jar).toURI().toURL().toString()
url = URL(u'jar:%s!/' % jar_url)
if is_jython_nt:
# URLJarFiles keep a cached open file handle to the jar even
# after this ClassLoader is GC'ed, disallowing Windows tests
# from removing the jar file from disk when finished with it
conn = url.openConnection()
if conn.getDefaultUseCaches():
# XXX: Globally turn off jar caching: this stupid
# instance method actually toggles a static flag. Need a
# better fix
conn.setDefaultUseCaches(False)
return URLClassLoader([url])
# Filename used for testing
示例11: createMenuItems
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def createMenuItems(self, invocation):
"""Creates the Burp Menu items"""
context = invocation.getInvocationContext()
if context == invocation.CONTEXT_MESSAGE_EDITOR_REQUEST \
or context == invocation.CONTEXT_MESSAGE_VIEWER_REQUEST \
or context == invocation.CONTEXT_PROXY_HISTORY \
or context == invocation.CONTEXT_TARGET_SITE_MAP_TABLE:
self.messages = invocation.getSelectedMessages()
if len(self.messages) == 1:
return [JMenuItem('Send URL to SpyDir',
actionPerformed=self.pass_url)]
else:
return None
示例12: set_url
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def set_url(self, menu_url):
"""Changes the configuration URL to the one from the menu event"""
self.url.setText(menu_url)
# Event functions
示例13: restore
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def restore(self, event):
"""Attempts to restore the previously saved configuration."""
jdump = None
try:
jdump = loads(self._callbacks.loadExtensionSetting("config"))
except Exception as exc: # Generic exception thrown directly to user
self.update_scroll(
"[!!] Error during restore!\n\tException: %s" % str(exc))
if jdump is not None:
self.url.setText(jdump.get('URL'))
# self.cookies.setText(jdump.get('Cookies'))
# self.headers.setText(jdump.get("Headers"))
ewl = ""
for ext in jdump.get('Extension Whitelist'):
ewl += ext + ", "
self.ext_white_list.setText(ewl[:-2])
self.delim.setText(jdump.get('String Delimiter'))
self.source_input = jdump.get("Input Directory")
self.config['Plugin Folder'] = jdump.get("Plugin Folder")
if (self.config['Plugin Folder'] is not None and
(len(self.plugins.values()) < 1)):
self._load_plugins(self.config['Plugin Folder'])
self._update()
self.update_scroll("[^] Restore complete!")
else:
self.update_scroll("[!!] Restore failed!")
示例14: save
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def save(self, event=None):
"""
Saves the configuration details to a Burp Suite's persistent store.
"""
self._update()
try:
if not self._callbacks.isInScope(URL(self.url.getText())):
self.update_scroll("[!!] URL provided is NOT in Burp Scope!")
except MalformedURLException: # If url field is blank we'll
pass # still save the settings.
try:
self._callbacks.saveExtensionSetting("config", dumps(self.config))
self.update_scroll("[^] Settings saved!")
except Exception:
self.update_scroll("[!!] Error saving settings to Burp Suite!")
示例15: _code_as_endpoints
# 需要導入模塊: from java import net [as 別名]
# 或者: from java.net import URL [as 別名]
def _code_as_endpoints(self, filename, ext):
file_set = set()
file_url = self.config.get("URL")
if self.loaded_plugins or ext == '.txt':
if self._ext_test(ext):
file_set.update(
self._parse_file(filename, file_url))
else:
file_set.update(
self._parse_file(filename, file_url))
return file_set