@@ -138,7 +138,21 @@ def do_terminal_command(self, command):
138138
139139 def do_token_reset (self , api , token , username ):
140140 """
141- reset the API tokens
141+ Explanation:
142+ ------------
143+ Reset the API tokens when needed, this will overwrite the existing
144+ API token with a provided one
145+
146+ Parameters:
147+ -----------
148+ :param api: name of the API to reset
149+ :param token: the token that will overwrite the current token
150+ :param username: if resetting Censys this will be the user ID token
151+
152+ Examples:
153+ ---------
154+ Censys -> reset/tokens censys <token> <userID>
155+ Shodan -> reset.tokens shodan <token>
142156 """
143157 if api .lower () == "censys" :
144158 lib .output .info ("resetting censys API credentials" )
@@ -151,9 +165,21 @@ def do_token_reset(self, api, token, username):
151165 token_ .write (token )
152166 lib .output .warning ("program must be restarted for the new tokens to initialize" )
153167
154- def do_api_search (self , requested_api_data , query , tokens , proxy = None , agent = None ):
168+ def do_api_search (self , requested_api_data , query , tokens ):
155169 """
156- search the API's for hosts
170+ Explanation:
171+ ------------
172+ Search the API with a provided query for potentially exploitable hosts.
173+
174+ Parameters:
175+ -----------
176+ :param requested_api_data: data to be used with the API tuple of info
177+ :param query: the query to be searched
178+ :param tokens: an argument dict that will contain the token information
179+
180+ Examples:
181+ ---------
182+ search/api/gather shodan[,censys[,zoomeye]] windows 10
157183 """
158184 acceptable_api_names = ("shodan" , "censys" , "zoomeye" )
159185 api_checker = lambda l : all (i .lower () in acceptable_api_names for i in l )
@@ -246,7 +272,17 @@ def do_view_gathered(self):
246272
247273 def do_add_single_host (self , ip ):
248274 """
249- add a single host to the host file
275+ Explanation:
276+ ------------
277+ Add a single host by IP address
278+
279+ Parameters:
280+ -----------
281+ :param ip: IP address to be added
282+
283+ Examples:
284+ ---------
285+ single 89.76.12.124
250286 """
251287 validated_ip = lib .settings .validate_ip_addr (ip )
252288 if not validated_ip :
@@ -272,7 +308,17 @@ def do_quit_terminal(self, save_history=True):
272308
273309 def do_exploit_targets (self , workspace_info ):
274310 """
275- exploit the already gathered targets
311+ Explanation:
312+ ------------
313+ Exploit the already gathered hosts inside of the hosts.txt file
314+
315+ Parameters:
316+ -----------
317+ :param workspace_info: a tuple of workspace information
318+
319+ Examples:
320+ ---------
321+ exploit/run/attack 127.0.0.1 9065 default [whitewash list]
276322 """
277323 if workspace_info [- 1 ] is not None :
278324 lib .output .misc_info ("doing whitewash on hosts file" )
@@ -321,7 +367,19 @@ def do_exploit_targets(self, workspace_info):
321367
322368 def do_load_custom_hosts (self , file_path ):
323369 """
324- load a custom hosts file
370+ Explanation:
371+ -----------
372+ Load a custom exploit file, this is useful to attack already gathered hosts
373+ instead of trying to gather them again from the backup host files inside
374+ of the `.autosploit_home` directory
375+
376+ Parameters:
377+ -----------
378+ :param file_path: the full path to the loadable hosts file
379+
380+ Examples:
381+ ---------
382+ custom/personal /some/path/to/myfile.txt
325383 """
326384 import shutil
327385
@@ -340,6 +398,12 @@ def terminal_main_display(self, tokens, extra_commands=None, save_history=True):
340398 """
341399 terminal main display
342400 """
401+ lib .output .warning (
402+ "no arguments have been passed, dropping into terminal session. "
403+ "to get help type `help` to quit type `exit/quit` to get help on "
404+ "a specific command type `command help`"
405+ )
406+
343407 if extra_commands is not None :
344408 for command in extra_commands :
345409 self .external_terminal_commands .append (command )
@@ -385,7 +449,7 @@ def terminal_main_display(self, tokens, extra_commands=None, save_history=True):
385449 choice_data_list = None
386450 except :
387451 choice_data_list = None
388- if any ( c in choice for c in ( "help" , "?" )) :
452+ if choice == "?" or choice == "help" :
389453 self .do_display_usage ()
390454 elif any (c in choice for c in ("external" ,)):
391455 self .do_display_external ()
@@ -396,11 +460,16 @@ def terminal_main_display(self, tokens, extra_commands=None, save_history=True):
396460 elif any (c in choice for c in ("view" , "gathered" )):
397461 self .do_view_gathered ()
398462 elif "single" in choice :
463+ if "help" in choice_data_list :
464+ print (self .do_add_single_host .__doc__ )
465+
399466 if choice_data_list is None or len (choice_data_list ) == 1 :
400467 lib .output .error ("must provide host IP after `single` keyword (IE single 89.65.78.123)" )
401468 else :
402469 self .do_add_single_host (choice_data_list [- 1 ])
403470 elif any (c in choice for c in ("exploit" , "run" , "attack" )):
471+ if "help" in choice_data_list :
472+ print (self .do_exploit_targets .__doc__ )
404473 if len (choice_data_list ) < 4 :
405474 lib .output .error (
406475 "must provide at least LHOST, LPORT, workspace name with `{}` keyword "
@@ -427,11 +496,16 @@ def terminal_main_display(self, tokens, extra_commands=None, save_history=True):
427496 "did you type it right?"
428497 )
429498 elif any (c in choice for c in ("personal" , "custom" )):
499+ if "help" in choice_data_list :
500+ print (self .do_load_custom_hosts .__doc__ )
430501 if len (choice_data_list ) == 1 :
431502 lib .output .error ("must provide full path to file after `{}` keyword" .format (choice ))
432503 else :
433504 self .do_load_custom_hosts (choice_data_list [- 1 ])
434505 elif any (c in choice for c in ("search" , "api" , "gather" )):
506+ if "help" in choice_data_list :
507+ print (self .do_api_search .__doc__ )
508+
435509 if len (choice_data_list ) < 3 :
436510 lib .output .error (
437511 "must provide a list of API names after `{}` keyword and query "
@@ -457,6 +531,9 @@ def terminal_main_display(self, tokens, extra_commands=None, save_history=True):
457531 elif any (c in choice for c in ("tokens" , "reset" )):
458532 acceptable_api_names = ("shodan" , "censys" )
459533
534+ if "help" in choice_data_list :
535+ print (self .do_token_reset .__doc__ )
536+
460537 if len (choice_data_list ) < 3 :
461538 lib .output .error (
462539 "must supply API name with `{}` keyword along with "
0 commit comments