
    Mg(	                         S SK r S SKJrJrJr  S SKJr  SS jrS\SS4S jr\" SS	9\" S
\S9\" S5      S\	SS4S j5       5       5       r
g)    N)pluginrequireLINUX)Forereturnc                     U R                  S[        R                  5        U R                  S[        R                  5        U R                  [	        UR                  5       S   5      [        R                  5        g )Nz$Please, check your input is correct
z%This might hint what the problem is:
error)sayr   REDYELLOWstrscaninfo)jarvisnm_scans     B/Users/admin/workspace/ai/Jarvis/jarviscli/plugins/scan_network.pyerror_outputr      sM    
JJ6A
JJ7E
JJs7##%g./=    resultsc                    US   S   S   nU R                  SU-   S-   [        R                  5        US   nU GH  nU R                  U[        R                  5        U R                  SX4   S   S	   S
   -   [        R                  5        SX4   ;   a  X4   S   nU H  nU R                  S[        U5      -   [        R                  5        U R                  SXV   S
   -   [        R                  5        U R                  SXV   S   -   [        R                  5        U R                  SXV   S   -   [        R                  5        M     [	        S5        GM     g )Nnmap	scanstatsuphostszNumber of hosts up: 
scanz	Name: 	hostnamesr   nametcpz	Open TCP Port: z		Protocol Name: z		Product: productz		Version: versionz----------------------------
)r
   r   GREENr   print)r   r   r   devicesd	tcp_portsports          r   show_outputr&      s!   6?;/	:G
JJ%/$6

CFOG

1djj!

:
; 7 :6 BBDJJOGJ%j/I!

.T:DJJG

09?63JJDJJW

?Y_Y-GGT

?Y_Y-GGT	 "
 	./ r   T)networkr   )nativeplatformscan_networksc                 ~   SSK Jn  [         R                  " 5       nU R                  S5        U(       d!  U R                  S[        R                  5        gUR                  U5        SUR                  5       ;   a  [        X5        UR                  5       S   R                  S5        UR                  n[        X5        g)	zd
Scans provided network for all connected devices
Usage example: jarvis scan_network 172.16.1.10/24
r   )PortScannerz%Please wait, this might take a while!zRYou need to provide address as input!
 For example: jarvis scan_network x.x.x.x/24r	   r   servicesN)r   r-   r
   r   r   r   r   r   pop_scan_resultr&   )r   r+   r-   r   r   s        r   r   r      s     !++-G
JJ67

 BCG;;	P 	Qg&&(() 	5!%%j1,,F$r   )r   N)r   r   r   r   coloramar   r   dictr&   r   r    r   r   <module>r4      sl     ) ) >0 0$ 0$ 	'%C %D %  ( %r   