@@ -150,7 +150,7 @@ func HandleHTTPRequests(reqs, results chan string, quit chan int, bar *pb.Progre
150150
151151}
152152
153- func AsyncHTTPHead (urls []string , threads int , timeout int , details RequestDetails ) {
153+ func AsyncHTTPHead (urls []string , threads int , timeout int , details RequestDetails , output string ) {
154154
155155 result := make (chan string )
156156 reqs := make (chan string , len (urls )) // buffered
@@ -169,7 +169,7 @@ func AsyncHTTPHead(urls []string, threads int, timeout int , details RequestDeta
169169 }()
170170
171171
172-
172+ var results [] string
173173
174174 // parsing http codes
175175 // 500 , 502 server error
@@ -184,16 +184,23 @@ func AsyncHTTPHead(urls []string, threads int, timeout int , details RequestDeta
184184 if res != "err" {
185185 if strings .Contains (res , "200" ) {
186186 log .Info ().Msg ("Open : " + "[response code :" + res + "]" )
187+ results = append (results ,"Open : " + "[response code :" + res + "]" )
187188 }
188189 if strings .Contains (res , "301" ) || strings .Contains (res , "402" ) {
189190 log .Warn ().Msg ("Redirect : " + "[response code :" + res + "]" )
191+ results = append (results ,"Redirect : " + "[response code :" + res + "]" )
192+
190193 }
191194 if strings .Contains (res , "400" ) || strings .Contains (res , "401" ) ||
192195 strings .Contains (res , "403" ) {
193196 log .Warn ().Msg ("Protected : " + "[response code :" + res + "]" )
197+ results = append (results ,"Protected : " + "[response code :" + res + "]" )
198+
194199 }
195200 if strings .Contains (res , "500" ) || strings .Contains (res , "502" ) {
196201 log .Warn ().Msg ("Server error :" + "[response code :" + res + "]" )
202+ results = append (results ,"Server error :" + "[response code :" + res + "]" )
203+
197204 }
198205 }
199206
@@ -204,12 +211,19 @@ func AsyncHTTPHead(urls []string, threads int, timeout int , details RequestDeta
204211 bar .Set (len (urls ))
205212 bar .Finish ()
206213
214+ if len (results ) > 0 {
215+
216+ WriteResultsToFile (results , output )
217+ }
218+
219+
207220 return
208221 }
209222 }
210223
211224
212225
226+
213227}
214228
215229func GenerateMutatedUrls (wordListPath string , provider string , providerPath string , target string , environments []string ) ([]string , error ) {
0 commit comments