@@ -17,15 +17,18 @@ class Metasploit3 < Msf::Auxiliary
17
17
def initialize
18
18
super (
19
19
'Name' => 'Poison Ivy C&C Scanner' ,
20
- 'Description' => 'Enumerate Poison Ivy C&C on ports 3460,80,8080 and 443. Adaptation of iTrust Python script.
21
- www.malware.lu/Pro/RAP002_APT1_Technical_backstage.1.0.pdf' ,
20
+ 'Description' => 'Enumerate Poison Ivy C&C on ports 3460,80,8080 and 443. Adaptation of iTrust Python script.' ,
21
+ 'References' =>
22
+ [
23
+ [ 'URL' , 'www.malware.lu/Pro/RAP002_APT1_Technical_backstage.1.0.pdf' ] ,
24
+ ] ,
22
25
'Author' => [ 'SeawolfRN' ] ,
23
26
'License' => MSF_LICENSE
24
27
)
25
28
26
29
register_options (
27
30
[
28
- OptInt . new ( 'TIMEOUT ' , [ true , "The socket connect timeout in milliseconds" , 1000 ] ) ,
31
+ OptString . new ( 'PORTS ' , [ true , "Ports to Check" , "80,8080,443,3460" ] )
29
32
OptInt . new ( 'CONCURRENCY' , [ true , "The number of concurrent ports to check per host" , 10 ] ) ,
30
33
] , self . class )
31
34
@@ -38,7 +41,7 @@ def run_host(ip)
38
41
39
42
timeout = datastore [ 'TIMEOUT' ] . to_i
40
43
41
- ports = Rex ::Socket . portspec_crack ( "3460,80,443,8080" )
44
+ ports = Rex ::Socket . portspec_crack ( datastore [ 'PORTS' ] )
42
45
43
46
while ( ports . length > 0 )
44
47
t = [ ]
@@ -56,24 +59,23 @@ def run_host(ip)
56
59
'ConnectTimeout' => ( timeout / 1000.0 )
57
60
}
58
61
)
59
- r << [ ip , port , "open" ]
62
+ r << [ ip , port , "open" , 'Unknown' ]
60
63
s . send ( "\x00 " *0x100 , 0 ) #Send 0x100 zeros, wait for answer
61
64
data = s . recv ( 0x100 )
62
65
if data . length ==0x100
63
66
data = s . recv ( 0x4 )
64
67
if data =="\xD0 \x15 \x00 \x00 " #Signature for PIVY C&C
65
68
print_status ( "#{ ip } :#{ port } - C&C Server Found" )
69
+ r << [ ip , port , "open" , 'Poison Ivy C&C' ]
66
70
end
67
71
end
68
72
rescue ::Rex ::ConnectionRefused
69
73
vprint_status ( "#{ ip } :#{ port } - TCP closed" )
70
- r << [ ip , port , "closed" ]
74
+ r << [ ip , port , "closed" , '' ]
71
75
rescue ::Rex ::ConnectionError , ::IOError , ::Timeout ::Error
72
76
rescue ::Rex ::Post ::Meterpreter ::RequestError
73
77
rescue ::Interrupt
74
78
raise $!
75
- rescue ::Exception => e
76
- print_error ( "#{ ip } :#{ port } exception #{ e . class } #{ e } #{ e . backtrace } " )
77
79
ensure
78
80
disconnect ( s ) rescue nil
79
81
end
@@ -87,7 +89,7 @@ def run_host(ip)
87
89
end
88
90
89
91
r . each do |res |
90
- report_service ( :host => res [ 0 ] , :port => res [ 1 ] , :state => res [ 2 ] )
92
+ report_service ( :host => res [ 0 ] , :port => res [ 1 ] , :state => res [ 2 ] , :name => res [ 3 ] )
91
93
end
92
94
end
93
95
end
0 commit comments