Giter Club home page Giter Club logo

proxpy's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

proxpy's Issues

host:port url handling

What steps will reproduce the problem?
1. lookup any url through the proxy in the form of https://host:port/etc

modify the following code in http.py ( getHost() )
from 
            if port is None and r.scheme != "https":
                port = 80
            else:
                port = 443

to
            if port is None and r.scheme != "https":
                port = 80
            elif port is None and r.scheme == "https":
                port = 443

Original issue reported on code.google.com by [email protected] on 29 Jan 2014 at 3:25

Hook for internal response

I want to trigger a response in my proxy_mangle_request, this is what I came up 
with to support it. I'm used to working with F5 iRules, so far this seems to be 
the most light weight yet powerful open source alternative for that sort of 
thing.

I don't want to clutter up your beautiful code with my hacks, just looking for 
some advice. Is there any side effect that I may be missing? I'm a python 
newbie. Literally, zero exposure to python until now. This library is so tidy, 
even I (think) I can understand how it works though.

So in "class HTTPRequest", "def __init__" block, I added...

         self.response_hook = False

In "class ProxyHandler", end of "def handle" block...

        if req.response_hook == False:
          # if you need a persistent connection set the flag in order to save the status
          if req.isKeepAlive():
              self.keepalive = True
          else:
              self.keepalive = False

          # Target server host and port
          host, port = ProxyState.getTargetHost(req)

          if req.getMethod() == HTTPRequest.METHOD_GET:
              res = self.doGET(host, port, req)
              self.sendResponse(res)
          elif req.getMethod() == HTTPRequest.METHOD_POST:
              res = self.doPOST(host, port, req)
              self.sendResponse(res)
          elif req.getMethod() == HTTPRequest.METHOD_CONNECT:
              res = self.doCONNECT(host, port, req)
        else:
          self.sendResponse(req.response_hook)


This allows me to do stuff like this in my proxy_mangle_request function, which 
seems to work well...

        hdr = ["Content-Type: text/html", "Server: ProxPy"]
        res = HTTPResponse("HTTP/1.1", 200, "OK", hdr,"<h1>HELLOWORLD</h1>")
        req.response_hook = res.serialize()

I probably need to stick some more headers in there, but other than that have I 
missed anything?

Original issue reported on code.google.com by [email protected] on 10 Jun 2014 at 1:00

proxpy mixes up ports

What steps will reproduce the problem?

These are (edited) screenscrapes. Adjust IP addresses and pathnamesto suit.

1. /NFS/projects/PROXY/test/proxpy.py

2. http_proxy=http://192.168.71.130:8080/   lynx http://192.168.7.179:8080/
3.

What is the expected output? What do you see instead?

I expect:

--------------------------------------------------------------------------------
lynx http://192.168.7.179:8080/




                                              Bulk Updates Progress Report



This page shows the status of Bulk Updates as at


        Thursday 17 May 2012 08:58:46 +1000 EST
...
...
--------------------------------------------------------------------------------
I get:

http_proxy=http://192.168.71.130:8080/   lynx http://192.168.7.179:8080/

Looking up 192.168.71.130:8080
Making HTTP connection to 192.168.71.130:8080
Sending HTTP request.
HTTP request sent; waiting for response.
Alert!: Unexpected network read error; connection aborted.
Can't Access `http://192.168.7.179:8080/'
Alert!: Unable to access document.

lynx: Can't access startfile 

--------------------------------------------------------------------------------





What version of the product are you using? On what operating system?

I think it's r27. I downloaded it yesterday.

Linux fed 3.3.0-4.fc16.i686 #1 SMP Tue Mar 20 18:45:14 UTC 2012 i686 i686 i386 
GNU/Linux
Fedora release 16 (Verne)



Please provide any additional information below.

/NFS/projects/PROXY/proxpy-read-only/proxpy.py
[*] <b77e46c0> Server 0.0.0.0 listening on port 8080
[!] <b6cffb40> [Errno 111] Connection refused: 192.168.7.179:443



Debugging:

HMG HTTPRequest:GET http://192.168.7.179:8080/ HTTP/1.0
{REQ #0} method: GET ; host: ('192.168.7.179', 443) ; path: / ; proto: HTTP/1.0 
; len(body): 0

[!] <b6bffb40> [Errno 111] Connection refused: 192.168.7.179:443


Let me know if you need more.

Original issue reported on code.google.com by [email protected] on 4 Feb 2013 at 1:02

Outbound proxy usage

What steps will reproduce the problem?
1. Try to run proxpy setting an outbound with HTTP_PROXY and HTTPS_PROXY 
environment variables

What is the expected output? What do you see instead?
It does not connect to the targe host.

What version of the product are you using? On what operating system?
Ubuntu 13.04, last svn version r29

Are planned to integrate some option (as command line parameters) to set 
outbound HTTP proxy? 

Original issue reported on code.google.com by [email protected] on 25 Nov 2013 at 2:47

AddHeader method adds an empty value as header name.

What steps will reproduce the problem?
1. add req.addHeader methon to def proxy_mangle_request(req):
2. Check the header in this request at method output

What is the expected output? What do you see instead?
Header should be added in format:
Name: Value

Actual:
Header is added in format:
None: Value.

What version of the product are you using? On what operating system?
latest

Please provide any additional information below.
this is the new method:

 def addHeader(self, name, value, ignorecase = True):
        """
        Add a new 'name' header with value 'value' to this HTTPMessage. If
        'ignorecase' is True, then the case of the header name is ignored.
        """
        k = self.__findHeader(name, ignorecase)
        if k not in self.headers:
            self.headers[name] = []
        self.headers[name].append(value)


Original issue reported on code.google.com by [email protected] on 9 Nov 2012 at 2:04

https problem

Hello, i have an problem with https:
1) i was downloaded proxpy
2) run ./proxpy -p8888
3) I was set 127.0.0.1:8888 as proxy in the FFox
4) I was added proxpyca.crt into "Trusted CAs"
5) I got an ssl error "sec_error_untrusted_cert"
6) I was tried to update "proxpy.pem", but i got same error

