|
19 | 19 | # Global for access by event hooks |
20 | 20 | session = requests.Session() |
21 | 21 |
|
| 22 | + |
22 | 23 | def enableColors(): |
23 | | - global W,R,G,O,B,P |
| 24 | + global W, R, G, O, B, P |
24 | 25 | W = "\033[0m" # white (normal) |
25 | 26 | R = "\033[31m" # red |
26 | 27 | G = "\033[32m" # green |
27 | 28 | O = "\033[33m" # orange |
28 | 29 | B = "\033[34m" # blue |
29 | 30 | P = "\033[35m" # purple |
30 | 31 |
|
| 32 | + |
31 | 33 | def printSummary(s): |
32 | 34 | L = logging.getLogger("SUMMARY:") |
33 | 35 | L.info(f"Start URL: {s['responses'][0]['url']}") |
@@ -100,39 +102,37 @@ def cbLinkFollow(response, *args, **kwargs): |
100 | 102 | @click.command() |
101 | 103 | @click.version_option() |
102 | 104 | @click.argument("url") |
103 | | -@click.option("-T", "--timeout", default=10, help="Request timeout in seconds") |
104 | 105 | @click.option("-a", "--accept", default="*/*", help="Accept header value") |
105 | 106 | @click.option("-b", "--body", is_flag=True, help="Show response body") |
106 | | -@click.option( |
107 | | - "-C", "--colors", default=False, is_flag=True, help="Console colors" |
108 | | -) |
| 107 | +@click.option("-C", "--colors", default=False, is_flag=True, help="Enable console colors") |
109 | 108 | @click.option("-j", "--json", "json_report", is_flag=True, help="Report in JSON") |
110 | 109 | @click.option( |
111 | 110 | "-k", "--insecure", default=False, is_flag=True, help="Don't verify certificates" |
112 | 111 | ) |
113 | 112 | @click.option("-L", "--link-type", default=None, help="Follow link header with type") |
| 113 | +@click.option("-m", "--minimal", is_flag=True, help="Minimal redirect info") |
114 | 114 | @click.option( |
115 | 115 | "-P", "--link-profile", default=None, help="Follow link header with profile" |
116 | 116 | ) |
117 | 117 | @click.option( |
118 | 118 | "-R", "--link-rel", default="alternate", help="Follow link header with rel" |
119 | 119 | ) |
| 120 | +@click.option("-T", "--timeout", default=10, help="Request timeout in seconds") |
120 | 121 | @click.option("-U", "--user-agent", default=None, help="User agent header value") |
121 | | -@click.option("-m", "--minimal", is_flag=True, help="Minimal redirect info") |
122 | 122 | @click.option("--log_time", is_flag=True, help="Show timestamp in output") |
123 | 123 | def main( |
124 | 124 | url, |
125 | | - timeout, |
126 | 125 | accept, |
127 | 126 | body, |
128 | 127 | colors, |
129 | 128 | json_report, |
130 | 129 | insecure, |
131 | 130 | link_type, |
| 131 | + minimal, |
132 | 132 | link_profile, |
133 | 133 | link_rel, |
| 134 | + timeout, |
134 | 135 | user_agent, |
135 | | - minimal, |
136 | 136 | log_time, |
137 | 137 | ): |
138 | 138 | if insecure: |
|
0 commit comments