@@ -140,14 +140,13 @@ where
140140 port. range
141141 . clone ( )
142142 . into_iter ( )
143- . map ( move |r| ( port. protocol , r) )
143+ . map ( move |r| ( port. protocol . as_ref ( ) , r) )
144144 } ) ,
145145 |mut b, ( protocol, range) | {
146146 b. push_bind ( & mapped_id)
147147 . push_bind ( match protocol {
148148 None => "udp_tcp" ,
149- Some ( models:: Protocol :: TCP ) => "tcp" ,
150- Some ( models:: Protocol :: UDP ) => "udp" ,
149+ Some ( x) => x. as_ref ( ) ,
151150 } )
152151 . push_bind ( range. start as i64 )
153152 . push_bind ( range. end . map ( |x| x as i64 ) ) ;
@@ -158,6 +157,47 @@ where
158157 query. execute ( & mut * tx) . await ?;
159158 }
160159 }
160+ if !scan. target . alive_test_ports . is_empty ( ) {
161+ for ports in scan
162+ . target
163+ . alive_test_ports
164+ . chunks ( SQLITE_LIMIT_VARIABLE_NUMBER / 4 )
165+ {
166+ let mut builder =
167+ QueryBuilder :: new ( "INSERT INTO ports (id, protocol, start, end, alive)" ) ;
168+ builder. push_values (
169+ ports. iter ( ) . flat_map ( |port| {
170+ port. range
171+ . clone ( )
172+ . into_iter ( )
173+ . map ( move |r| ( port. protocol . as_ref ( ) , r) )
174+ } ) ,
175+ |mut b, ( protocol, range) | {
176+ b. push_bind ( & mapped_id)
177+ . push_bind ( match protocol {
178+ None => "udp_tcp" ,
179+ Some ( x) => x. as_ref ( ) ,
180+ } )
181+ . push_bind ( range. start as i64 )
182+ . push_bind ( range. end . map ( |x| x as i64 ) )
183+ . push_bind ( true ) ;
184+ } ,
185+ ) ;
186+ let query = builder. build ( ) ;
187+
188+ query. execute ( & mut * tx) . await ?;
189+ }
190+ }
191+
192+ if !scan. target . alive_test_methods . is_empty ( ) {
193+ let mut builder = QueryBuilder :: new ( "INSERT INTO alive_methods (id, method)" ) ;
194+ builder. push_values ( & scan. target . alive_test_methods , |mut b, method| {
195+ b. push_bind ( & mapped_id) . push_bind ( method. as_ref ( ) ) ;
196+ } ) ;
197+ let query = builder. build ( ) ;
198+ query. execute ( & mut * tx) . await ?;
199+ }
200+
161201 let mut scan_preferences = scan. scan_preferences . clone ( ) ;
162202 if scan. target . reverse_lookup_unify . unwrap_or_default ( ) {
163203 scan_preferences. push ( models:: ScanPreference {
0 commit comments