slowloris | Slowloris rewrite in Python | HTTP library

 by   gkbrk Python Version: 0.2.6 License: MIT

kandi X-RAY | slowloris Summary

kandi X-RAY | slowloris Summary

slowloris is a Python library typically used in Networking, HTTP applications. slowloris has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can install using 'pip install slowloris' or download it from GitHub, PyPI.

Slowloris is basically an HTTP Denial of Service attack that affects threaded servers. It works like this:. This exhausts the servers thread pool and the server can't reply to other people.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              slowloris has a medium active ecosystem.
              It has 2072 star(s) with 655 fork(s). There are 73 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 10 open issues and 36 have been closed. On average issues are closed in 186 days. There are 4 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of slowloris is 0.2.6

            kandi-Quality Quality

              slowloris has 0 bugs and 0 code smells.

            kandi-Security Security

              slowloris has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              slowloris code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              slowloris is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              slowloris releases are not available. You will need to build from source code and install.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              slowloris saves you 77 person hours of effort in developing the same functionality from scratch.
              It has 201 lines of code, 4 functions and 2 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed slowloris and discovered the below as its top functions. This is intended to give you an instant insight into slowloris implemented functionality, and help decide if they suit your requirements.
            • Starts socket .
            • Create a socket for the given IP address .
            • Send a line .
            • Send a header .
            Get all kandi verified functions for this library.

            slowloris Key Features

            No Key Features are available at this moment for slowloris.

            slowloris Examples and Code Snippets

            Installing
            Pythondot img1Lines of Code : 33dot img1License : Permissive (Unlicense)
            copy iconCopy
            build-essential
            cmake
            libgmp3-dev
            gengetopt
            libpcap-dev
            flex
            byacc
            libjson-c-dev
            pkg-config
            libunistring-dev
            tcpdump
            
            shodan
            sslyze
            
                                            NETSPLOIT
                      _                      _______                      _
                   _dMM  
            Basic Usage
            Pythondot img2Lines of Code : 11dot img2License : Permissive (MIT)
            copy iconCopy
            $ slowloris --help
            usage: slowloris [-h] -u URL [-c CONNECTION_COUNT] [-s]
            
            Asynchronous Python implementation of SlowLoris attack
            
            optional arguments:
              -h, --help            show this help message and exit
              -u URL, --url URL     Link to a web serv  
            Example of usage
            Pythondot img3Lines of Code : 8dot img3License : Permissive (MIT)
            copy iconCopy
            from pyslowloris import HostAddress, SlowLorisAttack
            
            url = HostAddress.from_url("http://kpi.ua")
            connections_count = 100
            
            loris = SlowLorisAttack(url, connections_count, silent=True)
            loris.start()
            
            $ slowloris -u http://kpi.ua/ -c 100 -s
              

            Community Discussions

            QUESTION

            Netty SslHandler handshake timeout after removal
            Asked 2020-Apr-02 at 12:32

            Part of our application requires removing/adding SSL handlers in our Netty pipeline, we set a timeout on the SSL handshake to try and prevent Slowloris attacks. We're using Netty 4.1.44.Final.

            When creating an SslHandler based on a server SSLEngine, we set a 2 second handshake timeout. However if the channel is idle for 1 second, we will replace the SslHandler with a new one with a client SSLEngine that will be able to successfully handshake. However the pipeline receives an javax.net.ssl.SSLException: handshake timed out from the original SslHandler.

            Is there a better way to do this dynamic replacement of SslHandlers that allows setting a handshake timeout?

            ...

            ANSWER

            Answered 2020-Apr-02 at 12:32

            As mentioned in the netty bug tracker this is a bug

            Source https://stackoverflow.com/questions/60975537

            QUESTION

            Can HTTP/1.1 requests be split up into multiple TCP messages?
            Asked 2020-Feb-09 at 23:30

            I’m reading about Slowloris, and I’m not sure why the attack works because the client is sending one header at a time to the server. Don’t servers expect only one TCP message/request excluding the second which may come with a body after a 100 continue or more than 2 if chunked encoding is used? Can an HTTP request even be sent one byte at a time? And if it is, should I send 100 continue after each byte after a read() call? I’m having trouble finding out where this is documented. This is particularly important to me because I’m trying to build an HTTP server from scratch in C, and I’d like to know if I’ll need character-by-character parsing.

            ...

            ANSWER

            Answered 2020-Feb-09 at 23:30
            Getting Data from TCP

            TCP does not deliver messages. It delivers a stream of bytes, and it can deliver those bytes in parcels whose size need not bear any resemblance to the size of the parcels that were written by the sender. So whenever you're reading a stream of data from TCP you have to be prepared to get that data in small parcels spread over multiple read() calls on the socket.

            Typically the receiver will accumulate the data from those parcels into a buffer until it has collected enough data to construct a meaningful data unit of some kind that can then be processed. Depending on the format and meaning of the data that unit of actionable data could be a certain number of bytes, or a line's worth of characters, or a (potentially multi-byte) character, or something else.

            For an HTTP server the actionable unit could reasonably be a complete set of headers, which is recognisable by the empty line that marks the end of the header block. Or you might decide that the first actionable unit is a line (the HTTP request line) and the second actionable unit is the remaining set of headers. (If you decide that the actionable unit while processing headers is always a line, you have to be prepared to deal with multi-line headers. That probably involves an additional layer of buffering.)

            In the usual case data from TCP on an HTTP connection will arrive in fairly large blocks, hundreds or even thousands of bytes from a single read() if the specified buffer is large enough to hold them. So it might be the case that all of the headers are collected by your first read() on a new connection. But you must not depend on that happening. You must be prepared to issue multiple read() calls to get the data you need.

            Even if you do have to make multiple read() calls to get all of the headers, the time spent doing this is usually pretty brief and then you can get on with handling this request and moving on to the next one.

            Resource Exhaustion

            Whenever an HTTP server is handling a request it will have a certain number of resources devoted to that request -- it has the connection socket, data buffers, probably some structures allocated for tracking request state, maybe one or more threads devoted to this connection or request, a TLS context if this is an HTTPS request, and so on. If the request can be handled quickly then those resources can be released and recycled or applied to other requests and connections. If the request can not be handled quickly then those resources remain tied up, and if the server has to handle lots of long-lived requests then its resource demands can rise to the point where the server becomes sluggish, or becomes unable to accept new connections, or perhaps even crashes.

            Resource exhaustion can happen in normal operation if the server is undersized for the load, but it's also possible for a server to be deliberately driven into exhaustion by an attacker. There are many variants of this kind of attack. The first HTTP server exhaustion attacks involved having a hostile client send very large (perhaps infinitely large) request bodies, and/or send those request bodies very slowly, and/or keep the connection open while not sending any request data at all. The server's defence against this kind of attack is to limit the size of request body it will consume, and to limit the length of time that it will wait for a request body to be completely delivered, and to limit the length of time it will wait for a certain incremental amount of request data to be received.

            There's also an attack where the client opens a connection to the server but does not send any header data at all. The server's defence is to limit the time it will wait for header data to begin arriving, and also to limit the time it will wait for additional header data to arrive.

            Slowloris

            The Slowloris attack is the next step in the header-based exhaustion attack progression. Instead of sending no headers, it sends them but does it very slowly, just slowly enough to avoid having the connection dropped by the server.

            And Slowloris sends a never-ending series of made-up headers, so that the server never goes into the mode where its defences against ridiculous request body attacks come into play. The attacker could even send these headers a single byte at a time if it wanted to waste more CPU at the server; I don't know if the original Slowloris does this but I wouldn't be at all surprised if some later variant does.

            The usual server-side defence against Slowloris is to apply the same strategies that are used against hostile request bodies. That is, put arrival-completion-time and total-header size limits on the request headers.

            100-Continue

            The 100-Continue thing is unrelated. Your server should be prepared to send a 100-Continue interim response after processing the request headers, but only if the client explicitly specifies (by sending an Expect header that asks for 100-Continue) that it wants an interim response. In my experience this is rare, so I wouldn't worry about it too much if you're just starting to build a server. It should be straightforward to add this feature after you have the basic server up and running.

            Documentation

            RFC 2616 is where all of HTTP 1.1 is specified. If you're writing a server then you should start by becoming very familiar with that RFC.

            Technically RFC 2616 has been superseded by a series of later RFCs (7230, 7231, 7232, 7233, 7234, 7235) but the changes are small and I find it easier to read the one old document than the five new ones.

            Source https://stackoverflow.com/questions/60124769

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install slowloris

            You can clone the git repo or install using pip. Here's how you run it. That's all it takes to install and run slowloris.py. If you want to clone using git instead of pip, here's how you do it.
            sudo pip3 install slowloris
            slowloris example.com
            git clone https://github.com/gkbrk/slowloris.git
            cd slowloris
            python3 slowloris.py example.com

            Support

            However, if you plan on using the -x option in order to use a SOCKS5 proxy for connecting instead of a direct connection over your IP address, you will need to install the PySocks library (or any other implementation of the socks library) as well. PySocks is a fork from SocksiPy by GitHub user @Anorov and can easily be installed by adding PySocks to the pip command above or running it again like so:. You can then use the -x option to activate SOCKS5 support and the --proxy-host and --proxy-port option to specify the SOCKS5 proxy host and its port, if they are different from the standard 127.0.0.1:8080.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install Slowloris

          • CLONE
          • HTTPS

            https://github.com/gkbrk/slowloris.git

          • CLI

            gh repo clone gkbrk/slowloris

          • sshUrl

            git@github.com:gkbrk/slowloris.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link