-
Notifications
You must be signed in to change notification settings - Fork 11
/
httpsh
executable file
·54 lines (41 loc) · 1.26 KB
/
httpsh
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from httpshell import httpshell
from httpshell import version
def parse_command_line():
parser = argparse.ArgumentParser(
description="An interactive shell for issuing HTTP commands to a web server or REST API")
parser.add_argument(
"url",
metavar="URL",
help="url to connect to")
parser.add_argument(
"-f", "--format",
action="store_true",
default=False,
dest="auto_format",
help="Attempt to automatically format known mimetypes (JSON or XML)")
parser.add_argument(
"-c", "--no-cookies",
action="store_true",
default=False,
dest="disable_cookies",
help="Do not respect cookies sent by host")
parser.add_argument(
"-i", "--no-headers",
action="store_false",
default=True,
dest="show_headers",
help="Suppress the display of headers")
parser.add_argument(
"--version",
action="version",
version="{0} {1}".format("%(prog)s", version.VERSION))
return parser.parse_args()
def main():
args = parse_command_line()
shell = httpshell.HttpShell(args)
shell.input_loop()
if __name__ == "__main__":
main()