Skip to content

Commit 94380fd

Browse files
authored
Initial commit
1 parent 7d0ea7e commit 94380fd

File tree

5 files changed

+829
-1
lines changed

5 files changed

+829
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,4 @@ cython_debug/
159159
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160160
# and can be added to the global gitignore or merged into this file. For a more nuclear
161161
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162-
#.idea/
162+
.idea/

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3.12
2+
3+
ENV PYTHONDONTWRITEBYTECODE=1
4+
ENV PYTHONUNBUFFERED=1
5+
COPY . .
6+
RUN pip install -r requirements.txt
7+
ENTRYPOINT ["python3", "analyze.py"]

README.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,105 @@
11
# Raw-HTTP-Support-Analyzer
22
Analyzes a server for unencrypted HTTP support for version HTTP/0.9 to HTTP/2.
3+
4+
Execute the script with a host as an argument. It tells you the unencrypted HTTP versions supported by the server. Supported versions:
5+
- HTTP/0.9: experimental
6+
- HTTP/1.0
7+
- HTTP/1.1
8+
- HTTP/2 (Prior Knowledge)
9+
- HTTP/2 (Upgrade)
10+
11+
## Requirements
12+
- Python 3
13+
- Supported versions: 3.9, 3.10, 3.11, 3.12, 3.13
14+
- https://www.python.org/downloads/
15+
- h2 (https://pypi.org/project/h2/)
16+
- Install with `pip3 install h2` or `pip3 install -r requirements.txt`
17+
- docker (if you want to run the script inside a container)
18+
- https://docs.docker.com/engine/install/
19+
20+
## Usage
21+
```
22+
usage: analyze.py [options]
23+
24+
Analyzes servers for unencrypted HTTP support.
25+
26+
positional arguments:
27+
hostname The hostname of the server to analyze
28+
29+
options:
30+
-h, --help show this help message and exit
31+
--path PATH The path to request from the server (default: /)
32+
--ip IP The IP of the server to analyze. If not provided, the hostname is resolved. If present, prevents domain resolution after redirects. (default: None)
33+
--port PORT The port of the server to analyze (default: 80)
34+
--http09, --no-http09
35+
By default, HTT/0.9 is not analyzed. Provide --http09 to analyze the server for HTT/0.9 support. Return Type of HTT/0.9 probe is inconclusive, so run with debug or external analysis tool like Wireshark to verify the actual server answer. (default: False)
36+
--debug, --no-debug Whether to print debug output (default: False)
37+
--redirect_depth REDIRECT_DEPTH
38+
The maximum depth of redirects to follow (default: 2)
39+
--timeout TIMEOUT The timeout for socket operations (default: 5)
40+
```
41+
42+
## Example output
43+
44+
`python3 analyze.py lgbtchinatour.com`
45+
46+
```
47+
lgbtchinatour.com analysis started.
48+
Server online. Scanning!
49+
50+
#####################
51+
52+
HTTP/1.0: REDIRECT(www.lgbtchinatour.com/) -> SUCCESS
53+
HTTP/1.1: SUCCESS
54+
HTTP/2 (Prior Knowledge): FAILURE
55+
HTTP/2 (Upgrade): FAILURE
56+
```
57+
58+
## Return Types
59+
### SUCCESS
60+
The server supports the version of HTTP. For HTTP/0.9, the server responded with HTML.
61+
For HTML/1.0 and HTTP/1.1 the server responded with a 200 status code.
62+
For HTTP/2 with prior knowledge, the server responded with a 200 status code in an HTTP/2 response.
63+
For HTTP/2 with upgrade, the server responded with a 101 status code in an HTTP/1.1 response and then a 200 status code
64+
in an HTTP/2 response.
65+
66+
### FAILURE
67+
The server does not support the version of HTTP. Run with `--debug` to see detailed analysis and server responses.
68+
69+
### TIMEOUT
70+
The server did not respond within the specified timeout. The timeout is specified with `--timeout` (default: 5s).
71+
72+
### MAX REDIRECT
73+
The server redirected too many times. The maximum number of redirects is specified with `--redirect_depth` (default: 5).
74+
75+
### REDIRECT
76+
The server redirected to another location. The location is specified alongside this feedback. Multiple redirects are
77+
chained in the output.
78+
79+
### HTTPS REDIRECT
80+
The server redirected to an HTTPS location. The server does not support unencrypted HTTP.
81+
82+
## Docker
83+
The script can be run inside a Docker container. The Dockerfile is included in the repository.
84+
85+
To run the script inside a container, build the image with
86+
```
87+
docker build -t raw-http-support-analyzer .
88+
```
89+
and run the script using
90+
```
91+
docker run raw-http-support-analyzer <arguments>
92+
```
93+
for example
94+
```
95+
docker run raw-http-support-analyzer nsfwyoutube.com --debug --timeout 10
96+
```
97+
98+
### HTTP/0.9 Support
99+
Currently, the tool checks unencrypted HTTP/0.9 support by detecting whether the server answered with HTML content. It
100+
is possible that the tool outputs a false positive if the server responds with HTML content that does not serve the
101+
requested website. For instance, the server could host a default page that is served for all requests. For the detailed
102+
server response, run the tool with the `--debug` flag.
103+
104+
### Acknowledgements
105+
This tool is based on code written by Jonathan von Niessen (https://github.com/jonvn) for his master thesis.

0 commit comments

Comments
 (0)