From 224f45e9b599839f0eaf229f13652596a9fabf04 Mon Sep 17 00:00:00 2001 From: sjanusz-r7 Date: Tue, 28 Jul 2026 11:11:47 +0100 Subject: [PATCH] Add Callback Address column to Listener --- app/models/mdm/listener.rb | 11 ++++++++++- ...0260728000000_add_callback_address_to_listeners.rb | 5 +++++ spec/app/models/mdm/listener_spec.rb | 1 + spec/dummy/db/structure.sql | 4 +++- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20260728000000_add_callback_address_to_listeners.rb diff --git a/app/models/mdm/listener.rb b/app/models/mdm/listener.rb index 530dd003..9fb72680 100755 --- a/app/models/mdm/listener.rb +++ b/app/models/mdm/listener.rb @@ -21,7 +21,16 @@ class Mdm::Listener < ApplicationRecord # # @!attribute address - # The IP address to which the listener is bound. + # The local IP address to which the listener is bound (used as the + # handler's +ReverseListenerBindAddress+). + # + # @return [String] + + # @!attribute callback_address + # The IP address or hostname the payload connects back to (used as the + # handler's +LHOST+). This is the address that must be routable from the + # target and may differ from {#address} when NAT or port forwarding is in + # use. # # @return [String] diff --git a/db/migrate/20260728000000_add_callback_address_to_listeners.rb b/db/migrate/20260728000000_add_callback_address_to_listeners.rb new file mode 100644 index 00000000..0bef1a38 --- /dev/null +++ b/db/migrate/20260728000000_add_callback_address_to_listeners.rb @@ -0,0 +1,5 @@ +class AddCallbackAddressToListeners < ActiveRecord::Migration[7.0] + def change + add_column :listeners, :callback_address, :text + end +end diff --git a/spec/app/models/mdm/listener_spec.rb b/spec/app/models/mdm/listener_spec.rb index f779f7b7..c417fb63 100644 --- a/spec/app/models/mdm/listener_spec.rb +++ b/spec/app/models/mdm/listener_spec.rb @@ -20,6 +20,7 @@ it { is_expected.to have_db_column(:owner).of_type(:text) } it { is_expected.to have_db_column(:payload).of_type(:text) } it { is_expected.to have_db_column(:address).of_type(:text) } + it { is_expected.to have_db_column(:callback_address).of_type(:text) } it { is_expected.to have_db_column(:port).of_type(:integer) } it { is_expected.to have_db_column(:options).of_type(:binary) } it { is_expected.to have_db_column(:macro).of_type(:text) } diff --git a/spec/dummy/db/structure.sql b/spec/dummy/db/structure.sql index bfde563e..c28a3fee 100644 --- a/spec/dummy/db/structure.sql +++ b/spec/dummy/db/structure.sql @@ -561,7 +561,8 @@ CREATE TABLE public.listeners ( address text, port integer, options bytea, - macro text + macro text, + callback_address text ); @@ -3605,6 +3606,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20251231162000'), ('20260130124052'), ('20260411000000'), +('20260728000000'), ('21'), ('22'), ('23'),