mirror of
https://github.com/Cronocide/wifipumpkin3.git
synced 2025-01-22 19:37:18 +00:00
added option on captiveflask to force redirect sucessful template
This commit is contained in:
parent
342261d1ae
commit
434e38db64
@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- added many improvements into system modules
|
- added many improvements into system modules
|
||||||
- added improves module for running in background
|
- added improves module for running in background
|
||||||
- added command kill: terminate a module in background by id
|
- added command kill: terminate a module in background by id
|
||||||
|
- added option on captiveflask to force redirect sucessful template
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- moved command info to extensions directory
|
- moved command info to extensions directory
|
||||||
|
@ -34,9 +34,12 @@ def login():
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
global FORCE_REDIRECT
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
login_user(request.remote_addr)
|
login_user(request.remote_addr)
|
||||||
if "orig_url" in request.args and len(request.args["orig_url"]) > 0:
|
if FORCE_REDIRECT:
|
||||||
|
return render_template("templates/login_successful.html")
|
||||||
|
elif "orig_url" in request.args and len(request.args["orig_url"]) > 0:
|
||||||
return redirect(unquote(request.args["orig_url"]))
|
return redirect(unquote(request.args["orig_url"]))
|
||||||
else:
|
else:
|
||||||
return render_template("templates/login_successful.html")
|
return render_template("templates/login_successful.html")
|
||||||
@ -61,7 +64,18 @@ def catch_all(path):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
_version = "1.0.1"
|
#https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse
|
||||||
|
def str2bool(v):
|
||||||
|
if isinstance(v, bool):
|
||||||
|
return v
|
||||||
|
if v.lower() in ('yes', 'true', 't', 'y', '1'):
|
||||||
|
return True
|
||||||
|
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
raise argparse.ArgumentTypeError('Boolean value expected.')
|
||||||
|
|
||||||
|
_version = "1.0.2"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("[*] CaptiveFlask v{} - subtool from wifipumpkin3".format(_version))
|
print("[*] CaptiveFlask v{} - subtool from wifipumpkin3".format(_version))
|
||||||
@ -81,9 +95,18 @@ if __name__ == "__main__":
|
|||||||
dest="redirect",
|
dest="redirect",
|
||||||
help="IpAddress from gataway captive portal",
|
help="IpAddress from gataway captive portal",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-f",
|
||||||
|
"--force-login_successful-template",
|
||||||
|
dest="force_redirect",
|
||||||
|
default=False,
|
||||||
|
type=str2bool,
|
||||||
|
help="force redirect to login_successful.html template",
|
||||||
|
)
|
||||||
parser.add_argument("-v", "--version", dest="version", help="show version the tool")
|
parser.add_argument("-v", "--version", dest="version", help="show version the tool")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
REDIRECT = args.redirect
|
REDIRECT = args.redirect
|
||||||
|
FORCE_REDIRECT = args.force_redirect
|
||||||
|
|
||||||
app.static_url_path = "\{}".format(args.static)
|
app.static_url_path = "\{}".format(args.static)
|
||||||
app.static_folder = "{}".format(args.static)
|
app.static_folder = "{}".format(args.static)
|
||||||
|
@ -8,3 +8,6 @@ DarkLogin=true
|
|||||||
Default=true
|
Default=true
|
||||||
En=false
|
En=false
|
||||||
ptBr=false
|
ptBr=false
|
||||||
|
|
||||||
|
[settings]
|
||||||
|
force_redirect_sucessful_template=false
|
||||||
|
@ -84,6 +84,8 @@ class CaptivePortal(ProxyMode):
|
|||||||
self.conf.get("dhcp", "router"),
|
self.conf.get("dhcp", "router"),
|
||||||
"-s",
|
"-s",
|
||||||
self.tamplate.StaticPath,
|
self.tamplate.StaticPath,
|
||||||
|
"-f",
|
||||||
|
self.config.get("settings", "force_redirect_sucessful_template"),
|
||||||
]
|
]
|
||||||
return self._cmd_array
|
return self._cmd_array
|
||||||
|
|
||||||
@ -131,6 +133,11 @@ class CaptivePortal(ProxyMode):
|
|||||||
list_commands.append(self.ID + "." + command)
|
list_commands.append(self.ID + "." + command)
|
||||||
for sub_plugin in self.config.get_all_childname("set_{}".format(command)):
|
for sub_plugin in self.config.get_all_childname("set_{}".format(command)):
|
||||||
list_commands.append("{}.{}.{}".format(self.ID, command, sub_plugin))
|
list_commands.append("{}.{}.{}".format(self.ID, command, sub_plugin))
|
||||||
|
# load all settings extra plugin
|
||||||
|
settings = self.config.get_all_childname("settings")
|
||||||
|
for config in settings:
|
||||||
|
list_commands.append("{}.{}".format(self.ID, config))
|
||||||
|
|
||||||
return list_commands
|
return list_commands
|
||||||
|
|
||||||
def LogOutput(self, data):
|
def LogOutput(self, data):
|
||||||
@ -166,6 +173,8 @@ class CaptivePortal(ProxyMode):
|
|||||||
)
|
)
|
||||||
if key_plugin in self.config.get_all_childname("plugins"):
|
if key_plugin in self.config.get_all_childname("plugins"):
|
||||||
self.setPluginActivated(key_plugin, status)
|
self.setPluginActivated(key_plugin, status)
|
||||||
|
elif key_plugin in self.config.get_all_childname("settings"):
|
||||||
|
self.config.set("settings", key_plugin, status)
|
||||||
else:
|
else:
|
||||||
print(
|
print(
|
||||||
display_messages(
|
display_messages(
|
||||||
|
@ -104,7 +104,25 @@ class Info(ExtensionUI):
|
|||||||
)
|
)
|
||||||
if output_table != []:
|
if output_table != []:
|
||||||
print(display_messages("Plugins:", info=True, sublime=True))
|
print(display_messages("Plugins:", info=True, sublime=True))
|
||||||
return display_tabulate(headers_table, output_table)
|
display_tabulate(headers_table, output_table)
|
||||||
|
|
||||||
|
settings = proxies["Config"].get_all_childname("settings")
|
||||||
|
if not settings:
|
||||||
|
return
|
||||||
|
headers_settings, output_settings = ["Setting", "Value"], []
|
||||||
|
# search extra settings plugin
|
||||||
|
|
||||||
|
for command in settings:
|
||||||
|
output_settings.append(
|
||||||
|
[
|
||||||
|
setcolor("{}".format(command), color="blue",),
|
||||||
|
proxies["Config"].get("settings", command),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
if output_settings != []:
|
||||||
|
print(display_messages("Settings:", info=True, sublime=True))
|
||||||
|
return display_tabulate(headers_settings, output_settings)
|
||||||
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user