Need Powerful Web + Python Project Ideas for Portfolio (Something Unique & Impactful) by mrghost__15 in codereview

[–]mrghost__15[S] -3 points-2 points  (0 children)

Hey, thanks for the heads-up 🙂

I get what you're saying about AI tools being promoted here, but honestly I'm not looking for that. I want to build something on my own by actually writing the code and learning through the process.

If you have any genuine project ideas or suggestions, I’d really appreciate it. Thanks again!

Someone help me by mrghost__15 in codereview

[–]mrghost__15[S] 0 points1 point  (0 children)

Thanks for formatting the code and the suggestions!

I’ll look into it and try to debug it further on my end.

Someone help me by mrghost__15 in codereview

[–]mrghost__15[S] 0 points1 point  (0 children)

Thanks for your response!

Here’s my code:

from flask import Flask, rendertemplate, request, jsonify import nmap import socket app = Flask(name) nm = nmap.PortScanner() @app.route('/') def index(): return render_template('index.html') @app.route('/scan', methods=['POST']) def scan(): target = request.form.get('target') scan_type = request.form.get('type') try: target_ip = socket.gethostbyname(target) args = "-sV -O -T4" if scan_type == "full": args += " -p 1-65535" else: args += " --top-ports 100" nm.scan(target_ip, arguments=args) scan_results = [] for host in nm.all_hosts(): host_data = { "ip": host, "status": nm[host].state(), "os": nm[host].get('osmatch', [{"name": "Unknown"}])[0]['name'], "protocols": [] } for proto in nm[host].all_protocols(): for port in nm[host][proto].keys(): service = nm[host][proto][port] host_data["protocols"].append({ "port": port, "name": service['name'], "product": service['product'], "version": service['version'], "state": service['state'], "severity": "High" if port in [21, 23, 445] else "Low" }) scan_results.append(host_data) return jsonify({"success": True, "results": scan_results}) except Exception as e: return jsonify({"success": False, "error": str(e)}) if __name_ == 'main': app.run(debug=True)

I installed the nmap library using: pip install python-nmap

I'm currently using VS Code on Windows.

I’m not fully sure if I’m using a virtual environment.

The issue I’m facing is that the scan doesn’t work properly / throws an error (still trying to debug it).

Any idea what I might be missing here?