nproxy | A cli proxy tool specialized in file replacing | HTTP library
kandi X-RAY | nproxy Summary
kandi X-RAY | nproxy Summary
A cli proxy tool specialized in file replacing.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of nproxy
nproxy Key Features
nproxy Examples and Code Snippets
Community Discussions
Trending Discussions on nproxy
QUESTION
I'm starting to play around with Python sockets and I found the following example online for sending and receiving data to a web URL:
...ANSWER
Answered 2017-Jun-12 at 07:14I'v tried decode the response and I made it.
QUESTION
import socket
import ssl
host = 'postlm.com' #browsec addon v2.0.7
port = 443
def pp(a):
s = socket.socket()
s = ssl.wrap_socket(s)
s.connect((host, port))
s.send(a)
aaa=b''
for i in range(2):
aa=s.recv(10240)
if not aa:break
print('='*100)
if b'Connection established' in aa:
a=(a.replace(b'CONNECT ',b'GET https://'))
s.send(a)
continue
aaa+=aa
break
s.close()
return (aaa)
if __name__ == '__main__':
j=b'CONNECT www.wikipedia.org:443 HTTP/1.1\r\nHost: www.wikipedia.org\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-GB,en;q=0.5\r\nProxy-Authorization: Basic NWE5MTMxODE5ZjY4NjNlOWJkMDAwYjdiOkdXbHVpTm9JejMzMTRvZXNFemI3emNLTXU2aHZrc214\r\nAccept-Encoding: gzip, deflate\r\nProxy-Connection: keep-alive\r\n\r\n'
# j=b'GET http://example.com HTTP/1.1\r\nHost: example.com\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-GB,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\nConnection: keep-alive\r\n\r\n'
a=pp(j)
print(a)
...ANSWER
Answered 2018-Mar-25 at 19:26It is not fully clear for me what the intention if your code is since you've only dumped some code without documenting its function. But I've tried to extract from this kind what you are probably trying to do and where your problem is. Given the code I can see that you are doing the following:
- Connect to postlm.com port 443 with SSL.
- Send a CONNECT request over this SSL connection: This suggests that postlm.com:443 must be a HTTP proxy which gets accessed by HTTPS. This is not an invalid but still unusual setup. This CONNECT then builds a connection to www.wikipedia.org. Usually a CONNECT requires a port number but you don't give one. Probably 443 (https) is assumed in this case.
- After you've somehow read the response of this proxy to the request you check for success. The check is unusual in that you don't check for HTTP status code 200 but instead for some specific string. But maybe it works with this proxy.
- Then you send a
GET https://
request over this connection. The expectation with CONNECT is that it only builds a tunnel and that any encrypted traffic (i.e. your https:// URL) should be done inside the tunnel. This would mean that you would need another encryption (to the target site) on top of your already established encryption (to the proxy) before you send the next HTTP request. But you don't do it and that's why it (wikipedia.org) complains that a plain HTTP request was send to a HTTPS socket.
I don't think that you can do this kind of double ssl wrapping with Python. Apart from that you should not put a https://
URL as the path in a HTTP (non-proxy) request but only the path on the server.
QUESTION
I am trying to make a web proxy that is multi threaded. I can do a single threaded one just fine but when I try to use multi-threading it throws this error every time.
...ANSWER
Answered 2017-Jan-24 at 23:17The error is due to an unfortunate typo in passing the parameters when starting the new thread. Unfortunate because it matches a name in the socket library, thus the error generated is harder to debug.
The error message can be reproduced by trying to call:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install nproxy
For UI Developers from SuccessFactors, here is a bonus for you guys. You can use the sf-transfer tool to transfer the combo xml file to NProxy rule file automatically!.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page