From eaf21cf81136b0c082725ee61b43c46d6ecbba50 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Fri, 14 Jun 2024 16:56:22 +0200 Subject: [PATCH] adding service detection to pg templates --- javascript/enumeration/pgsql/pgsql-default-db.yaml | 6 +++++- javascript/enumeration/pgsql/pgsql-file-read.yaml | 6 +++++- javascript/enumeration/pgsql/pgsql-list-database.yaml | 6 +++++- .../enumeration/pgsql/pgsql-list-password-hashes.yaml | 6 +++++- javascript/enumeration/pgsql/pgsql-list-users.yaml | 6 +++++- javascript/enumeration/pgsql/pgsql-version-detect.yaml | 6 +++++- 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/javascript/enumeration/pgsql/pgsql-default-db.yaml b/javascript/enumeration/pgsql/pgsql-default-db.yaml index a0f64ad65e..abc05d2f53 100644 --- a/javascript/enumeration/pgsql/pgsql-default-db.yaml +++ b/javascript/enumeration/pgsql/pgsql-default-db.yaml @@ -14,7 +14,11 @@ info: shodan-query: "product:\"PostgreSQL\"" tags: js,network,postgresql,authenticated,enum javascript: - - code: | + - pre-condition: | + var m = require("nuclei/postgres"); + var c = m.PGClient(); + c.IsPostgres(Host, Port); + code: | const postgres = require('nuclei/postgres'); const client = new postgres.PGClient; connected = client.ConnectWithDB(Host, Port, User, Pass, Db); diff --git a/javascript/enumeration/pgsql/pgsql-file-read.yaml b/javascript/enumeration/pgsql/pgsql-file-read.yaml index 8a7f96f012..e77c1dcdbe 100644 --- a/javascript/enumeration/pgsql/pgsql-file-read.yaml +++ b/javascript/enumeration/pgsql/pgsql-file-read.yaml @@ -14,7 +14,11 @@ info: shodan-query: "product:\"PostgreSQL\"" tags: js,network,postgresql,authenticated,enum javascript: - - code: | + - pre-condition: | + var m = require("nuclei/postgres"); + var c = m.PGClient(); + c.IsPostgres(Host, Port); + code: | const postgres = require('nuclei/postgres'); const client = new postgres.PGClient; connected = client.ExecuteQuery(Host, Port, User, Pass, Db, "select pg_ls_dir('./');"); diff --git a/javascript/enumeration/pgsql/pgsql-list-database.yaml b/javascript/enumeration/pgsql/pgsql-list-database.yaml index d6f1bde551..a8a8c0b690 100644 --- a/javascript/enumeration/pgsql/pgsql-list-database.yaml +++ b/javascript/enumeration/pgsql/pgsql-list-database.yaml @@ -15,7 +15,11 @@ info: shodan-query: "product:\"PostgreSQL\"" tags: js,network,postgresql,authenticated,enum javascript: - - code: | + - pre-condition: | + var m = require("nuclei/postgres"); + var c = m.PGClient(); + c.IsPostgres(Host, Port); + code: | const postgres = require('nuclei/postgres'); const client = new postgres.PGClient; connected = client.ExecuteQuery(Host, Port, User, Pass, Db, "SELECT datname FROM pg_database"); diff --git a/javascript/enumeration/pgsql/pgsql-list-password-hashes.yaml b/javascript/enumeration/pgsql/pgsql-list-password-hashes.yaml index c665db8bc4..6a9aa5d455 100644 --- a/javascript/enumeration/pgsql/pgsql-list-password-hashes.yaml +++ b/javascript/enumeration/pgsql/pgsql-list-password-hashes.yaml @@ -16,7 +16,11 @@ info: shodan-query: "product:\"PostgreSQL\"" tags: js,network,postgresql,authenticated,enum javascript: - - code: | + - pre-condition: | + var m = require("nuclei/postgres"); + var c = m.PGClient(); + c.IsPostgres(Host, Port); + code: | const postgres = require('nuclei/postgres'); const client = new postgres.PGClient; connected = client.ExecuteQuery(Host, Port, User, Pass, Db, "SELECT usename, passwd FROM pg_shadow"); diff --git a/javascript/enumeration/pgsql/pgsql-list-users.yaml b/javascript/enumeration/pgsql/pgsql-list-users.yaml index 63150b7589..e679facdb7 100644 --- a/javascript/enumeration/pgsql/pgsql-list-users.yaml +++ b/javascript/enumeration/pgsql/pgsql-list-users.yaml @@ -14,7 +14,11 @@ info: shodan-query: "product:\"PostgreSQL\"" tags: js,network,postgresql,enum,authenticated javascript: - - code: | + - pre-condition: | + var m = require("nuclei/postgres"); + var c = m.PGClient(); + c.IsPostgres(Host, Port); + code: | const postgres = require('nuclei/postgres'); const client = new postgres.PGClient; connected = client.ExecuteQuery(Host, Port, User, Pass, Db, "SELECT usename FROM pg_user"); diff --git a/javascript/enumeration/pgsql/pgsql-version-detect.yaml b/javascript/enumeration/pgsql/pgsql-version-detect.yaml index b0185935f9..54f7c25094 100644 --- a/javascript/enumeration/pgsql/pgsql-version-detect.yaml +++ b/javascript/enumeration/pgsql/pgsql-version-detect.yaml @@ -14,7 +14,11 @@ info: shodan-query: "product:\"PostgreSQL\"" tags: js,network,postgresql,enum,authenticated javascript: - - code: | + - pre-condition: | + var m = require("nuclei/postgres"); + var c = m.PGClient(); + c.IsPostgres(Host, Port); + code: | const postgres = require('nuclei/postgres'); const client = new postgres.PGClient; connected = client.ExecuteQuery(Host, Port, User, Pass, Db, "select version();");