Original issue reported on code.google.com by [email protected] on 4 Dec 2014 at 8:37

Allow external proxy

Could you add a commandline switch to use an external proxy? So far proxpy 
cannot be used in combination with e.g. a company proxy or a logging proxy, but 
sometimes it would be very nice to be able to use some...
Alternatively environmental variables like HTTP_PROXY and HTTPS_PROXY could be 
read.

Original issue reported on code.google.com by [email protected] on 29 Jan 2014 at 11:20

PUT and DELETE requests not supported

What steps will reproduce the problem?
1. Start proxy
2. Make an HTTP PUT or DELETE request through proxy

What is the expected output? What do you see instead?

Expected proxying as with POST. Got the following error:

2014-02-13T22:51:51.793047+00:00 app[web.1]: Traceback (most recent call last):
2014-02-13T22:51:51.793047+00:00 app[web.1]:   File 
"/usr/local/lib/python2.7/SocketServer.py", line 582, in process_request_thread
2014-02-13T22:51:51.793047+00:00 app[web.1]:     self.finish_request(request, 
client_address)
2014-02-13T22:51:51.793047+00:00 app[web.1]:   File 
"/usr/local/lib/python2.7/SocketServer.py", line 323, in finish_request
2014-02-13T22:51:51.793047+00:00 app[web.1]:     
self.RequestHandlerClass(request, client_address, self)
2014-02-13T22:51:51.793047+00:00 app[web.1]:   File "/app/proxpy/core.py", line 
54, in __init__
2014-02-13T22:51:51.793047+00:00 app[web.1]:     
SocketServer.StreamRequestHandler.__init__(self, request, client_address, 
server)
2014-02-13T22:51:51.794594+00:00 app[web.1]:   File 
"/usr/local/lib/python2.7/SocketServer.py", line 639, in __init__
2014-02-13T22:51:51.794671+00:00 app[web.1]:     self.handle()
2014-02-13T22:51:51.794671+00:00 app[web.1]:   File "/app/proxpy/core.py", line 
128, in handle
2014-02-13T22:51:51.794671+00:00 app[web.1]:     if req.getMethod() == 
HTTPRequest.METHOD_GET:
2014-02-13T22:51:51.794671+00:00 app[web.1]:   File "/app/proxpy/http.py", line 
272, in getMethod
2014-02-13T22:51:51.794671+00:00 app[web.1]:     return r
2014-02-13T22:51:51.794671+00:00 app[web.1]: UnboundLocalError: local variable 
'r' referenced before assignment

The error occurs because `getMethod` does not account for these HTTP verbs 
(presumably because PUT and DELETE need more code):

    def getMethod(self):
        m = self.method.lower()
        if   m == "get":     r = HTTPRequest.METHOD_GET
        elif m == "post":    r = HTTPRequest.METHOD_POST
        elif m == "head":    r = HTTPRequest.METHOD_HEAD
        elif m == "options": r = HTTPRequest.METHOD_OPTIONS
        elif m == "connect": r = HTTPRequest.METHOD_CONNECT
    elif m == "unknown": r = HTTPRequest.METHOD_UNKNOWN
        return r


What version of the product are you using? On what operating system?

r29 on Ubuntu 10.04, with Python 2.7.2



Original issue reported on code.google.com by [email protected] on 14 Feb 2014 at 12:24

Unable to act as transparent proxy [Temp Patch Included]

What steps will reproduce the problem?
1. Apply an IPTables transparent proxy rule a la:
iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 80 -j DNAT 
--to-destination [YOUR IP]:8080

2. engage the proxpy at port 8080

3. set the computer running proxpy as your gateway

4. Browse to a *NON HTTPS WEBSITE*


What is the expected output? What do you see instead?
Expected output is a webpage -- instead the program hangs as it tries to 
contact an HTTPS version of the site -- but https sites fail to process (due to 
another unrelated bug)

What version of the product are you using? On what operating system?
Most recent, various versions of linux

Please provide any additional information below.

Fixed this by removing 's' from 'https' in parameters to the _fixurl hack in 
http module.  Unfortunately HTTPS is broken though.

Original issue reported on code.google.com by [email protected] on 19 Jan 2013 at 9:58

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.