Security-Tools-Alliance / rengine-ng

reNgine-ng is an automated reconnaissance framework for web applications with a focus on highly configurable streamlined recon process via Engines, recon data correlation and organization, continuous monitoring, backed by a database, and simple yet intuitive User Interface.
GNU General Public License v3.0
12 stars 6 forks source link

feat(alerts): Showing new domain's title and status code in notification webhook #29

Open psyray opened 2 months ago

psyray commented 2 months ago

Is there an existing feature or issue for this?

Expected feature

Submitted by @z7701858

I get the message from the discord webhook that a new domain was found, but I don't know the title and status code of the new domain, I need to return to rengine to see the title and status code of the new domain

Alternative solutions

Add the title and status code of the new domain to the information returned by rengine to discord webhhok

Anything else?

Modification proposed by @xnl-h4ck3r

If you want a work around to do this before the feature is added, you can edit the file ~/rengine/web/reNgine/tasks.py and change the code for new subdomain and interesting subdomains like below:

    # check for any subdomain changes and send notif if any
    if notification and notification[0].send_subdomain_changes_notif:
        newly_added_subdomain = get_new_added_subdomain(task.id, domain.id)
        if newly_added_subdomain:
            message = "**{} New Subdomains Discovered on domain {}**".format(newly_added_subdomain.count(), domain.name)
            for subdomain in newly_added_subdomain:
                httpx_cmd = "echo \"{}\" | httpx -silent -status-code -title -nc".format(subdomain.name) 
                domainStatusTitle = subprocess.getoutput(httpx_cmd) 
                if not domainStatusTitle:
                    domainStatusTitle =  "{} [No response] [No title]".format(subdomain.name)
                message += "\n• {}".format(domainStatusTitle) 
            send_notification(message)

        removed_subdomain = get_removed_subdomain(task.id, domain.id)
        if removed_subdomain:
            message = "**{} Subdomains are no longer available on domain {}**".format(removed_subdomain.count(), domain.name)
            for subdomain in removed_subdomain:
                message += "\n• {}".format(subdomain.name)
            send_notification(message)

    # check for interesting subdomains and send notif if any
    if notification and notification[0].send_interesting_notif:
        interesting_subdomain = get_interesting_subdomains(task.id, domain.id)
        print(interesting_subdomain)
        if interesting_subdomain:
            message = "**{} Interesting Subdomains Found on domain {}**".format(interesting_subdomain.count(), domain.name)
            for subdomain in interesting_subdomain:
                httpx_cmd = "echo \"{}\" | httpx -silent -status-code -title -nc".format(subdomain.name)
                domainStatusTitle = subprocess.getoutput(httpx_cmd)
                if not domainStatusTitle:
                    domainStatusTitle = "{} [No response] [No title]".format(subdomain.name)
                message += "\n• {}".format(domainStatusTitle)
            send_notification(message)

basically it's adding this code to each section before message += "\n• {}".format(subdomain.name)...

                httpx_cmd = "echo \"{}\" | httpx -silent -status-code -title -nc".format(subdomain.name) 
                domainStatusTitle = subprocess.getoutput(httpx_cmd) 
                if not domainStatusTitle:
                    domainStatusTitle =  "{} [No response] [No title]".format(subdomain.name)

and then changing the line message += "\n• {}".format(subdomain.name) to message += "\n• {}".format(domainStatusTitle)

The subs messages are sent before HTTPX is used to get the status amnd title shown in the portal, so you have to just do it on each sub at this point in the code. Hope this helps!

Also would be nice to toggle X Interesting Subdomains Found on domain and X New Subdomains Discovered on domain if they're not "alive".