Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions credmaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def parse_all_args(self, args):
self.secret_access_key = args.secret_access_key or config_dict.get("secret_access_key")
self.session_token = args.session_token or config_dict.get("session_token")
self.profile_name = args.profile_name or config_dict.get("profile_name")
self.no_fireprox = args.no_fireprox or config_dict.get("no_fireprox", False)


def do_input_error_handling(self):
Expand Down Expand Up @@ -168,9 +169,10 @@ def do_input_error_handling(self):
if self.access_key is None and self.secret_access_key is not None:
self.log_entry("secret_access_key requires access_key")
sys.exit()
if self.access_key is None and self.secret_access_key is None and self.session_token is None and self.profile_name is None:
self.log_entry("No FireProx access arguments settings configured, add access keys/session token or fill out config file")
sys.exit()
if not self.no_fireprox:
if self.access_key is None and self.secret_access_key is None and self.session_token is None and self.profile_name is None:
self.log_entry("No FireProx access arguments settings configured, add access keys/session token or fill out config file, or use --no-fireprox")
sys.exit()

# Region handling
if self.region is not None and self.region not in self.regions:
Expand Down Expand Up @@ -385,6 +387,19 @@ def Execute(self, args):

def load_apis(self, url, region=None):

if self.no_fireprox:
self.log_entry(f"FireProx disabled - connecting directly to {url}")
self.log_entry("WARNING: All requests will originate from your IP address")
# Create dummy API entries that point directly to the target URL
self.apis = []
for x in range(0, self.thread_count):
self.apis.append({
"api_gateway_id": "direct",
"proxy_url": url.strip().rstrip('/'),
"region": "direct"
})
return

if self.thread_count > len(self.regions):
self.log_entry("Thread count over maximum, reducing to 15")
self.thread_count = len(self.regions)
Expand Down Expand Up @@ -429,8 +444,12 @@ def get_fireprox_args(self, command, region, url = None, api_id = None):

def display_stats(self, start=True):
if start:
self.log_entry(f"Total Regions Available: {len(self.regions)}")
self.log_entry(f"Total API Gateways: {len(self.apis)}")
if self.no_fireprox:
self.log_entry("Mode: Direct Connection (No FireProx)")
self.log_entry(f"Threads: {self.thread_count}")
else:
self.log_entry(f"Total Regions Available: {len(self.regions)}")
self.log_entry(f"Total API Gateways: {len(self.apis)}")

if self.end_time and not start:
self.log_entry(f"End Time: {self.end_time}")
Expand Down Expand Up @@ -475,6 +494,10 @@ def destroy_single_api(self, api):

def destroy_apis(self):

if self.no_fireprox:
self.log_entry("FireProx disabled - no APIs to destroy")
return

for api in self.apis:

args, help_str = self.get_fireprox_args("delete", api["region"], api_id = api["api_gateway_id"])
Expand Down Expand Up @@ -763,6 +786,8 @@ def log_success(self, username, password):
fpu_args.add_argument('--clean', default=False, action="store_true", help='Clean up all fireprox AWS APIs from every region, warning irreversible')
fpu_args.add_argument('--api_destroy', type=str, default=None, help='Destroy single API instance, by API ID')
fpu_args.add_argument('--api_list', default=False, action="store_true", help='List all fireprox APIs')
fpu_args.add_argument('--no-fireprox', default=False, action="store_true",
help='Bypass FireProx and connect directly to target (WARNING: No IP rotation)')

args,pluginargs = parser.parse_known_args()

Expand Down