Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service banner #42

Closed
manu-g opened this issue Dec 13, 2016 · 9 comments
Closed

service banner #42

manu-g opened this issue Dec 13, 2016 · 9 comments

Comments

@manu-g
Copy link
Contributor

manu-g commented Dec 13, 2016

Hello,
i discovered that aiohttp sets a service banner that looks something like 'Python/3.5 aiohttp/1.1.6'.
This can be changed as this is only a variable set in aiohttp source.
The corrisbonding file can be found in
/urs/local/lib/python3.5/dist-packages/aiohttp/protocol.py
in line 539 ( if installed with pip3 in default install location)

regards

@afeena
Copy link
Collaborator

afeena commented Dec 13, 2016

It is possible to set Server in headers, as well as another response headers.

for example we can add just one line before https://github.com/mushorg/snare/blob/master/snare.py#L237
response.add_header('Server', 'cloudflare-nginx')

On screens you can see the difference (without/with Server header)
chrome_2016-12-13_14-33-44
chrome_2016-12-13_14-42-29

@manu-g
Copy link
Contributor Author

manu-g commented Dec 13, 2016

PORT STATE SERVICE VERSION
80/tcp open http testing
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port80-TCP:V=7.31%I=7%D=12/13%Time=584FC36B%P=x86_64-pc-linux-gnu%r(Get
SF:Request,26F,"HTTP/1.0\x20200\x20OK\r\nContent-Type:\x20text/html\r\nCo
SF:ntent-Length:\x20480\r\nServer:\x20testing\r\nConnection:\x20keep-alive
SF:\r\nDate:\x20Tue,\x2013\x20Dec\x202016\x2009:58:20\x20GMT\r\n\r\n
SF:\n\n<meta\x20content="text/html;\x20charset=utf-8"\x20http-equi
SF:v="content-type">\n\n<meta
SF:x20content="no-cache"\x20http-equiv="cache-control">\n<meta\x20cont
SF:ent="no-cache"\x20http-equiv="pragma">\n<meta\x20content="0"\x20h
SF:ttp-equiv="expires">\n<meta\x20content="0;\x20URL=/Portal/Intro.htm
SF:l"\x20http-equiv="refresh">\n</he
SF:ad>\n\n<a\x20href="/Portal/Intro.html">Click\x20here,\x20when
SF:r\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20you're\x20not\x20aut
SF:omatically\x20redirected\n\n")%r(HTTPOptions,26F,"HTT
SF:P/1.0\x20200\x20OK\r\nContent-Type:\x20text/html\r\nContent-Length:\x2
SF:0480\r\nServer:\x20testing\r\nConnection:\x20keep-alive\r\nDate:\x20Tue
SF:,\x2013\x20Dec\x202016\x2009:58:20\x20GMT\r\n\r\n\n\n<meta
SF:x20content="text/html;\x20charset=utf-8"\x20http-equiv="content-type
SF:">\n\n<meta\x20content="no-
SF:cache"\x20http-equiv="cache-control">\n<meta\x20content="no-cache"
SF:\x20http-equiv="pragma">\n<meta\x20content="0"\x20http-equiv="expi
SF:res">\n<meta\x20content="0;\x20URL=/Portal/Intro.html"\x20http-equi
SF:v="refresh">\n\n\n<a
SF:x20href="/Portal/Intro.html">Click\x20here,\x20when\r\n\x20\x20\x20
SF:x20\x20\x20\x20\x20\x20\x20\x20\x20you're\x20not\x20automatically\x20re
SF:directed\n\n")%r(RTSPRequest,15C,"HTTP/1.1\x20400\x2
SF:0Bad\x20Request\r\nContent-Type:\x20text/html;\x20charset=utf-8\r\nCont
SF:ent-Length:\x20133\r\nConnection:\x20close\r\nDate:\x20Tue,\x2013\x20De
SF:c\x202016\x2009:58:20\x20GMT\r\nServer:\x20\x20Siemens\x20315-2PN/DP\x2
SF:0programmable\x20logic\x20controller\x20http\x20admin
\r\n\r\n\n\n
SF:\x20\x20\n\x20\x20\x20\x20<title>400\x20Bad\x20Request</title>\n
SF:x20\x20\n\x20\x20\n\x20\x20\x20\x20<h1400\x20Bad\x20Reque
SF:st\n\x20\x20\x20\x20Bad\x20Request\n\x20\x20\n");

   if content:
            response.add_header('Content-Length', str(len(content)))
   response.add_header('Server', 'testing')
   response.send_headers()

I checked your suggestion and added the server header. I think it is easier to adjust the aiohttp source code and replace the variable there.

@glaslos
Copy link
Member

glaslos commented Dec 13, 2016

I'd actually recommend to not change the aiohttp source code. This would mean we have to maintain the fork and merge future changes to the library.

@afeena
Copy link
Collaborator

afeena commented Dec 13, 2016

nmap-service-probes database is open, so I it might be possible to understand what we should return to change service.

For example, I changed server header to nginx, and now I have no errors in nmap

nmap -sV -T4 -F localhost

Starting Nmap 7.31 ( https://nmap.org ) at 2016-12-13 10:51 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000020s latency).
Other addresses for localhost (not scanned): ::1
rDNS record for 127.0.0.1: localhost.localdomain
Not shown: 98 closed ports
PORT     STATE SERVICE     VERSION
22/tcp   open  ssh         OpenSSH 7.3 (protocol 2.0)
8080/tcp open  http-proxy?

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 35.03 seconds

And after fixing local error:

nmap -sV -T4 -F localhost

Starting Nmap 7.31 ( https://nmap.org ) at 2016-12-13 11:06 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000030s latency).
Other addresses for localhost (not scanned): ::1
rDNS record for 127.0.0.1: localhost.localdomain
Not shown: 98 closed ports
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 7.3 (protocol 2.0)
8080/tcp open  http    nginx

@glaslos
Copy link
Member

glaslos commented Dec 13, 2016

shall we add the server header as an optional flag?

@afeena
Copy link
Collaborator

afeena commented Dec 13, 2016

I think it will be good feature :)

@manu-g
Copy link
Contributor Author

manu-g commented Dec 13, 2016

I have an equal error and get an output like
http?
what local errors did you fix?

@afeena
Copy link
Collaborator

afeena commented Dec 13, 2016

@manu-g
It was an error in TANNER config (I forgot to replace old config with new config), so, I had fixed TANNER and after started SNARE

@glaslos
Copy link
Member

glaslos commented Mar 19, 2020

Duplicate of #7

@glaslos glaslos marked this as a duplicate of #7 Mar 19, 2020
@glaslos glaslos closed this as completed Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants